Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net bpf: refresh bd_pid in a few more places as well



details:   https://anonhg.NetBSD.org/src/rev/79d4b0f0a219
branches:  trunk
changeset: 372371:79d4b0f0a219
user:      yamt <yamt%NetBSD.org@localhost>
date:      Sat Nov 19 08:53:06 2022 +0000

description:
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:

 sys/net/bpf.c |  19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diffs (54 lines):

diff -r c5a0dfff6d2e -r 79d4b0f0a219 sys/net/bpf.c
--- a/sys/net/bpf.c     Sat Nov 19 08:00:51 2022 +0000
+++ b/sys/net/bpf.c     Sat Nov 19 08:53:06 2022 +0000
@@ -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 @@
        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 @@
        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 @@
        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)



Home | Main Index | Thread Index | Old Index