all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Hannes Laimer <h.laimer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server v6 11/17] network: sdn: keep the DHCP backends current on guest NICs
Date: Thu,  5 Nov 2026 11:03:10 +0100	[thread overview]
Message-ID: <20261105100316.449163-12-h.laimer@proxmox.com> (raw)
In-Reply-To: <20261105100316.449163-1-h.laimer@proxmox.com>

A DHCP backend that serves the guest's tap itself has to hear of
every plug and removal of that tap. The plug now carries the NIC's
MAC, so the backend can look up the NIC's record. Removing a tap now
goes through the SDN layer as well, so the backend drops its entry
for that tap.

A bridge change allocated the NIC's address in the new vnet, but
unlike a start or a hotplug it never pushed the mapping to the
backend of that vnet's zone. It now does.

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---

Notes:
    v5:
     * the resume push moved to the IPAM series

 src/PVE/CLI/qm.pm                                | 4 ++--
 src/PVE/QemuServer.pm                            | 4 ++++
 src/PVE/QemuServer/Network.pm                    | 4 ++--
 src/test/hotplug/net-change-bridge.conf.expected | 3 ++-
 src/usr/pve-bridge                               | 8 +++++++-
 src/usr/pve-bridgedown                           | 4 ++--
 6 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/src/PVE/CLI/qm.pm b/src/PVE/CLI/qm.pm
index b903c1f1085f..6c53581ab686 100755
--- a/src/PVE/CLI/qm.pm
+++ b/src/PVE/CLI/qm.pm
@@ -22,7 +22,7 @@ use PVE::GuestHelpers;
 use PVE::GuestImport::OVF;
 use PVE::INotify;
 use PVE::JSONSchema qw(get_standard_option);
-use PVE::Network;
+use PVE::Network::SDN::Zones;
 use PVE::RPCEnvironment;
 use PVE::SafeSyslog;
 use PVE::Tools qw(extract_param file_get_contents);
@@ -1143,7 +1143,7 @@ __PACKAGE__->register_method({
                     foreach my $opt (keys %$conf) {
                         next if $opt !~ m/^net(\d+)$/;
                         my $interface = $1;
-                        PVE::Network::tap_unplug("tap${vmid}i${interface}");
+                        PVE::Network::SDN::Zones::tap_unplug("tap${vmid}i${interface}");
                     }
                 }
 
diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 69a2bd64f849..22366c257bd6 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -4973,6 +4973,9 @@ sub vmconfig_update_net {
                     PVE::Network::SDN::Vnets::add_next_free_cidr(
                         $newnet->{bridge}, $conf->{name}, $newnet->{macaddr}, $vmid, undef, 1,
                     );
+                    PVE::Network::SDN::Vnets::add_dhcp_mapping(
+                        $newnet->{bridge}, $newnet->{macaddr}, $vmid, $conf->{name},
+                    );
                 }
 
                 PVE::QemuServer::Network::tap_plug(
@@ -4982,6 +4985,7 @@ sub vmconfig_update_net {
                     $newnet->{firewall},
                     $newnet->{trunks},
                     $newnet->{rate},
+                    { mac => $newnet->{macaddr} },
                 );
 
             } elsif (safe_num_ne($oldnet->{rate}, $newnet->{rate})) {
diff --git a/src/PVE/QemuServer/Network.pm b/src/PVE/QemuServer/Network.pm
index 7ae448ea1369..ac821ee994e2 100644
--- a/src/PVE/QemuServer/Network.pm
+++ b/src/PVE/QemuServer/Network.pm
@@ -367,10 +367,10 @@ sub delete_ifaces_ipams_ips {
 }
 
 sub tap_plug {
-    my ($iface, $bridge, $tag, $firewall, $trunks, $rate) = @_;
+    my ($iface, $bridge, $tag, $firewall, $trunks, $rate, $opts) = @_;
 
     $firewall = $firewall && PVE::Firewall::Helpers::needs_fwbr($bridge);
-    PVE::Network::SDN::Zones::tap_plug($iface, $bridge, $tag, $firewall, $trunks, $rate);
+    PVE::Network::SDN::Zones::tap_plug($iface, $bridge, $tag, $firewall, $trunks, $rate, $opts);
 }
 
 sub get_nets_host_mtu {
diff --git a/src/test/hotplug/net-change-bridge.conf.expected b/src/test/hotplug/net-change-bridge.conf.expected
index a745b2e58e50..61d0f5b2d102 100644
--- a/src/test/hotplug/net-change-bridge.conf.expected
+++ b/src/test/hotplug/net-change-bridge.conf.expected
@@ -2,5 +2,6 @@ net tap_unplug ["tap8006i0"]
 qmp set_link {"name":"net0","up":false}
 sdn del_ips_from_mac ["vmbr0","A2:C0:43:77:08:A0","hotplug"]
 sdn add_next_free_cidr ["vmbr1","hotplug","A2:C0:43:77:08:A0","8006",null,1]
-net tap_plug ["tap8006i0","vmbr1","100",null,null,null]
+sdn add_dhcp_mapping ["vmbr1","A2:C0:43:77:08:A0","8006","hotplug"]
+net tap_plug ["tap8006i0","vmbr1","100",null,null,null,{"mac":"A2:C0:43:77:08:A0"}]
 qmp set_link {"name":"net0","up":true}
diff --git a/src/usr/pve-bridge b/src/usr/pve-bridge
index c7260c6b5a82..20724271f9a4 100755
--- a/src/usr/pve-bridge
+++ b/src/usr/pve-bridge
@@ -43,7 +43,13 @@ die "unable to parse network config '$netid'\n" if !$net;
 PVE::Network::SDN::Vnets::add_dhcp_mapping($net->{bridge}, $net->{macaddr}, $vmid, $conf->{name});
 PVE::Network::SDN::Zones::tap_create($iface, $net->{bridge});
 PVE::QemuServer::Network::tap_plug(
-    $iface, $net->{bridge}, $net->{tag}, $net->{firewall}, $net->{trunks}, $net->{rate},
+    $iface,
+    $net->{bridge},
+    $net->{tag},
+    $net->{firewall},
+    $net->{trunks},
+    $net->{rate},
+    { mac => $net->{macaddr} },
 );
 
 exit 0;
diff --git a/src/usr/pve-bridgedown b/src/usr/pve-bridgedown
index e867b640207a..79a3722bd46a 100755
--- a/src/usr/pve-bridgedown
+++ b/src/usr/pve-bridgedown
@@ -2,7 +2,7 @@
 
 use strict;
 use warnings;
-use PVE::Network;
+use PVE::Network::SDN::Zones;
 
 my $iface = shift;
 
@@ -11,6 +11,6 @@ die "no interface specified\n" if !$iface;
 die "got strange interface name '$iface'\n"
     if $iface !~ m/^tap(\d+)i(\d+)$/;
 
-PVE::Network::tap_unplug($iface);
+PVE::Network::SDN::Zones::tap_unplug($iface);
 
 exit 0;
-- 
2.47.3





  parent reply	other threads:[~2026-11-05 10:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 10:02 [PATCH container/docs/manager/network/proxmox{,-perl-rs,-ve-rs}/qemu-server v6 00/17] sdn: implement DHCP for all zones using eBPF Hannes Laimer
2026-11-05 10:03 ` [PATCH proxmox v6 01/17] network-types: mac address: add an accessor for the bytes Hannes Laimer
2026-11-05 10:03 ` [PATCH proxmox v6 02/17] ebpf: dhcp: add the per-tap DHCPv4 responder program Hannes Laimer
2026-11-05 10:03 ` [PATCH proxmox v6 03/17] ebpf: dhcp: add the subsystem that loads the responder and keeps its records Hannes Laimer
2026-11-05 10:03 ` [PATCH proxmox-perl-rs v6 04/17] pve-rs: sdn: add bindings for the eBPF DHCP responder Hannes Laimer
2026-11-05 10:03 ` [PATCH pve-network v6 05/17] sdn: zones: take the VXLAN and EVPN MTU from the underlay interface Hannes Laimer
2026-11-05 10:03 ` [PATCH pve-network v6 06/17] sdn: dhcp: make the lease time configurable per subnet Hannes Laimer
2026-11-05 10:03 ` [PATCH pve-network v6 07/17] sdn: dhcp: require a backend only if a zone on this node uses it Hannes Laimer
2026-11-05 10:03 ` [PATCH pve-network v6 08/17] sdn: dhcp: add an eBPF backend answering on each guest interface Hannes Laimer
2026-11-05 10:03 ` [PATCH pve-network v6 09/17] sdn: zones: report interface plugs and unplugs to the DHCP backends Hannes Laimer
2026-11-05 10:03 ` [PATCH pve-network v6 10/17] sdn: zones: allow the ebpf DHCP backend on every zone type Hannes Laimer
2026-11-05 10:03 ` Hannes Laimer [this message]
2026-11-05 10:03 ` [PATCH pve-container v6 12/17] net: report NIC plugs and removals to the SDN DHCP backends Hannes Laimer
2026-11-05 10:03 ` [PATCH pve-manager v6 13/17] ui: sdn: add zone DHCP backend selector and subnet DHCP options Hannes Laimer
2026-11-05 10:03 ` [PATCH pve-manager v6 14/17] sdn: bring up the DHCP backends at boot before the guests start Hannes Laimer
2026-11-05 10:03 ` [PATCH proxmox-ve-rs v6 15/17] ve-config: sdn: add the ebpf dhcp backend Hannes Laimer
2026-11-05 10:03 ` [PATCH pve-docs v6 16/17] sdn: zones: document the MTU taken from the underlay interface Hannes Laimer
2026-11-05 10:03 ` [PATCH pve-docs v6 17/17] sdn: dhcp: add eBPF backend section Hannes Laimer

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=20261105100316.449163-12-h.laimer@proxmox.com \
    --to=h.laimer@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