Git Product home page Git Product logo

lua-resty-dns-server's People

Contributors

selboo avatar vislee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lua-resty-dns-server's Issues

no options request causes exception

Issuing a dns request made with python scapy module got me this error:

runtime error: /usr/local/lib/lua/resty/dns/server.lua:245: bad argument #1 to 'lshift' (number expected, got nil)

ipv6 简写地址 多了一个 "0"

ipv6 地址简写 多了一个 "0"

完整地址: 2400:89c0:1022:0657:0000:0000:0152:0150 返回正常

dns:create_aaaa_answer("a.test.com", 100, "2400:89c0:1022:0657:0000:0000:0152:0150")

dig @127.0.0.1 a.test.com -p 2953 AAAA
a.test.com. 100 IN AAAA 2400:89c0:1022:657::152:150

简写地址: 2400:89c0:1022:657::152:150

dns:create_aaaa_answer("a.test.com", 100, "2400:89c0:1022:657::152:150")

dig @127.0.0.1 a.test.com -p 2953 AAAA
a.test.com. 100 IN AAAA 2400:89c0:1022:657::152:150:0

后面多了一个 "0"

@vislee

ipv6 不支持多个 AAAA 地址

dns:create_aaaa_answer("a.test.com", 100, "2400:89c0:1022:0657:0000:0000:0152:0150")
dns:create_aaaa_answer("a.test.com", 100, "2400:89c0:1022:0657:0000:0000:0152:0151")
dns:create_aaaa_answer("a.test.com", 100, "2400:89c0:1022:0657:0000:0000:0152:0152")

只返回 一条

dig @127.0.0.1 a.test.com -p 2953 AAAA
a.test.com. 100 IN AAAA 2400:89c0:1022:657::152:150

@vislee

the edns maybe not success

fengxin@fengxins-MacBook-Air ~ % dig -v DiG 9.9.3

start the lua-resty-dns-server on localhost

`fengxin@fengxins-MacBook-Air ~ % dig @localhost www.fengxin.com +client=159.138.88.145

; <<>> DiG 9.9.3 <<>> @localhost www.fengxin.com +client=159.138.88.145
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52034
;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;www.fengxin.com. IN A

;; AUTHORITY SECTION:
www.fengxin.com. 600 IN NS 8.8.8.8.

;; Query time: 6 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Jul 14 18:24:27 CST 2020
;; MSG SIZE rcvd: 69

fengxin@fengxins-MacBook-Air ~ % `

then this is ok!
and then lost +client paramter

`fengxin@fengxins-MacBook-Air ~ % dig @localhost www.fengxin.com

; <<>> DiG 9.9.3 <<>> @localhost www.fengxin.com
; (2 servers found)
;; global options: +cmd
;; connection timed out; no servers could be reached
fengxin@fengxins-MacBook-Air ~ %
`
then error log

2020/07/14 18:27:50 [error] 11074#1563068: *6 lua entry thread aborted: runtime error: ./commons/dns/server.lua:286: bad argument #1 to 'lshift' (number expected, got nil) stack traceback: coroutine 0: [C]: in function 'lshift' ./commons/dns/server.lua:286: in function 'decode_request' .../shareit-mcp-dns/model/service/resolution_dns_53_udp.lua:22: in main chunk, udp client: 127.0.0.1, server: 0.0.0.0:53

see the code with server.lua:286

local opt_code_hi, opt_code_lo = byte(self.buf, self.pos - 1, self.pos) local opt_code = lshift(opt_code_hi, 8) + opt_code_lo

the question ,I am lost the +client paramter when use dig, maybe maybu the dig think the edns paramter is null,so the server code 286 line opt_code_hi and opt_code_lo all is null?

do i need check the opt_code_hi and opt_code_lo is or not null in the server.lua

dig测试出错

按readme 中Synopsis 的说明搭建
执行dig @127.0.0.1 www.taobao.com 出错
出错信息

2019/11/28 18:53:11 [error] 503566#503566: *10 lua entry thread aborted: runtime error: /usr/local/openresty/lualib/resty/dns/server.lua:286: bad argument #1 to 'lshift' (number expected, got nil)
stack traceback:
coroutine 0:
	[C]: in function 'lshift'
	/usr/local/openresty/lualib/resty/dns/server.lua:286: in function 'decode_request'
	content_by_lua(dns.conf:60):16: in main chunk, udp client: 127.0.0.1, server: 0.0.0.0:53

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.