public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Hannes Laimer <h.laimer@proxmox.com>
To: Stefan Hanreich <s.hanreich@proxmox.com>, pve-devel@lists.proxmox.com
Subject: Re: [PATCH pve-network v3 09/17] sdn: dhcp: add an eBPF backend answering on each guest interface
Date: Wed, 21 Oct 2026 08:16:41 +0200	[thread overview]
Message-ID: <2001674a-32d1-4ae4-a7c8-4d989eea0fce@proxmox.com> (raw)
In-Reply-To: <edaeb5a6-dca4-4b8f-9034-70cdd13f7ea2@proxmox.com>

On 2026-10-20 15:11, Stefan Hanreich wrote:
> On 10/20/26 10:04 AM, Hannes Laimer wrote:
>> The ebpf DHCP backend answers DHCPv4 from a program in the kernel on
>> every guest interface of its zones, with the address the SDN MAC cache
>> holds for the interface's MAC. No server runs per zone, and IPv6
>> subnets are not served. A subnet without a gateway is served under a
>> link-local server identifier no host owns, so its guests renew by
>> broadcast at their rebinding time.
>>
>> An apply runs a full pass on each node, and on a node that no zone
>> with the ebpf backend includes, the pass removes the responder
>> altogether. A record change rewrites the answers for its MAC on the
>> node the change is made on, and the other nodes catch up at their
>> next apply.
>>
>> The responder is pinned in bpffs and does not survive a reboot, so a
>> boot hook runs a full pass. Removing the package deletes those pins,
>> since nothing would detach the responder afterward.
>>
>> Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
>> ---

[..]

>> +# the NIC lines come from pmxcfs in one go, so no guest config gets parsed for
>> +# this. With a vmid only that guest's lines are fetched
>> +sub guest_nics {
>> +    my ($vmid) = @_;
>> +
>> +    # a hook script starts with the cluster cache empty
>> +    PVE::Cluster::cfs_update();
>> +    my $vmlist = PVE::Cluster::get_vmlist();
>> +    my $nets = PVE::Cluster::get_guest_config_properties([map { "net$_" } 0 .. 31], $vmid);
>> +    my $nics = [];
>> +    for my $vmid (sort keys %$nets) {
>> +        my $guest = $vmlist->{ids}->{$vmid} // next;
>> +        my $prefix = ($guest->{type} // '') eq 'lxc' ? 'veth' : 'tap';
>> +        for my $key (sort keys %{ $nets->{$vmid} }) {
>> +            my ($index) = $key =~ m/^net(\d+)$/ or next;
>> +            my $net = $nets->{$vmid}->{$key};
>> +            my ($bridge) = $net =~ m/(?:^|,)bridge=([^,]+)/ or next;
>> +            # a VM names the MAC as the value of its model, a container as hwaddr
>> +            my ($mac) = $net =~ m/(?:^|,)[a-z0-9_-]+=([0-9a-f]{2}(?::[0-9a-f]{2}){5})(?:,|$)/i;
> 
> Is there a reason for not using the pre-existing parse_net /
> parse_lxc_network functions in qemu-server / pve-container here?
> They'd provide a standalone way of parsing the property string only,
> without re-implementing the logic here.
> 
> Circular dependencies potentially?

yes, both depend on pve-network :/
the lxc helper also fills the mac if missing, and for
`parse_property_string` we'd need the format

> 
>> +            push @$nics,
>> +                {
>> +                    vmid => $vmid,
>> +                    node => $guest->{node},
>> +                    iface => "$prefix${vmid}i$index",
>> +                    bridge => $bridge,
>> +                    mac => $mac,
>> +                };
>> +        }
>> +    }
>> +
>> +    return $nics;
>> +}
>> +


[..]





  reply	other threads:[~2026-10-21  6:16 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20  7:59 [PATCH container/docs/manager/network/proxmox{-ebpf,-perl-rs}/qemu-server v3 00/17] sdn: implement DHCP for all zones using eBPF Hannes Laimer
2026-10-20  7:59 ` [PATCH proxmox-ebpf v3 01/17] dhcp: add the per-tap DHCPv4 responder program Hannes Laimer
2026-10-20  7:59 ` [PATCH proxmox-ebpf v3 02/17] dhcp: add the subsystem that loads the responder and keeps its records Hannes Laimer
2026-10-20 13:09   ` Stefan Hanreich
2026-10-21  7:09     ` Hannes Laimer
2026-10-20  7:59 ` [PATCH proxmox-perl-rs v3 03/17] pve-rs: sdn: add bindings for the eBPF DHCP responder Hannes Laimer
2026-10-20 13:10   ` Stefan Hanreich
2026-10-21  7:32     ` Hannes Laimer
2026-10-20  7:59 ` [PATCH pve-network v3 04/17] sdn: dhcp: replace a stale dnsmasq reservation instead of dropping it Hannes Laimer
2026-10-20 13:15   ` Stefan Hanreich
2026-10-20  7:59 ` [PATCH pve-network v3 05/17] sdn: dhcp: update reservations when ip mappings change Hannes Laimer
2026-10-20 13:42   ` Stefan Hanreich
2026-10-21  7:21     ` Hannes Laimer
2026-10-20  7:59 ` [PATCH pve-network v3 06/17] sdn: ipam: key the MAC cache by lower-case MAC, stop caching misses Hannes Laimer
2026-10-20 13:10   ` Stefan Hanreich
2026-10-21  6:17     ` Hannes Laimer
2026-10-20  7:59 ` [PATCH pve-network v3 07/17] sdn: dhcp: make the lease time configurable per subnet Hannes Laimer
2026-10-20 13:17   ` Stefan Hanreich
2026-10-20  7:59 ` [PATCH pve-network v3 08/17] sdn: dhcp: require a backend only if a zone on this node uses it Hannes Laimer
2026-10-20 13:17   ` Stefan Hanreich
2026-10-20  7:59 ` [PATCH pve-network v3 09/17] sdn: dhcp: add an eBPF backend answering on each guest interface Hannes Laimer
2026-10-20 13:10   ` Stefan Hanreich
2026-10-21  6:16     ` Hannes Laimer [this message]
2026-10-20  7:59 ` [PATCH pve-network v3 10/17] sdn: zones: report interface plugs and unplugs to the DHCP backends Hannes Laimer
2026-10-20 13:17   ` Stefan Hanreich
2026-10-20  7:59 ` [PATCH pve-network v3 11/17] sdn: dhcp: push IP mapping edits to the guest's node Hannes Laimer
2026-10-20 13:09   ` Stefan Hanreich
2026-10-21  6:44     ` Hannes Laimer
2026-10-20  8:00 ` [PATCH pve-network v3 12/17] sdn: zones: allow the ebpf DHCP backend on every zone type Hannes Laimer
2026-10-20  8:00 ` [PATCH qemu-server v3 13/17] network: sdn: keep the DHCP backends current on guest NICs Hannes Laimer
2026-10-20 13:38   ` Stefan Hanreich
2026-10-20  8:00 ` [PATCH pve-container v3 14/17] net: report NIC plugs and removals to the SDN DHCP backends Hannes Laimer
2026-10-20 13:36   ` Stefan Hanreich
2026-10-21  7:29     ` Hannes Laimer
2026-10-20  8:00 ` [PATCH pve-manager v3 15/17] ui: sdn: add zone DHCP backend selector and subnet DHCP options Hannes Laimer
2026-10-20 13:19   ` Stefan Hanreich
2026-10-20  8:00 ` [PATCH pve-manager v3 16/17] sdn: bring up the DHCP backends at boot before the guests start Hannes Laimer
2026-10-20 13:21   ` Stefan Hanreich
2026-10-21  7:17     ` Hannes Laimer
2026-10-20  8:00 ` [PATCH pve-docs v3 17/17] sdn: dhcp: add eBPF backend section Hannes Laimer
2026-10-20 13:11 ` [PATCH container/docs/manager/network/proxmox{-ebpf,-perl-rs}/qemu-server v3 00/17] sdn: implement DHCP for all zones using eBPF Stefan Hanreich
2026-10-21  7:35   ` Hannes Laimer
2026-10-21  8:46 ` superseded: " 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=2001674a-32d1-4ae4-a7c8-4d989eea0fce@proxmox.com \
    --to=h.laimer@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=s.hanreich@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