On Mon, 8 Jun 2026 at 09:37, Kristof Provost <[email protected]> wrote:
> On 8 Jun 2026, at 10:00, Doug Rabson wrote: > > In my smallest test-case, the host and jail use the same root filesystem > > and the host is running 15.0-RELEASE-p8. I haven't tested with stable/15 > > yet. This reproduces the problem for me: > > > > $ sudo pfctl -s nat > > nat on bridge42 inet from <cni-nat> to any -> (bridge42) round-robin > > nat on bridge42 inet6 from <cni-nat> to ! ff00::/8 -> (bridge42) > round-robin > > nat-anchor "cni-rdr/*" all > > rdr-anchor "cni-rdr/*" all > > $ cat jail-pfctl-15 > > #! /bin/sh > > j=$(jail -ic name=pfctl-in-jail15 ip4=inherit ip6=inherit path=/ persist) > > jexec $j pfctl -s nat > > jail -r $j > > $ sudo ./jail-pfctl-15 > > pfctl: DIOCGETRULES: Operation not permitted > > $ freebsd-version -k > > 15.0-RELEASE-p8 > > > > > > Do the pf unit tests cover the case where the jail shares the host vnet? > > > Oh. No, no they do not. That’s just plain not supposed to work. > Historically, though, it has always worked, at least as far back as FreeBSD-13 so this is a regression. > You only ever get to manage your own pf instance, never the one of a > parent jail. > It seems reasonable (to me at least) that if a jail inherits a vnet from its parent, it should be able to manage that vnet. I see some evidence in the history that at least parts of netlink are intended to work for jails which don't have their own vnet (e.g. https://cgit.freebsd.org/src/commit/sys/netlink?id=04f75b980293d517558990a7fda6900445edcac6). I would also like to be able to create interfaces in non-vnet jails but that is another conversation entirely. For what it's worth, this pattern of delegating network management to a privileged container is common on Linux. For instance, the Linux version of kube-proxy as well as the popular Calico cluster networking stack, uses this pattern to manage interfaces and iptable rule sets. Doug.
