Page MenuHomeFreeBSD

Allow the BPF to be select for EVFILT_WRITE with kqueue.
ClosedPublic

Authored by harti on Sep 15 2021, 8:35 AM.
Tags
None
Referenced Files
F160183902: D31967.id96788.diff
Sun, Jun 21, 11:50 PM
F160178308: D31967.diff
Sun, Jun 21, 10:43 PM
F160172117: D31967.id95958.diff
Sun, Jun 21, 9:41 PM
Unknown Object (File)
Sat, Jun 20, 4:59 AM
Unknown Object (File)
Wed, Jun 17, 4:38 PM
Unknown Object (File)
Mon, Jun 15, 2:03 AM
Unknown Object (File)
May 19 2026, 2:26 PM
Unknown Object (File)
May 18 2026, 6:24 PM
Subscribers

Details

Summary

Allow the BPF to be select for EVFILT_WRITE with kqueue. This is required for Boost asio to be able to use a BPF file descriptor even if it is used only for reading. Asio insists on installing a write filter.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 41523
Build 38412: arc lint + arc unit

Event Timeline

harti requested review of this revision.Sep 15 2021, 8:35 AM
sys/net/bpf.c
2200

I'd prefer a bit less code duplication:

struct filterops *ops;

...

switch (kn->kn_filter) {
case EVFILT_READ:
   ops = &bpfread_filtops;
   break;
case EVFILT_WRITE:
   ops = &bpwrite_filtops;
   break;
default:
   return (EINVAL);
}

...

Also it seems you need to modify kqueue(2).

Reduce code duplication.
Update kqueue.2.

This revision is now accepted and ready to land.Oct 1 2021, 8:03 AM