Code Monkey home page Code Monkey logo

Comments (1)

wsgtrsys avatar wsgtrsys commented on July 22, 2024

找到原因了,不是dnsmasq的问题。
由于上级是用广电的dns服务器。
我在内网使用了ipv6双栈。
出现的问题是,就是偶然、随机的打不开网页,提示是dns不能解析。
用wireshack抓包发现:打开网页时,windows会发现两个dns请求,一个是请求AAAA记录。第二个是A记录。
因为很多域名是没有ipv6地址的,于是dns先返回一个NXDOMAIN AAAA,再返回一个正常的A记录。于是浏览器误以为没有这个域名了。
开始以为是dnsmasq的问题,放狗搜索,了解 dnsmasq已经解决这个bug.
有关链接在:
NODATA-reply on AAAA-CNAME-queries where no A-record exists
打开tcpdump,直接抓上级服务器返回的dns包。结果发现,是上级dns的原因。因为上级dns直接返回了NXDOMAIN的AAAA记录,下级的dnsmasq当然是照单全转了。
找到了病因,就要从dnsmsq中下手了,办法就是:把dnsmasq 返回的NXDOMAIN AAAA记录,修改为NODATA。让windows不再误会。
看源码看了n久。最终。
修改src/forward.c,在process_reply函数中

if (extract_addresses(header, n, daemon->namebuff, now, sets, is_sign, check_rebind, no_cache, cache_secure, &doctored))
前面添加:
if (RCODE(header) == NXDOMAIN &&
extract_request(header, n, daemon->namebuff, NULL) == F_IPV6 )
{
munged = 1;
header->hb3 |= HB3_AA;
SET_RCODE(header, NOERROR);
cache_secure = 0;
}
大功告成。

from dnsmasq.

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.