Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] drop_resp 只丢弃 dns返回报文里的 ipv4结果吗?ipv6不丢弃? #836

Open
4 tasks done
muziling opened this issue Sep 2, 2024 · 3 comments
Open
4 tasks done

Comments

@muziling
Copy link

muziling commented Sep 2, 2024

在提交之前,请确认

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

mosdns 版本

5.3.3

操作系统

openwrt

Bug 描述和复现步骤

只配置 matches: resp_ip 127.0.0.1 0.0.0.0 , 会返回包括 ::1 的 ipv4+ipv6结果

# nslookup anitabi.cn 127.0.0.1#65353
Server:		127.0.0.1
Address:	127.0.0.1#65353

Name:      anitabi.cn
Address 1: 172.67.148.20
Address 2: 104.21.71.189
Address 3: ::1

配置 matches: resp_ip 127.0.0.1 0.0.0.0 ::1 ,会返回包括 :: 两个冒号的 ipv4+ipv6结果

# nslookup anitabi.cn 127.0.0.1#65353
Server:		127.0.0.1
Address:	127.0.0.1#65353

Name:      anitabi.cn
Address 1: 172.67.148.20
Address 2: 104.21.71.189
Address 3: ::

期望也丢弃异常的ipv6解析结果

使用的配置文件

log:
  level: warn
  file: stdout

api:
  http: "0.0.0.0:65355"

include: []

plugins:
  - tag: forward_cn_dns
    type: forward
    args:
      upstreams:
        - addr: 58.22.96.66

  - tag: forward_cn_dns2
    type: forward
    args:
      upstreams:
        - addr: 218.104.128.106

  - tag: forward_cn_dns3
    type: forward
    args:
      upstreams:
        - addr: 223.5.5.5

  - tag: cn_sequence3
    type: sequence
    args:
      - exec: $forward_cn_dns3
      - matches: resp_ip 127.0.0.1 0.0.0.0 ::1
        exec: drop_resp

  - tag: cn_sequence2
    type: sequence
    args:
      - exec: $forward_cn_dns2
      - matches: resp_ip 127.0.0.1 0.0.0.0 ::1
        exec: $forward_cn_dns3

  - tag: cn_sequence
    type: sequence
    args:
      - exec: $forward_cn_dns
      - matches: resp_ip 127.0.0.1 0.0.0.0 ::1
        exec: $cn_sequence2

  - tag: forward_foreign_dns
    type: forward
    args:
      upstreams:
        - addr: '1.1.1.1'

  - tag: foreign_sequence
    type: sequence
    args:
      - exec: $forward_foreign_dns
      - matches: resp_ip 1.1.1.1
        exec: $cn_sequence

  - tag: cn_udp_server
    type: udp_server
    args:
      entry: cn_sequence
      listen: ":65353"

  - tag: foreign_udp_server
    type: udp_server
    args:
      entry: foreign_sequence
      listen: ":65354"

mosdns 的 log 记录

No response

@yyysuo
Copy link

yyysuo commented Sep 12, 2024

1:58.22.96.66 218.104.128.106 223.5.5.5这3个dns并发不行吗,你这样写,真遇到异常的域名,有机率要依次查3个dns,每个dns返回的结果不一样,结果很不好预测;
2:这种会污染的dns还是别用了吧,单独223就好了。
3:nslookup一个域名,v4和v6是2次查询,分别查的,没有prefer的情况下,互不影响,有prefer,一个域名可能要查4次。

@muziling
Copy link
Author

并发查询没用呀,并发查询是配置在同一个sequence 里, drop_resp 后就3个DNS一起被丢弃了

@yyysuo
Copy link

yyysuo commented Sep 12, 2024

并发查询没用呀,并发查询是配置在同一个sequence 里, drop_resp 后就3个DNS一起被丢弃了

确实。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants