Commit Graph

83 Commits

Author SHA1 Message Date
christos bad095e351 PR/50872: David Binderman: Use logical and instead of arithmetic 2016-02-29 18:21:15 +00:00
mrg 5f8222cdb9 query the window size and use it instead of assuming 24 lines.
now the header isn't re-printed a lot of times in tall windows.
2015-09-20 00:30:04 +00:00
christos f8128537a0 adjust to the netname4 prototype. 2015-01-07 22:43:01 +00:00
christos 34cb342199 use the common code from route.c 2014-11-06 21:30:09 +00:00
christos 04908d82dd use correct function and symbolic constants 2013-10-19 15:56:05 +00:00
christos 35be7e66a7 use new scopeid functions 2013-10-19 00:28:38 +00:00
christos 15a5bba97c - avoid pointer gymnastics
- remove unused variables
2013-10-18 20:26:45 +00:00
joerg e240adbd0b Retire OSI network stack. OK core@ 2013-03-01 18:25:13 +00:00
msaitoh fe467d4df9 Line up total numbers again (for -b case and -X case). 2012-10-19 19:50:19 +00:00
matt d34c2845b8 Use C89 function definitions 2012-03-20 20:34:57 +00:00
christos 0cdb0b2663 PR/44889: Yamamoto Takashi: netstat -d option is broken (from Elad) 2012-02-12 19:11:33 +00:00
joerg 6818646ac8 Use __dead 2011-09-16 15:39:25 +00:00
martin 82fe9809af Use RT_ROUNDUP() and friends from sys/route.h instead of homegrown
variants.
2011-02-04 14:31:23 +00:00
pooka f2ee316255 Add netstat rump client. For now, it always sets -X, i.e. will
use only sysctl and no kvm (implementing /dev/mem for a rump kernel
would probably not be hard, but still a non-zero effort).

Note: since there is absolutely no network activity in a fresh rump
kernel, rump.netstat usually displays exactly nothing when invoked
without parameters.  Arguments like -r, -bi, -p icmp etc. produce
more stuff.
2010-12-13 21:15:30 +00:00
enami 4964ac468f Line up total numbers again. 2010-07-09 07:04:30 +00:00
pooka bc1cf39b94 Add -h, which makes output of bytes counts "humanized" (e.g. -bih)
(netstat had -h some 15 years ago, but since then it has been just
a fancy way of calling usage())
2010-02-24 11:00:27 +00:00
plunky 98f75b5b42 protecting sockaddr_in6 with -DINET6 2009-09-27 18:19:18 +00:00
pgoyette ca6d65ecdd Use PRIu64 for printf'ing stuff. Fixes build breakage on part-amd64
introduced in rev 1.64 (and reverts a partial fix provided in rev 1.65)
2009-09-13 21:46:23 +00:00
elad dc553b0f9c Put some unsigned long long casts (as was in the original printing code).
Should fix build breakage noticed by pgoyette@ on current-users@:

    http://mail-index.netbsd.org/current-users/2009/09/13/msg010554.html

(sorry, don't have an amd64 anymore!)
2009-09-13 19:04:29 +00:00
elad a363352277 Checkin work in progress to make netstat use sysctl rather than kvm(3).
This commit mostly adds code written by Claudio Jeker for OpenBSD to
support sysctl in the interface printing parts (-i, -I, -w). The port has
been ported to NetBSD with tiny adjustments -- of course all bugs etc.
are mine.

Also add and document a -X flag to force sysctl usage. The documentation
notes this flag may be removed at any time and its presence should not be
relied on.

Some misc. comments/#ifdef changes/code snippet moves as well.

Please note that no functionality should change as the routing and
interface printing code is still not fully supported.

Mailing list reference:

    http://mail-index.netbsd.org/tech-userlevel/2009/09/09/msg002604.html
2009-09-13 02:53:17 +00:00
lukem d5a0caad3b Fix many WARNS=4 issues (-Wshadow -Wcast-qual -Wsign-compare).
Fix probable bug with numeric printing of anon ports when using sysctl.
2009-04-12 16:08:37 +00:00
thorpej 2654d13326 netns is no longer in the tree; completely purge it from netstat(1). 2008-04-23 15:35:37 +00:00
matt a5db205458 Conditionalize XNS support. No longer enabled. 2006-08-26 15:33:20 +00:00
elad 5d7aa1a613 Make netstat use sysctl when dumping routing tables/stats.
Heavily based on similar code from Claudio Jeker (at OpenBSD).

While here, fix inet/inet6 sysctl stuff commited previously to
actually work, and some other nits to make netstat more sysctl
friendly.

One step closer to losing setgid kmem on this one...
2006-05-28 16:51:40 +00:00
rpaulo 9ce7ce6bf0 Added #include <kvm.h> since netstat.h, which is included too, needs it. 2005-08-04 19:41:28 +00:00
itojun b95181fc9b NI_WITHSCOPEID was not picked up by IETF standardization process. 2004-11-16 05:59:32 +00:00
ragge ab6a210f76 Use itimerval() instead of alarm() for interval displaying. This increases
accuracy on interval stats also on fast machines.
2003-11-15 11:54:34 +00:00
itojun c636858983 correct strange indentation 2003-08-19 12:52:13 +00:00
agc 89aaa1bb64 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22365, verified by myself.
2003-08-07 11:13:06 +00:00
itojun 47d22404d4 use proper #ifdef to determine behavior (__KAME__) 2003-05-14 23:36:32 +00:00
itojun 01757d86d6 make char array bigger where it seems too small and may overrun. 2003-04-15 08:07:10 +00:00
itojun 8b228ca304 use macro to determine link-local multicast addr 2002-06-19 23:38:59 +00:00
itojun 9be14081f9 identify kame scopeid hack with KAME_SCOPEID 2002-06-19 16:42:09 +00:00
yamt be385ec4c0 make an auto const variable static. 2002-06-08 14:56:26 +00:00
bjh21 3369b8a6bb Use getnameinfo() for printing link-layer addresses in netstat -i, rather
than doing it ourselves.
2001-10-06 18:48:30 +00:00
itojun ea6a7c4787 pedant changes for strcpy/sprintf. 2001-04-06 05:10:28 +00:00
cgd a8ec668ddf convert to use getprogname() 2001-02-19 23:03:42 +00:00
matt b6e8f357a2 Print out IEEE1394 addresses with : . Add a hack to limit the address
to 8 bytes.
2000-11-14 23:00:57 +00:00
is 135600f947 More format string cleanup by sommerfeld. 2000-10-11 14:46:00 +00:00
itojun 5872028b21 more stats. from kame 2000-07-06 12:40:19 +00:00
enami 92b750d474 Allocate one more byte for the asterisk after the name of interface. 2000-07-03 05:06:43 +00:00
matt fcd0fb118f Make gcc 2.96 (and maybe earlier) happier. Include <stdlib.h>,<string.>,
etc. as appropriate to get exit,srncmp,abs,abort,etc.
Add -I${.CURDIR} to a few Makefiles
2000-07-03 02:51:12 +00:00
itojun 144ba78cf9 with -inv flag, do not truncate name of the interface (like "strip0"). 2000-07-02 09:07:23 +00:00
enami 7e18584b57 Define members previously defined as u_long in struct iftot as u_quad_t.
Since these members are used to hold members defined now as u_quad_t
in struct if_data, u_long is quite not enough actually.
Without this, one night ttcp easily makes netstat to produce wrong output
like this:
enami@annex-2f-floor-244% netstat -ibw 1 -I tlp0
   tlp0 in            tlp0 out          total in           total out
     bytes               bytes             bytes               bytes
176333740607          176914940420         240082591           821282404
176093659136          176093659136                 0                   0
176093659136          176093659136                 0                   0
2000-04-19 03:26:55 +00:00
itojun 8b2de4271e use NI_WITHSCOPEID when printing multicast group with -inav. 2000-02-09 13:57:06 +00:00
itojun 9fb53279e8 print IPv6 scopeid on -inv. with -in, scopeid is omitted due to insufficient
width.
2000-02-05 17:39:22 +00:00
itojun 4978f056f6 better sync with #ifdef notdef part (in -i for AF_INET). 2000-01-25 16:07:13 +00:00
itojun 5fa65dbb58 don't truncate IPv4 entries on -i (with -v). it is mainly for
"Network" column (13 digits, it will be 18 digits in maximum).
2000-01-25 15:56:55 +00:00
itojun e30f445f00 print IPv6 multicast group on -ia (-iav will avoid truncation) 2000-01-17 18:24:37 +00:00
itojun 033763d6c9 per-interface statistics.
bring in and enable KAME scopeid hack.
lots of cleanups.
(sync with latest KAME)
1999-12-13 15:22:55 +00:00