Kristof Provost
2021-03-29 14:55:29 UTC
"Kristof
Provost
many
examples of userland and kernel not being in sync over the years. For
ipfilter, I've made incompatible changes to data structures requiring
userand and kernel be in sync. These are few and far between.
I've gotten away with this because there is no third party software
that
relies on the ipfilter kernel interfaces. I could be wrong but I doubt
there may be third party software requiring pf ABI compatibility. But
if
there is then verstioned library interfaces are required.
Given that the advice is to keep kernel and userland in sync there
probably
is no requirement for an UPDATING entry but that would be your call.
There are out-of-tree users of the pf ioctl interface.Provost
Hi,
There are several patches in the pipeline that require changes in
pfâs
interface between kernel and userspace.
In the past these have been handled in multiple ways. Either by
simply
making the change, breaking binary compatibility, or by introducing a
v2
ioctl (e.g. DIOCADDALTQV1).
While one is better than the other neither is wholly satisfying. New
versions of calls constitute a maintenance burden after all.
Iâd like to change the ioctl interface to use nvlists, which
would
make such extensions much easier, because fields can be optional.
That is, if userspace doesnât supply the
âshinynewfeatureâ field
the kernel can assume the default value and things just work.
Similarly,
if the kernel supplies a âshinynewfeatureâ which userspace
doesnât
know about itâs simply ignored.
The rough plan is to introduce nvlist versions of the get/add rules
calls for now. Others will follow as the need presents itself.
As these are new ioctls it is safe to MFC them to stable/12 and
stable/13.
The old interface will remain supported in those branches, but
Iâd
like to remove it from main (and thus FreeBSD 14).
As part of this effort I may end up splitting off the ioctl interface
code from pfctl into libpfctl, which should make reuse of that code
easier.
I hope to post preliminary patches in the coming week.
Thoughts? Objections?
Kernel and userland should be, I'd say must be, kept in sync. We haveThere are several patches in the pipeline that require changes in
pfâs
interface between kernel and userspace.
In the past these have been handled in multiple ways. Either by
simply
making the change, breaking binary compatibility, or by introducing a
v2
ioctl (e.g. DIOCADDALTQV1).
While one is better than the other neither is wholly satisfying. New
versions of calls constitute a maintenance burden after all.
Iâd like to change the ioctl interface to use nvlists, which
would
make such extensions much easier, because fields can be optional.
That is, if userspace doesnât supply the
âshinynewfeatureâ field
the kernel can assume the default value and things just work.
Similarly,
if the kernel supplies a âshinynewfeatureâ which userspace
doesnât
know about itâs simply ignored.
The rough plan is to introduce nvlist versions of the get/add rules
calls for now. Others will follow as the need presents itself.
As these are new ioctls it is safe to MFC them to stable/12 and
stable/13.
The old interface will remain supported in those branches, but
Iâd
like to remove it from main (and thus FreeBSD 14).
As part of this effort I may end up splitting off the ioctl interface
code from pfctl into libpfctl, which should make reuse of that code
easier.
I hope to post preliminary patches in the coming week.
Thoughts? Objections?
many
examples of userland and kernel not being in sync over the years. For
ipfilter, I've made incompatible changes to data structures requiring
userand and kernel be in sync. These are few and far between.
I've gotten away with this because there is no third party software
that
relies on the ipfilter kernel interfaces. I could be wrong but I doubt
there may be third party software requiring pf ABI compatibility. But
if
there is then verstioned library interfaces are required.
Given that the advice is to keep kernel and userland in sync there
probably
is no requirement for an UPDATING entry but that would be your call.
security/expiretable[1] for example.
security/snort2pfcd appears to as well.
sysutils/pfstat and sysutils/pftop use the ioctl interface as well,
although not the three specific calls of immediate interest.
I’m trying to work out how many examples there are, because one way or
the other they’re going to have to cope with changes.
So, I’d prefer to not just change the definitions of structs, even if
we’ve done that in the past. struct pf_rule contains a few
peculiarities from historical mistakes that I hope to correct now.
Best regards,
Kristof
[1] Perhaps not the greatest example, because its use of struct pf_state
was incorrect, so it couldn’t actually have worked correctly before it
stopped building. See PR #253547 for details.