lua-resty-dns-server icon indicating copy to clipboard operation
lua-resty-dns-server copied to clipboard

no options request causes exception

Open andreaf74 opened this issue 6 years ago • 5 comments

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)

andreaf74 avatar Jul 19 '19 14:07 andreaf74

Thank you for your issue. You can use the release version.

@selboo can you fix this issue.

vislee avatar Jul 20 '19 09:07 vislee

fix in a7fc349 . @andreaf74 @selboo If you use the subnet feature, try again. @andreaf74

vislee avatar Jul 21 '19 06:07 vislee

Hello, I've tried the subnet feature branch but I got the same error (only on a different line) this time it happens even using a simple dig:

2019/07/23 13:51:25 [error] 8052#8052: *1250 lua entry thread aborted: runtime error: /usr/local/lib/lua/resty/dns/server.lua:286: bad argument #1 to 'lshift' (number expected, got nil) stack traceback: coroutine 0: [C]: in function 'lshift' /usr/local/lib/lua/resty/dns/server.lua:286: in function 'decode_request' content_by_lua(nginx.conf:297):38: in main chunk, udp client: xxxxxxx:53 , server: xxxxxx:53

I believe the problem is because the code doesn't actually check the RDLEN size. (line 278) If it is 0 it shouldn't go on with decoding.. I'll try to post a fix later..

Bye

andreaf74 avatar Jul 23 '19 12:07 andreaf74

@andreaf74 Can you provide the version of dig, and parameters? In theory it can't happen, I guess it maybe need to second recv.

vislee avatar Jul 24 '19 01:07 vislee

按readme 中Synopsis 的说明搭建 执行 nslookup www.taobao.com 127.0.0.1 不会报错 而执行dig @127.0.0.1 www.taobao.com 出错

dig -v DiG 9.10.6

出错信息

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'

zengjinji avatar Nov 28 '19 11:11 zengjinji