[pve-devel] [PATCH container] net: do not force network interface down if `link_down` is to 0
Christoph Heiss
c.heiss at proxmox.com
Wed Apr 30 13:19:33 CEST 2025
Reported in the forum [0].
Currently, the (host) interface is always forced down if the property is
set. Check the actual (boolean) value and honor the users request if set
to `0` aka. off.
[0] https://forum.proxmox.com/threads/bug-container-network-card-turned-off.160691/
Fixes: 9e56948 ("net: Add `link_down` config to allow setting interfaces as disconnected")
Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
---
src/PVE/LXC.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index a58c997..5d9b524 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -995,7 +995,7 @@ sub vm_stop_cleanup {
sub net_tap_plug : prototype($$) {
my ($iface, $net) = @_;
- if (defined($net->{link_down})) {
+ if (defined($net->{link_down}) && $net->{link_down}) {
PVE::Tools::run_command(['/sbin/ip', 'link', 'set', 'dev', $iface, 'down']);
# Don't add disconnected interfaces to the bridge, otherwise e.g. applying any network
# change (e.g. `ifreload -a`) could (re-)activate it unintentionally.
--
2.49.0
More information about the pve-devel
mailing list