Commit Graph

314 Commits

Author SHA1 Message Date
obrien
a2842c2079 MFC: 2006/07/28 commit achieving WARNS=3
Also fix nlist 'nl' should be terminated by a NULL entry.
2007-10-03 19:56:17 +00:00
obrien
a66443f373 MFC: rev. 1.8's layout changes. 2007-10-03 19:28:57 +00:00
jhb
f92f6a31e3 Fix another nit in an earlier MFC so that we properly warn if we can't
read the multicast routing stats from a live kernel via sysctl(8).
2007-09-28 19:45:18 +00:00
jhb
f435e446f6 Correct a nit in earlier MFC: the carp stats routine does use sysctl. 2007-09-28 19:38:40 +00:00
jhb
44ff2749c0 MFC: Restore netstat -M functionality for most statistics on core dumps.
One change in this patch relative to the changes in HEAD is that the
mroute statistics will still fallback to using libkvm on live kernels
if the sysctl fails.
2007-07-23 15:40:26 +00:00
bde
2c1a613795 MFC: all except 1.63:
1.59-1.62: already merged
1.63: removal of bridge(45) not merged
1.64: already merged
1.65: use uintmax_t
1.66: repair formatting to 79 columns
1.67: increase accuracy of timeouts and thus of per-interval counts
1.68: style fixes

Requested by:	kuriyama (1.66)

1.66 changes the whitespace in output.  Hopefully nothing depends on the
exact misformatting that it fixes.
2007-06-14 12:38:12 +00:00
maxim
eaf028c697 MFC rev. 1.75: fill the list of icmp types; make its size depend
on ICMP_MAXTYPE.
2007-05-14 18:09:00 +00:00
bms
fc0fad9e36 MFC rev 1.4:
Update host-mode multicast group information output.
   Display IPv4 and IPv6 memberships separately.
    Obey the MK_INET6_SUPPORT flag.
   Display link-layer memberships.
    Use addr2ascii() to correctly print non-IEEE 802 sockaddr_dl instances.
   Eliminate redundant switch..case blocks.
   Update copyright.
   Misc style changes.
2007-03-14 14:10:22 +00:00
yar
f63e02e363 MFC rev. 1.80: We should return the name in cp, not printf it. 2006-12-20 12:47:50 +00:00
julian
075428bf8d MFC: 1.26
Don't print an error if used on a kernel with no ipv6, just do nothing.
2006-07-26 21:49:25 +00:00
andre
e41548655f MFC rev. 1.49 to 1.51: Print statistics on jumbo clusters and improve
packet zone information.

Sponsored by:	TCP/IP Optimization Fundraise 2005
Approved by:	re (scottl)
2006-03-01 20:54:21 +00:00
rwatson
c4063eb562 Merge mbuf.c:1.48 from HEAD to RELENG_6:
Sort sfbuf allocation counters with other sfbuf information.

Approved by:	re (scottl)
2006-02-14 03:39:04 +00:00
rwatson
6e53964350 Merge mbuf.c:1.47 from HEAD to RELENG_6:
Un-#if 0 the printing of allocation failure counts for mbufs, clusters,
  and packets in netstat -m.

Approved by:	re (scottl)
2006-02-14 03:33:49 +00:00
kbyanc
e0bfda5a3c MFC:
kbyanc      2005-12-28 20:36:55 UTC

      FreeBSD src repository

      Modified files:
        usr.bin/netstat      Makefile ipsec.c main.c netstat.h
      Added files:
        usr.bin/netstat      pfkey.c
      Log:
      Add support for printing IPSEC protocol stats if the kernel was
      compiled with FAST_IPSEC rather than the KAME IPSEC stack.

    Note that the output of "netstat -s -p ipsec" differs depending on
    which stack is compiled into the kernel since they each keep different
    stats.  This delta also adds the "esp", "ah", and "ipcomp" protocol
    stats, which are also available when the kernel is compiled with the
    FAST_IPSEC stack (e.g. "netstat -s -p esp").

      Submitted by:   Matt Titus <titus at nttmcl dot com>

      Revision  Changes    Path
      1.31      +2 -1      src/usr.bin/netstat/Makefile
      1.13      +266 -94   src/usr.bin/netstat/ipsec.c
      1.81      +29 -0     src/usr.bin/netstat/main.c
      1.47      +6 -0      src/usr.bin/netstat/netstat.h
      1.1       +184 -0    src/usr.bin/netstat/pfkey.c (new)
2006-01-05 03:47:24 +00:00
cvs2svn
30ca7bc8d2 This commit was manufactured by cvs2svn to create branch 'RELENG_6'. 2005-12-30 16:45:32 +00:00
csjp
22f2501d22 MFC bpf stats functionality into netstat 2005-12-27 23:34:13 +00:00
rwatson
fe78d82c95 Merge mbuf.c:1.46 from HEAD to RELENG_6: trim accidentally committed
debugging printfs from netstat -m.
2005-11-28 18:07:36 +00:00
rwatson
5bea52cfc5 Merge main.c:1.80, mbuf.c:1.45, netstat.h:1.46 from HEAD to RELENG_6:
Modify netstat -mb to use libmemstat when accessing a core dump or live
  kernel memory and not using sysctl.  Previously, libmemstat was used
  only for the live kernel via sysctl paths.

  This results in netstat output becoming both more consistent between
  core dumps and the live kernel, and also more information in the core
  dump case than previously (i.e., mbuf cache information).

  Statistics relating to sfbufs still rely on a kvm descriptor as they
  are not currently exposed via libmemstat.  netstat -m operating on a
  core is still unable to print certain sfbuf stats available on the live
  kernel.
2005-11-20 00:38:06 +00:00
ru
583f9a601a MFC: 1.64: Align output. 2005-11-16 08:27:46 +00:00
glebius
7b38b603f5 MFC 1.61 by ru:
Bail if interface is misspelled instead of falling out into the
  "all interfaces" mode.  (Only works with -w, but still better
  than nothing.)
2005-11-09 10:55:37 +00:00
mlaier
135560a493 MFC: rev. 1.79
Fix obvious copy'n'paste-O in rev.1.36  While here nit style.

    PR:			bin/87783
    Submitted by:	Mats Palmgren
2005-11-08 16:45:00 +00:00
glebius
ebe24453ed MFC 1.62:
- Print space character in show_stat(). Remove a lot of priuntf(" ").
  - Utilize show_stat() in sidewaysintpr() loop. This makes periodic
    statistics to honor -h flag.

Approved by:	re (kensmith)
2005-09-29 13:19:10 +00:00
cvs2svn
21f17fbdbc This commit was manufactured by cvs2svn to create branch 'RELENG_6'. 2005-09-17 03:36:48 +00:00
yar
64ca23e269 MFC rev. 1.52:
List -W as one of the meaningful options to the -i (interfaces)
  display of netstat(1).

Approved by:	re (hrs)
2005-08-28 09:03:45 +00:00
glebius
d4bfa24b97 MFC:
Add a new switch -h for interface stats mode, which prints all interface
  statistics in human readable form.

  In collaboration with:	vsevolod
  Reviewed by:			cperciva

Approved by:	re (kensmith)
2005-08-19 15:08:43 +00:00
rwatson
2be4c0a749 Merge mbuf.c:1.43,1.44 and Makefile:1.27 from HEAD to RELENG_6:
Modify "netstat -mb" to use libmemstat(3) when acting on a live system,
  with a number of positive benefits:

  - Start using UMA(9) statistics for mbufs and clusters, which avoids
    using the mbuf allocator statistics which suffer from races under
    load on SMP.  This should eliminate "negative" mbuf counts in
    netstat -mb.

  - We are now able to track cached (free) mbufs and clusters and count
    it towards memory allocated by the network stack.

  - We are now also able to track memory allocated to mbuf tags since
    libmemstat(3) can also query malloc(9).  We don't print this except
    as part of the total (for now - #if 0).

  - We are now able to track mbuf/cluster/packet allocation failures,
    although they are not currently printed (#if 0).

  - Don't print out sfbuf statistics when running on a kernel core, as
    currently that code is able only to query sysctl for statistics.

mbuf.c:1.44:

  Since libmemstat(3) now supports its own error management mechanism,
  use that instead of trying to use errno, in order to produce a
  sensible error message.

Approved by:	re (kensmith)
2005-07-28 19:54:55 +00:00
mlaier
6b5cea57ef MFC: -sp pfsync
Print newly exported pfsync statistics with netstat(8).

  Requested by:   glebius

Approved by:	re (kensmith)
2005-07-23 17:03:59 +00:00
ume
e33ba03345 NI_WITHSCOPEID cleanup. Neither RFC 2553 nor RFC 3493 defines
NI_WITHSCOPEID, and our getaddrinfo(3) does nothing special
for it, now.
2005-05-13 16:31:11 +00:00
ru
07d3bbca19 Silence a warning on systems without carp(4). 2005-04-12 08:47:04 +00:00
ps
f01ea9b626 Add limits on the number of elements in the sack scoreboard both
per-connection and globally. This eliminates potential DoS attacks
where SACK scoreboard elements tie up too much memory.

Submitted by:	Raja Mukerji (raja at moselle dot com).
Reviewed by:	Mohan Srinivasan (mohans at yahoo-inc dot com).
2005-03-09 23:14:10 +00:00
glebius
e1d22638d0 Add CARP (Common Address Redundancy Protocol), which allows multiple
hosts to share an IP address, providing high availability and load
balancing.

Original work on CARP done by Michael Shalayeff, with many
additions by Marco Pfatschbacher and Ryan McBride.

FreeBSD port done solely by Max Laier.

Patch by:	mlaier
Obtained from:	OpenBSD (mickey, mcbride)
2005-02-22 13:04:05 +00:00
delphij
89e5680369 According to style.Makefile(5):
WARNS?= should appear before CFLAGS

Reviewed by:	ru
2005-01-23 12:29:46 +00:00
delphij
99a68ccb1f Make sure that we don't define INET6 when NO_INET6 is defined.
Without this change, when running netstat with a kernel without
INET6 built in, you will get a complain at the end of "netstat -s"
output.

X-MFC:		NO_INET6 was called "NOINET6" on RELENG_5
2005-01-22 19:35:48 +00:00
rwatson
13cad23620 evise use of queue(9) macros for netipx when used from userspace:
LIST_FOREACH() is difficult to use correctly, so don't try to.
2005-01-02 19:26:06 +00:00
rwatson
deba9fc9d0 Apply a simplifying patch submitted by rik to the IPX support in
netstat(1):

- Make previously unnecessarily global variables local.
- Use LIST_FOREACH() in preference to manual iteration.
- Restore a sanity check through slightly incestuous use of queue macro
  knowledge.

Submitted by:	rik
2004-12-31 12:04:21 +00:00
rwatson
e1d1aaa012 Update netstat(1) for recent conversion of netipx to queue(9) from
home-brew linked lists.  Read in the ipxpcb_list structure first in
order to find the first pcb pointer.  Then follow the chain as
before, only the termination condition is a NULL next pointer
rather than a next pointer equal to the original offset.
2004-12-31 00:32:50 +00:00
ru
5db2b9d5b3 For variables that are only checked with defined(), don't provide
any fake value.
2004-10-24 15:33:08 +00:00
maxim
62754bb686 -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
glebius
658e7039ff 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
stefanf
7cdc27d942 Use the length modifier 'll' instead of 'q' to print long longs. 2004-07-28 16:03:13 +00:00
charnier
cd48a1d32b 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
ps
f5e286321c Add SACK statistics to netstat. 2004-06-29 20:05:45 +00:00
bms
6f2c3ad82d 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
fjoe
94247dad2e 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
bmilekic
f7574a2276 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
ru
1c78462ed3 Bumped document date.
Fixed the grammar nit.
2004-05-19 09:52:40 +00:00
ru
11a1318135 Output style nit. 2004-05-12 07:36:59 +00:00
silby
bd609915e0 Add the bad reset statistic (corresponds to tcp_input.c rev 1.235) 2004-04-26 02:57:33 +00:00
luigi
ce58934c26 Replace ROUNDUP/ADVANCE with SA_SIZE 2004-04-13 11:24:43 +00:00
ru
4998d56908 Show link-level multicast packet counters with the -a option. 2004-04-12 15:00:48 +00:00