Page MenuHomeFreeBSD

bpf: convert several boolean natured fields of bpf_d to flags
ClosedPublic

Authored by glebius on Nov 21 2025, 10:56 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, May 17, 3:14 PM
Unknown Object (File)
Sun, May 17, 3:14 PM
Unknown Object (File)
Sun, May 17, 1:47 PM
Unknown Object (File)
Sun, May 17, 12:58 AM
Unknown Object (File)
Sat, May 16, 8:09 PM
Unknown Object (File)
Wed, May 13, 5:15 PM
Unknown Object (File)
Wed, May 13, 5:09 PM
Unknown Object (File)
Wed, May 13, 5:00 PM

Details

Summary

This shrinks the structure a bit. Should be no functional change.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj added inline comments.
sys/net/bpf.c
876

No lock is held here.

1511

Most of the accesses/updates are locked by the bpfd lock, so this update is unlocked.

sys/net/bpf.c
1511

With this revision I don't intend to fix any bugs, just make struct smaller and make it possible to pass flags to bif_write method.

sys/net/bpf.c
1511

Ok, but you're also introducing new bugs. Before, the code was performing unsynchronized stores to different fields. Now they are doing read-modify-writes to the same field, so setting one flag might clobber a different one. That wasn't possible before.

The d_promisc appears to be locked by the global BPF_LOCK(). Thus, remove it
from this changes. This addresses Mark's comments.

This revision was not accepted when it landed; it landed in state Needs Review.Dec 13 2025, 12:44 AM
This revision was automatically updated to reflect the committed changes.