Coder Social home page Coder Social logo

[BUG] 配置 mosdns 对指定范围的双栈域名立即屏蔽 AAAA 解析请求,但并未得到期待的结果 about mosdns HOT 7 CLOSED

irinesistiana avatar irinesistiana commented on May 23, 2024
[BUG] 配置 mosdns 对指定范围的双栈域名立即屏蔽 AAAA 解析请求,但并未得到期待的结果

from mosdns.

Comments (7)

IceCodeNew avatar IceCodeNew commented on May 23, 2024

光是这个问题的话我还能通过升级到 v0.23.0 版本解决,但是就像上面配置文件展示的那样,sequence 路由插件里存在下面这样两个匹配条件:
其中前一个可以改写成 if,if_and,exec,goto 的形式。但是第二个因为需要先尝试解析一次,才能匹配第二个匹配条件(if(response_has_bogus_ip)),因此只能写成 if,exec,if,exec,go 的形式。
这是我为什么要提出这个 issue 的主要原因,因为从结果来看我目前的这个写法根本不起效果。

        - if:
            - query_is_non_local_domain
          exec:
            - forward_nextdns
            - if:
                - match_aaaa
              exec:
                - _drop_response
          goto: _end

        - if:
            - query_is_local_domain
          exec:
            - with_fallback_cn_dns_serv
            - if:
                - response_has_bogus_ip
              exec:
                - _drop_response
          goto: _end

from mosdns.

IrineSistiana avatar IrineSistiana commented on May 23, 2024

看 debug log。match_aaaa 返回了什么 ?

from mosdns.

IrineSistiana avatar IrineSistiana commented on May 23, 2024

没理解你的问题。是 match_aaaa 没生效,还是什么?

from mosdns.

IceCodeNew avatar IceCodeNew commented on May 23, 2024

看 debug log。match_aaaa 返回了什么 ?

日志完全没有有用的信息,不然我一开始就会提供了。
下面是日志级别设置到 debug 级别的输出,我把整个目录复制了一份,调整了一下监听的端口复现问题。所以日志显示第一次启动失败了,但是除此以外就没有任何可以指示问题的输出。

time="2021-01-03T16:31:51+08:00" level=info msg="loading plugin my_server"
time="2021-01-03T16:31:51+08:00" level=info msg="loading plugin main_pipeline"
time="2021-01-03T16:31:51+08:00" level=info msg="loading plugin main_sequence"
time="2021-01-03T16:31:51+08:00" level=info msg="loading plugin cloak_hosts"
time="2021-01-03T16:31:51+08:00" level=info msg="loading plugin set_ecs"
time="2021-01-03T16:31:51+08:00" level=info msg="loading plugin with_fallback_cn_dns_serv"
time="2021-01-03T16:31:51+08:00" level=info msg="loading plugin plain_req_pku_and_tuna"
time="2021-01-03T16:31:51+08:00" level=info msg="loading plugin forward_ali_and_tx"
time="2021-01-03T16:31:51+08:00" level=info msg="loading plugin forward_nextdns"
time="2021-01-03T16:31:51+08:00" level=info msg="loading plugin query_is_local_domain"
time="2021-01-03T16:31:51+08:00" level=fatal msg="plugin my_server reported a fatal err: server exited with err: listen tcp 127.0.0.1:3000: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted."
time="2021-01-03T16:32:09+08:00" level=info msg="loading plugin my_server"
time="2021-01-03T16:32:09+08:00" level=info msg="loading plugin main_pipeline"
time="2021-01-03T16:32:09+08:00" level=info msg="loading plugin main_sequence"
time="2021-01-03T16:32:09+08:00" level=info msg="loading plugin cloak_hosts"
time="2021-01-03T16:32:09+08:00" level=info msg="loading plugin set_ecs"
time="2021-01-03T16:32:09+08:00" level=info msg="loading plugin with_fallback_cn_dns_serv"
time="2021-01-03T16:32:09+08:00" level=info msg="loading plugin plain_req_pku_and_tuna"
time="2021-01-03T16:32:09+08:00" level=info msg="loading plugin forward_ali_and_tx"
time="2021-01-03T16:32:09+08:00" level=info msg="loading plugin forward_nextdns"
time="2021-01-03T16:32:09+08:00" level=info msg="loading plugin query_is_local_domain"
time="2021-01-03T16:32:09+08:00" level=info msg="loading plugin query_is_non_local_domain"
time="2021-01-03T16:32:09+08:00" level=info msg="loading plugin query_is_ad_domain"
time="2021-01-03T16:32:09+08:00" level=info msg="loading plugin match_aaaa"
time="2021-01-03T16:32:09+08:00" level=info msg="loading plugin response_has_bogus_ip"
time="2021-01-03T16:32:09+08:00" level=info msg="all plugins are successfully loaded"
time="2021-01-03T16:32:09+08:00" level=debug msg="loaded plugins: [_block_with_servfail _query_is_common my_server _default_cache _drop_response _block_with_nxdomain _end with_fallback_cn_dns_serv plain_req_pku_and_tuna query_is_non_local_domain match_aaaa _no_ecs _qtype_A_AAAA _response_rcode_success main_pipeline main_sequence query_is_local_domain response_has_bogus_ip my_logger cloak_hosts set_ecs forward_ali_and_tx forward_nextdns query_is_ad_domain]"
time="2021-01-03T16:32:24+08:00" level=debug msg="HeapObjects: 446609 NumGC: 6 PauseTotalNs: 1016900, NumGoroutine: 9"
time="2021-01-03T16:32:39+08:00" level=debug msg="HeapObjects: 446628 NumGC: 6 PauseTotalNs: 1016900, NumGoroutine: 9"
time="2021-01-03T16:32:54+08:00" level=debug msg="HeapObjects: 446648 NumGC: 6 PauseTotalNs: 1016900, NumGoroutine: 9"
time="2021-01-03T16:33:09+08:00" level=debug msg="HeapObjects: 446674 NumGC: 6 PauseTotalNs: 1016900, NumGoroutine: 9"


没理解你的问题。是 match_aaaa 没生效,还是什么?

是的,感觉 match_aaaa 没生效,因为我几乎可以肯定域名解析过程中进入了 non_local_domain 的分支,但是对 www.facebook.com 解析返回了 IPv6 地址。

from mosdns.

IrineSistiana avatar IrineSistiana commented on May 23, 2024

你确定你的请求是 mosdns 处理的么.....

不管怎么样,只要收到请求,mosdns 就有 log 的,不可能漏。

from mosdns.

IceCodeNew avatar IceCodeNew commented on May 23, 2024

你确定你的请求是 mosdns 处理的么.....

不管怎么样,只要收到请求,mosdns 就有 log 的,不可能漏。

那确实很奇怪……我吸取上次的教训,这次是开了 ps 以后打开 nslookup 测试的。

nslookup

> set port=5454
> set server=127.0.0.2
> set type=a+aaaa
> www.facebook.com

from mosdns.

IceCodeNew avatar IceCodeNew commented on May 23, 2024

重启解决问题了……感觉大概是缓存的锅。

from mosdns.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.