Skip to content

"localhost" dns always returns both ipv4 and ipv6 regardless of queryStrategy! #4302

@patterniha

Description

@patterniha

Integrity requirements

  • I confirm that I have read the documentation, understand the meaning of all the configuration items I wrote, and did not pile up seemingly useful options or default values.
  • I provided the complete config and logs, rather than just providing the truncated parts based on my own judgment.
  • I searched issues and did not find any similar issues.
  • The problem can be successfully reproduced in the latest Release

Description

test version: v25.1.1
test os: android, windows
according to https://xtls.github.io/config/dns.html#dnsobject
after xray-core v1.8.6 built-in dns server support "global" and "per server" queryStrategy.
so according to the documentation,
for example if "global queryStrategy" is UseIP and "dns server 1 queryStrategy" is UseIPv4,
dns server 1 should only return ipv4 and final result should only contain ipv4(if for example
we have only server 1 dns server)
but for example if we only have "localhost" dns with UseIPv4 queryStrategy and run "host cloudflare.com" command in terminal
result incorrectly contains both ipv4 and ipv6!!!

*** instead of "localhost" if we use other types of dns (udp,tcp,doh,...) it works correctly and dns query result contains only ipv4.

example config with "localhost" dns which incorrectly returns both IPv4 and ipv6: https://raw.githubusercontent.com/patterniha/xray_configs/refs/heads/main/buggy_localhost_dns_example.json

example config with "udp" dns which correctly only returns ipv4: https://raw.githubusercontent.com/patterniha/xray_configs/refs/heads/main/bug_free_udp_dns_example.json

Client config

buggy config and bug-free config link is in Description

Server config

my example config is serverless config.

Client log

no need, just run "host cloudflare.com" in terminal to see the result incorrectly contains both ipv4 and ipv6.

Server log

no need

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions