From 3fc825b15e203540e4bc59816cdf44b3add08c57 Mon Sep 17 00:00:00 2001 From: nnposter Date: Sun, 5 Aug 2018 21:11:48 +0000 Subject: [PATCH] Takes advantage of freshly implemented ipOps.get_first_ip() --- nselib/dns.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nselib/dns.lua b/nselib/dns.lua index 91ccee9fd..5caac382a 100644 --- a/nselib/dns.lua +++ b/nselib/dns.lua @@ -1414,8 +1414,7 @@ function addClientSubnet(pkt,Z,subnet) -- Per RFC 7871, section 6: -- Address must have all insignificant bits zeroed out and insignificant bytes -- must be trimmed off. (/24 IPv4 address is submitted as 3 octets, not 4.) - local addr = ipOps.ip_to_bin(subnet.address) - addr = ipOps.bin_to_ip(addr:sub(1, mask) .. ("0"):rep(#addr - mask)) + local addr = ipOps.get_first_ip(subnet.address, mask) addr = ipOps.ip_to_str(addr):sub(1, (mask + 7) // 8) local data = bin.pack(">SCCA", family, mask, scope_mask, addr) local opt = bin.pack(">SS",code, #data) .. data