summaryrefslogtreecommitdiffstats
path: root/usr.bin/netstat/main.c
Commit message (Collapse)AuthorAgeFilesLines
* Add CARP (Common Address Redundancy Protocol), which allows multipleglebius2005-02-221-0/+4
| | | | | | | | | | | | | 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)
* Update netstat(1) for recent conversion of netipx to queue(9) fromrwatson2004-12-311-1/+1
| | | | | | | 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.
* -c flag (cache stats) was killed in rev. 1.68. Fix getopt(3) andmaxim2004-10-201-2/+2
| | | | | | usage() accordingly. Submitted by: Pawel Worach
* Add __FBSDID. Replace local variable sin by sockin to not conflict with sin(3).charnier2004-07-261-8/+10
| | | | | Use warnx() instead of warn() when error message is not of any interest. Add prototypes.
* Bring in mbuma to replace mballoc.bmilekic2004-05-311-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* Output style: Get rid of an unnecessary newline.bms2004-03-251-1/+0
|
* Teach netstat(1) how to print the multicast group memberships presentbms2004-03-251-0/+2
| | | | | | within the running system. Sponsored by: Ralf the Wonder Llama
* More cleanups:ru2004-03-181-20/+20
| | | | | | | | - 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
* NULL -> 0.ru2004-03-171-1/+1
|
* Restore old netstat -m output.alfred2003-12-231-3/+11
| | | | A new flag '-c' can be used to ask for the cache stats.
* 1. Add support for printing PIM-related statistics withhsu2003-08-071-0/+2
| | | | | | | | | 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>
* Kill #ifdef NS and some leftover #ifdef ISO code. Re-pack the nlist[]peter2003-03-051-121/+33
| | | | array, it isn't likely to find any ARPAnet IMP drivers in FreeBSD.
* o Allow "buckets" in mb_alloc to be differently sized (according tobmilekic2003-02-201-7/+13
| | | | | | | | | | | | | | | | 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
* o Typo/Grammar fixesmtm2003-01-141-0/+6
| | | | | | | | o Added mini-function to correctly handle singular/plural of words ending in 'ly' Approved by: markm (mentor) Not objected to by: -audit
* Warns cleanups for netstat:dwmalone2002-09-051-17/+15
| | | | | | | | | | | 1) Include arpa/inet.h for ntohs. 2) Constness fixes. 3) Fix shadowing except for "sin" which shouldn't be in scope. 4) Remove register keyword. 5) Add missing initialsers to user defined structs. 5) Make prototype of netname6 globally visable. 6) Use right macros for printing syncache stats (even though entrie isn't a word).
* Some easy const fixes.markm2002-04-281-3/+3
|
* Implement the ``-f address_family'' filter for -i.ru2001-09-111-1/+4
| | | | Prodded by: Igor Podlesny <poige@morning.ru>
* Update usage() to match reality.ru2001-09-111-5/+12
|
* Deprecate the -l option in favour of more natural -W.ru2001-09-071-4/+1
| | | | | | | | The compatibility glue is still provided. (This change is not yet reflected in the manpage, nor in usage(). This will be fixed at a later time today, with the general manpage cleanup commit.)
* SECURITY: Drop `setgid kmem' bit as early as possible.ru2001-08-311-0/+1
|
* Make `rttrash' variable (#routes not in table but not freed) visibleru2001-06-291-1/+3
| | | | through ``netstat -rs''.
* - create an entry of IPV6CTL_STATS sysctl.ume2001-06-281-4/+4
| | | | | | | | | - fix the problem that netstat doesn't show raw6 and icmp6 pcblist. - make netstat use sysctl to retreive stats of ipv6 and icmpv6 instead of kread. Obtained from: KAME MFC after: 1 week
* Add netstat(1) knob to reset net.inet.{ip|icmp|tcp|udp|igmp}.stats.ru2001-06-231-1/+5
| | | | | | For example, ``netstat -s -p ip -z'' will show and reset IP stats. PR: bin/17338
* Introduce numerous SMP friendly changes to the mbuf allocator. Namely,bmilekic2001-06-221-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | introduce a modified allocation mechanism for mbufs and mbuf clusters; one which can scale under SMP and which offers the possibility of resource reclamation to be implemented in the future. Notable advantages: o Reduce contention for SMP by offering per-CPU pools and locks. o Better use of data cache due to per-CPU pools. o Much less code cache pollution due to excessively large allocation macros. o Framework for `grouping' objects from same page together so as to be able to possibly free wired-down pages back to the system if they are no longer needed by the network stacks. Additional things changed with this addition: - Moved some mbuf specific declarations and initializations from sys/conf/param.c into mbuf-specific code where they belong. - m_getclr() has been renamed to m_get_clrd() because the old name is really confusing. m_getclr() HAS been preserved though and is defined to the new name. No tree sweep has been done "to change the interface," as the old name will continue to be supported and is not depracated. The change was merely done because m_getclr() sounds too much like "m_get a cluster." - TEMPORARILY disabled mbtypes statistics displaying in netstat(1) and systat(1) (see TODO below). - Fixed systat(1) to display number of "free mbufs" based on new per-CPU stat structures. - Fixed netstat(1) to display new per-CPU stats based on sysctl-exported per-CPU stat structures. All infos are fetched via sysctl. TODO (in order of priority): - Re-enable mbtypes statistics in both netstat(1) and systat(1) after introducing an SMP friendly way to collect the mbtypes stats under the already introduced per-CPU locks (i.e. hopefully don't use atomic() - it seems too costly for a mere stat update, especially when other locks are already present). - Optionally have systat(1) display not only "total free mbufs" but also "total free mbufs per CPU pool." - Fix minor length-fetching issues in netstat(1) related to recently re-enabled option to read mbuf stats from a core file. - Move reference counters at least for mbuf clusters into an unused portion of the cluster itself, to save space and need to allocate a counter. - Look into introducing resource freeing possibly from a kproc. Reviewed by (in parts): jlemon, jake, silby, terry Tested by: jlemon (Intel & Alpha), mjacob (Intel & Alpha) Preliminary performance measurements: jlemon (and me, obviously) URL: http://people.freebsd.org/~bmilekic/mb_alloc/
* remove warningsassar2001-06-151-20/+1
| | | | | remove superfluous declarations make things more consistent
* remove K&R supportassar2001-06-151-20/+15
|
* revert removal of warning and K&R supportassar2001-06-151-12/+36
| | | | Requested by: bde
* First round of netstat(1) cleanup.ru2001-06-151-26/+21
| | | | | | | | | | | | | | | | | | | | | | | | Removed the ambiguity in -s, -f, -p and -i flags handling. Basically, there are four displays (except others): 1. PCB display. 2. Protocol statistics display. (-s) 3. Interface statistics display. (-i) 4. Per-interface protocol statistics display. (-i -s) All of the above except 3) can be limited to a particular protocol family (-f) or a single protocol (-p). Some examples: 1. netstat -f inet -- show PCBs of all INET protocols 2. netstat -p udp -- show PCB of UDP protocol only (NEW!) 3. netstat -s -- show protocol statistics for all families 4. netstat -s -f inet -- show INET protocols statistics 5. netstat -s -p icmp -- show ICMP protocol statistics This is a work in progress. Manpage has been fixed slightly, but is still incomplete.
* remove most of the warningsassar2001-06-151-19/+14
|
* add the option -S for printing port numbers symbolically but addressesassar2001-06-151-4/+8
| | | | numerically. clean up the CFLAGS in Makefile.
* Restore -M -N support for -m.ru2001-06-141-3/+19
| | | | PR: 20808
* Really delete the -h option.ru2001-06-141-2/+2
| | | | | CSRG revision 5.33 deleted -h option from getopt(), but not from usage(). Revision 8.3 restored it in getopt().
* Sync with recent KAME.ume2001-06-111-0/+2
| | | | | | | | | | | | | | | | | | This work was based on kame-20010528-freebsd43-snap.tgz and some critical problem after the snap was out were fixed. There are many many changes since last KAME merge. TODO: - The definitions of SADB_* in sys/net/pfkeyv2.h are still different from RFC2407/IANA assignment because of binary compatibility issue. It should be fixed under 5-CURRENT. - ip6po_m member of struct ip6_pktopts is no longer used. But, it is still there because of binary compatibility issue. It should be removed under 5-CURRENT. Reviewed by: itojun Obtained from: KAME MFC after: 3 weeks
* Add a -W flag that tells netstat not to truncate addresses even if they aredes2001-03-151-3/+29
| | | | | | | | too long for the column they're printed in. Move variable definitions out of netstat.h and into main.c. Clean up some warnings.
* MAXHOSTNAMELEN includes space for a NUL.brian2001-03-141-30/+0
| | | | | | Don't roll our own version of trimdomain(), use the one in libutil. Not objected to by: freebsd-audit
* Do not display icmp(4) sockets as non-existent bridge(4) sockets.ru2000-08-031-2/+2
|
* add pfkeystat. sync with kameitojun2000-07-051-0/+23
|
* Add '-L' option to usage().guido2000-03-201-1/+1
|
* Add a flag to the usage display.shin2000-03-111-2/+2
| | | | | | | | | There was a missing description for a new flags to netstat. I already added the fix to netstat man, but usage() change is also necessary. Specified by: Ben Smithurst <ben@scientia.demon.co.uk> Approved by: jkh
* IPv6 multicast routing.shin2000-01-281-6/+0
| | | | | | | | | | | | | kernel IPv6 multicast routing support. pim6 dense mode daemon pim6 sparse mode daemon netstat support of IPv6 multicast routing statistics Merging to the current and testing with other existing multicast routers is done by Tatsuya Jinmei <jinmei@kame.net>, who writes and maintainances the base code in KAME distribution. Make world check and kernel build check was also successful.
* -permit protocol specific statistics at iflag,shin2000-01-071-1/+1
| | | | | | | | | only when either of sflag and "-f inet6" is specified. -fix the indentation of default output Specified by: Stephen McKay <syssgm@detir.qld.gov.au> Reviewed and Confirmed by: Stephen McKay <syssgm@detir.qld.gov.au>
* Getaddrinfo(), getnameinfo(), and etc support in libc/net.shin1999-12-281-1/+1
| | | | | | | Several udp and raw apps IPv6 support. Reviewed by: freebsd-arch, cvs-committers Obtained from: KAME project
* Add new option, -L that will listen the various listen queue lengths.guido1999-12-131-2/+5
| | | | | Reviewed by: Garrett Wollman <wollman@khavrinen.lcs.mit.edu>, Clive Lin <clive@GnatS.CirX.ORG>
* udp IPv6 support, IPv6/IPv4 tunneling support in kernel,shin1999-12-071-55/+145
| | | | | | | | | | packet divert at kernel for IPv6/IPv4 translater daemon This includes queue related patch submitted by jburkhol@home.com. Submitted by: queue related patch from jburkhol@home.com Reviewed by: freebsd-arch, cvs-committers Obtained from: KAME project
* Whistle's Netgraph link-layer (sometimes more) networking infrastructure.julian1999-10-211-1/+20
| | | | | | | | | | Been in production for 3 years now. Gives Instant Frame relay to if_sr and if_ar drivers, and PPPOE support soon. See: ftp://ftp.whistle.com/pub/archie/netgraph/index.html for on-line manual pages. Reviewed by: Doug Rabson (dfr@freebsd.org) Obtained from: Whistle CVS tree
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Document the use of the -a flag in conjunction with the -r flag.nik1999-08-111-2/+2
| | | | | PR: docs/13037 Submitted by: Christopher Masto <chris@netmonger.net>
* Add support for printing bridging statistics with ``-p bdg '' .luigi1999-04-261-1/+3
| | | | If someone has a better flag to use I'll be glad to change it.
* Make the ipx part of netstat work again.jhay1999-02-061-5/+7
|
* Don't use ip_mrtproto to determine whether multicast routing is infenner1999-01-181-15/+11
| | | | | | | | the kernel; this was left over from the earlier protocol-dependent kernel multicast routing code. Learn how to handle the malloc'd multicast routing table (instead of expecting it to be in mbufs)
OpenPOWER on IntegriCloud