The NetBSD Project

CVS log for src/usr.bin/netstat/bpf.c

[BACK] Up to [cvs.NetBSD.org] / src / usr.bin / netstat

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.18 / (download) - annotate - [select for diffs], Fri Aug 18 13:18:17 2023 UTC (6 months, 1 week ago) by martin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.17: +3 -3 lines
Diff to previous 1.17 (colored)

Rename local bpf_* functions to nsbpf_* to avoid conflicts with
new libpcap bpf_* functions

Revision 1.17 / (download) - annotate - [select for diffs], Sat Nov 19 08:56:20 2022 UTC (15 months, 1 week ago) by yamt
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10
Changes since 1.16: +7 -2 lines
Diff to previous 1.16 (colored)

netstat/bpf.c: Don't print garbage for stale pid

Revision 1.11.22.1 / (download) - annotate - [select for diffs], Mon Sep 12 14:29:19 2022 UTC (17 months, 2 weeks ago) by martin
Branch: netbsd-8
Changes since 1.11: +19 -20 lines
Diff to previous 1.11 (colored) next main 1.12 (colored)

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.

Revision 1.13.4.2 / (download) - annotate - [select for diffs], Mon Sep 12 14:23:41 2022 UTC (17 months, 2 weeks ago) by martin
Branch: netbsd-9
Changes since 1.13.4.1: +24 -23 lines
Diff to previous 1.13.4.1 (colored) to branchpoint 1.13 (colored) next main 1.14 (colored)

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.

Revision 1.16 / (download) - annotate - [select for diffs], Thu Sep 1 10:10:20 2022 UTC (17 months, 3 weeks ago) by msaitoh
Branch: MAIN
Changes since 1.15: +24 -24 lines
Diff to previous 1.15 (colored)

KNF. No functional change.

Revision 1.15 / (download) - annotate - [select for diffs], Fri Aug 28 07:23:48 2020 UTC (3 years, 5 months ago) by ozaki-r
Branch: MAIN
CVS Tags: cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Changes since 1.14: +3 -2 lines
Diff to previous 1.14 (colored)

netstat: strengthen against kernel changes

netstat uses sysctlbyname to get counter data from the kernel.
sysctlbyname fails with ENOMEM if actual counter data in the kernel is
larger than a passed buffer.  netstat just skips showing counters of a
category if sysctlbyname fails, so if we added new counters of the
category to the kernel, nestat shows nothing for the category.

Fortunately sysctlbyname fills data as much as possible even if a passed
buffer is short.  So we can allow netstat to show the filled data anyway
if sysctlbyname fails with ENOMEM.

Note that this backcompat mechanism works only if new counters are
appended, and doesn't work if new counters are inserted into the middle
or counters are moved.

Revision 1.13.2.1 / (download) - annotate - [select for diffs], Mon Apr 13 08:05:45 2020 UTC (3 years, 10 months ago) by martin
Branch: phil-wifi
Changes since 1.13: +3 -3 lines
Diff to previous 1.13 (colored) next main 1.14 (colored)

Mostly merge changes from HEAD upto 20200411

Revision 1.13.4.1 / (download) - annotate - [select for diffs], Mon Aug 19 15:56:49 2019 UTC (4 years, 6 months ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1
Changes since 1.13: +3 -3 lines
Diff to previous 1.13 (colored)

Pull up following revision(s) (requested by kamil in ticket #94):

	usr.bin/netstat/netstat_rumpops.c: revision 1.2
	usr.bin/netstat/netstat_hostops.c: revision 1.2
	usr.bin/netstat/inet6.c: revision 1.73
	usr.bin/netstat/bpf.c: revision 1.14
	usr.bin/netstat/Makefile: revision 1.46
	usr.bin/netstat/prog_ops.h: revision 1.3
	usr.bin/netstat/pfsync.c: revision 1.2
	usr.bin/netstat/pfkey.c: revision 1.2
	usr.bin/netstat/fast_ipsec.c: revision 1.23
	usr.bin/netstat/atalk.c: revision 1.17
	usr.bin/netstat/inet.c: revision 1.110

netstat: Add indirection of symbols to remove clash with sanitizers

Add indirection and symbol renaming under MKSANITIZER for the linked in
version of sysctlbyname, sysctlgetmibinfo and sysctlnametomib.

Revision 1.14 / (download) - annotate - [select for diffs], Sun Aug 18 04:14:40 2019 UTC (4 years, 6 months ago) by kamil
Branch: MAIN
CVS Tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, is-mlppp-base, is-mlppp
Changes since 1.13: +3 -3 lines
Diff to previous 1.13 (colored)

netstat: Add indirection of symbols to remove clash with sanitizers

Add indirection and symbol renaming under MKSANITIZER for the linked in
version of sysctlbyname, sysctlgetmibinfo and sysctlnametomib.

Revision 1.11.28.1 / (download) - annotate - [select for diffs], Sat Jul 28 04:38:14 2018 UTC (5 years, 7 months ago) by pgoyette
Branch: pgoyette-compat
CVS Tags: pgoyette-compat-merge-20190127
Changes since 1.11: +3 -2 lines
Diff to previous 1.11 (colored) next main 1.12 (colored)

Sync with HEAD

Revision 1.13 / (download) - annotate - [select for diffs], Tue Jun 26 09:50:42 2018 UTC (5 years, 8 months ago) by msaitoh
Branch: MAIN
CVS Tags: phil-wifi-base, phil-wifi-20190609, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, netbsd-9-base
Branch point for: phil-wifi, netbsd-9
Changes since 1.12: +2 -2 lines
Diff to previous 1.12 (colored)

 Fix a bug that BPF_D_OUT isn't printed correctly.

Revision 1.12 / (download) - annotate - [select for diffs], Tue Jun 26 06:48:03 2018 UTC (5 years, 8 months ago) by msaitoh
Branch: MAIN
Changes since 1.11: +3 -2 lines
Diff to previous 1.11 (colored)

 Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

 This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.

Revision 1.10.12.1 / (download) - annotate - [select for diffs], Mon Feb 25 00:30:37 2013 UTC (11 years ago) by tls
Branch: tls-maxphys
Changes since 1.10: +2 -1 lines
Diff to previous 1.10 (colored) next main 1.11 (colored)

resync with head

Revision 1.10.6.1 / (download) - annotate - [select for diffs], Wed Jan 23 00:06:39 2013 UTC (11 years, 1 month ago) by yamt
Branch: yamt-pagecache
CVS Tags: yamt-pagecache-tag8
Changes since 1.10: +2 -1 lines
Diff to previous 1.10 (colored) next main 1.11 (colored)

sync with head

Revision 1.8.6.1 / (download) - annotate - [select for diffs], Sun Jan 13 16:36:58 2013 UTC (11 years, 1 month ago) by bouyer
Branch: netbsd-5
Changes since 1.8: +2 -1 lines
Diff to previous 1.8 (colored) next main 1.9 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1833):
	usr.bin/netstat/bpf.c: revision 1.11
Fix memory leak.

Revision 1.10.8.1 / (download) - annotate - [select for diffs], Tue Dec 25 21:07:04 2012 UTC (11 years, 2 months ago) by snj
Branch: netbsd-6
CVS Tags: netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1
Changes since 1.10: +2 -1 lines
Diff to previous 1.10 (colored) next main 1.11 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #763):
	usr.bin/netstat/bpf.c: revision 1.11
Fix memory leak.

Revision 1.11 / (download) - annotate - [select for diffs], Fri Dec 14 08:15:44 2012 UTC (11 years, 2 months ago) by msaitoh
Branch: MAIN
CVS Tags: yamt-pagecache-base9, yamt-pagecache-base8, tls-maxphys-base, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, pgoyette-localcount-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount, pgoyette-compat-base, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, perseant-stdc-iso10646-base, perseant-stdc-iso10646, netbsd-8-base, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-7, matt-nb8-mediatek-base, matt-nb8-mediatek, localcount-20160914, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan, agc-symver-base, agc-symver
Branch point for: pgoyette-compat, netbsd-8
Changes since 1.10: +2 -1 lines
Diff to previous 1.10 (colored)

Fix memory leak.

Revision 1.10 / (download) - annotate - [select for diffs], Mon Dec 13 21:15:30 2010 UTC (13 years, 2 months ago) by pooka
Branch: MAIN
CVS Tags: yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, netbsd-6-base, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, matt-mips64-premerge-20101231, cherry-xenmp-base, cherry-xenmp, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2
Branch point for: yamt-pagecache, tls-maxphys, netbsd-6
Changes since 1.9: +5 -3 lines
Diff to previous 1.9 (colored)

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.

Revision 1.8.8.1 / (download) - annotate - [select for diffs], Wed May 13 19:19:59 2009 UTC (14 years, 9 months ago) by jym
Branch: jym-xensuspend
Changes since 1.8: +6 -6 lines
Diff to previous 1.8 (colored) next main 1.9 (colored)

Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html

Revision 1.9 / (download) - annotate - [select for diffs], Sun Apr 12 16:08:37 2009 UTC (14 years, 10 months ago) by lukem
Branch: MAIN
CVS Tags: matt-premerge-20091211, jym-xensuspend-nbase, jym-xensuspend-base
Changes since 1.8: +6 -6 lines
Diff to previous 1.8 (colored)

Fix many WARNS=4 issues (-Wshadow -Wcast-qual -Wsign-compare).
Fix probable bug with numeric printing of anon ports when using sysctl.

Revision 1.6.16.1 / (download) - annotate - [select for diffs], Sun May 18 12:36:07 2008 UTC (15 years, 9 months ago) by yamt
Branch: yamt-pf42
Changes since 1.6: +2 -10 lines
Diff to previous 1.6 (colored) next main 1.7 (colored)

sync with head.

Revision 1.8 / (download) - annotate - [select for diffs], Mon Apr 28 20:24:14 2008 UTC (15 years, 10 months ago) by martin
Branch: MAIN
CVS Tags: yamt-pf42-base4, yamt-pf42-base3, yamt-pf42-base2, wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, wrstuden-revivesa-base-1, wrstuden-revivesa-base, wrstuden-revivesa, netbsd-5-base, netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-3-RELEASE, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2, netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, netbsd-5-1-5-RELEASE, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE, netbsd-5-1, netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, netbsd-5-0, matt-nb5-pq3-base, matt-nb5-pq3, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-premerge-20091211, matt-nb5-mips64-k15, matt-nb5-mips64, matt-nb4-mips64-k7-u2a-k9b, matt-mips64-base2, hpcarm-cleanup-nbase
Branch point for: netbsd-5, jym-xensuspend
Changes since 1.7: +1 -8 lines
Diff to previous 1.7 (colored)

Remove clause 3 and 4 from TNF licenses

Revision 1.7 / (download) - annotate - [select for diffs], Thu Apr 24 04:09:27 2008 UTC (15 years, 10 months ago) by thorpej
Branch: MAIN
Changes since 1.6: +2 -3 lines
Diff to previous 1.6 (colored)

Note which things are not available by KVM, and print a nice message
stating so if someone specifically asks for it.

Revision 1.6 / (download) - annotate - [select for diffs], Fri Sep 22 23:21:52 2006 UTC (17 years, 5 months ago) by elad
Branch: MAIN
CVS Tags: yamt-pf42-baseX, yamt-pf42-base, wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, wrstuden-fixsa, netbsd-4-base, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, netbsd-4-0, netbsd-4, matt-mips64-base, matt-mips64, matt-armv6-prevmlocking, matt-armv6-nbase, matt-armv6-base, matt-armv6, keiichi-mipv6-nbase, keiichi-mipv6-base, keiichi-mipv6, hpcarm-cleanup-base, hpcarm-cleanup, cube-autoconf-base, cube-autoconf
Branch point for: yamt-pf42
Changes since 1.5: +2 -2 lines
Diff to previous 1.5 (colored)

PR/31347: Geoff C. Wing: netstat err message is ambiguous about cause
Applied patch, thanks!

Revision 1.5 / (download) - annotate - [select for diffs], Mon Nov 21 22:43:34 2005 UTC (18 years, 3 months ago) by rpaulo
Branch: MAIN
CVS Tags: chap-midi-nbase, chap-midi-base, chap-midi, abandoned-netbsd-4-base, abandoned-netbsd-4
Changes since 1.4: +3 -4 lines
Diff to previous 1.4 (colored)

Convert 3 printf() calls into one puts().

Revision 1.4 / (download) - annotate - [select for diffs], Fri Sep 2 22:52:24 2005 UTC (18 years, 5 months ago) by rpaulo
Branch: MAIN
Changes since 1.3: +106 -90 lines
Diff to previous 1.3 (colored)

Place the sysctl code under an if block and print an error message if the
user tries to fetch information via kvm.

Discussed with Elad Efrat.

Revision 1.3 / (download) - annotate - [select for diffs], Fri Sep 2 22:23:13 2005 UTC (18 years, 5 months ago) by rpaulo
Branch: MAIN
Changes since 1.2: +16 -9 lines
Diff to previous 1.2 (colored)

Request process information using sysctl(3) and not kvm(3) since bpf(4)
statistics and peers are only available using the former.

Revision 1.2 / (download) - annotate - [select for diffs], Fri Aug 5 12:16:51 2005 UTC (18 years, 6 months ago) by elad
Branch: MAIN
Changes since 1.1: +5 -5 lines
Diff to previous 1.1 (colored)

Fix printing formats.

Revision 1.1 / (download) - annotate - [select for diffs], Thu Aug 4 19:39:40 2005 UTC (18 years, 6 months ago) by rpaulo
Branch: MAIN

Implemented the userland part of the BPF statistics and BPF peers,
net.bpf.stats and net.bpf.peers sysctls respectively. netstat(1) now
has an additional syntax:
	netstat [-s] [-B] [-I Interface]

Only the super user can see a list of BPF peers with the following command:
# netstat -B
Active BPF peers
PID     Int     Recv     Drop     Capt     Flags  Bufsize  Comm
4941    lo0     0        0        0        I--S-  262144   tcpdump
252     ex0     19668    0        5        I-RS-  32768    dhclient

And every user can see the BPF statistics with:
$ netstat -s -B
bpf:
        19669 total packets received
        5 total packets captured
        0 total packets dropped

This idea came from FreeBSD (Christian S.J. Peron) but, currently, they
doen't have a userland utility in the base system to read the sysctls.

Reviewed by: christos@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>