海运的博客

dnsmasql设置客户端add-subnet edns ip缓存问题

发布时间:January 24, 2022 // 分类: // No Comments

路由上跑dnsmasq通过将客户端ip添加为edns ip转发到其它dns服务器时可以根据客户端ip做相应操作,dnmasq只有在设置add-subnet为固定ip段时才缓存,add-subnet=32时动态添加客户端ip为edns ip时不缓存,做了下修改可以缓存。

--- dnsmasq-2.86/src/edns0.c    2021-09-09 04:21:22.000000000 +0800
+++ dnsmasq-2.86-bak/src/edns0.c        2022-01-23 18:54:04.801336879 +0800
@@ -375,6 +375,7 @@
   if (cacheablep)
     *cacheablep = cacheable;
   
+  *cacheablep = 1;
   return len + 4;
 }
  
diff -urN dnsmasq-2.86/src/forward.c dnsmasq-2.86-bak/src/forward.c
--- dnsmasq-2.86/src/forward.c  2021-09-09 04:21:22.000000000 +0800
+++ dnsmasq-2.86-bak/src/forward.c      2022-01-23 18:58:25.020648204 +0800
@@ -596,7 +596,7 @@
       /* Get extended RCODE. */
       rcode |= sizep[2] << 4;
 
-      if (check_subnet && !check_source(header, plen, pheader, query_source))
+      if ( 0 && check_subnet && !check_source(header, plen, pheader, query_source))
        {
          my_syslog(LOG_WARNING, _("discarding DNS reply: subnet option mismatch"));
          return 0;
分类
最新文章
最近回复
  • 海运: 网络,找到相应的url编辑重发请求,firefox有此功能,其它未知。
  • knetxp: 用浏览器F12网络拦截或监听后编辑重发请求,修改url中的set为set_super,将POS...
  • Albert: 啊啊啊啊啊啊啊啊啊 我太激动了,终于好了英文区搜索了半天,翻遍了 pve 论坛没找到好方法,博...
  • jiangker: good, very helpful to me
  • fengfeng: N1 armbian 能有编译下内核吗。。我要开启can 不懂怎么操作
  • 1: 方法一ngtcp2要改下:./configure PKG_CONFIG_PATH=/usr/l...
  • 海运: 关闭服务器
  • 海风: override.battery.charge.low以及override.battery.r...
  • koldjf: 不能过滤
  • 杰迪武士: 此文甚好甚强巨,依照此文在树莓派2 + Rasbian上部署成功 感谢博主美文共赏