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)
Thu, Jan 15, 11:36 AM
Unknown Object (File)
Fri, Jan 9, 12:01 PM
Unknown Object (File)
Thu, Jan 8, 2:49 AM
Unknown Object (File)
Wed, Jan 7, 6:26 AM
Unknown Object (File)
Wed, Jan 7, 6:00 AM
Unknown Object (File)
Dec 25 2025, 1:57 AM
Unknown Object (File)
Dec 24 2025, 1:11 AM
Unknown Object (File)
Dec 23 2025, 11:53 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.