Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coredns: request must return both IPv6 and IPv4 for recordtype ANY #250

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/dns/coredns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,30 +275,33 @@ impl CoreDns {
}
};
if !resolved_ip_list.is_empty() {
if record_type == RecordType::A {
for record_addr in resolved_ip_list {
// Append matched IPv4 if request type is `A` or `ANY`.
if record_type == RecordType::A || record_type == RecordType::ANY {
for record_addr in &resolved_ip_list {
if let IpAddr::V4(ipv4) = record_addr {
req.add_answer(
Record::new()
.set_name(record_name.clone())
.set_ttl(86400)
.set_rr_type(RecordType::A)
.set_dns_class(DNSClass::IN)
.set_rdata(RData::A(ipv4))
.set_rdata(RData::A(*ipv4))
.clone(),
);
}
}
} else if record_type == RecordType::AAAA {
for record_addr in resolved_ip_list {
}
// Append matched IPv6 if request type is `AAAA` or `ANY`.
if record_type == RecordType::AAAA || record_type == RecordType::ANY {
for record_addr in &resolved_ip_list {
if let IpAddr::V6(ipv6) = record_addr {
req.add_answer(
Record::new()
.set_name(record_name.clone())
.set_ttl(86400)
.set_rr_type(RecordType::AAAA)
.set_dns_class(DNSClass::IN)
.set_rdata(RData::AAAA(ipv6))
.set_rdata(RData::AAAA(*ipv6))
.clone(),
);
}
Expand Down