MetaCubeX / mihomo

A simple Python Pydantic model for Honkai: Star Rail parsed data from the Mihomo API.
https://wiki.metacubex.one
MIT License
17.04k stars 2.69k forks source link

[Bug] UDP DNS返回结果超过512字节时用TCP重新发起查询无法正常返回结果 #1117

Closed AllForLandlord closed 8 months ago

AllForLandlord commented 8 months ago

Verify steps

Mihomo version

alpha-gb3db113

What OS are you seeing the problem on?

Linux

Mihomo config

dns:
  enable: true
  ipv6: false
  enhanced-mode: redir-host
  listen: 0.0.0.0:7874
  nameserver:
  - 223.5.5.5
  default-nameserver:
  - 223.5.5.5
  - 119.29.29.29
  use-hosts: true

Mihomo log

2024-03-19 09:32:09 level=debug msg="[DNS] www.ai2moe.org --> [] A from udp://223.5.5.5:53"
2024-03-19 09:32:09 level=debug msg="[DNS] resolve www.ai2moe.org from udp://223.5.5.5:53"
2024-03-19 09:32:09 level=debug msg="[DNS] cache hit for www.ai2moe.org., expire at 2024-03-19 01:32:10"
2024-03-19 09:32:09 level=debug msg="[DNS] www.ai2moe.org --> [] A from udp://223.5.5.5:53"
2024-03-19 09:32:09 level=debug msg="[DNS] www.ai2moe.org --> [] HTTPS from udp://223.5.5.5:53"
2024-03-19 09:32:09 level=debug msg="[DNS] resolve www.ai2moe.org from udp://223.5.5.5:53"
2024-03-19 09:32:09 level=debug msg="[DNS] cache hit for www.ai2moe.org., expire at 2024-03-19 01:32:09"
2024-03-19 09:32:09 level=debug msg="[DNS] resolve www.ai2moe.org from udp://223.5.5.5:53"

Description

Describe the Bug

在OpenClash issue提出了此问题,V大表示是内核的问题:https://github.com/vernesong/OpenClash/issues/3811

详见:https://www.v2ex.com/t/1024280 223.5.5.5在进行UDP DNS查询返回A记录过多超过512字节后会重新用TCP进行DNS查询,而在开启openclash(nameserver只用223.5.5.5)的情况下无法正常进行DNS查询。复现网址:www.ai2moe.org。 表现结果为chrome浏览器访问该网站报错DNS_PROBE_FINISHED_NXDOMAIN

而关掉openclash用命令dig +tcp @223.5.5.5 -p 53 www.ai2moe.org返回结果正常。后在PC上手动设置DNS用223.5.5.5,可以正常访问www.ai2moe.org。而开了openclash就无法正常访问。

所以我推测可能openclash或者可能是meta内核对于这种情况的DNS查询有bug,而V大表示是内核的问题。

To Reproduce

openclash用meta内核,在redir-host模式下,DNS设置中启用自定义上游 DNS 服务器,nameserver只勾选223.5.5.5,fallback关掉。 访问www.ai2moe.org,发现无法访问,chrome浏览器报错DNS_PROBE_FINISHED_NXDOMAIN

AllForLandlord commented 8 months ago

@wwqgtxx 大佬,感谢commit,我刚刚把openclash meta内核升级到alpha-g9c08e93,然后再测试了访问https://www.ai2moe.org/,依旧报错DNS_PROBE_FINISHED_NXDOMAIN

下面是debug的DNS日志:

1

如果需要什么测试结果,请随时回复。

wwqgtxx commented 8 months ago

试试 https://github.com/MetaCubeX/mihomo/commit/d56a439a741ec8762409598bc927390cdf67c5fa

AllForLandlord commented 8 months ago

试试 d56a439

测试下来现在可以正常解析了!感谢修复!

下面是日志:

1