aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/netstat
Commit message (Collapse)AuthorAgeFilesLines
* Renumber copyright clause 4Warner Losh2017-02-2811-11/+11
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Merge projects/ipsec into head/.Andrey V. Elsukov2017-02-061-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Small summary ------------- o Almost all IPsec releated code was moved into sys/netipsec. o New kernel modules added: ipsec.ko and tcpmd5.ko. New kernel option IPSEC_SUPPORT added. It enables support for loading and unloading of ipsec.ko and tcpmd5.ko kernel modules. o IPSEC_NAT_T option was removed. Now NAT-T support is enabled by default. The UDP_ENCAP_ESPINUDP_NON_IKE encapsulation type support was removed. Added TCP/UDP checksum handling for inbound packets that were decapsulated by transport mode SAs. setkey(8) modified to show run-time NAT-T configuration of SA. o New network pseudo interface if_ipsec(4) added. For now it is build as part of ipsec.ko module (or with IPSEC kernel). It implements IPsec virtual tunnels to create route-based VPNs. o The network stack now invokes IPsec functions using special methods. The only one header file <netipsec/ipsec_support.h> should be included to declare all the needed things to work with IPsec. o All IPsec protocols handlers (ESP/AH/IPCOMP protosw) were removed. Now these protocols are handled directly via IPsec methods. o TCP_SIGNATURE support was reworked to be more close to RFC. o PF_KEY SADB was reworked: - now all security associations stored in the single SPI namespace, and all SAs MUST have unique SPI. - several hash tables added to speed up lookups in SADB. - SADB now uses rmlock to protect access, and concurrent threads can do SA lookups in the same time. - many PF_KEY message handlers were reworked to reflect changes in SADB. - SADB_UPDATE message was extended to support new PF_KEY headers: SADB_X_EXT_NEW_ADDRESS_SRC and SADB_X_EXT_NEW_ADDRESS_DST. They can be used by IKE daemon to change SA addresses. o ipsecrequest and secpolicy structures were cardinally changed to avoid locking protection for ipsecrequest. Now we support only limited number (4) of bundled SAs, but they are supported for both INET and INET6. o INPCB security policy cache was introduced. Each PCB now caches used security policies to avoid SP lookup for each packet. o For inbound security policies added the mode, when the kernel does check for full history of applied IPsec transforms. o References counting rules for security policies and security associations were changed. The proper SA locking added into xform code. o xform code was also changed. Now it is possible to unregister xforms. tdb_xxx structures were changed and renamed to reflect changes in SADB/SPDB, and changed rules for locking and refcounting. Reviewed by: gnn, wblock Obtained from: Yandex LLC Relnotes: yes Sponsored by: Yandex LLC Differential Revision: https://reviews.freebsd.org/D9352 Notes: svn path=/head/; revision=313330
* Fix rstat: symbol not in namelist from netstatSteven Hartland2017-01-091-3/+3
| | | | | | | | | | | | Load kvm symbols earlier to prevent rstat: symbol not in namelist error when running netstat -rs. Submitted by: Sebastian Huber <sebastian.huber@embedded-brains.de> MFC after: 1 week Sponsored by: Multiplay Notes: svn path=/head/; revision=311769
* Fix typo.Xin LI2017-01-091-1/+1
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=311762
* When displaying netstat details with libxo in JSONHajimu UMEMOTO2017-01-051-1/+1
| | | | | | | | | | | or XML modes, the value conversion for tcp6 and udp6 port numbers drops last digit. PR: 215682 MFC after: 3 days Notes: svn path=/head/; revision=311426
* Use strlcpy and snprintf in netstat(1).Xin LI2017-01-058-70/+101
| | | | | | | | | | | | Expand inet6name() line buffer to NI_MAXHOST and use strlcpy/snprintf in various places. Reported by: Anton Yuzhaninov <citrin citrin ru> MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D8916 Notes: svn path=/head/; revision=311392
* Print hostcache usage counts with TCP statistics.Marcelo Araujo2016-12-281-0/+6
| | | | | | | | | PR: 196252 Submitted by: Anton Yuzhaninov <citrin+pr@citrin.ru> MFC after: 3 weeks. Notes: svn path=/head/; revision=310698
* Use bogus_page to properly reduce number of I/Os in sendfile(2). The newGleb Smirnoff2016-11-171-0/+3
| | | | | | | | | | | | | | | | | | sendfile_swapin() loop works this way: - Find first invalid page in the request. - Do vm_pager_has_page() and get count of pages, that can be taken in single I/O. - Trim valid pages from the end of the request. - Cycle through the request and substitute to bogus_page all valid pages that are in the middle of the request. - After I/O launched (pager copies array of pages into buf(9), it is important to restore proper page pointers with help vm_page_lookup(). Count bogus pages used and report them in sendfile stats. Notes: svn path=/head/; revision=308783
* Fix build without INET6 and with gcc. A function definition was ifdefedBruce Evans2016-08-271-0/+2
| | | | | | | for INET6, but its protototype was not, and gcc detects the error. Notes: svn path=/head/; revision=304895
* Fix the output for scope statistics.Michael Tuexen2016-08-171-2/+2
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=304295
* Use names for SCTP and UDPLite when reporting the input histogram.Michael Tuexen2016-08-171-2/+2
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=304292
* Use nitems() from sys/param.h.Marcelo Araujo2016-07-301-2/+1
| | | | | | | | MFC after: 2 weeks. Sponsored by: gandi.net (BSD Day Taiwan) Notes: svn path=/head/; revision=303545
* Don't duplicate code for SCTP, just use the ones used for UDP and TCP.Michael Tuexen2016-07-171-83/+4
| | | | | | | | | | | This fixes a bug with link local addresses. This will require and upcoming change in the kernel to bring SCTP to the same behaviour as UDP and TCP. MFC after: 3 days Notes: svn path=/head/; revision=302945
* Ensure that the -a, -W, -L options for SCTP behave similarMichael Tuexen2016-07-151-3/+6
| | | | | | | | | as for TCP. MFC after: 3 days Notes: svn path=/head/; revision=302917
* When calling netstat -Laptcp the local address values are not alignedMichael Tuexen2016-07-151-3/+3
| | | | | | | | | | | | with the corresponding entry in the table header. r295136 increased the value width from 14 to 32 without the corresponding change to the table header. This commit adds the change to the table header width. MFC after: 3 days Notes: svn path=/head/; revision=302907
* Fix a bug which results in a core dump when running netstat withMichael Tuexen2016-07-151-1/+1
| | | | | | | | | | the -W option and having a listening SCTP socket. The bug was introduced in r279122 when adding support for libxo. MFC after: 3 days Notes: svn path=/head/; revision=302904
* Use macro MAX() from sys/param.h.Marcelo Araujo2016-04-221-1/+1
| | | | | | | MFC after: 2 weeks. Notes: svn path=/head/; revision=298442
* Use NULL instead of 0 for pointers.Marcelo Araujo2016-04-183-7/+7
| | | | | | | | | Also malloc will return NULL if it cannot allocate memory. MFC after: 2 weeks. Notes: svn path=/head/; revision=298182
* netstat: avoid returning uninitialized value in p_sockaddr().Pedro F. Giffuni2016-03-271-0/+1
| | | | | | | | | | | In the case the width is less than 0, we are returning an uninitialized value. For practical purposes the return value is ignored but initialize it to avoid trouble. CID: 1341619 Notes: svn path=/head/; revision=297321
* Print running TCP connection counts with TCP statistics.Gleb Smirnoff2016-03-154-6/+54
| | | | Notes: svn path=/head/; revision=296882
* DIRDEPS_BUILD: Regenerate without local dependencies.Bryan Drewery2016-02-241-10/+0
| | | | | | | | | | | These are no longer needed after the recent 'beforebuild: depend' changes and hooking DIRDEPS_BUILD into a subset of FAST_DEPEND which supports skipping 'make depend'. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=295989
* Increase max allowed backlog for listen socketsAlfred Perlstein2016-02-023-9/+10
| | | | | | | | | | | from short to int. PR: 203922 Submitted by: White Knight <white_knight@2ch.net> MFC After: 4 weeks Notes: svn path=/head/; revision=295136
* New sendfile(2) syscall. A joint effort of NGINX and Netflix from 2013 andGleb Smirnoff2016-01-081-3/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | up to now. The new sendfile is the code that Netflix uses to send their multiple tens of gigabits of data per second. The new implementation features asynchronous I/O, when I/O operations are launched, but not awaited to be complete. An explanation of why such behavior is beneficial compared to old one is going to be too long for a commit message, so we will skip it here. Additional features of new syscall are extra flags, which provide an application more control over data sent. The SF_NOCACHE flag tells kernel that data shouldn't be cached after it was sent. The SF_READAHEAD() macro allows to specify readahead size in pages. The new syscalls is a drop in replacement. No modifications are required to applications. One can take nginx binary for stable/10 and run it successfully on head. Although SF_NODISKIO lost its original sense, as now sendfile doesn't block, and now means something completely different (tm), using the new sendfile the old way is absolutely safe. Celebrates: Netflix global launch! Sponsored by: Nginx, Inc. Sponsored by: Netflix Relnotes: yes Notes: svn path=/head/; revision=293439
* Switch the IPsec related statistics to using the built in sysctlGeorge V. Neville-Neil2015-12-172-14/+24
| | | | | | | | | | | | variable set rather than reading from kernel memory. This also makes the -z (zero) flag work correctly MFC after: 1 week Sponsored by: Rubicon Communications, LLC (Netgate) Differential Revision: https://reviews.freebsd.org/D4591 Notes: svn path=/head/; revision=292394
* Add more text to explain --libxo flag.Craig Rodrigues2015-12-011-1/+8
| | | | Notes: svn path=/head/; revision=291607
* At the time a destination or a gateway of `netstat -r'Hajimu UMEMOTO2015-12-011-6/+14
| | | | | | | | protrudes its field, narrow the next field to raise readability bit. Notes: svn path=/head/; revision=291592
* Update dependencies after r291406 added libelf to libkvm.Bryan Drewery2015-12-011-0/+1
| | | | | | | | | | | Unfortunately filemon/meta mode tracks all indirect dependencies here since ld(1) is reading libelf when linking in libkvm. Churn would be reduced if this was able to be limited to direct dependencies. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=291558
* Replace DPSRCS that work fine in SRCS.Bryan Drewery2015-11-251-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is so that 'make depend' is not a required build step in these files. DPSRCS is overall unneeded. DPSRCS already contains SRCS, so anything which can safely be in SRCS should be. DPSRCS is mostly just a way to generate files that should not be linked into the final PROG/LIB. For headers and grammars it is safe for them to be in SRCS since they will be excluded during linking and installation. The only remaining uses of DPSRCS are for generating .c or .o files that must be built before 'make depend' can run 'mkdep' on the SRCS c files list. A semi-proper example is in tests/sys/kern/acct/Makefile where a checked-in .c file has an #include on a generated .c file. The generated .c file should not be linked into the final PROG though since it is #include'd. The more proper way here is just to build/link it in though without DPSRCS. Another example is in sys/modules/linux/Makefile where a shell script runs to parse a DPSRCS .o file that should not be linked into the module. Beyond those, the need for DPSRCS is largely unneeded, redundant, and forces 'make depend' to be ran. Generally, these Makefiles should avoid the need for DPSRCS and define proper dependencies for their files as well. An example of an improper usage and why this matters is in usr.bin/netstat. nl_defs.h was only in DPSRCS and so was not generated during 'make all', but only during 'make depend'. The files including it lacked proper depenencies on it, which forced running 'make depend' to workaround that bug. The 'make depend' target should mostly be used for incremental build help, not to produce a working build. This specific example was broken in the meta build until r287905 since it does not run 'make depend'. The gnu/lib/libreadline/readline case is fine since bsd.lib.mk has 'OBJS: SRCS:M*.h' when there is no .depend file. Sponsored by: EMC / Isilon Storage Division MFC after: 1 week Notes: svn path=/head/; revision=291330
* Fix udp entry of `netstat -TW'.Hajimu UMEMOTO2015-11-251-0/+2
| | | | Notes: svn path=/head/; revision=291298
* Correct alignment of the addresses in the `netstat -aW' output.Hajimu UMEMOTO2015-11-241-12/+21
| | | | Notes: svn path=/head/; revision=291259
* Add missing error check after xo_parse_args() in netstat(8).Hajimu UMEMOTO2015-11-241-0/+2
| | | | | | | | Submitted by: Oliver Pinter Differential Revision: https://reviews.freebsd.org/D4233 Notes: svn path=/head/; revision=291247
* Don't truncate an interface name when -W option is specified.Hajimu UMEMOTO2015-11-201-1/+5
| | | | | | | | Spotted by: Jim Thompson <jim__at__netgate.com> MFC after: 1 week Notes: svn path=/head/; revision=291097
* Avoid core dump when output style is html.Hajimu UMEMOTO2015-11-201-10/+8
| | | | Notes: svn path=/head/; revision=291096
* JSON doesn't permit a hexadecimal notation of an integer.Hajimu UMEMOTO2015-11-171-1/+1
| | | | Notes: svn path=/head/; revision=290975
* Do not truncate addresses when printing in encoded format.Hajimu UMEMOTO2015-11-061-10/+11
| | | | Notes: svn path=/head/; revision=290449
* - Fix alignment for padding link address.Hajimu UMEMOTO2015-11-061-2/+2
| | | | | | | - Trim whitespace of link address. Notes: svn path=/head/; revision=290446
* Fix compiling netstat after r290367 by substituting sys/types.h forEnji Cooper2015-11-061-1/+1
| | | | | | | | | | sys/param.h, as sys/param.h defines the MAX(..) macro Reported by: O. Hartmann <ohartman@zedat.fu-berlin.de> Pointyhat to: ume Notes: svn path=/head/; revision=290437
* Give enough room for addresses when -W option is specified.Hajimu UMEMOTO2015-11-051-11/+25
| | | | Notes: svn path=/head/; revision=290391
* Fix alignment of `Drop' header.Hajimu UMEMOTO2015-11-051-1/+1
| | | | Notes: svn path=/head/; revision=290390
* Use returned network name from getnetbyaddr() correctly.Hajimu UMEMOTO2015-11-051-6/+5
| | | | Notes: svn path=/head/; revision=290389
* Revert previous workaround. This problem was fixedHajimu UMEMOTO2015-11-051-4/+0
| | | | | | | by r290318. Notes: svn path=/head/; revision=290388
* Since sa->sa_len doesn't match sizeof(struct sockaddr_dl),Hajimu UMEMOTO2015-11-041-0/+4
| | | | | | | | getnameinfo() fails against sockaddr_dl. This commit is workaround for this problem. Notes: svn path=/head/; revision=290372
* Fix alignment of AF_LINK address.Hajimu UMEMOTO2015-11-041-2/+1
| | | | Notes: svn path=/head/; revision=290371
* Simplify r290367 using asterisk for a field widthHajimu UMEMOTO2015-11-041-8/+3
| | | | | | | and precision. Notes: svn path=/head/; revision=290370
* Unify AF_INET case and AF_INET6 case.Hajimu UMEMOTO2015-11-041-15/+1
| | | | Notes: svn path=/head/; revision=290368
* Change to not truncate an interface name when -W optionHajimu UMEMOTO2015-11-041-11/+24
| | | | | | | is specified. Notes: svn path=/head/; revision=290367
* Mask an IPv6 network address.Hajimu UMEMOTO2015-11-041-1/+8
| | | | Notes: svn path=/head/; revision=290366
* Restore an interface name field to left align.Hajimu UMEMOTO2015-11-041-2/+2
| | | | Notes: svn path=/head/; revision=290365
* Update META_MODE dependencies.Bryan Drewery2015-09-171-0/+10
| | | | Notes: svn path=/head/; revision=287905
* Use a common subroutine to fetch and zero protocol stats instead ofMark Johnston2015-09-1110-236/+113
| | | | | | | | | duplicating roughly similar code for each protocol. MFC after: 2 weeks Notes: svn path=/head/; revision=287649