From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id A20841FF0B6 for ; Thu, 12 Nov 2026 13:46:10 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 64340216D0; Thu, 12 Nov 2026 13:46:03 +0100 (CET) Message-ID: <62562a47-0279-405c-9608-582bc85acb96@proxmox.com> Date: Thu, 12 Nov 2026 13:45:38 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: superseded: [PATCH container/docs/manager/network/proxmox{,-perl-rs,-ve-rs}/qemu-server v6 00/17] sdn: implement DHCP for all zones using eBPF To: pve-devel@lists.proxmox.com References: <20261105100316.449163-1-h.laimer@proxmox.com> From: Hannes Laimer Content-Language: en-US In-Reply-To: <20261105100316.449163-1-h.laimer@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1794487538282 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.137 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: 2KRHIT7VNPWX5QVKC67X7WMEYPGWPOTQ X-Message-ID-Hash: 2KRHIT7VNPWX5QVKC67X7WMEYPGWPOTQ X-MailFrom: h.laimer@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: superseded-by: https://lore.proxmox.com/pve-devel/20261112124201.2844423-1-h.laimer@proxmox.com/ On 2026-11-05 11:04, Hannes Laimer wrote: > This series adds a second DHCP backend, ebpf, next to dnsmasq. A zone > picks its backend. dnsmasq stays limited to simple zones, while ebpf > answers on the guest's own interface and works on every zone type. A > guest on a zone with the ebpf backend gets the address its NIC has in > the IPAM. There is no daemon per zone and no lease file. The answers > are held in the kernel and do not depend on the IPAM being reachable. > > The responder is a BPF program on the ingress of each guest interface > of a zone with the ebpf backend. It answers a request from the record > of that interface, and the exchange never reaches the bridge. A > request whose client MAC is not the interface's own passes on > unanswered. So a guest cannot read another guest's record, and a > nested client does not get the outer guest's address. > > An edit through /cluster/sdn/vnets/{vnet}/ips is proxied to the > guest's node and updates the backend there. The guest sees the change > at its next renewal, so the lease time bounds how long an old answer > survives. Subnets get a dhcp-lease-time property for both backends. > Without it dnsmasq hands out infinite leases and the responder ten > minutes. An apply attaches the responder to running guests, so a zone > switched to ebpf serves them without a restart. > > Changes reach the kernel in the order they read their input. So no > change overwrites a newer one with older input. A hotplug moves the > interface before the guest config names the new bridge. An apply or an > edit that read the older config in between leaves the moved interface > as its plug left it. Once the config names the bridge the interface > sits on, an apply also repairs an interface whose plug failed. An edit > through the API whose update fails returns an error, with the mapping > saved. Any other change that fails only warns, and what was served > stays served. Nothing of the responder survives a reboot, so it is > loaded again at boot before the guests start. > > Only DHCPv4 is answered. A request the guest tagged itself passes > unanswered as well, so a trunk port keeps working as before. The > request is answered on the guest interface, so the guest's firewall > rules, its DHCP firewall option and its rate limit do not apply to it. > The reply leaves through the interface's egress, where the rate limit > shapes it. A request the responder does not answer passes on to the > bridge and through the firewall as before. Mappings changed directly > in an external IPAM are not picked up, as with dnsmasq. > > In patch order, the series adds > - proxmox, a byte accessor for the MAC address type of > proxmox-network-types, and the dhcp subsystem of proxmox-ebpf, a tc > program answering on the guest interface and the per-interface map > it answers from > - pve-rs, the bindings > - pve-network, the VXLAN and EVPN MTU taken from the underlay > interface, the ebpf backend, the hooks that keep a backend current > when a guest interface changes, and dhcp on every zone type > - qemu-server and pve-container, the reports of a guest NIC coming, > going or moving > - pve-manager, the backend and subnet options in the UI, and the > backends brought up at boot ahead of the guests > - proxmox-ve-rs, the ebpf variant of the dhcp backend type > - pve-docs, the MTU VXLAN and EVPN zones take from the underlay, and > the documentation of the backend > > - proxmox applies on top of the proxmox-ebpf series [1] > - pve-network, qemu-server and pve-docs apply on top of [2] > - pve-rs needs proxmox-ebpf with the dhcp feature and > proxmox-network-types with the byte accessor > - pve-network needs pve-rs, at build and run time > - qemu-server, pve-container and pve-manager need pve-network > - proxmox-ve-config needs nothing, and proxmox-firewall needs its > dependency on it bumped, since an older one fails to parse a zone > with the ebpf backend and the firewall then cannot load its config > An older pve-network fails its apply on the unknown backend, so every > node needs the new one before a zone gets ebpf. > > > v6: > * like the ebpf-lib v8 [1] that this is based on, this moved into the > proxmox workspace > * rebased onto the ipam series v6 [2] > * rebased onto current master > * an apply repairs an interface whose plug failed, once it sits on > the bridge its config names > * a plug reads the zone's backend under the responder's lock, so an > apply switching it meanwhile is not undone > * a map replacement that cannot write every entry keeps the old maps > * an API edit whose DHCP update fails returns an error > * the bindings use the MAC address type of proxmox-network-types > * docs: the MTU default of VXLAN and EVPN zones > > v5: > * rebased onto ebpf-lib v5 > * the MAC cache and dnsmasq fixes moved to [2], as did running a > mapping edit on the guest's node and the push on resume > * a mapping edit only changes the answers on its own vnet > * the VXLAN and EVPN bridges get the MTU that DHCP hands out, both > take it from the underlay interface > * a MAC change on the same vnet is no longer undone by an apply > running meanwhile > > v4, thanks @Stefan!: > * a mapping edit runs on the guest's node instead of being pushed to > it, the node endpoint is gone > * the MAC cache is read and written with lower-case keys, and its > three fixes are three commits > * the guest NIC list is keyed by MAC > * add the missing proxmox-ve-rs patch, the ebpf variant of the dhcp > backend type > * reword log lines and warnings > * (notes on patches with changes) > > v3: > * drop the generation counter. Every change takes the responder's > lock before it reads its input instead. An edit takes it > exclusively > * the resume at the end of a live migration pushes the guest's > mappings again on the target, so an edit made during the migration > reaches it > * new first pve-network commit, a dnsmasq fix that replaces a stale > reservation of another MAC instead of dropping it > * no MTU option for a zone without an MTU, where v2 handed out 1500 > * a mapping edit without a MAC no longer reaches the backends > * rewrite commit messages, cover letter and parts of the docs > * rebase onto current master > > pre-build packages are on sani(`packages/ebpf-dhcp-v6`) > > [1] https://lore.proxmox.com/pve-devel/20261104172918.2643810-1-h.laimer@proxmox.com/ > [2] https://lore.proxmox.com/pve-devel/20261105093529.209052-1-h.laimer@proxmox.com/ > > > proxmox: > > Hannes Laimer (3): > network-types: mac address: add an accessor for the bytes > ebpf: dhcp: add the per-tap DHCPv4 responder program > ebpf: dhcp: add the subsystem that loads the responder and keeps its > records > > proxmox-ebpf/Cargo.toml | 5 + > proxmox-ebpf/debian/control | 18 + > proxmox-ebpf/src/bpf-shim/bpf/bpf_helpers.h | 1 + > proxmox-ebpf/src/bpf-shim/linux/bpf.h | 3 + > proxmox-ebpf/src/dhcp/bpf/dhcp.bpf.c | 400 ++++++ > proxmox-ebpf/src/dhcp/bpf/types.h | 24 + > proxmox-ebpf/src/dhcp/mod.rs | 1219 +++++++++++++++++++ > proxmox-ebpf/src/dhcp/types.rs | 65 + > proxmox-ebpf/src/lib.rs | 3 + > proxmox-ebpf/src/subsystem.rs | 2 +- > proxmox-ebpf/tests/common/mod.rs | 63 +- > proxmox-ebpf/tests/dhcp.rs | 825 +++++++++++++ > proxmox-network-types/src/mac_address.rs | 13 + > 13 files changed, 2636 insertions(+), 5 deletions(-) > create mode 100644 proxmox-ebpf/src/dhcp/bpf/dhcp.bpf.c > create mode 100644 proxmox-ebpf/src/dhcp/bpf/types.h > create mode 100644 proxmox-ebpf/src/dhcp/mod.rs > create mode 100644 proxmox-ebpf/src/dhcp/types.rs > create mode 100644 proxmox-ebpf/tests/dhcp.rs > > > proxmox-perl-rs: > > Hannes Laimer (1): > pve-rs: sdn: add bindings for the eBPF DHCP responder > > pve-rs/Cargo.toml | 2 + > pve-rs/Makefile | 3 + > pve-rs/debian/control | 2 + > pve-rs/src/bindings/sdn/dhcp.rs | 217 ++++++++++++++++++++++++++++++++ > pve-rs/src/bindings/sdn/mod.rs | 1 + > 5 files changed, 225 insertions(+) > create mode 100644 pve-rs/src/bindings/sdn/dhcp.rs > > > pve-network: > > Hannes Laimer (6): > sdn: zones: take the VXLAN and EVPN MTU from the underlay interface > sdn: dhcp: make the lease time configurable per subnet > sdn: dhcp: require a backend only if a zone on this node uses it > sdn: dhcp: add an eBPF backend answering on each guest interface > sdn: zones: report interface plugs and unplugs to the DHCP backends > sdn: zones: allow the ebpf DHCP backend on every zone type > > debian/libpve-network-perl.prerm | 13 + > src/PVE/API2/Network/SDN/Zones.pm | 11 +- > src/PVE/Network/SDN/Dhcp.pm | 107 +- > src/PVE/Network/SDN/Dhcp/Dnsmasq.pm | 3 +- > src/PVE/Network/SDN/Dhcp/Ebpf.pm | 345 ++++++ > src/PVE/Network/SDN/Dhcp/Makefile | 2 +- > src/PVE/Network/SDN/Dhcp/Plugin.pm | 24 +- > src/PVE/Network/SDN/SubnetPlugin.pm | 11 + > src/PVE/Network/SDN/Vnets.pm | 2 +- > src/PVE/Network/SDN/Zones.pm | 29 +- > src/PVE/Network/SDN/Zones/EvpnPlugin.pm | 40 +- > src/PVE/Network/SDN/Zones/FaucetPlugin.pm | 1 + > src/PVE/Network/SDN/Zones/QinQPlugin.pm | 7 + > src/PVE/Network/SDN/Zones/SimplePlugin.pm | 2 +- > src/PVE/Network/SDN/Zones/VlanPlugin.pm | 7 + > src/PVE/Network/SDN/Zones/VxlanPlugin.pm | 31 +- > src/test/run_test_vnets_blackbox.pl | 1017 ++++++++++++++++- > .../underlay_mtu/expected_controller_config | 44 + > .../evpn/underlay_mtu/expected_sdn_interfaces | 42 + > src/test/zones/evpn/underlay_mtu/interfaces | 8 + > src/test/zones/evpn/underlay_mtu/sdn_config | 26 + > .../underlay_mtu/expected_sdn_interfaces | 16 + > src/test/zones/vxlan/underlay_mtu/interfaces | 8 + > src/test/zones/vxlan/underlay_mtu/sdn_config | 11 + > 24 files changed, 1770 insertions(+), 37 deletions(-) > create mode 100755 debian/libpve-network-perl.prerm > create mode 100644 src/PVE/Network/SDN/Dhcp/Ebpf.pm > create mode 100644 src/test/zones/evpn/underlay_mtu/expected_controller_config > create mode 100644 src/test/zones/evpn/underlay_mtu/expected_sdn_interfaces > create mode 100644 src/test/zones/evpn/underlay_mtu/interfaces > create mode 100644 src/test/zones/evpn/underlay_mtu/sdn_config > create mode 100644 src/test/zones/vxlan/underlay_mtu/expected_sdn_interfaces > create mode 100644 src/test/zones/vxlan/underlay_mtu/interfaces > create mode 100644 src/test/zones/vxlan/underlay_mtu/sdn_config > > > qemu-server: > > Hannes Laimer (1): > network: sdn: keep the DHCP backends current on guest NICs > > 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(-) > > > pve-container: > > Hannes Laimer (1): > net: report NIC plugs and removals to the SDN DHCP backends > > src/PVE/LXC.pm | 13 +++++++++++-- > src/PVE/LXC/Config.pm | 3 ++- > src/lxc-pve-poststop-hook | 6 +++--- > 3 files changed, 16 insertions(+), 6 deletions(-) > > > pve-manager: > > Hannes Laimer (2): > ui: sdn: add zone DHCP backend selector and subnet DHCP options > sdn: bring up the DHCP backends at boot before the guests start > > bin/pve-sdn-commit | 4 ++++ > services/pve-sdn-commit.service | 1 + > www/manager6/sdn/SubnetEdit.js | 23 +++++++++++++++++++++++ > www/manager6/sdn/zones/Base.js | 17 +++++++++++++++++ > www/manager6/sdn/zones/SimpleEdit.js | 11 ----------- > 5 files changed, 45 insertions(+), 11 deletions(-) > > > proxmox-ve-rs: > > Hannes Laimer (1): > ve-config: sdn: add the ebpf dhcp backend > > proxmox-ve-config/src/sdn/config.rs | 3 +++ > 1 file changed, 3 insertions(+) > > > pve-docs: > > Hannes Laimer (2): > sdn: zones: document the MTU taken from the underlay interface > sdn: dhcp: add eBPF backend section > > pvesdn.adoc | 142 +++++++++++++++++++++++++++++++++++++++------------- > 1 file changed, 108 insertions(+), 34 deletions(-) > > > Summary over all repositories: > 58 files changed, 4822 insertions(+), 101 deletions(-) >