Commit Graph

278 Commits

Author SHA1 Message Date
Ruslan Ermilov
a35d88931c For variables that are only checked with defined(), don't provide
any fake value.
2004-10-24 15:33:08 +00:00
Maxim Konovalov
49c2dc64da -c flag (cache stats) was killed in rev. 1.68. Fix getopt(3) and
usage() accordingly.

Submitted by:	Pawel Worach
2004-10-20 11:18:31 +00:00
Gleb Smirnoff
77ef8a97cd Print link level address on vlan interfaces using ether_ntoa(), to make
output on bare ethernet and vlan interfaces the same.

PR:		bin/69674
Submitted by:	Pawel Malachowski <pawmal-posting@freebsd.lublin.pl>
Reviewed by:	ru
Approved by:	julian (mentor)
MFC after:	1 week
2004-07-28 18:18:47 +00:00
Stefan Farfeleder
14cc87e479 Use the length modifier 'll' instead of 'q' to print long longs. 2004-07-28 16:03:13 +00:00
Philippe Charnier
6cc6f12231 Add __FBSDID. Replace local variable sin by sockin to not conflict with sin(3).
Use warnx() instead of warn() when error message is not of any interest. Add
prototypes.
2004-07-26 20:18:11 +00:00
Paul Saab
b6101dafe9 Add SACK statistics to netstat. 2004-06-29 20:05:45 +00:00
Bruce M Simpson
2b286ced87 Make netstat(1) more closely follow documented behaviour. If a TCP
socket in LISTEN state happens to be bound to an interface, it will
show up in netstat(1) output even without the -a switch.

As the definition of "sockets used by server processes" is a
difficult one to qualify with regards to UDP, do not change the
output behaviour for UDP sockets.

PR:		bin/26359
2004-06-16 07:00:50 +00:00
Max Khon
eb6fe0d938 Add missing dot and newline in a message.
Submitted by:	Igor Sysoev <is (at) rambler-co.ru>
MFC after:	3 days
2004-06-02 18:45:05 +00:00
Bosko Milekic
099a0e588c Bring in mbuma to replace mballoc.
mbuma is an Mbuf & Cluster allocator built on top of a number of
extensions to the UMA framework, all included herein.

Extensions to UMA worth noting:
  - Better layering between slab <-> zone caches; introduce
    Keg structure which splits off slab cache away from the
    zone structure and allows multiple zones to be stacked
    on top of a single Keg (single type of slab cache);
    perhaps we should look into defining a subset API on
    top of the Keg for special use by malloc(9),
    for example.
  - UMA_ZONE_REFCNT zones can now be added, and reference
    counters automagically allocated for them within the end
    of the associated slab structures.  uma_find_refcnt()
    does a kextract to fetch the slab struct reference from
    the underlying page, and lookup the corresponding refcnt.

mbuma things worth noting:
  - integrates mbuf & cluster allocations with extended UMA
    and provides caches for commonly-allocated items; defines
    several zones (two primary, one secondary) and two kegs.
  - change up certain code paths that always used to do:
    m_get() + m_clget() to instead just use m_getcl() and
    try to take advantage of the newly defined secondary
    Packet zone.
  - netstat(1) and systat(1) quickly hacked up to do basic
    stat reporting but additional stats work needs to be
    done once some other details within UMA have been taken
    care of and it becomes clearer to how stats will work
    within the modified framework.

From the user perspective, one implication is that the
NMBCLUSTERS compile-time option is no longer used.  The
maximum number of clusters is still capped off according
to maxusers, but it can be made unlimited by setting
the kern.ipc.nmbclusters boot-time tunable to zero.
Work should be done to write an appropriate sysctl
handler allowing dynamic tuning of kern.ipc.nmbclusters
at runtime.

Additional things worth noting/known issues (READ):
   - One report of 'ips' (ServeRAID) driver acting really
     slow in conjunction with mbuma.  Need more data.
     Latest report is that ips is equally sucking with
     and without mbuma.
   - Giant leak in NFS code sometimes occurs, can't
     reproduce but currently analyzing; brueffer is
     able to reproduce but THIS IS NOT an mbuma-specific
     problem and currently occurs even WITHOUT mbuma.
   - Issues in network locking: there is at least one
     code path in the rip code where one or more locks
     are acquired and we end up in m_prepend() with
     M_WAITOK, which causes WITNESS to whine from within
     UMA.  Current temporary solution: force all UMA
     allocations to be M_NOWAIT from within UMA for now
     to avoid deadlocks unless WITNESS is defined and we
     can determine with certainty that we're not holding
     any locks when we're M_WAITOK.
   - I've seen at least one weird socketbuffer empty-but-
     mbuf-still-attached panic.  I don't believe this
     to be related to mbuma but please keep your eyes
     open, turn on debugging, and capture crash dumps.

This change removes more code than it adds.

A paper is available detailing the change and considering
various performance issues, it was presented at BSDCan2004:
http://www.unixdaemons.com/~bmilekic/netbuf_bmilekic.pdf
Please read the paper for Future Work and implementation
details, as well as credits.

Testing and Debugging:
    rwatson,
    brueffer,
    Ketrien I. Saihr-Kesenchedra,
    ...
Reviewed by: Lots of people (for different parts)
2004-05-31 21:46:06 +00:00
Ruslan Ermilov
0d25a5d896 Bumped document date.
Fixed the grammar nit.
2004-05-19 09:52:40 +00:00
Ruslan Ermilov
01d3e1c00d Output style nit. 2004-05-12 07:36:59 +00:00
Mike Silbersack
fa126c2954 Add the bad reset statistic (corresponds to tcp_input.c rev 1.235) 2004-04-26 02:57:33 +00:00
Luigi Rizzo
0b46c08590 Replace ROUNDUP/ADVANCE with SA_SIZE 2004-04-13 11:24:43 +00:00
Ruslan Ermilov
e16552014d Show link-level multicast packet counters with the -a option. 2004-04-12 15:00:48 +00:00
Ruslan Ermilov
bce2e7c8bb Fixed alignment of multicast addresses when printing that got
broken in previous revision.
2004-04-12 09:44:42 +00:00
Bruce M Simpson
1d2a7e07d7 Sort SRCS in Makefile and document -g option additions.
Nudged by:	ru
2004-03-25 09:07:26 +00:00
Bruce M Simpson
3f2631c7ba Output style: Get rid of an unnecessary newline. 2004-03-25 08:51:14 +00:00
Bruce M Simpson
9fcc066d3e Teach netstat(1) how to print the multicast group memberships present
within the running system.

Sponsored by:	Ralf the Wonder Llama
2004-03-25 08:43:59 +00:00
Ruslan Ermilov
6bb3f2072d More cleanups:
- 0 should have been -1 in previous commit (just to stay consistent),
- Spell null pointers as NULL, not 0,
- Fixed the comment about pr_usesysctl to not confuse it with boolean.

Pointed by:	bde
2004-03-18 07:21:31 +00:00
Ruslan Ermilov
52ded959f5 NULL -> 0. 2004-03-17 20:19:45 +00:00
Dag-Erling Smørgrav
6d7c0d2fed Do not print a warning about net.inet.pim.stats if errno is
ENOENT, because that means we do not have PIM in the kernel.

Submitted by:	hmp
MFC after:	1 week
2004-03-12 11:22:50 +00:00
Bruce Evans
00925a8e84 Fixed misspellings of 0 as NULL. 2004-03-11 10:19:45 +00:00
Hajimu UMEMOTO
4ef2dc8b71 printed statistics about source address selection rules.
Obtained from:	KAME
2004-02-05 12:08:35 +00:00
Hajimu UMEMOTO
cb60a8de59 stops program if kvm_read fails.
Obtained from:	KAME
2004-02-05 12:05:35 +00:00
Hajimu UMEMOTO
22a4e20905 - support hmac-ripemd160.
- support AES XCBC MAC/AES counter mode.

Obtained from:	KAME
2004-02-05 12:02:37 +00:00
Hajimu UMEMOTO
3fde69b944 print stats on SPD cache lookups.
Obtained from:	KAME
2004-02-05 12:01:39 +00:00
Hajimu UMEMOTO
5d8a878a55 - %d is 12 chars, not 10. use NI_MAX* where appropriate.
- goodbye RC5.
- use %llu directly.
- KNF.

Obtained from:	KAME
2004-02-05 11:59:37 +00:00
Bruce Evans
9e53fb7dc8 Use floating point instead of unsigned long longs in percentage
calculations.  Long longs should never be used, since they break compiling
with C90 compilers and don't necessarily work any better than longs for
avoiding overflow.

Print percentages with another digit of precision since they can be small
and this is easy to do now that the format is floating point.

Restored some more of the old -m output:
Print the percentage of allocated memory that is in use.  This is the
amount of memory in active mbufs and mbuf clusters relative to the
total amount of memory soft-allocated for mbufs and mbuf clusters.

Print the percentage of allocated memory that is wired (cached).  The
old mbuf allocator never freed memory so printing this value wasn't
useful.  A previous version of netstat for the new allocator printed
the in-use amount as a percentage of the wired amount.

Fixed some nearby style bugs (excessive parenthesization and a redundant
return).

Reviewed by:	alfred
2003-12-29 08:25:32 +00:00
Bruce Evans
aa54e1ecc5 Fixed missing declaration of pluralies(). This showed up as strange
printf format warnings for inet6.c (pluralies() was implicit int, but
the context requires a "char *").

Added WARNS?=2 to the Makefile so that such errors don't come back.
Added NO_WERROR?= to the Makefile because I haven't checked that setting
WARNS doesn't uncover more bugs except on i386's.
2003-12-29 04:41:38 +00:00
Bruce Evans
3e15599181 Fixed style bugs created in rev.1.27 by removing "__P(" and its closing ")"
without removing the space before it.
2003-12-29 04:34:36 +00:00
Mike Silbersack
6171a2800d Teach netstat about the new sendfile statistics. 2003-12-28 08:59:41 +00:00
Mike Silbersack
18258f6d7a Clean up the style of the previous commit, and fix a few
type mismatches as well.

Suggested by:	bde
2003-12-27 09:02:31 +00:00
Mike Silbersack
8db142fa03 Teach netstat to read and display the new sfbuf statistics. 2003-12-27 07:58:31 +00:00
Alfred Perlstein
1164d324ea Fix percentages by using long long to hold values for 'space',
overflow was breaking a bunch of the stats, specifically the
percentage displayed for wired memory.

Fix the output for current/peak/max lines, I forgot to output the types.
161/320/51200 (current/peak/max):
-to-
639/25696/51200 mbufs in use (current/peak/max):
2003-12-26 18:47:41 +00:00
Alfred Perlstein
7a744a48d2 I asked Bosko Milekic for help with 'peak' reporting, and he suggested
using the old 'cached' value but reporting it as 'cached'.

I've decided to report the 'cached' as 'peak', why?  Well because
it is the peak, the peak of what is actually allocated.  'cached'
doesn't make sense to me as a user.
2003-12-23 14:06:24 +00:00
Alfred Perlstein
dbe0253a8b Restore old netstat -m output.
A new flag '-c' can be used to ask for the cache stats.
2003-12-23 13:24:03 +00:00
Bruce M Simpson
25d295e1ed Fix some minor nits in netstat whereby large interface names would be
truncated. In environments where many tunnel or vlan interfaces are created,
interface names have high numbers which overflow the field width.

PRs:		bin/52349, bin/35838
Submitted by:	Mike Tancsa, Scot W. Hetzel
Approved by:	re (rwatson)
2003-11-28 17:34:23 +00:00
Brooks Davis
9bf40ede4a Replace the if_name and if_unit members of struct ifnet with new members
if_xname, if_dname, and if_dunit. if_xname is the name of the interface
and if_dname/unit are the driver name and instance.

This change paves the way for interface renaming and enhanced pseudo
device creation and configuration symantics.

Approved By:	re (in principle)
Reviewed By:	njl, imp
Tested On:	i386, amd64, sparc64
Obtained From:	NetBSD (if_xname)
2003-10-31 18:32:15 +00:00
Ruslan Ermilov
0237ca7b95 Print the correct ICMP statistics for "no return routes". 2003-10-23 13:53:19 +00:00
Sam Leffler
8145952fa5 remove unneeded include of route.h
Supported by:	FreeBSD Foundation
2003-10-03 21:05:08 +00:00
Jeffrey Hsu
c7b9b5bb49 1. Add support for printing PIM-related statistics with
netstat -s -p pim

2. Print information about the bandwidth meters installed in the kernel with
	netstat -g

Submitted by:	Pavlin Radoslavov <pavlin@icir.org>
2003-08-07 18:21:21 +00:00
Jeffrey Hsu
0ae2b7649e * Use sysctlbyname(3) to print statistics about the MFC and
multicast VIF tables.
  This change is needed for consistency with the rest of the
  netstat/mroute.c implementation, and because in some
  cases "netstat -g" may fail to report the multicast forwarding
  information (e.g., if we run a multicast router on PicoBSD).

* Remove "DVMRP" from the head comment of file netstat/mroute.c,
  because the printed multicast-related statistics are not
  DVMRP-specific anymore.

Submitted by:	Pavlin Radoslavov <pavlin@icir.org>
2003-08-05 17:07:04 +00:00
Ruslan Ermilov
c002b2c842 Revert last delta.
The -l option is deprecated (hence undocumented in usage() and
SYNOPSIS), as was threatened in the commitlog accompanying rev.
1.10 of main.c.

Approved by:	re (blanket)
2003-05-21 20:52:57 +00:00
Bosko Milekic
11583f6c93 Make the mb_alloc low-watermark sysctl-tunable read-only and make
netstat(1) not display it for now because its effects are not yet
completely implemented and we're about to cut 5.2-RELEASE.
This is temporary.

Approved by: re (scottl, rwatson)
2003-05-15 19:05:28 +00:00
Matthew N. Dodd
2c56e246fa Back out support for RFC3514.
RFC3514 poses an unacceptale risk to compliant systems.
2003-04-02 20:14:44 +00:00
Matthew N. Dodd
09139a4537 Implement support for RFC 3514 (The Security Flag in the IPv4 Header).
(See: ftp://ftp.rfc-editor.org/in-notes/rfc3514.txt)

This fulfills the host requirements for userland support by
way of the setsockopt() IP_EVIL_INTENT message.

There are three sysctl tunables provided to govern system behavior.

	net.inet.ip.rfc3514:

		Enables support for rfc3514.  As this is an
		Informational RFC and support is not yet widespread
		this option is disabled by default.

	net.inet.ip.hear_no_evil

		 If set the host will discard all received evil packets.

	net.inet.ip.speak_no_evil

		If set the host will discard all transmitted evil packets.

The IP statistics counter 'ips_evil' (available via 'netstat') provides
information on the number of 'evil' packets recieved.

For reference, the '-E' option to 'ping' has been provided to demonstrate
and test the implementation.
2003-04-01 08:21:44 +00:00
Giorgos Keramidas
66fe5468f7 Document the undcumnt -l option (that's a lowercase `el').
PR:		48466
Submitted by:	Peter Philipp <dot.bomb@freenet.de>
2003-03-26 02:00:35 +00:00
Peter Wemm
ab54ea99de Kill #ifdef NS and some leftover #ifdef ISO code. Re-pack the nlist[]
array, it isn't likely to find any ARPAnet IMP drivers in FreeBSD.
2003-03-05 19:20:29 +00:00
Bosko Milekic
025b4be197 o Allow "buckets" in mb_alloc to be differently sized (according to
compile-time constants).  That is, a "bucket" now is not necessarily
  a page-worth of mbufs or clusters, but it is MBUF_BUCK_SZ, CLUS_BUCK_SZ
  worth of mbufs, clusters.
o Rename {mbuf,clust}_limit to {mbuf,clust}_hiwm and introduce
  {mbuf,clust}_lowm, which currently has no effect but will be used
  to set the low watermarks.
o Fix netstat so that it can deal with the differently-sized buckets
  and teach it about the low watermarks too.
o Make sure the per-cpu stats for an absent CPU has mb_active set to 0,
  explicitly.
o Get rid of the allocate refcounts from mbuf map mess.  Instead,
  just malloc() the refcounts in one shot from mbuf_init()
o Clean up / update comments in subr_mbuf.c
2003-02-20 04:26:58 +00:00
Robert Drehmel
ec3b72e932 - Determine the size of buffers with sizeof() instead of using
plain magic numbers - one of them was apparently wrong but unharmful.
 - Remove empty line.
2003-02-10 16:58:47 +00:00