Home | History | Annotate | Download | only in netstat
History log of /src/usr.bin/netstat/if.c
RevisionDateAuthorComments
 1.109  28-Dec-2022  mrg if not given an interface to monitor by default, pick the one
with the most bytes in/out the first time and keep using it.

in addition to picking the most likely intersting interface,
this actually fixes a bug where interfaces coming/going in
the middle of eg, "netstat -b -w 1", may end up showing the
data for another interface on any output line (including the
the header declaring the interface!)
 1.108  12-Dec-2022  msaitoh branches: 1.108.2;
Use warn() instead of warnx() and simplify.
 1.107  19-Nov-2022  taca netstat/if.c: Fix error message with "-w" option.

Now ifq_drops is 64bit unsigned integer.

No description in src/doc/CHANGES?
 1.106  24-Oct-2022  msaitoh Make ifq_drops in struct ifqueue and struct ifaltq 64 bit.
 1.105  21-Sep-2022  msaitoh s/u_quad_t/uint64_t/. No functional change.
 1.104  12-Sep-2022  msaitoh Print oqdrops correctly in continuous display mode using with kvm.
 1.103  11-Sep-2022  msaitoh Fix printing current output drop packet count in continuous display mode.
 1.102  05-Sep-2022  msaitoh G.C. No functional change.
 1.101  05-Sep-2022  msaitoh Print oqdrops correctly.
 1.100  05-Sep-2022  msaitoh Get if_data correctly when kvm is used.
 1.99  02-Sep-2022  msaitoh KNF. No functional change.
 1.98  01-Sep-2022  msaitoh KNF. No functional change.
 1.97  18-Aug-2022  msaitoh Use NULL instead of 0.
 1.96  02-Feb-2020  thorpej Update for per-cpu interface statistics.
 1.95  11-Jul-2018  msaitoh branches: 1.95.2;
Print iqdrops, too. This change also fixes a bug that Odrops prints
iqdrops when kvm read failed.
 1.94  23-Feb-2017  ozaki-r branches: 1.94.4; 1.94.10; 1.94.12;
Remove mkludge stuffs

For unknown reasons, IPv6 multicast addresses are linked to a first
IPv6 address assigned to an interface. Due to the design, when removing
a first address having multicast addresses, we need to save them to
somewhere and later restore them once a new IPv6 address is activated.
mkludge stuffs support the operations.

This change links multicast addresses to an interface directly and
throws the kludge away.

Note that as usual some obsolete member variables remain for kvm(3)
users. And also sysctl net.inet6.multicast_kludge remains to avoid
breaking old ifmcstat.

TODO: currently ifnet has a list of in6_multi but obviously the list
should be protocol independent. Provide a common structure (if_multi
or something) to handle in6_multi and in_multi together as well as
ifaddr does for in_ifaddr and in6_ifaddr.
 1.93  22-Jan-2017  mrg re-do the previous to avoid malloc/free on the same size every iteration.

with this, or the previous, 'netstat -b 1' no longer leaks memory in
-current (or any older release using sysctl for this.)
 1.92  22-Jan-2017  christos sprinkle free
 1.91  11-Jan-2017  ozaki-r branches: 1.91.2;
Fix showing multicast addresses of !IFF_UP interfaces

netstat appends '*' to the name of an interface without IFF_UP, so
if_nametoindex which is used in mc_print fails. mc_print needs just
an interface index so pass it instead of a tweaked interface name.
 1.90  24-Nov-2016  dholland Fix "sidewaysintpr", the thing that prints interface statistics in a
loop, to use signals properly. There are two copies of this code; one
uses kvm and the other uses sysctls. One copy had been updated to use
sigset_t and sigsuspend; the other was using vintage sigpause(). Sync
up the code so both use sigpause. Also, use sig_atomic_t, and block
SIGALRM when not waiting for it to avoid a small and unlikely but real
race.

Since the non-modernized copy of the code *had* for some been
modernized to use setitimer instead of just alarm(), propagate that
change to the other copy.

These copies could share more logic than they do.
 1.89  14-Jul-2016  christos branches: 1.89.2;
more XXX removal.
 1.88  14-Jul-2016  christos XXX: removal
 1.87  14-Jul-2016  christos remove __P
 1.86  14-Jul-2016  christos dedup
 1.85  14-Jul-2016  christos use sysctl to print multicast addresses
 1.84  13-Jul-2016  christos fix sysctl based interface printing, and annotate where we should add the
missing multicast printing code.
 1.83  29-Feb-2016  christos PR/50872: David Binderman: Use logical and instead of arithmetic
 1.82  20-Sep-2015  mrg 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.
 1.81  07-Jan-2015  christos adjust to the netname4 prototype.
 1.80  06-Nov-2014  christos use the common code from route.c
 1.79  19-Oct-2013  christos branches: 1.79.4;
use correct function and symbolic constants
 1.78  19-Oct-2013  christos use new scopeid functions
 1.77  18-Oct-2013  christos - avoid pointer gymnastics
- remove unused variables
 1.76  01-Mar-2013  joerg Retire OSI network stack. OK core@
 1.75  19-Oct-2012  msaitoh Line up total numbers again (for -b case and -X case).
 1.74  20-Mar-2012  matt branches: 1.74.2;
Use C89 function definitions
 1.73  12-Feb-2012  christos branches: 1.73.2;
PR/44889: Yamamoto Takashi: netstat -d option is broken (from Elad)
 1.72  16-Sep-2011  joerg branches: 1.72.2;
Use __dead
 1.71  04-Feb-2011  martin Use RT_ROUNDUP() and friends from sys/route.h instead of homegrown
variants.
 1.70  13-Dec-2010  pooka branches: 1.70.2;
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.
 1.69  09-Jul-2010  enami Line up total numbers again.
 1.68  24-Feb-2010  pooka 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())
 1.67  27-Sep-2009  plunky protecting sockaddr_in6 with -DINET6
 1.66  13-Sep-2009  pgoyette 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)
 1.65  13-Sep-2009  elad 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!)
 1.64  13-Sep-2009  elad 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
 1.63  12-Apr-2009  lukem Fix many WARNS=4 issues (-Wshadow -Wcast-qual -Wsign-compare).
Fix probable bug with numeric printing of anon ports when using sysctl.
 1.62  23-Apr-2008  thorpej branches: 1.62.8;
netns is no longer in the tree; completely purge it from netstat(1).
 1.61  26-Aug-2006  matt branches: 1.61.16;
Conditionalize XNS support. No longer enabled.
 1.60  28-May-2006  elad 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...
 1.59  04-Aug-2005  rpaulo branches: 1.59.2;
Added #include <kvm.h> since netstat.h, which is included too, needs it.
 1.58  16-Nov-2004  itojun NI_WITHSCOPEID was not picked up by IETF standardization process.
 1.57  15-Nov-2003  ragge Use itimerval() instead of alarm() for interval displaying. This increases
accuracy on interval stats also on fast machines.
 1.56  19-Aug-2003  itojun correct strange indentation
 1.55  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.54  14-May-2003  itojun use proper #ifdef to determine behavior (__KAME__)
 1.53  15-Apr-2003  itojun make char array bigger where it seems too small and may overrun.
 1.52  19-Jun-2002  itojun use macro to determine link-local multicast addr
 1.51  19-Jun-2002  itojun identify kame scopeid hack with KAME_SCOPEID
 1.50  08-Jun-2002  yamt make an auto const variable static.
 1.49  06-Oct-2001  bjh21 Use getnameinfo() for printing link-layer addresses in netstat -i, rather
than doing it ourselves.
 1.48  06-Apr-2001  itojun pedant changes for strcpy/sprintf.
 1.47  19-Feb-2001  cgd convert to use getprogname()
 1.46  14-Nov-2000  matt Print out IEEE1394 addresses with : . Add a hack to limit the address
to 8 bytes.
 1.45  11-Oct-2000  is More format string cleanup by sommerfeld.
 1.44  06-Jul-2000  itojun more stats. from kame
 1.43  03-Jul-2000  enami Allocate one more byte for the asterisk after the name of interface.
 1.42  03-Jul-2000  matt 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
 1.41  02-Jul-2000  itojun with -inv flag, do not truncate name of the interface (like "strip0").
 1.40  19-Apr-2000  enami branches: 1.40.4;
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
 1.39  09-Feb-2000  itojun use NI_WITHSCOPEID when printing multicast group with -inav.
 1.38  05-Feb-2000  itojun print IPv6 scopeid on -inv. with -in, scopeid is omitted due to insufficient
width.
 1.37  25-Jan-2000  itojun better sync with #ifdef notdef part (in -i for AF_INET).
 1.36  25-Jan-2000  itojun don't truncate IPv4 entries on -i (with -v). it is mainly for
"Network" column (13 digits, it will be 18 digits in maximum).
 1.35  17-Jan-2000  itojun print IPv6 multicast group on -ia (-iav will avoid truncation)
 1.34  13-Dec-1999  itojun per-interface statistics.
bring in and enable KAME scopeid hack.
lots of cleanups.
(sync with latest KAME)
 1.33  19-Nov-1999  bouyer Change printf formats for 64bit counters.
 1.32  01-Jul-1999  itojun branches: 1.32.4;
make netstat IPv6-ready.
 1.31  14-Mar-1999  mycroft branches: 1.31.2;
Make the damned columns line up.
 1.30  11-Jan-1999  mrg #ifndef SMALL changes. saves 30k on the sparc
 1.29  25-Aug-1998  ross Add { and } to shut up egcs. Reformat the more questionable code.
 1.28  12-Jul-1998  mrg - KNF
- use err(3)
- sprintf/strcpy -> snprintf/strncpy
- change route.c:domask() to take a size_t of the buffer passed.
 1.27  14-May-1998  kml Partial fix for PR kern/5435 -- changed netstat to use unsigned counters
instead of signed. The rest of the fix will have to wait for 64-bit counters.
 1.26  19-Mar-1998  kml Add support for a '-b' option to provide byte counts in and out,
instead of just packet counts. On the byte screens, errors and
collisions are not shown, since they are more packet count related.
 1.25  19-Oct-1997  lukem branches: 1.25.2;
fix up .Nm usage, getopt returns -1 not EOF
 1.24  22-May-1997  christos branches: 1.24.2;
PR/3660: Dave Huang: Fix formatting misalignments in appletalk
PR/3659: Dave Huang: Fix PCB reporting in appletalk
 1.23  07-Apr-1997  mikel more column alignment fixes
 1.22  07-Apr-1997  christos PR/3451: Anders Hjalmarsson: Column alignment fixes after the netatalk addition.
 1.21  03-Apr-1997  christos - netatalk additions
- printf format fixes
- minor prototype cleanups
 1.20  26-Mar-1997  thorpej Print Ethernet and FDDI addresses in the same format as ether_ntoa().
From Matt Thomas <matt@3am-software.com>
 1.19  07-Jun-1996  thorpej Fix missing `)' in the sideways view of interfaces (i.e. netstat -w 1).
Bug pointed out by Chris G. Demetriou.
 1.18  04-Jun-1996  cgd bump MAXIF (the maximum number of interfaces for which information is kept,
for 'netstat -w <delay>') to 100, from 10. 10 was definitely not sufficient
for many hosts; 100 should be for most if not all. This code really should
dynamically allocate the information structures, based on the number of
interfaces in the kernel, account for interfaces that are added or removed,
etc., but given its current structure that would require substantial changes.
 1.17  04-Jun-1996  cgd if doing 'netstat -I <intf> -w <delay>', and netstat can't find an
interface of the given name, print an error message and exit.
This whole section of code needs to be re-thought, if interfaces
can be dynamically added or removed.
 1.16  07-May-1996  thorpej branches: 1.16.4;
Kill a couple of unnecessary calls to strlen().
 1.15  07-May-1996  thorpej Update for the changes to struct ifnet. While I'm here, fix a couple
of long-standing bugs:

- Actually deal with the fact that the kernel ifnet list is
a TAILQ; it just happened to work before.

- Use kvm_openfiles() instead of kvm_open(). The code passed
arguments to kvm_open() as if it were kvm_openfiles(), but
apparently went unnoticed since the prototypes are the same.
Amusing bit: there were XXX's in the code which seemed to
apologize for a verbose libkvm, when it happened to be a
bug in netstat!
 1.14  17-Oct-1995  jtc Implement change done in revision 1.12 (for PR #1473 & duplicates) in a
slightly different way. This widens the Address field instead of the
Ipkts field because Address is the one that may be too big.
 1.13  03-Oct-1995  thorpej New-style RCS ids.
 1.12  28-Sep-1995  jtc Change formatting so that columns line up; PR #1473 + several duplicates
 1.11  03-Jul-1995  mycroft Remove an extra htonl().
 1.10  12-Jun-1995  mycroft Update to match kernel changes.
 1.9  17-Sep-1994  mycroft Align link address under `Address' header.
 1.8  13-May-1994  mycroft Clean up import.
 1.7  01-Apr-1994  cgd kill lots of off_t's.
 1.6  28-Mar-1994  cgd clean up, for off_t... ugliest 'cleaning' possible, i think...
 1.5  03-Mar-1994  deraadt netname() takes a struct in_addr, not an int. Breaks on sparc.
fix from Chuck Cranor <chuck@maria.wustl.edu>
 1.4  22-Feb-1994  cgd fix to print netstat unit number right; from Greenman
 1.3  01-Aug-1993  mycroft Add RCS identifiers.
 1.2  11-Jul-1993  paul Included Havard Eidnes' latest changes.
 1.1  21-Mar-1993  cgd branches: 1.1.1;
after 0.2.2 "stable" patches applied
 1.1.1.2  02-Jan-1997  mellon imported from 44lite2
 1.1.1.1  06-Oct-1994  mycroft Import original 4.4-Lite version.
 1.16.4.2  07-Jun-1996  thorpej Update from trunk:

Fix missing `)' in the sideways view of interfaces (i.e. netstat -w 1).
Bug pointed out by Chris G. Demetriou.
 1.16.4.1  04-Jun-1996  cgd pull up changes from the trunk:
>if doing 'netstat -I <intf> -w <delay>', and netstat can't find an
>interface of the given name, print an error message and exit.
>This whole section of code needs to be re-thought, if interfaces
>can be dynamically added or removed.
and:
>bump MAXIF (the maximum number of interfaces for which information is kept,
>for 'netstat -w <delay>') to 100, from 10. 10 was definitely not sufficient
>for many hosts; 100 should be for most if not all. This code really should
>dynamically allocate the information structures, based on the number of
>interfaces in the kernel, account for interfaces that are added or removed,
>etc., but given its current structure that would require substantial changes.
 1.24.2.2  22-May-1997  christos PR/3660: Dave Huang: Fix formatting misalignments in appletalk
PR/3659: Dave Huang: Fix PCB reporting in appletalk
 1.24.2.1  22-May-1997  christos file if.c was added on branch SYN_cache_branch on 1997-05-22 17:21:28 +0000
 1.25.2.1  19-Jan-1999  cgd pull up rev 1.30 from trunk (mrg)
 1.31.2.1  19-Oct-2000  he Pull up revision 1.45 (requested by he):
Format string cleanup.
 1.32.4.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.40.4.2  18-Oct-2000  tv Pullup usr.bin string format fixes [is].
See "cvs log" for explicit revision numbers per file, from sommerfeld.
 1.40.4.1  03-Jul-2000  thorpej Pull up rev. 1.41:
with -inv flag, do not truncate name of the interface (like "strip0").
 1.59.2.1  19-Jun-2006  chap Sync with head.
 1.61.16.1  18-May-2008  yamt sync with head.
 1.62.8.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.70.2.1  08-Feb-2011  bouyer Sync with HEAD
 1.72.2.3  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.72.2.2  30-Oct-2012  yamt sync with head
 1.72.2.1  17-Apr-2012  yamt sync with head
 1.73.2.1  24-Oct-2012  riz Pull up following revision(s) (requested by msaitoh in ticket #632):
usr.bin/netstat/if.c: revision 1.75
Line up total numbers again (for -b case and -X case).
 1.74.2.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.74.2.2  23-Jun-2013  tls resync from head
 1.74.2.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.79.4.2  08-Jan-2015  martin Pull up following revision(s) (requested by prlw1 in ticket #395):
sbin/route/rtutil.c: revision 1.4
sbin/route/rtutil.h: revision 1.3
usr.bin/netstat/if.c: revision 1.81
make netname4 match the netname6 signature avoiding a NULL pointer.
adjust to the netname4 prototype.
 1.79.4.1  08-Jan-2015  martin Pull up following revision(s) (requested by prlw1 in ticket #390):
usr.bin/netstat/mroute.c: revision 1.25
usr.bin/netstat/Makefile: revision 1.40
sbin/route/prog_ops.h: revision 1.3
sbin/route/rtutil.c: revision 1.1
sbin/route/rtutil.h: revision 1.1
usr.bin/netstat/mroute6.c: revision 1.15
sbin/route/extern.h: revision 1.15
usr.bin/netstat/show.c: file removal
usr.bin/netstat/main.c: revision 1.93
usr.bin/netstat/route.c: revision 1.83
usr.bin/netstat/netstat.h: revision 1.51
distrib/utils/x_route/Makefile: revision 1.18
sbin/route/show.c: revision 1.46
usr.bin/netstat/if.c: revision 1.80
sbin/route/route.c: revision 1.145
sbin/route/Makefile: revision 1.26
Factor out the netstat route printing code and use it here. There is no
point in having 2 different copies; fixes PR/49371
 1.89.2.2  20-Mar-2017  pgoyette Sync with HEAD
 1.89.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.91.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.94.12.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.94.12.1  10-Jun-2019  christos Sync with HEAD
 1.94.10.1  28-Jul-2018  pgoyette Sync with HEAD
 1.94.4.2  12-Sep-2022  martin Pull up the following, requested by msaitoh in ticket #1762:

usr.bin/netstat/atalk.c 1.18,1.20-1.21
usr.bin/netstat/bpf.c 1.16 via patch
usr.bin/netstat/fast_ipsec.c 1.24 via patch
usr.bin/netstat/if.c 1.97-1.99,1.101-1.104 via patch
usr.bin/netstat/inet.c 1.111,1.115-1.116 via patch
usr.bin/netstat/inet6.c 1.70,1.74-1.75,1.80-1.81 via patch
usr.bin/netstat/main.c 1.100,1.102-1.103
usr.bin/netstat/mbuf.c 1.34-1.35
usr.bin/netstat/mroute.c 1.26-1.27
usr.bin/netstat/mroute6.c 1.16
usr.bin/netstat/netstat.h 1.52-1.53
usr.bin/netstat/pfkey.c 1.4-1.5 via patch
usr.bin/netstat/pfsync.c 1.4-1.5 via patch
usr.bin/netstat/route.c 1.87-1.88
usr.bin/netstat/unix.c 1.36-1.37
usr.bin/netstat/vtw.c 1.11,1.13

- Add names of a few more ICMPv6 messages.
Also make the array be explicitly 256 entries long.
- sprintf() -> snprintf(), and adjust a buffer size to avoid any
potential for overflow.
- Add missing {IP,IP6}_STAT_NOIPSEC to netstat.
- Don't show any of the completely and utterly undocumented VTW info
if the feature isn't enabled.
- Print oqdrops correctly.
- netstat.1: Add various xrefs present in the body to "See Also".
- Limit maximum owner name to appease gcc.
- KNF. Style fixes.
 1.94.4.1  26-Jul-2018  snj Pull up following revision(s) (requested by msaitoh in ticket #939):
usr.bin/netstat/if.c: revision 1.95
Print iqdrops, too. This change also fixes a bug that Odrops prints
iqdrops when kvm read failed.
 1.95.2.1  12-Sep-2022  martin Pull up the following, requested by msaitoh in ticket #1522:

usr.bin/netstat/atalk.c 1.18,1.20-1.21
usr.bin/netstat/bpf.c 1.16 via patch
usr.bin/netstat/fast_ipsec.c 1.24
usr.bin/netstat/if.c 1.97-1.99,1.101-1.104 via patch
usr.bin/netstat/inet.c 1.111,1.115-1.116 via patch
usr.bin/netstat/inet6.c 1.74-1.75,1.80-1.81 via patch
usr.bin/netstat/main.c 1.100-1.103
usr.bin/netstat/mbuf.c 1.35
usr.bin/netstat/mroute.c 1.26-1.27
usr.bin/netstat/mroute6.c 1.16
usr.bin/netstat/netstat.h 1.52-1.53
usr.bin/netstat/pfkey.c 1.4-1.5 via patch
usr.bin/netstat/pfsync.c 1.4-1.5 via patch
usr.bin/netstat/route.c 1.86-1.88
usr.bin/netstat/unix.c 1.36-1.37
usr.bin/netstat/vtw.c 1.11,1.13

- sprintf() -> snprintf(), and adjust a buffer size to avoid any
potential for overflow.
- Fix netstat -rs to print it correctly.
- Add missing {IP,IP6}_STAT_NOIPSEC to netstat.
- Don't show any of the completely and utterly undocumented VTW info
if the feature isn't enabled.
- Print oqdrops correctly.
- Remove Network ATM soft intr queue reporting, we don't have that
in the kernel anymore.
- netstat.1: Add various xrefs present in the body to "See Also".
- KNF. Style fixes.
 1.108.2.1  12-Jan-2023  martin Pull up following revision(s) (requested by mrg in ticket #42):

usr.bin/netstat/if.c: revision 1.109

if not given an interface to monitor by default, pick the one
with the most bytes in/out the first time and keep using it.

in addition to picking the most likely intersting interface,
this actually fixes a bug where interfaces coming/going in
the middle of eg, "netstat -b -w 1", may end up showing the
data for another interface on any output line (including the
the header declaring the interface!)

RSS XML Feed