Comparison

net/dns.lua @ 4422:c25dee24623f

s2smanager, net.dns: Fix handling for NXNAME and SRV target of "."
author Florian Zeitz <florob@babelmonkeys.de>
date Wed, 26 Oct 2011 02:03:33 +0200
parent 4400:ac651265766c
child 5266:5c3a3ef6b769
comparison
equal deleted inserted replaced
4421:971a66627f7a 4422:c25dee24623f
356 356
357 function resolver:name() -- - - - - - - - - - - - - - - - - - - - - - name 357 function resolver:name() -- - - - - - - - - - - - - - - - - - - - - - name
358 local remember, pointers = nil, 0; 358 local remember, pointers = nil, 0;
359 local len = self:byte(); 359 local len = self:byte();
360 local n = {}; 360 local n = {};
361 if len == 0 then return "." end -- Root label
361 while len > 0 do 362 while len > 0 do
362 if len >= 0xc0 then -- name is "compressed" 363 if len >= 0xc0 then -- name is "compressed"
363 pointers = pointers + 1; 364 pointers = pointers + 1;
364 if pointers >= 20 then error('dns error: 20 pointers'); end; 365 if pointers >= 20 then error('dns error: 20 pointers'); end;
365 local offset = ((len-0xc0)*0x100) + self:byte(); 366 local offset = ((len-0xc0)*0x100) + self:byte();