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] client_ip匹配ipv6 cidr未按预期工作 #784

Open
4 tasks done
yuukh opened this issue Jan 8, 2024 · 2 comments
Open
4 tasks done

[Bug] client_ip匹配ipv6 cidr未按预期工作 #784

yuukh opened this issue Jan 8, 2024 · 2 comments

Comments

@yuukh
Copy link

yuukh commented Jan 8, 2024

在提交之前,请确认

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

mosdns 版本

v5.3.1

操作系统

debian

Bug 描述和复现步骤

mosdns的client_ip匹配器在匹配ipv6 cidr无法正常工作。复现方式:使用如下配置,通过mosdns的局域网ipv6地址(如fe80::xxxx:xxxx:xxxx:xxxx)解析”www.google.com“,日志中的client为fe80::e2ef:2ff:fe91:bebc属于fe80::/32,但日志不存在query from fakeip 1,故未进入fakeip_sequence;日志中有query from main 2;可以确定clent_ip未成功匹配,未按预期工作

使用的配置文件

log:
  level: info

plugins:
  - tag: forward_fakeip
    type: forward
    args:
      upstreams:
        - addr: "tls://223.5.5.5"

  - tag: fakeip_sequence
    type: sequence
    args:
      - exec: query_summary query from fakeip 1
      
      - exec: $forward_fakeip
      - exec: accept

  - tag: main_sequence
    type: sequence
    args:
      - exec: query_summary query from main 1

      - matches: 
          - client_ip fe80::/32
        exec: goto fakeip_sequence

      - exec: query_summary query from main 2

      - exec: $forward_fakeip

  - tag: udp_server
    type: udp_server
    args:
      entry: main_sequence
      listen: 0.0.0.0:53

  - tag: tcp_server
    type: tcp_server
    args:
      entry: main_sequence
      listen: 0.0.0.0:53

mosdns 的 log 记录

2024-01-08T01:22:00.097Z	INFO	main_sequence.r6	query from main 2	{"uqid": 1, "client": "fe80::35e0:2ff:fe91:15f8%eth0", "qname": "www.google.com.", "qtype": 28, "qclass": 1, "rcode": 0, "elapsed": "315.171641ms"}
2024-01-08T01:22:00.098Z	INFO	main_sequence.r2	query from main 1	{"uqid": 1, "client": "fe80::35e0:2ff:fe91:15f8%eth0", "qname": "www.google.com.", "qtype": 28, "qclass": 1, "rcode": 0, "elapsed": "316.086599ms"}
@wzy105
Copy link

wzy105 commented Feb 11, 2024

同样情况:

  • tag: khd
    type: sequence
    args:
    - matches:
    - client_ip 192.168.3.2/32
    exec: $forward_local

  • tag: has_resp_sequence
    type: sequence
    args:
    - matches: qname $ddnslist
    exec: $modify_ddns_ttl
    - matches: "!qname $ddnslist"
    exec: $modify_ttl
    - matches: has_resp
    exec: accept

  • tag: main_sequence
    type: sequence
    args:
    - exec: $khd
    - exec: jump has_resp_sequence
    目的:客户端 192.168.3.2 。用forward_local查询
    结果:不起作用。。。

@Sereinfy
Copy link

    • client_ip 192.168.3.2/32
      Dnsmasq的原因
      试试用mosdns 监听53 。

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

3 participants