all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH container] net: do not force network interface down if `link_down` is to 0
Date: Wed, 30 Apr 2025 13:19:33 +0200	[thread overview]
Message-ID: <20250430111934.696262-1-c.heiss@proxmox.com> (raw)

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@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



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


             reply	other threads:[~2025-04-30 11:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-30 11:19 Christoph Heiss [this message]
2025-04-30 12:24 ` Fabian Grünbichler
2025-04-30 12:45   ` Christoph Heiss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250430111934.696262-1-c.heiss@proxmox.com \
    --to=c.heiss@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal