Make sure that we refresh the PID on read(2) and write(2) operations.
This fixes the process portion of the bpf(4) stats if the peer forks into the background after it's opened the descriptor. This bug results in the following behavior for netstat -B: # netstat -B Pid Netif Flags Recv Drop Match Sblen Hblen Command netstat: kern.proc.pid failed: No such process 78023 em0 p--s-- 2237404 43119 2237404 13986 0 ?????? MFC after: 1 week
This commit is contained in:
parent
dd1d7df604
commit
e5337493b3
@ -488,6 +488,7 @@ bpfread(struct cdev *dev, struct uio *uio, int ioflag)
|
||||
return (EINVAL);
|
||||
|
||||
BPFD_LOCK(d);
|
||||
d->bd_pid = curthread->td_proc->p_pid;
|
||||
if (d->bd_state == BPF_WAITING)
|
||||
callout_stop(&d->bd_callout);
|
||||
timed_out = (d->bd_state == BPF_TIMED_OUT);
|
||||
@ -616,6 +617,7 @@ bpfwrite(struct cdev *dev, struct uio *uio, int ioflag)
|
||||
struct sockaddr dst;
|
||||
int error, hlen;
|
||||
|
||||
d->bd_pid = curthread->td_proc->p_pid;
|
||||
if (d->bd_bif == NULL)
|
||||
return (ENXIO);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user