From: Matthieu Pignolet via pve-devel <pve-devel@lists.proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Matthieu Pignolet <m@mpgn.dev>
Subject: [pve-devel] [PATCH] dns: powerdns: correctly handle different records types (A / AAAA)
Date: Thu, 27 Feb 2025 13:02:27 +0400 [thread overview]
Message-ID: <mailman.604.1740647417.293.pve-devel@lists.proxmox.com> (raw)
[-- 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
next reply other threads:[~2025-02-27 9:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-27 9:02 Matthieu Pignolet via pve-devel [this message]
2025-03-13 16:14 ` Stefan Hanreich
2025-03-24 17:01 ` Matthieu Pignolet via pve-devel
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=mailman.604.1740647417.293.pve-devel@lists.proxmox.com \
--to=pve-devel@lists.proxmox.com \
--cc=m@mpgn.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal