IrineSistiana / mosdns

一个 DNS 转发器

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] prefer_ipv4 是否有bug,影响到了纯 ipv6 解析

without-yy opened this issue · comments

在提交之前,请确认

  • 我已经尝试搜索过 Issue ,但没有找到相关问题。
  • 我正在使用最新的 mosdns 版本(或者最新的 commit),问题依旧存在。
  • 我仔细看过 wiki 后仍然无法自行解决该问题。
  • 我非常确定这是 mosdns 核心的问题。(如果是通过第三方衍生软件使用 mosdns 核心,不确定问题源头时,请先向衍生软件开发者提交问题。)

mosdns 版本

v5.3.1

操作系统

openwrt

Bug 描述和复现步骤

日志没有报错信息, nslookup 6.ipw.cn 获取 ip 时有时无

Dnsmasq 已经将53转发到 mosdns 8338 ,并关闭了缓存

root@iStoreOS:~# nslookup 6.ipw.cn
Server:         127.0.0.1
Address:        127.0.0.1:53

Non-authoritative answer:

Non-authoritative answer:

root@iStoreOS:~# nslookup 6.ipw.cn
Server:         127.0.0.1
Address:        127.0.0.1:53

Non-authoritative answer:

Non-authoritative answer:
Name:   6.ipw.cn
Address: 2400:8905::f03c:94ff:fe1c:a95e

root@iStoreOS:~# nslookup 6.ipw.cn
Server:         127.0.0.1
Address:        127.0.0.1:53

Non-authoritative answer:

Non-authoritative answer:

root@iStoreOS:~# nslookup 6.ipw.cn
Server:         127.0.0.1
Address:        127.0.0.1:53

Non-authoritative answer:

Non-authoritative answer:

使用的配置文件

log:
  level: info
  file: "/var/log/mosdns.log"

# API 入口设置
api:
  http: "0.0.0.0:8339"

include: []

plugins:
  # 转发至 DNS 服务器
  - tag: forward_local
    type: forward
    args:
      concurrent: 3
      upstreams:
        - addr: "tls://223.5.5.5"
        - addr: "tls://223.6.6.6"
        - addr: "tls://1.12.12.12"
        - addr: "tls://120.53.53.53"

  - tag: main
    type: sequence
    args:
      - matches:
        - qtype 12
        exec: reject 3
      - exec: prefer_ipv4
      - exec: $forward_local

  # 启动 udp 服务器。
  - tag: udp_server
    type: udp_server
    args:
      entry: main
      listen: ":8338"

  # 启动 tcp 服务器。
  - tag: tcp_server
    type: tcp_server
    args:
      entry: main
      listen: ":8338"


### mosdns 的 log 记录

```txt
2024-05-13 02:06:35	INFO	unpacking entry	{"tag": "cn", "length": 10701, "file": "/var/mosdns/geoip_cn.txt"}
2024-05-13 02:06:35	INFO	unpacking entry	{"tag": "cn", "length": 75261, "file": "/var/mosdns/geosite_cn.txt"}
2024-05-13 02:06:35	INFO	unpacking entry	{"tag": "geolocation-!cn", "length": 24953, "file": "/var/mosdns/geosite_geolocation-!cn.txt"}
2024-05-13T02:06:36.313Z	INFO	loading plugin	{"tag": "forward_local", "type": "forward"}
2024-05-13T02:06:36.314Z	INFO	loading plugin	{"tag": "main", "type": "sequence"}
2024-05-13T02:06:36.314Z	INFO	loading plugin	{"tag": "udp_server", "type": "udp_server"}
2024-05-13T02:06:36.315Z	INFO	udp_server	udp server started	{"addr": "[::]:8338"}
2024-05-13T02:06:36.315Z	INFO	loading plugin	{"tag": "tcp_server", "type": "tcp_server"}
2024-05-13T02:06:36.315Z	INFO	tcp_server	tcp server started	{"addr": "[::]:8338", "tls": false}
2024-05-13T02:06:36.316Z	INFO	all plugins are loaded
2024-05-13T02:06:36.316Z	INFO	starting api http server	{"addr": "0.0.0.0:8339"}

可能是上游不稳定,这会测试几乎都是成功