summaryrefslogtreecommitdiffstats
path: root/usr.bin/netstat/main.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC: 292394gnn2016-01-071-5/+5
| | | | | | | | Switch the IPsec related statistics to using the built in sysctl variable set rather than reading from kernel memory. This also makes the -z (zero) flag work correctly Sponsored by: Rubicon Communications, LLC (Netgate)
* MFC r287649:markj2016-01-071-0/+24
| | | | | Use a common subroutine to fetch and zero protocol stats instead of duplicating roughly similar code for each protocol.
* MFC r285782:markj2015-07-311-6/+18
| | | | | | Fix counter reads on platforms where sizeof(uint64_t) != sizeof(uint64_t *). PR: 201700
* MFC r266418, r266448hiren2015-04-061-2/+6
| | | | | | | | | Add the flowtype to the inpcb. Add -R to netstat to dump RSS/flow information. Reviewed by: delphij Relnotes: yes (for r266448) Sponsored by: Limelight Networks
* Merge r260524,r260540melifaro2014-05-081-9/+23
| | | | | | | | | | | r260524: Add -4/-6 shorthand for -finet/-finet6 in route(8) and netstat(8). r260540: Bump dates in nestat(1) and route(8) man pages. Fix several small errors introduced by r260524. Suggested by: glebius
* Merge r262763, r262767, r262771, r262806 from head:glebius2014-03-211-0/+13
| | | | | | | | | | - Remove rt_metrics_lite and simply put its members into rtentry. - Use counter(9) for rt_pksent (former rt_rmx.rmx_pksent). This removes another cache trashing ++ from packet forwarding path. - Create zini/fini methods for the rtentry UMA zone. Via initialize mutex and counter in them. - Fix reporting of rmx_pksent to routing socket. - Fix netstat(1) to report "Use" both in kvm(3) and sysctl(3) mode.
* Merge r259562,r259566,r259638,r259645,r260124 by melifaro:glebius2014-03-191-20/+29
| | | | | Switch netstat -rn to use standard API for retrieving list of routes instead of peeking inside in-kernel radix via kget.
* Bulk sync of pf changes from head, in attempt to fixup broken build Iglebius2014-03-121-0/+2
| | | | | | | | | made in r263029. Merge r257186,257215,257349,259736,261797. These changesets split pfvar.h into several smaller headers and make userland utilities to include only some of them.
* Merge r261582, r261601, r261610, r261613, r261627, r261640, r261641, r261823,glebius2014-03-041-2/+3
| | | | | | | | | | r261825, r261859, r261875, r261883, r261911, r262027, r262028, r262029, r262030, r262162 from head. Large flowtable revamp. See commit messages for merged revisions for details. Sponsored by: Netflix
* Merged /head:r256510,256512,257376,257469,260052:glebius2014-01-271-4/+3
| | | | Make 'netstat -i' use getifaddrs(3) instead of kvm(3).
* Sweep unused nlist entries.glebius2013-07-161-48/+26
| | | | Sponsored by: Nginx, Inc.
* Introduce new structure sfstat for collecting sendfile's statisticsae2013-07-151-1/+3
| | | | | | | and remove corresponding fields from struct mbstat. Use PCPU counters and SFSTAT_INC() macro for update these statistics. Discussed with: glebius
* Add -F fibnum option to specify an FIB number for -r flag.hrs2013-07-121-2/+10
|
* Use new macros to implement ipstat and tcpstat using PCPU counters.ae2013-07-091-5/+11
| | | | Change interface of kread_counters() similar ot kread() in the netstat(1).
* Use kvm_counter_u64_fetch() to fix obtaining ipstat and tcpstat fromglebius2013-04-101-25/+54
| | | | | | kernel core files. Sponsored by: Nginx, Inc.
* WARNS=6 compliancecharnier2013-02-191-3/+1
|
* - Merge in OFED 1.5.3 from projects/ofed/headjeff2011-03-211-0/+8
|
* Remove the advertising clause from UCB copyrighted files in usr.bin. Thisjoel2010-12-111-4/+0
| | | | | | | | | is in accordance with the information provided at ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change Also add $FreeBSD$ to a few files to keep svn happy. Discussed with: imp, rwatson
* Add new, per connection, statistics for TCP, including:gnn2010-11-171-2/+9
| | | | | | | | | | Retransmitted Packets Zero Window Advertisements Out of Order Receives These statistics are available via the -T argument to netstat(1). MFC after: 2 weeks
* Teach netstat -Q to work with -N and -M by adding libkvm versions of datarwatson2010-03-011-3/+5
| | | | | | | | | query routines. This code is necessarily more fragile in the presence of kernel changes than querying the kernel via sysctl (the default), but useful when investigating crashes or live kernel state via firewire. MFC after: 1 week Sponsored by: Juniper Networks
* Teach netstat(1) to print out netisr statistics when given the -Q argument.rwatson2010-02-221-3/+15
| | | | | | | | Currently supports only reporting on live systems via sysctl, kmem support needs to be edded. MFC after: 1 week Sponsored by: Juniper Networks
* Add a new option, -q howmany, which when used in conjuction with -w,delphij2010-01-111-2/+8
| | | | | | | | exits netstat after _howmany_ outputs. Requested by: thomasa Reviewed by: freebsd-net (bms, old version in early 2007) MFC after: 1 month
* Revert most part of 200420 as requested, as more review and polish isdelphij2009-12-131-0/+2
| | | | needed.
* Remove unneeded header includes from usr.bin/ except contributed code.delphij2009-12-111-2/+0
| | | | Tested with: make universe
* Remove -t from the manpage and usage.jhb2009-12-011-2/+2
|
* Unbreak user space after if_timer/if_watchdog removal in r199975.bz2009-12-011-4/+0
| | | | Tested by: glebius
* netstat(1) support for UNIX SOCK_SEQPACKET sockets -- changes were requiredrwatson2009-10-051-1/+4
| | | | | | | only for the kvm case, as we supported SOCK_SEQPACKET via sysctl already. Sponsored by: Google MFC after: 3 months
* Add ARP statistics to the kernel and netstat.gnn2009-09-031-0/+4
| | | | | | | | | | | | | | | | | | New counters now exist for: requests sent replies sent requests received replies received packets received total packets dropped due to no ARP entry entrys timed out Duplicate IPs seen The new statistics are seen in the netstat command when it is given the -s command line switch. MFC after: 2 weeks In collaboration with: bz
* Introduce a number of changes to the MROUTING code.bms2009-03-191-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is purely a forwarding plane cleanup; no control plane code is involved. Summary: * Split IPv4 and IPv6 MROUTING support. The static compile-time kernel option remains the same, however, the modules may now be built for IPv4 and IPv6 separately as ip_mroute_mod and ip6_mroute_mod. * Clean up the IPv4 multicast forwarding code to use BSD queue and hash table constructs. Don't build our own timer abstractions when ratecheck() and timevalclear() etc will do. * Expose the multicast forwarding cache (MFC) and virtual interface table (VIF) as sysctls, to reduce netstat's dependence on libkvm for this information for running kernels. * bandwidth meters however still require libkvm. * Make the MFC hash table size a boot/load-time tunable ULONG, net.inet.ip.mfchashsize (defaults to 256). * Remove unused members from struct vif and struct mfc. * Kill RSVP support, as no current RSVP implementation uses it. These stubs could be moved to raw_ip.c. * Don't share locks or initialization between IPv4 and IPv6. * Don't use a static struct route_in6 in ip6_mroute.c. The v6 code is still using a cached struct route_in6, this is moved to mif6 for the time being. * More cleanup remains to be merged from ip_mroute.c to ip6_mroute.c. v4 path tested using ports/net/mcast-tools. v6 changes are mostly mechanical locking and *have not* been tested. As these changes partially break some kernel ABIs, they will not be MFCed. There is a lot more work to be done here. Reviewed by: Pavlin Radoslavov
* Now that ifmcstat(8) does not suck, retire host-mode netstat -g.bms2009-02-151-1/+0
| | | | This change will not be back-ported.
* Fix usage() with SYNOPSIS.ru2009-01-101-5/+6
|
* Fix crash with "netstat -m -N foo".ru2009-01-101-1/+1
| | | | | PR: bin/124724 MFC after: 3 days
* o With -L flag show unix sockets listen queues stats. It is usefulmaxim2008-12-311-1/+1
| | | | | | | | to know number of not accepted connections for monitoring purposes. PR: bin/128871 Submitted by: Anton Yuzhaninov MFC after: 1 month
* add new build knobs and jigger some existing controls to improvesam2008-09-211-2/+8
| | | | | | | | control over the result of buildworld and installworld; this especially helps packaging systems such as nanobsd Reviewed by: various (posted to arch) MFC after: 1 month
* Minimize changes CURRENT<->releng7.obrien2008-09-011-1/+1
|
* Update the kernel to count the number of mbufs and clustersgnn2008-05-151-1/+5
| | | | | | | | | | | | (all types) used per socket buffer. Add support to netstat to print out all of the socket buffer statistics. Update the netstat manual page to describe the new -x flag which gives the extended output. Reviewed by: rwatson, julian
* style(9)obrien2008-01-021-28/+28
| | | | | | | + kread is not a boolean, so check it as such + fix $FreeBSD$ Ids + denote copyrights with /*- + misc whitespace changes.
* Bah, fix a cosmetic nit and remove a debugging aid missed in the previousjhb2007-07-161-2/+1
| | | | | | | fixes for netstat -M. Pointy hat to: jhb Approved by: re (kensmith)
* Restore netstat -M functionality for most statistics on core dumps. Injhb2007-07-161-83/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | general, when support was added to netstat for fetching data using sysctl, no provision was left for fetching equivalent data from a core dump, and in fact, netstat would _always_ fetch data from the live kernel using sysctl even when -M was specified resulting in the user believing they were getting data from coredumps when they actually weren't. Some specific changes: - Add a global 'live' variable that is true if netstat is running against the live kernel and false if -M has been specified. - Stop abusing the sysctl flag in the protocol tables to hold the protocol number. Instead, the protocol is now its own field in the tables, and it is passed as a separate parameter to the PCB and stat routines rather than overloading the KVM offset parameter. - Don't run PCB or stats functions who don't have a namelist offset if we are being run against a crash dump (!live). - For the inet and unix PCB routines, we generate the same buffer from KVM that the sysctl usually generates complete with the header and trailer. - Don't run bpf stats for !live (before it would just silently always run live). - kread() no longer trashes memory when opening the buffer if there is an error on open and the passed in buffer is smaller than _POSIX2_LINE_MAX. - The multicast routing code doesn't fallback to kvm on live kernels if the sysctl fails. Keeping this made the code rather hairy, and netstat is already tied to the kernel ABI anyway (even when using sysctl's since things like xinpcb contain an inpcb) so any kernels this is run against that have the multicast routing stuff should have the sysctls. - Don't try to dig around in the kernel linker in the netgraph PCB routine for core dumps. Other notes: - sctp's PCB routine only works on live kernels, it looked rather complicated to generate all the same stuff via KVM. Someone can always add it later if desired though. - Fix the ipsec removal bug where N_xxx for IPSEC stats weren't renumbered. - Use sysctlbyname() everywhere rather than hardcoded mib values. MFC after: 1 week Approved by: re (rwatson)
* Commit IPv6 support for FAST_IPSEC to the tree.gnn2007-07-011-22/+5
| | | | | | | | This commit includes all remaining changes for the time being including user space updates. Submitted by: bz Approved by: re
* Adds support for SCTP.rrs2007-06-091-0/+4
|
* - Achieve WARNS=3 by using sparse initializers or avoiding initializers at all.yar2006-07-281-44/+44
| | | | | | | | - Fix a nlist initialization: it should be terminated by a NULL entry. - Constify. - Catch an unused parameter. Tested on: i386 amd64 ia64
* Achieve WARNS=2 by using uintmax_t to pass around 64-bit quantities,yar2006-07-281-4/+4
| | | | | | | including to printf(). Using uintmax_t is also robust to further extensions in both the C language and the bitwidth of kernel counters. Tested on: i386 amd64 ia64
* Add support for printing IPSEC protocol stats if the kernel was compiledkbyanc2005-12-281-0/+29
| | | | | | | | | | | | | 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> MFC after: 3 days
* Modify netstat -mb to use libmemstat when accessing a core dump or liverwatson2005-11-131-12/+2
| | | | | | | | | | | | | | | | 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. MFC after: 1 week
* Fix obvious copy'n'paste-O in rev.1.36 While here nit style.mlaier2005-10-221-3/+3
| | | | | | PR: bin/87783 Submitted by: Mats Palmgren MFC after: 1 week
* Remove bridge(4) from the tree. if_bridge(4) is a full functionalmlaier2005-09-271-4/+0
| | | | | | | | replacement and has additional features which make it superior. Discussed on: -arch Reviewed by: thompsa X-MFC-after: never (RELENG_6 as transition period)
* Update usage to reflect the new option.csjp2005-09-071-1/+2
| | | | Pointed out by: ru
* Merge bpfstat's functionality into the netstat(1) utility. This addscsjp2005-09-071-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | a -B option which causes bpf peers to be printed. This option can be used in conjunction with -I if information about specific interfaces is desired. This is similar to what NetBSD added to their version of netstat. $ netstat -B Pid Netif Flags Recv Drop Match Sblen Hblen Command 1137 lo0 p--s-- 0 0 0 0 0 tcpdump 205 sis0 -ifs-l 37331 0 1 0 0 dhclient $ $ netstat -I lo0 -B Pid Netif Flags Recv Drop Match Sblen Hblen Command 1174 lo0 p--s-- 0 0 0 0 0 tcpdump $ -Add bpf.c which stores all the code for retrieving and parsing bpf related statistics. -Modify main.c to add support for the -B option and hook it into the program logic. -Add bpf.c to the build. -Document this new functionality in the man page and bump the revision date. -Add prototype for bpf_stats function.
* Add a new switch -h for interface stats mode, which prints all interfaceglebius2005-08-181-2/+6
| | | | | | | statistics in human readable form. In collaboration with: vsevolod Reviewed by: cperciva
OpenPOWER on IntegriCloud