Comparison

net/dns.lua @ 8163:a55eb6c3b45c

net.dns: Prevent answers from immediately expiring even if TTL=0 (see #919)
author Kim Alvefur <zash@zash.se>
date Tue, 13 Jun 2017 16:36:47 +0200
parent 8151:2c65f8be38aa
child 8164:a395957f3bf2
comparison
equal deleted inserted replaced
8160:5566f82ffea4 8163:a55eb6c3b45c
511 rr.type = dns.type[self:word()] or rr.type; 511 rr.type = dns.type[self:word()] or rr.type;
512 rr.class = dns.class[self:word()] or rr.class; 512 rr.class = dns.class[self:word()] or rr.class;
513 rr.ttl = 0x10000*self:word() + self:word(); 513 rr.ttl = 0x10000*self:word() + self:word();
514 rr.rdlength = self:word(); 514 rr.rdlength = self:word();
515 515
516 rr.tod = self.time + rr.ttl; 516 rr.tod = self.time + math.min(rr.ttl, 1);
517 517
518 local remember = self.offset; 518 local remember = self.offset;
519 local rr_parser = self[dns.type[rr.type]]; 519 local rr_parser = self[dns.type[rr.type]];
520 if rr_parser then rr_parser(self, rr); end 520 if rr_parser then rr_parser(self, rr); end
521 self.offset = remember; 521 self.offset = remember;