Hi, thanks for hev-socks5-tunnel!
I think mapdns is currently (as of version 2.14.4) IPv4-only, even though the tunnel itself supports dual stack. This becomes a problem on IPv6-first / IPv6-only / NAT64 networks.
The tunnel itself seems to support IPv4/IPv6 dual stack, but mapdns appears to only support IPv4 synthetic mapping:
- It only synthesizes
A answers, not AAAA.
- It only treats the mapped DNS endpoint as special when the destination address is IPv4.
Because of that, on ipv6-heavy networks, DNS/app flows may not work correctly through mapdns.
1. hev_mapped_dns_handle() only handles QTYPE=A
In src/hev-mapped-dns.c:
- it checks
QTYPE == 1 and QCLASS == 1
- it writes an answer with:
- type
A
RDLENGTH = 4
- a 32-bit mapped IPv4 address
So for an AAAA query, it does not create a mapping and returns a response with ANCOUNT = 0.
2. mapdns interception only triggers for ipv4 destination addresses
In src/hev-socks5-tunnel.c, udp_recv_handler():
if (dns && addr->type == IPADDR_TYPE_V4) {
int faddr = hev_config_get_mapdns_address ();
int fport = hev_config_get_mapdns_port ();
if (fport == port && faddr == ip_2_ip4 (addr)->addr) {
udp_recv (pcb, dns_recv_handler, dns);
return;
}
}
So mapdsn path is only activated for IPv4-addressed DNS traffic.
Is this the intended behavior? If not I'll be happy to fix it (I am working on a proxy app and in a specific region of the country mobile ISPs only use ipv6 or so it seems).
Hi, thanks for
hev-socks5-tunnel!I think
mapdnsis currently (as of version 2.14.4) IPv4-only, even though the tunnel itself supports dual stack. This becomes a problem on IPv6-first / IPv6-only / NAT64 networks.The tunnel itself seems to support IPv4/IPv6 dual stack, but
mapdnsappears to only support IPv4 synthetic mapping:Aanswers, notAAAA.Because of that, on ipv6-heavy networks, DNS/app flows may not work correctly through
mapdns.1.
hev_mapped_dns_handle()only handlesQTYPE=AIn
src/hev-mapped-dns.c:QTYPE == 1andQCLASS == 1ARDLENGTH = 4So for an
AAAAquery, it does not create a mapping and returns a response withANCOUNT = 0.2.
mapdnsinterception only triggers for ipv4 destination addressesIn
src/hev-socks5-tunnel.c,udp_recv_handler():So
mapdsnpath is only activated for IPv4-addressed DNS traffic.Is this the intended behavior? If not I'll be happy to fix it (I am working on a proxy app and in a specific region of the country mobile ISPs only use ipv6 or so it seems).