public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Rémi PAETA" <remi.paeta@comaite.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server v2 2/2] fix #6490: network: add bridge fdb entries when hotplugging a nic
Date: Thu, 29 Oct 2026 17:49:39 +0100	[thread overview]
Message-ID: <20261029164939.1278135-3-remi.paeta@comaite.com> (raw)
In-Reply-To: <20261029164939.1278135-1-remi.paeta@comaite.com>

On bridges with MAC learning disabled, the forwarding database entries
of the guest NICs are added on VM start and on resume after a
migration, but not when a NIC gets hotplugged or re-plugged because its
bridge, VLAN tag, trunks or firewall setting changed. Re-plugging even
drops the existing entries.

The guest then loses connectivity on that NIC until its next start or
migration, for example after enabling or disabling the firewall of the
NIC.

Add the forwarding database entries of the NIC after plugging it. On
bridges with MAC learning enabled, this is a no-op. As the NIC is
already plugged at that point, only warn if adding them fails, instead
of failing the update and leaving the configuration out of sync with
the running VM.

Link: https://bugzilla.proxmox.com/show_bug.cgi?id=6490
Signed-off-by: Rémi PAETA <remi.paeta@comaite.com>
---
 src/PVE/QemuServer.pm | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index b4a1a38d..626dc78a 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -4994,6 +4994,9 @@ sub vmconfig_update_net {
                     $newnet->{trunks},
                     $newnet->{rate},
                 );
+                # unplugging the interface dropped its forwarding database entries
+                eval { PVE::QemuServer::Network::add_nets_bridge_fdb({ $opt => $value }, $vmid) };
+                log_warn("failed to add forwarding database entries of '$iface' - $@") if $@;
 
             } elsif (safe_num_ne($oldnet->{rate}, $newnet->{rate})) {
                 # Rate can be applied on its own but any change above needs to
@@ -5023,6 +5026,11 @@ sub vmconfig_update_net {
             $newnet->{bridge}, $newnet->{macaddr}, $vmid, $conf->{name},
         );
         vm_deviceplug($storecfg, $conf, $vmid, $opt, $newnet, $arch, $machine_type);
+        if ($newnet->{bridge}) {
+            # the NIC is plugged already, so do not fail the hotplug
+            eval { PVE::QemuServer::Network::add_nets_bridge_fdb({ $opt => $value }, $vmid) };
+            log_warn("failed to add forwarding database entries of '$opt' - $@") if $@;
+        }
     } else {
         die "skip\n";
     }
-- 
2.47.3




  parent reply	other threads:[~2026-10-29 16:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 16:49 [PATCH qemu-server v2 0/2] fix #6490: network: bridge fdb entries on nic hotplug Rémi PAETA
2026-10-29 16:49 ` [PATCH qemu-server v2 1/2] network: do not fail on missing bridge fdb entries when migrating Rémi PAETA
2026-10-29 16:49 ` Rémi PAETA [this message]
2026-10-30 13:32 ` [PATCH qemu-server v2 0/2] fix #6490: network: bridge fdb entries on nic hotplug Gabriel Goller

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=20261029164939.1278135-3-remi.paeta@comaite.com \
    --to=remi.paeta@comaite.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal