]> git.proxmox.com Git - pve-container.git/commit
net: Add `link_down` config to allow setting interfaces as disconnected
authorChristoph Heiss <c.heiss@proxmox.com>
Wed, 22 Feb 2023 12:49:02 +0000 (13:49 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 16 Mar 2023 11:48:49 +0000 (12:48 +0100)
commit9e5694881f54472a2093ee93e94a3cfd96904fa1
treeee0814884bdd6cfa0e55f04b94ddd3f70997a0a0
parent83ec30adfb9a1e3725f98bb48cbfd9e6a71484e6
net: Add `link_down` config to allow setting interfaces as disconnected

If this network option is set, the host-side link will be forced down
and the interface won't be connected to the bridge.

Add a `Disconnect` option for network interfaces on LXC containers, much
like it already exists for VMs. This has been requested in #3413 [0] and
seems useful, especially considering we already support the same thing
for VMs.

[0] https://bugzilla.proxmox.com/show_bug.cgi?id=3413

One thing to note is that LXC does not seem to support the notion of
setting an interface down. The `flags` property would suggest that this
possible [1], but AFAICS it does not work. I tried setting the value as
empty and to something else than "up" (since that is really the only
supported option [2][3]), which both had absolutely no effect.

[1] https://linuxcontainers.org/lxc/manpages/man5/lxc.container.conf.5.html#lbAO
[2] https://github.com/lxc/lxc/blob/08f0e769/src/lxc/confile.c#L453-L467
[3] https://github.com/lxc/lxc/blob/08f0e769/src/lxc/confile.c#L5933-L5952

Thus force the host-side link of the container network down and avoid
adding it to the designated bridge if the new option is set, effectively
disconnecting the container network.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Tested-by:  Friedrich Weber <f.weber@proxmox.com>
 [ T: paste cover letter as commit message ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/LXC.pm
src/PVE/LXC/Config.pm