Page MenuHomeFreeBSD

[WIP] bpf(9): Refactor to improve readability.
Needs ReviewPublic

Authored by delphij on Nov 30 2022, 4:13 AM.
This revision needs review, but there are no reviewers specified.



The API was confusing that it uses the length parameter to
distinguish between mbufs and plain memory buffers.

The existing bpf_filter is renamed to _bpf_filter and modified
so that the packet memory is referred to by an opaque pointer,
and callers have to provide a set of operators to extract values
from that opaque pointer.

bpf_filter is converted to a wrapper around _bpf_filter with
a set of operators that work on a plain memory buffer.

A new function, bpf_mfilter is added, which is a wrapper around
_bpf_filter with operators for extracting values from mbufs.

In-tree consumers of bpf_filter(9) are modified to use
bpf_mfilter(9) when appropriate.

Obtained from: OpenBSD

Test Plan

Run regression tests, etc.

Diff Detail

rG FreeBSD src repository
Lint Passed
No Test Coverage
Build Status
Buildable 48563
Build 45449: arc lint + arc unit

Event Timeline

delphij retitled this revision from bpf(9): Refactor to improve readability. to [WIP] bpf(9): Refactor to improve readability..Nov 30 2022, 4:18 AM
delphij edited the test plan for this revision. (Show Details)