diff --git a/Makefile b/Makefile index 4ed9e8e..ce2fe60 100644 --- a/Makefile +++ b/Makefile @@ -20,8 +20,8 @@ install: installdeps: # .deb/apt-get based distros - if test -x "$(APT_GET)"; then $(APT_GET) -y install perl-base perl-modules libnet-ip-perl libnet-dns-perl libio-socket-ip-perl iproute2 nftables tayga; fi + if test -x "$(APT_GET)"; then $(APT_GET) -y install perl-base perl-modules libnet-ip-perl libnet-dns-perl iproute2 nftables tayga; fi # .rpm/DNF/YUM-based distros - if test -x "$(DNF_OR_YUM)"; then $(DNF_OR_YUM) -y install perl perl-IPC-Cmd perl-Net-IP perl-Net-DNS perl-IO-Socket-IP perl-File-Temp iproute nftables; fi + if test -x "$(DNF_OR_YUM)"; then $(DNF_OR_YUM) -y install perl perl-IPC-Cmd perl-Net-IP perl-Net-DNS perl-File-Temp iproute nftables; fi # If necessary, try to install the TAYGA .rpm using dnf/yum. It is unfortunately not available in all .rpm based distros (in particular CentOS/RHEL). if test -x "$(DNF_OR_YUM)" && test ! -x "$(TAYGA)"; then $(DNF_OR_YUM) -y install tayga || echo "ERROR: Failed to install TAYGA using dnf/yum, the package is probably not included in your distro. Try enabling the EPEL repo and try again, or install TAYGA directly from source."; exit 1; fi diff --git a/clatd b/clatd index 8ded271..468c040 100755 --- a/clatd +++ b/clatd @@ -332,7 +332,6 @@ sub find_rfc7050_wka { sub get_plat_prefix { p("Performing DNS64-based PLAT prefix discovery (cf. RFC 7050)"); - require IO::Socket::IP; # needed by Net::DNS for querying IPv6 servers require Net::DNS; my @dns64_servers = split(",", cfg("dns64-servers") || ""); @@ -349,6 +348,16 @@ sub get_plat_prefix { $res = Net::DNS::Resolver->new(); } $res->dnssec(0); # RFC 7050 section 3 + + # Force use of AF_INET6 socket with IPv4-mapped addresses when querying + # an IPv4 name server (e.g., systemd-resolved listening on 127.0.0.53). + # This works around https://rt.cpan.org/Public/Bug/Display.html?id=158714 + # (and/or https://rt.cpan.org/Public/Bug/Display.html?id=132760). + $res->nameservers(map { + Net::IP->new($_)->version() == 4 ? "::ffff:$_" : $_; + } $res->nameservers); + d2("Nameservers after Net::DNS bug workaround: ", $res->nameservers); + my $pkt = $res->query('ipv4only.arpa', 'AAAA'); if(!$pkt) { d("No AAAA records was returned for 'ipv4only.arpa'");