Pickup locks for the BPF interface structure. It's quite possible that

bpf(4) descriptors can be added and removed on this interface while we
are processing stats.

MFC after:	2 weeks
This commit is contained in:
Christian S.J. Peron 2006-05-07 03:21:43 +00:00
parent 3baa00b342
commit 1fc9e38706
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=158345

View file

@ -1813,12 +1813,14 @@ bpf_stats_sysctl(SYSCTL_HANDLER_ARGS)
}
index = 0;
LIST_FOREACH(bp, &bpf_iflist, bif_next) {
BPFIF_LOCK(bp);
LIST_FOREACH(bd, &bp->bif_dlist, bd_next) {
xbd = &xbdbuf[index++];
BPFD_LOCK(bd);
bpfstats_fill_xbpf(xbd, bd);
BPFD_UNLOCK(bd);
}
BPFIF_UNLOCK(bp);
}
mtx_unlock(&bpf_mtx);
error = SYSCTL_OUT(req, xbdbuf, index * sizeof(*xbd));