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