* [pve-devel] [PATCH] dns: powerdns: correctly handle different records types (A / AAAA)
@ 2025-02-27 9:02 Matthieu Pignolet via pve-devel
2025-03-13 16:14 ` Stefan Hanreich
0 siblings, 1 reply; 2+ messages in thread
From: Matthieu Pignolet via pve-devel @ 2025-02-27 9:02 UTC (permalink / raw)
To: pve-devel; +Cc: Matthieu Pignolet
[-- Attachment #1: Type: message/rfc822, Size: 4604 bytes --]
From: Matthieu Pignolet <m@mpgn.dev>
To: pve-devel@lists.proxmox.com
Subject: [PATCH] dns: powerdns: correctly handle different records types (A / AAAA)
Date: Thu, 27 Feb 2025 13:02:27 +0400
Message-ID: <20250227090227.180317-1-m@mpgn.dev>
This fixes an issue with dual stacking, when using a zone with both a V4 and V6
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>
---
src/PVE/Network/SDN/Dns/PowerdnsPlugin.pm | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/PVE/Network/SDN/Dns/PowerdnsPlugin.pm b/src/PVE/Network/SDN/Dns/PowerdnsPlugin.pm
index dae63d1..70b7b80 100644
--- a/src/PVE/Network/SDN/Dns/PowerdnsPlugin.pm
+++ b/src/PVE/Network/SDN/Dns/PowerdnsPlugin.pm
@@ -57,7 +57,7 @@ sub add_a_record {
my $fqdn = $hostname.".".$zone.".";
my $zonecontent = get_zone_content($plugin_config, $zone);
- my $existing_rrset = get_zone_rrset($zonecontent, $fqdn);
+ my $existing_rrset = get_zone_rrset($zonecontent, $fqdn, $type);
my $final_records = [];
for my $record (@{$existing_rrset->{records}}) {
@@ -133,7 +133,7 @@ sub del_a_record {
my $type = Net::IP::ip_is_ipv6($ip) ? "AAAA" : "A";
my $zonecontent = get_zone_content($plugin_config, $zone);
- my $existing_rrset = get_zone_rrset($zonecontent, $fqdn);
+ my $existing_rrset = get_zone_rrset($zonecontent, $fqdn, $type);
my $final_records = [ grep { $_->{content} ne $ip } $existing_rrset->{records}->@* ];
my $final_records_size = scalar($final_records->@*);
@@ -278,10 +278,10 @@ sub get_zone_content {
}
sub get_zone_rrset {
- my ($zonecontent, $name) = @_;
+ my ($zonecontent, $name, $type) = @_;
for my $rrset (@{$zonecontent->{rrsets}}) {
- return $rrset if $rrset->{name} eq $name;
+ return $rrset if $rrset->{name} eq $name and ($rrset->{type} eq $type);
}
return; # not found
}
--
2.48.1
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-13 16:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-27 9:02 [pve-devel] [PATCH] dns: powerdns: correctly handle different records types (A / AAAA) Matthieu Pignolet via pve-devel
2025-03-13 16:14 ` Stefan Hanreich
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