dae icon indicating copy to clipboard operation
dae copied to clipboard

[Bug Report] `dial_mode == ip` 时按sip/mac分流的dns解析结果会因为dns cache的存在而出错

Open ppdragon16 opened this issue 5 months ago • 4 comments

Checks

  • [x] I have searched the existing issues
  • [x] I have read the documentation
  • [ ] Is it your first time sumbitting an issue

Current Behavior

dns cache设计为全局单例,并没有为不同的dialer或group创建分离的dns cache。

考虑如下配置,因为dns cache的存在,客户机X有可能拿到hk节点解析的IP地址而非tw。

global {
    dial_mode: ip
    ...
}

dns {
  upstream {
    proxy_dns: 'tcp://dns.google:53'
  }
  routing {
    request {
      qname(geosite:gfw) -> proxy_dns
      fallback: asis
    }
}
routing {
  mac('aa:bb:cc:dd:ee:ff') -> tw # 客户机 X
  fallback: hk
}

Expected Behavior

要完美解决这个问题可能会增加代码复杂度,比如需要跟踪dns解析的结果是从哪个dialer过来的。

较为简单的办法可以把选择权交给用户,比如支持在配置文件中禁用dns cache,并在文档中阐述其利弊。 或者不用增加配置项,直接当·dial_mode == ip·时禁用dns cache。

注:当dns cache被禁用时,不修改ttl。

Steps to Reproduce

如上配置dae,找俩客户机分别访问一些使用CDN的网站。

Environment

  • Dae version (use dae --version): https://github.com/daeuniverse/dae/pull/865 本地编译版本

  • OS (e.g cat /etc/os-release): ImmortalWrt 24.10.1

  • Kernel (e.g. uname -a): 6.6.86

Anything else?

No response

ppdragon16 avatar Jul 20 '25 08:07 ppdragon16

Thanks for opening this issue!

dae-prow[bot] avatar Jul 20 '25 08:07 dae-prow[bot]

一个更简单的方案:为DnsCache加上src addr/mac。

ppdragon16 avatar Jul 21 '25 09:07 ppdragon16

上面方案的一个实现:https://github.com/ppdragon16/dae/tree/dns-cache-per-client

目前运行24小时没出问题。CA大重构之前自用。

ppdragon16 avatar Jul 22 '25 09:07 ppdragon16

fork了CA大佬的dirty branch,加了merge answers的逻辑,希望能解决这个问题。

https://github.com/ppdragon16/dae/commits/dirty

ppdragon16 avatar Aug 02 '25 13:08 ppdragon16