summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authoryamt <yamt@NetBSD.org>2022-11-19 08:53:06 +0000
committeryamt <yamt@NetBSD.org>2022-11-19 08:53:06 +0000
commita581198fe330c3832c762c66aa8240bf5315efa5 (patch)
tree5e40a53e69632050d30bedbc413207cac2e21255 /sys/net
parentf8cb308b9e9338977143ba0158d7b10d180809a4 (diff)
bpf: refresh bd_pid in a few more places as well
This made "netstat -B" show hostapd and wpa_supplicant for me. kingcrab# netstat -B Active BPF peers PID Int Recv Drop Capt Flags Bufsize Comm 433 urtwn0 102 0 2 I-RSH 524288 hostapd 211 urtwn0 102 0 4 I-RS- 32768 dhcpd 670 bwfm0 295 0 2 I-RSH 524288 wpa_supplicant kingcrab#
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/bpf.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index 1c129d65458..53331442b08 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bpf.c,v 1.247 2022/09/03 10:03:20 riastradh Exp $ */
+/* $NetBSD: bpf.c,v 1.248 2022/11/19 08:53:06 yamt Exp $ */
/*
* Copyright (c) 1990, 1991, 1993
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.247 2022/09/03 10:03:20 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.248 2022/11/19 08:53:06 yamt Exp $");
#if defined(_KERNEL_OPT)
#include "opt_bpf.h"
@@ -682,6 +682,11 @@ bpf_read(struct file *fp, off_t *offp, struct uio *uio,
int timed_out;
int error;
+ /*
+ * Refresh the PID associated with this bpf file.
+ */
+ d->bd_pid = curproc->p_pid;
+
getnanotime(&d->bd_atime);
/*
* Restrict application to use a buffer the same size as
@@ -817,6 +822,11 @@ bpf_write(struct file *fp, off_t *offp, struct uio *uio,
struct psref psref;
int bound;
+ /*
+ * Refresh the PID associated with this bpf file.
+ */
+ d->bd_pid = curproc->p_pid;
+
m = NULL; /* XXX gcc */
bound = curlwp_bind();
@@ -1569,6 +1579,11 @@ filt_bpfread(struct knote *kn, long hint)
struct bpf_d *d = kn->kn_hook;
int rv;
+ /*
+ * Refresh the PID associated with this bpf file.
+ */
+ d->bd_pid = curproc->p_pid;
+
mutex_enter(d->bd_buf_mtx);
kn->kn_data = d->bd_hlen;
if (d->bd_immediate)