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

Enable IPv6 on all zones if available #176

Closed
wants to merge 2 commits into from
Closed
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
28 changes: 26 additions & 2 deletions lib/NP/Model/DnsRoot.pm
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,35 @@ sub populate_country_zones {
if (my $entries = $zone->active_servers('v6')) {
@$entries = shuffle(@$entries);

# for now just put all IPv6 servers in the '2' zone
# add all servers to the non-numbered "NTP" zone
(my $pgeodns_group = "${name}") =~ s/\.$//;
push @{$data->{$name}->{aaaa}}, $_ for @$entries;

# Historically, only '2' has had ipv6 records, so we ALSO put all
# of the records there, for anyone who is relying on 2 having a
# large number of entries (Who would do such a crazy thing?)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's one of the "vendor zones" that needs this. The bits somewhere to specify the zone is an "sntp" or "ntp" zone is supposed to do something appropriate with this.

For regular ntp zones (the defaults?) we shouldn't duplicate between two numbered zones.

(my $pgeodns_group = "2.${name}") =~ s/\.$//;
push @{$data->{$pgeodns_group}->{aaaa}}, $_ for @$entries;
}

# Smear the rest of the IPv6 records over the remaining zones,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather have IPv4 and IPv6 work the same; except .. again, we need a toggle to not swap the behavior for the "vendor zones". (Some of them might not handle IPv6 records and expect 0.x to not have them, for example, and many of them might not have contact information or even any active maintenance or support).

# up to 4 records per zone.
my $maxrecords = 4;
my $recordcount = 0;
my $currentzone = 0;
my @zones = ("0.", "1.", "3.");
while (@entries && $recordcount < $maxrecords) {
(my $pgeodns_group = @zones[$currentzone++].$name) =~ s/\.$//;
# If we've run out of zones, reset back to zero, and increase
# the count of records in the zone.
if (!@zones[$currentzone]) {
$currentzone = 0;
$recordcount++;
}
# Add the next entry to this zone.
my $e = shift @$entries;
push @{$data->{$pgeodns_group}->{aaaa}}, $e;
}
}
}
}

Expand Down