summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2025-04-09bump version to 0.11.2HEADmasterThomas Lamprecht
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-09frr: enable and start frr on reloading the controller configStefan Hanreich
Since we now ship frr with Proxmox VE, the frr service is available on the nodes but disabled on install. Prior to that, users had to manually install frr, which automatically enabled the service. When first applying a SDN configuration with an EVPN controller, we always fell back to restarting the frr service, because reloading fails when the daemon isn't running. This fallback to restarting leads to the service running but still being in the disabled state. This means that the EVPN setup is working until the next reboot. To avoid the situation where users configure an EVPN controller and everything seems to be working, until a restart breaks the EVPN setup, additionally enable and start the frr service before trying to reload the configuration. We enable the service after checking for the existence of frr-pythontools in order to avoid the situation where users apply an SDN configuration with an EVPN controller, but reloading fails due to a missing frr-pythontools package. Since we do an early return there, we never fell back to restarting the service in case frr-pythontools was not available. If we enabled the service before the check, the configuration would apply after a reboot since it already got written to the frr configuration file. Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
2025-04-09frr: remove erroneous outfunc from frr-reload commandStefan Hanreich
Prior to the upgrade to frr-pythontools 10.2.1, frr-reload.py did not print any output to STDOUT, which masked the erroneous outfunc provided in run_command. With 10.2.1 frr-reload.py now prints to STDOUT, which triggers the codepath for invoking the outfunc, leading to an error when invoking frr-reload.py. By removing the outfunc the invocation works again. In addition to fixing the regression introduced, we also now print the frr-reload.py informational output to the tasklog, which can be helpful in debugging any issues when reloading the frr configuration. Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
2025-04-08bump version to 0.11.1Thomas Lamprecht
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-08ipam: netbox: fix adding vms without a name set in the optionsStefan Hanreich
The hostname provided to the methods in the IPAM plugins is empty for VMs that do not have a name set. We always included the dns_name key in the request, even if it was undefined, which leads Netbox to return a 400 Bad Request error. With this patch we omit the dns_name parameter if it isn't set, so the call succeeds. Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com> Link: https://lore.proxmox.com/20250408132517.225240-1-s.hanreich@proxmox.com
2025-04-08bump version to 0.11.0Thomas Lamprecht
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-07subnet: dhcp: do not allow overlapping dhcp rangesStefan Hanreich
Check for overlapping DHCP ranges and reject them if there are any overlaps. If we can be certain that there are no overlapping DHCP ranges this saves us from running into errors later in IPAM modules where overlapping DHCP ranges are not allowed. Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com> Tested-by: Hannes Duerr <h.duerr@proxmox.com> Link: https://lore.proxmox.com/20250307125056.169575-4-s.hanreich@proxmox.com Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-07subnet: dhcp: only accept single ips and normalize themStefan Hanreich
Net::IP accepts a myriad of different IP objects from ranges to prefixes to singular IPs. We check if the object consists only of a singular IP and normalize the IP if it has size 1 (since then it could still be a /32 prefix or a range consisting of one IP). Otherwise we would theoretically accept any valid Net::IP object here. Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com> Tested-by: Hannes Duerr <h.duerr@proxmox.com> Link: https://lore.proxmox.com/20250307125056.169575-3-s.hanreich@proxmox.com Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-07subnet: dhcp: fix typo in error messageStefan Hanreich
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com> Tested-by: Hannes Duerr <h.duerr@proxmox.com> Link: https://lore.proxmox.com/20250307125056.169575-2-s.hanreich@proxmox.com Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-07subnet: dhcp: improve Net::IP usageStefan Hanreich
This simplifies the comparison of IPs by using the object-oriented interface over the procedural one. Also instantiate the ips using the new method rather than using new, which isn't a keyword in Perl. This fixes the respective perlcritic warning. Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com> Tested-by: Hannes Duerr <h.duerr@proxmox.com> Link: https://lore.proxmox.com/20250307125056.169575-1-s.hanreich@proxmox.com Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-07update tests following changes to behaviour:Lou Lecrivain
- allocating IPs also when prefix-only - PVE IPAM register details for every allocation strategy Signed-off-by: lou lecrivain <lou.lecrivain@wdz.de> Tested-by: Stefan Hanreich <s.hanreich@proxmox.com> Reviewed-by: Stefan Hanreich <s.hanreich@proxmox.com> Tested-by: Hannes Duerr <h.duerr@proxmox.com> Link: https://lore.proxmox.com/mailman.185.1734119199.332.pve-devel@lists.proxmox.com Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-07fix: register details in pve ipam db for add_next_freeipLou Lecrivain
Signed-off-by: lou lecrivain <lou.lecrivain@wdz.de> Tested-by: Stefan Hanreich <s.hanreich@proxmox.com> Reviewed-by: Stefan Hanreich <s.hanreich@proxmox.com> Tested-by: Hannes Duerr <h.duerr@proxmox.com> Link: https://lore.proxmox.com/mailman.187.1734119229.332.pve-devel@lists.proxmox.com Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-07dhcp: always generate dhcp-range for dnsmasqLou Lecrivain
(configure_range is now noop) Signed-off-by: lou lecrivain <lou.lecrivain@wdz.de> Tested-by: Stefan Hanreich <s.hanreich@proxmox.com> Reviewed-by: Stefan Hanreich <s.hanreich@proxmox.com> Tested-by: Hannes Duerr <h.duerr@proxmox.com> Link: https://lore.proxmox.com/mailman.183.1734119197.332.pve-devel@lists.proxmox.com Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-07vnet: do not skip if no range is defined, ask for allocation inside prefix ↵Lou Lecrivain
instead Signed-off-by: lou lecrivain <lou.lecrivain@wdz.de> Tested-by: Stefan Hanreich <s.hanreich@proxmox.com> Reviewed-by: Stefan Hanreich <s.hanreich@proxmox.com> Tested-by: Hannes Duerr <h.duerr@proxmox.com> Link: https://lore.proxmox.com/mailman.181.1734119196.332.pve-devel@lists.proxmox.com Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-07partial fix #5496: subnet: ipam: add update_subnet hookStefan Hanreich
Because of how the Netbox IPAM plugin works (utilizing IP ranges to represent DHCP ranges), we need a hook in the IPAM plugin that runs on updates to the subnet because DHCP ranges can be edited. The update hook in Netbox checks which DHCP ranges got added and which got deleted and then performs the respective changes in the Netbox IPAM. This operates under the assumption that DHCP ranges do not overlap (which is not supported by Netbox anyway). Only Netbox needs to do work on update, so we can leave this as noop in phpIPAM and the PVE IPAM, because they have no notion of IP ranges or similar entities. phpIPAM doesn't support DHCP ranges at all and PVE IPAM simply uses DHCP ranges as a constraint when allocating an IP. I decided on this approach over just creating IP ranges on demand when assigning IPs, because this keeps Netbox clean and in sync with the PVE state. It doesn't leave remnants of IP ranges in the Netbox database, which can lead to errors when trying to create IP ranges that overlap with IP ranges that already existed in an SDN subnet. This method tries to check for any possible errors before editing the entities. There is still a small window where external changes can occur that lead to errors. We are touching multiple entities here, so in case of errors users have to fix their Netbox instance manually. Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com> Tested-by: Hannes Duerr <h.duerr@proxmox.com> Link: https://lore.proxmox.com/20250310085103.30549-8-s.hanreich@proxmox.com Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-07partial fix #5496: ipam: netbox: create / delete ip ranges for dhcpStefan Hanreich
We use the IP ranges of netbox to represent the dhcp ranges. We were already querying the IP ranges for a IP when starting a guest, but we never created the IP ranges in the first place. Additionally implement deleting the IP ranges when the subnet gets deleted. These methods try to check for any possible errors before editing the entities. There is still a small window where external changes can occur that lead to errors. We are touching multiple entities here, so in case of errors users have to fix their Netbox instance manually. Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com> Tested-by: Hannes Duerr <h.duerr@proxmox.com> Link: https://lore.proxmox.com/20250310085103.30549-7-s.hanreich@proxmox.com Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-07partial fix #5496: ipam: netbox: properly return allocated ipStefan Hanreich
The netbox integration did not properly return the IP when creating the entries in netbox. This lead to errors on starting the guest, stating that an IP could not be allocated. Originally-by: lou lecrivain <lou.lecrivain@wdz.de> Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com> Tested-by: Hannes Duerr <h.duerr@proxmox.com> Link: https://lore.proxmox.com/20250310085103.30549-6-s.hanreich@proxmox.com Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-07ipam: netbox: add error handling to get_ips_from_macStefan Hanreich
This function did not catch any possible errors, nor respect the $noerr parameter. Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com> Tested-by: Hannes Duerr <h.duerr@proxmox.com> Link: https://lore.proxmox.com/20250310085103.30549-5-s.hanreich@proxmox.com Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-07ipam: netbox: no conditional assignments for descriptionsStefan Hanreich
While it should make practically no difference, it opens up potential errors in the future, so just remove the conditional assignments and explicitly define the variable as undef, so the intention is more clear. Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com> Tested-by: Hannes Duerr <h.duerr@proxmox.com> Link: https://lore.proxmox.com/20250310085103.30549-4-s.hanreich@proxmox.com Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-07ipam: netbox: simplify helpersStefan Hanreich
The helpers had lots of unnecessary intermediate assignments, which we can just simplify. Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com> Tested-by: Hannes Duerr <h.duerr@proxmox.com> Link: https://lore.proxmox.com/20250310085103.30549-3-s.hanreich@proxmox.com Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-07ipam: netbox: implement deleting subnetsStefan Hanreich
Deleting a subnet did not delete any created entities in Netbox. Implement deletion of a subnet by deleting all entities that are created in Netbox upon creation of a subnet. We are checking for any leftover IP assignments before deleting the prefix, so we do not accidentally delete any manually created IP assignments. This method tries to check for any possible errors before editing the entities. There is still a small window where external changes can occur that lead to errors. We are touching multiple entities here, so in case of errors users have to fix their Netbox instance manually. Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com> Tested-by: Hannes Duerr <h.duerr@proxmox.com> Link: https://lore.proxmox.com/20250310085103.30549-2-s.hanreich@proxmox.com Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-07ipam: netbox: factor out common api methods and unify error handlingStefan Hanreich
Create a helper method that abstracts the common code used in making netbox requests. Move all api_request incovations over to using the helper method. This saves us from writing lots of repeated code. This also updates the helpers and introduces error checking there. Helpers didn't catch any errors and the invoking methods didn't as well. This meant that functions with $noerr set to 1 would still error out. We now pass $noerr to the helper functions and they behave the same as the parent methods. This requires some additional checks in the call sites of the helpers. Also canonicalize all URLs, since Netbox does that and it saves us a redirect. Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com> Tested-by: Hannes Duerr <h.duerr@proxmox.com> Link: https://lore.proxmox.com/20250310085103.30549-1-s.hanreich@proxmox.com Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-07d/control: break the circular build-dependency with pve-firewall, and moreJing Luo via pve-devel
Currently pve-network has a (versioned) build-dep of pve-firewall, which has a (versioned) runtime dependency of a newer version of libpve-network-perl, which is not available because it has not been built. It turns out that pve-firewall is only needed in testing, so let's only pull it in if we don't use the "nocheck" build profile so that we can actually build pve-network from source. perl is a build-essential so no need to add it in build-deps. Fixes: cbc70c81b9a2647a20903b27cabb14c1d6dc6d76 Signed-off-by: Jing Luo <jing@jing.rocks> Link: https://lore.proxmox.com/mailman.599.1732342430.391.pve-devel@lists.proxmox.com
2025-03-25dns: powerdns: correctly handle different records types (A / AAAA)Matthieu Pignolet
This fixes an issue with dual stacking, when using a zone with both a IPv4 and IPv6 subnet and the same DNS suffix, pve-network will try to set both DNS records (type A and AAAA) in the same powerdns rrset, causing an API error, and effectively causing no forward DNS records being created. This change edits the `get_zone_rrset` function so that it takes the DNS record type into account. Signed-off-by: Matthieu Pignolet <m@mpgn.dev> Tested-by: Stefan Hanreich <s.hanreich@proxmox.com> [TL: wrap commit message] Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-03-06bump version to 0.10.1Thomas Lamprecht
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-03-06ipam dns: powerdns integration: factor out common API request codeThomas Lamprecht
No point in having the same generic code to prepare variables for an API request to PowerDNS 7 times basically duplicated. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-03-06api request helper: fix conditional declarationThomas Lamprecht
Reported-by: Fiona Ebner <f.ebner@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-03-06fix missing use statements in core SDN moduleThomas Lamprecht
Reported-by: Fiona Ebner <f.ebner@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-03-06dns: powerdns integration: add fingerprint option to api requestsHannes Duerr
Signed-off-by: Hannes Duerr <h.duerr@proxmox.com> Tested-by: Stefan Hanreich <s.hanreich@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-03-06ipam: dns base plugin: add fingerprint to available propertiesHannes Duerr
Signed-off-by: Hannes Duerr <h.duerr@proxmox.com> Tested-by: Stefan Hanreich <s.hanreich@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-03-06ipam: netbox integration: add fingerprint option to api requestsHannes Duerr
Signed-off-by: Hannes Duerr <h.duerr@proxmox.com> Tested-by: Stefan Hanreich <s.hanreich@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-03-06ipam: phpIPAM integration: add fingerprint option to api requestsHannes Duerr
Signed-off-by: Hannes Duerr <h.duerr@proxmox.com> Tested-by: Stefan Hanreich <s.hanreich@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-03-06ipam: base plugin: add fingerprint to available propertiesHannes Duerr
Signed-off-by: Hannes Duerr <h.duerr@proxmox.com> Tested-by: Stefan Hanreich <s.hanreich@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-03-06api request helper: enforce TLS cert-check and add cert-fingerprint optionHannes Duerr
Currently, we do not verify the TLS certificate for API requests external IPAM and DNS integration. This could allow man-in-the-middle attacks, albeit most IPAM infrastructure is on controlled and isolated LANs, so it's not something that should frequently happen; and technically our IPAM integration is still marked as tech-preview, which had its reasons. Enforce verification, and allow users to pass a cert SHA256 fingerprint to ensure a certificates validity if it's not trusted by the system trust store, as it's, e.g., the case for self-signed certs. The code was adapted from the one in pve-apiclient, which we cannot reuse directly as it is only implemented for requests against PVE nodes, not as a generic HTTP client request helper. Add the new dependency `libio-socket-ssl-perl` required to get the verify callback for the TLS certificate used for cert-fingerprint checking. Signed-off-by: Hannes Duerr <h.duerr@proxmox.com> Tested-by: Stefan Hanreich <s.hanreich@proxmox.com> [TL: return valid for non-leaf certs and rewrite commit message] Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-03-06api request helper: use builtin method to check success of requestsHannes Duerr
Avoid using a regex if we have a builtin function ready to use. Signed-off-by: Hannes Duerr <h.duerr@proxmox.com> Tested-by: Stefan Hanreich <s.hanreich@proxmox.com> [TL: touch up commit message] Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-03-06ipam: phpIPAM: remove unused variablesHannes Duerr
Signed-off-by: Hannes Duerr <h.duerr@proxmox.com> Tested-by: Stefan Hanreich <s.hanreich@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-03-06tree-wide: remove unused Data::Dumper module inclusionHannes Duerr
Signed-off-by: Hannes Duerr <h.duerr@proxmox.com> [TL: drop all other unused Dumper use statements] Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-02-11sdn: fix comparison of pending configuration valuesStefan Hanreich
The conditional assignment caused falsy values to be converted to undef when comparing them. This led to the behavior that configuration values that are interpreted by perl as falsy would get wrongly compared and always show up as pending changes. As an example the 'bgp-multipath-as-path-relax' or 'ebgp' keys of the bgp controller configuration are booleans and get stored as 0 in the controller configuration when they're turned off. They always showed up as a pending change, because of the behavior described above. Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
2024-11-20bump version to 0.10.0Thomas Lamprecht
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-11-20d/postinst: do not break, if ipam-file moves failStoiko Ivanov
failing a package-install does not help repairing the situation - so inform the user about the issue instead of erroring out. The copy could fail if a node is not quorate, so writes in /etc/pve are a bit more likely to fail adapts the change introduced in d0628df ("debian: migrate legacy mac/ipam cache/state files") Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2024-11-19bump version to 0.9.9Thomas Lamprecht
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-11-19debian: migrate legacy mac/ipam cache/state filesStefan Hanreich
We opted for a simple copy of the legacy file to the new location, since any other migration path would be too strenuous. The worst-case scenario of failures with this approach is losing IPAM / MAC entries that are created during the update window in the legacy files by nodes that are not yet updated to the new version. Those can be fixed by a simple start / stop of the affected VMs, triggering a rewrite of the IPAM database. Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com> [ TL: output message if files get moved and add todo-comment ] Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-11-19d/control: record dependency to pve-firewall from api packageThomas Lamprecht
We mount the per-vnet firewall API endpoints here now, as we split api and implementation we can avoid a cyclic dependency. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-11-19firewall: add endpoints for vnet-level firewallStefan Hanreich
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com> Reviewed-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-11-18d/control: bump versioned dependency for pve-clusterThomas Lamprecht
To ensure 'sdn/mac-cache.json' is available as observed file. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-11-18ipam: move mac-cache.db to unprivileged sdn/ subdirectoryStoiko Ivanov
follows commit: 0f48bc6 ("ipam: move state file of PVE plugin over to common sdn directory") as far as reasoning goes, and also closely code-wise (if only to make the clean-up with PVE 9.0 a bit more straight-forward): files in priv/ are sensitive in the sense that access there can be used to hijack (external systems) - the mac-cache can be kept next to the remaining sdn-config. minimally tested on my machine. depends on the pve-cluster commit sent with this. Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2024-11-18prepare bump version to 0.9.9Thomas Lamprecht
This is not yet marked as released as the bump was mostly done to allow testing with correct version for the package split's break/replaces. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-11-18split into implementation and API endpoint packagesThomas Lamprecht
To better handle the case where firewall requires to parse the SDN config and this package here would like to mount some vnet specific firewall endpoints, without a split we got a cyclic dependency here, and those are painful, especially on bootstrapping. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-11-18ipam: fix-up check for transitionThomas Lamprecht
forgot to squash this into the original patch.. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-11-18vnets : add ports isolationAlexandre Derumier via pve-devel
Add support for bridge ports isolation https://github.com/torvalds/linux/commit/7d850abd5f4edb1b1ca4b4141a4453305736f564 This allow to drop traffic between all ports having isolation enabled on the local bridge, but allow traffic with non isolated ports. Here,we isolate traffic between vms but allow traffic coming from outside. Main usage is for layer3 routed or natted setup, but some users have requested it for layer2/bridge network with proxy arp. So we can enable it at vnet level. Signed-off-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com> [ SH: improve option naming and description slightly ] Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>