CVSROOT:        /cvs
Module name:    src
Changes by:     d...@cvs.openbsd.org    2023/11/09 11:36:19

Modified files:
        sbin/pflogd    : pflogd.c 

Log message:
avoid restartable syscalls with siginterrupt() against all our handlers.

pflogd uses blocking bpf reads, but installs a bunch of signal
handlers to handle cleanly closing and (re)opening the log file.
signal() by default sets the handlers up so they're restartable.
this has the effect that when pflogd receives a signal while waiting
in bpfread, the signal handler runs and sets a flag saying the file
should be rotated or closed or whatever, but then the kernel restarts
the read.

when pflogd used a bpf read timeout, pflogd would run it's "event"
loop every time the read timeout expired. this meant even though
the bpf read was restarted, by having the read timeout expire every
500ms the flag the signal handlers set would be processed in a
relatively short period of time.

after moving bpf to a wait timeout, pflogd basically has to wait
for a packet to be captured before the bpf read will return. if
you're trying to kill pflogd on an idle firewall then you're basically
stuck.

making the signal handlers not restartable allows bpfread to fail
with EINTR so pflogd can go around it's even loop and exit as
expected.

reported by Mikhail on bugs@
ok claudio@

pflogd needs a rewrite though.

Reply via email to