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
F83032514: D31967.diff
Sun, May 5, 7:05 AM
Unknown Object (File)
Fri, Apr 26, 3:58 PM
Unknown Object (File)
Fri, Apr 26, 3:07 PM
Unknown Object (File)
Fri, Apr 26, 4:54 AM
Unknown Object (File)
Wed, Apr 24, 8:33 PM
Unknown Object (File)
Sat, Apr 20, 6:00 AM
Unknown Object (File)
Fri, Apr 19, 4:28 AM
Unknown Object (File)
Wed, Apr 17, 12:22 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
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

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

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