1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Takes advantage of freshly implemented ipOps.get_first_ip()

This commit is contained in:
nnposter
2018-08-05 21:11:48 +00:00
parent 57f9a46f73
commit 3fc825b15e

View File

@@ -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