public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Hannes Laimer <h.laimer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH container/docs/manager/network/proxmox{,-perl-rs,-ve-rs}/qemu-server v7 00/21] sdn: implement DHCP for all zones using eBPF
Date: Thu, 12 Nov 2026 13:41:40 +0100	[thread overview]
Message-ID: <20261112124201.2844423-1-h.laimer@proxmox.com> (raw)

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 while the new bridge is still a pending change in the guest
config. The responder drops the interface at the move and serves it
again once the change is applied. A request sent in between is not
answered. An apply serves an interface only on the bridge its config
names, and it 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 the next apply
makes up for it. 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
 - pve-rs, the Perl bindings for the responder, and a trigger that
   loads the responder again after an upgrade of pve-rs
 - pve-network, the VXLAN and EVPN MTU taken from the underlay
   interface, the BPF program in a package of its own, the ebpf
   backend, the plug and unplug hooks for the DHCP backends, and DHCP
   on every zone type
 - qemu-server and pve-container, the calls that tell the DHCP backends
   when a guest NIC is plugged, unplugged or moved to another bridge
 - pve-manager, the backend and subnet options in the UI, and the DHCP
   backends started at boot before the guests
 - proxmox-ve-rs, ebpf as a DHCP backend type in proxmox-ve-config,
   and the crate that loads the program and fills its map with the
   answer for each guest interface
 - 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-container applies on top of [3]
 - proxmox-ve-rs needs proxmox-ebpf from [1]
 - pve-rs needs proxmox-sdn-dhcp from proxmox-ve-rs, and
   proxmox-network-types with the byte accessor
 - pve-network needs pve-rs, at build and run time, and clang-21,
   libbpf-dev and proxmox-kernel-libc-dev to build the program
 - pve-network needs the qemu-server and pve-container of this series
   as well, since older ones plug a guest NIC without its MAC
 - qemu-server, pve-container and pve-manager need pve-network
 - proxmox-firewall needs proxmox-ve-config, 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.

v7:
 * move dhcp update call to after the config commit, this avoids the
   whole problem of the kernel state being newer than the committed
   config. the cost of having (hot)plugs and sdn applies based on the
   same information, is that during a hotplug, there is a short
   timeframe, namely between the unplug and the config commit from
   pending, where no responder is active. so between the interface
   changing, and the committed config reflecting this change the guest
   does not get its dhcp requests answered. this is short, and for dhcp
   it'll just ask again
 * have the zone mtu consider the address family, v6 needs 20 bytes more
   than v4
 * rebased onto the ebpf-lib v9 [1] and current master
 * the program moved from proxmox to pve-network, into the new
   pve-network-ebpf package. the tests for the C bpf programs stayed in
   rust, with perl we cant call the compiled program directly, and
   having them in C seemed worse than rust, even if the cargo build-dep
   for the tests seemed a little odd
 * the code that loads the program moved from proxmox into the new
   proxmox-sdn-dhcp crate in proxmox-ve-rs
 * new pve-rs patch, the responder is loaded again after an upgrade of
   pve-rs
 * an apply asks the IPAM for missing addresses before it takes the
   responder's lock
 * new pve-network patch, the underlay lookup of VXLAN and EVPN zones
   in a function of its own

v6:
 * like the ebpf-lib v8 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-v7`)

[1] https://lore.proxmox.com/pve-devel/20261110135005.2847847-1-h.laimer@proxmox.com/
[2] https://lore.proxmox.com/pve-devel/20261105093529.209052-1-h.laimer@proxmox.com/
[3] https://lore.proxmox.com/pve-devel/20261112104059.2377096-1-h.laimer@proxmox.com/


proxmox:

Hannes Laimer (1):
  network-types: mac address: add an accessor for the bytes

 proxmox-network-types/src/mac_address.rs | 5 +++++
 1 file changed, 5 insertions(+)


proxmox-perl-rs:

Hannes Laimer (2):
  pve-rs: sdn: add bindings for the eBPF DHCP responder
  pve-rs: fire the pve-ebpf-update trigger on upgrade

 pve-rs/Cargo.toml               |   2 +
 pve-rs/Makefile                 |   3 +
 pve-rs/debian/control           |   1 +
 pve-rs/debian/triggers          |   1 +
 pve-rs/src/bindings/sdn/dhcp.rs | 200 ++++++++++++++++++++++++++++++++
 pve-rs/src/bindings/sdn/mod.rs  |   1 +
 6 files changed, 208 insertions(+)
 create mode 100644 pve-rs/src/bindings/sdn/dhcp.rs


pve-network:

Hannes Laimer (10):
  sdn: zones: take the VXLAN and EVPN MTU from the underlay interface
  sdn: zones: account for IPv6 in the VXLAN and EVPN MTU
  sdn: dhcp: make the lease time configurable per subnet
  sdn: dhcp: require a backend only if a zone on this node uses it
  bpf: add the build, the package and a native harness for BPF programs
  sdn: dhcp: add the per-tap DHCPv4 responder program
  sdn: dhcp: add an eBPF backend answering on each guest interface
  sdn: zones: report interface plugs and unplugs to the DHCP backends
  sdn: zones: factor out the underlay lookup of VXLAN and EVPN zones
  sdn: zones: allow the ebpf DHCP backend on every zone type

 .gitignore                                    |    3 +
 Makefile                                      |    1 +
 debian/control                                |   14 +
 debian/libpve-network-perl.postinst           |   22 +
 debian/libpve-network-perl.prerm              |   13 +
 debian/pve-network-ebpf.install               |    1 +
 debian/pve-network-ebpf.lintian-overrides     |    2 +
 debian/triggers                               |    1 +
 src/Makefile                                  |    3 +-
 src/PVE/API2/Network/SDN/Zones.pm             |   16 +-
 src/PVE/Network/SDN/Dhcp.pm                   |  109 +-
 src/PVE/Network/SDN/Dhcp/Dnsmasq.pm           |    5 +-
 src/PVE/Network/SDN/Dhcp/Ebpf.pm              |  395 ++++++
 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                  |   42 +-
 src/PVE/Network/SDN/Zones/EvpnPlugin.pm       |   98 +-
 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      |  105 +-
 src/bpf/Makefile                              |   37 +
 src/bpf/dhcp/dhcp.bpf.c                       |  393 ++++++
 src/bpf/dhcp/types.h                          |   27 +
 src/bpf/harness/Cargo.toml                    |    8 +
 src/bpf/harness/build.rs                      |  101 ++
 src/bpf/harness/shim/bpf/bpf_helpers.h        |   35 +
 src/bpf/harness/shim/bpf_debug.h              |   10 +
 src/bpf/harness/shim/linux/bpf.h              |   28 +
 src/bpf/harness/tests/bpf/fixture.bpf.c       |   37 +
 src/bpf/harness/tests/common/mod.rs           |  267 ++++
 src/bpf/harness/tests/dhcp.rs                 |  804 +++++++++++
 src/bpf/harness/tests/harness.rs              |   98 ++
 src/bpf/include/bpf_debug.h                   |   12 +
 src/bpf/order                                 |    1 +
 src/test/run_test_vnets_blackbox.pl           | 1183 ++++++++++++++++-
 .../evpn/ipv6underlay/expected_sdn_interfaces |    8 +-
 .../expected_sdn_interfaces                   |    8 +-
 .../expected_sdn_interfaces                   |    8 +-
 .../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 +
 .../zones/vxlan/ipv6/expected_sdn_interfaces  |    4 +-
 .../underlay_mtu/expected_sdn_interfaces      |   16 +
 src/test/zones/vxlan/underlay_mtu/interfaces  |    8 +
 src/test/zones/vxlan/underlay_mtu/sdn_config  |   11 +
 .../underlay_mtu_ipv6/expected_sdn_interfaces |   16 +
 .../zones/vxlan/underlay_mtu_ipv6/interfaces  |    8 +
 .../zones/vxlan/underlay_mtu_ipv6/sdn_config  |   17 +
 53 files changed, 4028 insertions(+), 123 deletions(-)
 create mode 100755 debian/libpve-network-perl.prerm
 create mode 100644 debian/pve-network-ebpf.install
 create mode 100644 debian/pve-network-ebpf.lintian-overrides
 create mode 100644 src/PVE/Network/SDN/Dhcp/Ebpf.pm
 create mode 100644 src/bpf/Makefile
 create mode 100644 src/bpf/dhcp/dhcp.bpf.c
 create mode 100644 src/bpf/dhcp/types.h
 create mode 100644 src/bpf/harness/Cargo.toml
 create mode 100644 src/bpf/harness/build.rs
 create mode 100644 src/bpf/harness/shim/bpf/bpf_helpers.h
 create mode 100644 src/bpf/harness/shim/bpf_debug.h
 create mode 100644 src/bpf/harness/shim/linux/bpf.h
 create mode 100644 src/bpf/harness/tests/bpf/fixture.bpf.c
 create mode 100644 src/bpf/harness/tests/common/mod.rs
 create mode 100644 src/bpf/harness/tests/dhcp.rs
 create mode 100644 src/bpf/harness/tests/harness.rs
 create mode 100644 src/bpf/include/bpf_debug.h
 create mode 100644 src/bpf/order
 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
 create mode 100644 src/test/zones/vxlan/underlay_mtu_ipv6/expected_sdn_interfaces
 create mode 100644 src/test/zones/vxlan/underlay_mtu_ipv6/interfaces
 create mode 100644 src/test/zones/vxlan/underlay_mtu_ipv6/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                            | 16 ++++++++++++++++
 src/PVE/QemuServer/Network.pm                    | 10 ++++++++--
 .../aarch64/net-add-pci-bridge.conf.expected     |  1 +
 src/test/hotplug/aarch64/net-add.conf.expected   |  1 +
 .../aarch64/x86-guest-net-add.conf.expected      |  1 +
 .../hotplug/net-add-pci-bridge.conf.expected     |  1 +
 src/test/hotplug/net-add.conf.expected           |  1 +
 src/test/hotplug/net-change-bridge.conf.expected |  4 +++-
 src/test/hotplug/net-change-model.conf.expected  |  1 +
 src/test/hotplug/net-change-rate.conf.expected   |  1 +
 src/test/run_hotplug_tests.pl                    |  5 ++++-
 src/usr/pve-bridge                               |  8 +++++++-
 src/usr/pve-bridgedown                           |  4 ++--
 14 files changed, 49 insertions(+), 9 deletions(-)


pve-container:

Hannes Laimer (1):
  net: report NIC plugs and removals to the SDN DHCP backends

 src/PVE/LXC.pm            | 33 +++++++++++++++++++++++++++------
 src/PVE/LXC/Config.pm     |  3 ++-
 src/lxc-pve-poststop-hook |  6 +++---
 3 files changed, 32 insertions(+), 10 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 (2):
  ve-config: sdn: add the ebpf dhcp backend
  sdn-dhcp: add the crate that runs the eBPF DHCP responder

 Cargo.toml                            |   2 +
 proxmox-sdn-dhcp/Cargo.toml           |  18 +
 proxmox-sdn-dhcp/debian/changelog     |   5 +
 proxmox-sdn-dhcp/debian/control       |  42 ++
 proxmox-sdn-dhcp/debian/copyright     |  18 +
 proxmox-sdn-dhcp/debian/debcargo.toml |   7 +
 proxmox-sdn-dhcp/src/lib.rs           | 688 ++++++++++++++++++++++++++
 proxmox-sdn-dhcp/src/types.rs         |  42 ++
 proxmox-ve-config/src/sdn/config.rs   |   3 +
 9 files changed, 825 insertions(+)
 create mode 100644 proxmox-sdn-dhcp/Cargo.toml
 create mode 100644 proxmox-sdn-dhcp/debian/changelog
 create mode 100644 proxmox-sdn-dhcp/debian/control
 create mode 100644 proxmox-sdn-dhcp/debian/copyright
 create mode 100644 proxmox-sdn-dhcp/debian/debcargo.toml
 create mode 100644 proxmox-sdn-dhcp/src/lib.rs
 create mode 100644 proxmox-sdn-dhcp/src/types.rs


pve-docs:

Hannes Laimer (2):
  sdn: zones: document the MTU taken from the underlay interface
  sdn: dhcp: add eBPF backend section

 pvesdn.adoc | 154 +++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 117 insertions(+), 37 deletions(-)


Summary over all repositories:
  92 files changed, 5309 insertions(+), 190 deletions(-)

-- 
Generated by murpp 0.12.0




             reply	other threads:[~2026-11-12 12:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12 12:41 Hannes Laimer [this message]
2026-11-12 12:41 ` [PATCH proxmox v7 01/21] network-types: mac address: add an accessor for the bytes Hannes Laimer
2026-11-12 12:41 ` [PATCH proxmox-perl-rs v7 02/21] pve-rs: sdn: add bindings for the eBPF DHCP responder Hannes Laimer
2026-11-12 12:41 ` [PATCH proxmox-perl-rs v7 03/21] pve-rs: fire the pve-ebpf-update trigger on upgrade Hannes Laimer
2026-11-12 12:41 ` [PATCH pve-network v7 04/21] sdn: zones: take the VXLAN and EVPN MTU from the underlay interface Hannes Laimer
2026-11-12 12:41 ` [PATCH pve-network v7 05/21] sdn: zones: account for IPv6 in the VXLAN and EVPN MTU Hannes Laimer
2026-11-12 12:41 ` [PATCH pve-network v7 06/21] sdn: dhcp: make the lease time configurable per subnet Hannes Laimer
2026-11-12 12:41 ` [PATCH pve-network v7 07/21] sdn: dhcp: require a backend only if a zone on this node uses it Hannes Laimer
2026-11-12 12:41 ` [PATCH pve-network v7 08/21] bpf: add the build, the package and a native harness for BPF programs Hannes Laimer
2026-11-12 12:41 ` [PATCH pve-network v7 09/21] sdn: dhcp: add the per-tap DHCPv4 responder program Hannes Laimer
2026-11-12 12:41 ` [PATCH pve-network v7 10/21] sdn: dhcp: add an eBPF backend answering on each guest interface Hannes Laimer
2026-11-12 12:41 ` [PATCH pve-network v7 11/21] sdn: zones: report interface plugs and unplugs to the DHCP backends Hannes Laimer
2026-11-12 12:41 ` [PATCH pve-network v7 12/21] sdn: zones: factor out the underlay lookup of VXLAN and EVPN zones Hannes Laimer
2026-11-12 12:41 ` [PATCH pve-network v7 13/21] sdn: zones: allow the ebpf DHCP backend on every zone type Hannes Laimer
2026-11-12 12:41 ` [PATCH qemu-server v7 14/21] network: sdn: keep the DHCP backends current on guest NICs Hannes Laimer
2026-11-12 12:41 ` [PATCH pve-container v7 15/21] net: report NIC plugs and removals to the SDN DHCP backends Hannes Laimer
2026-11-12 12:41 ` [PATCH pve-manager v7 16/21] ui: sdn: add zone DHCP backend selector and subnet DHCP options Hannes Laimer
2026-11-12 12:41 ` [PATCH pve-manager v7 17/21] sdn: bring up the DHCP backends at boot before the guests start Hannes Laimer
2026-11-12 12:41 ` [PATCH proxmox-ve-rs v7 18/21] ve-config: sdn: add the ebpf dhcp backend Hannes Laimer
2026-11-12 12:41 ` [PATCH proxmox-ve-rs v7 19/21] sdn-dhcp: add the crate that runs the eBPF DHCP responder Hannes Laimer
2026-11-12 12:42 ` [PATCH pve-docs v7 20/21] sdn: zones: document the MTU taken from the underlay interface Hannes Laimer
2026-11-12 12:42 ` [PATCH pve-docs v7 21/21] 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=20261112124201.2844423-1-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 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