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)
Wed, Feb 18, 3:42 PM
Unknown Object (File)
Fri, Feb 6, 8:31 AM
Unknown Object (File)
Wed, Jan 28, 2:50 AM
Unknown Object (File)
Jan 15 2026, 11:36 AM
Unknown Object (File)
Jan 9 2026, 12:01 PM
Unknown Object (File)
Jan 8 2026, 2:49 AM
Unknown Object (File)
Jan 7 2026, 6:26 AM
Unknown Object (File)
Jan 7 2026, 6:00 AM

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.