1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-28 18:39:03 +00:00

Precalc/reuse some tables and values

This commit is contained in:
dmiller
2020-11-30 17:59:18 +00:00
parent d3ef26b229
commit c8fdcd80b5
3 changed files with 13 additions and 9 deletions

View File

@@ -62,6 +62,7 @@ DHCP6.OptionTypes = {
OPTION_CLIENT_FQDN = 0x27,
}
local DHCP6_EPOCH = os.time({year=2000, day=1, month=1, hour=0, min=0, sec=0})
-- DHCP6 options
DHCP6.Option = {
@@ -110,7 +111,7 @@ DHCP6.Option = {
type = DHCP6.OptionTypes.OPTION_CLIENTID,
duid = duid or 1,
hwtype = hwtype or 1,
time = time or os.time() - os.time({year=2000, day=1, month=1, hour=0, min=0, sec=0}),
time = time or os.time() - DHCP6_EPOCH,
mac = mac,
}
setmetatable(o, self)
@@ -131,7 +132,7 @@ DHCP6.Option = {
end
opt.hwtype, opt.time = string.unpack(">I2I4", data, pos)
opt.mac = data:sub(pos)
opt.time = opt.time + os.time({year=2000, day=1, month=1, hour=0, min=0, sec=0})
opt.time = opt.time + DHCP6_EPOCH
return opt
end,