IrineSistiana / mosdns

一个 DNS 转发器
GNU General Public License v3.0
2.96k stars 336 forks source link

[Bug] v4.1.2 quic http3查询失败 #402

Closed lix5027 closed 2 years ago

lix5027 commented 2 years ago

在提交之前,请确认

mosdns 版本

v4.1.2-0-g259bb47

操作系统

openwrt-x86

Bug 描述和复现步骤

v4.1.2 使用dig查询上游quic的服务器,会报错 dig @192.168.188.14 www.baidu.com ;; Warning: ID mismatch: expected ID 18404, got 0 ;; Warning: ID mismatch: expected ID 18404, got 0

###################################################### 回退至原版本v3.8,quic正常 dig @192.168.188.12 www.baidu.com

; <<>> DiG 9.14.0 <<>> @192.168.188.12 www.baidu.com ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41775 ;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ; COOKIE: 5a0c346c58511e93 (echoed) ;; QUESTION SECTION: ;www.baidu.com. IN A

;; ANSWER SECTION: www.baidu.com. 60 IN CNAME www.a.shifen.com. www.a.shifen.com. 60 IN A 110.242.68.3 www.a.shifen.com. 60 IN A 110.242.68.4

;; Query time: 136 msec ;; SERVER: 192.168.188.12#53(192.168.188.12) ;; WHEN: Tue Jun 28 13:08:10 ;; MSG SIZE rcvd: 161

使用的配置文件

V4.12配置文件
log:
  level:                   debug
  file:                    './mosdns.log'

plugins:

  - tag: adguard
    type: forward
    args:
      upstream:
        - addr: "quic://dns-unfiltered.adguard.com:784" # 服务器地址
          trusted: true # 是否是可信服务器
      bootstrap:
        - "tls://1.1.1.1"
        - "https://223.5.5.5/dns-query"

  # main_sequence
  - tag: main_sequence
    type: sequence
    args:
      exec:

        - adguard
        - _return # 结束 

servers:
  - exec: main_sequence
#    max_concurrent_queries: 0  # 插件最大并发处理请求数。默认 0 代表无限制。
    timeout: 5        
    listeners:
      - protocol: udp
        addr: :53

      - protocol: tcp
        addr: :53

##############################################
同时正常quic的v3.8配置文件
log:
  level:                   error
  file:                    './mosdns.log'

plugin:

  - tag: main_server
    type: server
    args:
      entry:
        - main_sequence # 运行主执行序列
      max_concurrent_queries: 0  # 插件最大并发处理请求数。默认 0 代表无限制。
      timeout: 5                 # 请求处理超时时间。单位: 秒。默认: 5。
#
      server:
        - protocol:        udp
          addr:            '0.0.0.0:53'

  # doq 备用
  - tag: adguard
    type: forward
    args:
      upstream:
        - addr: "quic://dns-unfiltered.adguard.com:784" # 服务器地址
          trusted: true # 是否是可信服务器
      bootstrap:
        - "tls://1.1.1.1"
        - "https://223.5.5.5/dns-query"

  # main_sequence
  - tag: main_sequence
    type: sequence
    args:
      exec:
        - adguard
        - _return

mosdns 的 log 记录

V4.1.2 quic查询异常的debug

2022-06-28T13:05:00.157+0800    debug   dns_handler/server_handler.go:88        entry returned  {"query": "www.baidu.com. IN A 2 3 192.168.188.8", "status": "responded"}
2022-06-28T13:05:02.317+0800    debug   bundled_upstream/bundled_upstream.go:70 response received       {"query": "www.baidu.com. IN AAAA 3 4 192.168.188.8", "from": "quic://dns-unfiltered.adguard.com:784"}
2022-06-28T13:05:02.317+0800    debug   dns_handler/server_handler.go:88        entry returned  {"query": "www.baidu.com. IN AAAA 3 4 192.168.188.8", "status": "responded"}
2022-06-28T13:05:04.486+0800    debug   bundled_upstream/bundled_upstream.go:70 response received       {"query": "www.baidu.com. IN A 4 5 192.168.188.8", "from": "quic://dns-unfiltered.adguard.com:784"}
2022-06-28T13:05:04.487+0800    debug   dns_handler/server_handler.go:88        entry returned  {"query": "www.baidu.com. IN A 4 5 192.168.188.8", "status": "responded"}
2022-06-28T13:05:06.641+0800    debug   bundled_upstream/bundled_upstream.go:70 response received       {"query": "www.baidu.com. IN AAAA 5 6 192.168.188.8", "from": "quic://dns-unfiltered.adguard.com:784"}
2022-06-28T13:05:06.641+0800    debug   dns_handler/server_handler.go:88        entry returned  {"query": "www.baidu.com. IN AAAA 5 6 192.168.188.8", "status": "responded"}
2022-06-28T13:06:50.313+0800    warn    dns_handler/server_handler.go:86        entry returned an err   {"query": "cmmyjkzd.nodelist.xyz. IN A 51461 7 127.0.0.1", "error": "reading response from quic://dns-unfiltered.adguard.com:784: Application error 0x0"}
lix5027 commented 2 years ago

另外这是测试http3的,v4也不行 同tag在v3.8下可以反馈结果

######################################### V4 的http3 dig dig @192.168.188.14 www.baidu.com

; <<>> DiG 9.14.0 <<>> @192.168.188.14 www.baidu.com ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 64076 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION: ;www.baidu.com. IN A

;; Query time: 5002 msec ;; SERVER: 192.168.188.14#53(192.168.188.14) ;; WHEN: Tue Jun 28 16:34:01 ;; MSG SIZE rcvd: 31

#############################

v3.8的http3 dig dig @192.168.188.12 www.baidu.com

; <<>> DiG 9.14.0 <<>> @192.168.188.12 www.baidu.com ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 13496 ;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ; COOKIE: b3f1e8449b127246 (echoed) ;; QUESTION SECTION: ;www.baidu.com. IN A

;; ANSWER SECTION: www.baidu.com. 36 IN CNAME www.a.shifen.com. www.a.shifen.com. 36 IN A 110.242.68.4 www.a.shifen.com. 36 IN A 110.242.68.3

;; Query time: 6 msec ;; SERVER: 192.168.188.12#53(192.168.188.12) ;; WHEN: Tue Jun 28 16:33:54 ;; MSG SIZE rcvd: 161

IrineSistiana commented 2 years ago

quic: adg dnsproxy 的 bug。等下个版本mosdns就行了。


不是所有doh都支持http3,http3很新。

lix5027 commented 2 years ago

quic: adg dnsproxy 的 bug。等下个版本mosdns就行了。

不是所有doh都支持http3,http3很新。

是同一个测试服务器,http3, v3.8版本正常dig,v4版本无反馈内容 用的是fast_forward

IrineSistiana commented 2 years ago

阿里dns确实不支持http3。如果你确定v3.8连通了,可能是bug。