[systemd-devel] MACVLAN= in .nspawn file vs command line results in /sys/class/net showing host interfaces

Steve Dodd steved424 at gmail.com
Mon Aug 19 13:38:14 UTC 2019


I'm running Ubuntu bionic, with systemd 237, so I haven't filed a bug
report, but I'm wondering if it rings any bells with anyone.. I've tried
searching github issues, but my keywords either get too few or too many
results to be useful.

I have machine with the following nspawn file:

--
[Network]
MACVLAN=laneth0

[Exec]
PrivateUsers=false
--

if I start it with systemctl start systemd-nspawn at name, all works as
expected.

If I start manually with systemd-nspawn -M name -b, I seem to correctly get
a new network namespace (ip link output in container is correct), but ls
/sys/class/net shows the host's interfaces.

The difference turns out to be that starting with systemctl uses a default
command line which includes --private-network; the MACVLAN= in the config
file should imply this, but instead it seems I'm getting "half" a private
network, with the namespace correctly set but /sys not.

Having a quick poke around, I suspect

https://github.com/systemd/systemd/commit/60f1ec13ed059e412c2a2ee4cc3093e2d520673c

may have 'accidentally' fixed this - it moves

       if (arg_private_network)
                arg_mount_settings |= MOUNT_APPLY_APIVFS_NETNS;

from parse_argv to verify_arguments which is called later - does that sound
like a correct interpretation? This bug causes netplan to fail on Ubuntu as
it rummages around in /sys/class/net ..

S.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20190819/1a0304ce/attachment.html>


More information about the systemd-devel mailing list