Page MenuHomeFreeBSD

pfctl: Stop sharing pf_ruleset.c with the kernel
ClosedPublic

Authored by kp on Dec 24 2020, 3:49 PM.

Details

Summary

Now that we've split up the datastructures used by the kernel and
userspace there's essentually no more overlap between the pf_ruleset.c
code used by userspace and kernelspace.

Copy the userspace bits to the pfctl directory and stop using the kernel
file.

MFC after: 2 weeks
Sponsored by: Orange Business Services

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

kp requested review of this revision.Dec 24 2020, 3:49 PM

If there are no objections to this series (D27707, D27756 - D27764) I'm going to push this tomorrow.

Given, that the old file was included by user space programms, I'd suggest to include some lines like

#ifndef KERNEL
# error "Kernel only file! Please include ...."
#endif
This revision is now accepted and ready to land.Dec 30 2020, 11:15 AM

Fail build if the kernel file is used in userspace.

This revision now requires review to proceed.Dec 30 2020, 2:46 PM

Still looks good to me.

This patch series is likely to be very upsetting to pftop. Though I think it was already broken. Maybe the #error will nudge someone to fix it?

This revision is now accepted and ready to land.Dec 31 2020, 12:16 AM

Still looks good to me.

This patch series is likely to be very upsetting to pftop. Though I think it was already broken. Maybe the #error will nudge someone to fix it?

It appears to still just build and work, at least with some basic testing.
This patch is the most visible to userspace, because userspace is now expected to no longer use kernel files (ick, ick, ew). The ioctl interface for pf is entirely unchanged, at least as far as userspace can tell.
A few definitions moved around in the header files, but pfvar.h includes pf.h, so that doesn't really matter either.