mirror of
https://github.com/nmap/nmap.git
synced 2025-12-24 00:19:01 +00:00
Skip lease time in DHCP client packets by default
The old behavior (of using the default time of 1s) did not allow constructing packets without this option, which in turn resulted in (1) DHCPINFORM packets being non-compliant with RFC 2131 and (2) DHCP discovery scripts potentially receiving non-default IP lease information. Fixes #2197
This commit is contained in:
@@ -396,7 +396,7 @@ end
|
||||
--@param overrides [optional] A table of overrides. If a field in the table matches a field in the DHCP
|
||||
-- packet (see rfc2131 section 2 for a list of possible fields), the value in the table
|
||||
-- will be sent instead of the default value.
|
||||
--@param lease_time [optional] The lease time used when requestint an IP. Default: 1 second.
|
||||
--@param lease_time [optional] The lease time used when requesting an IP. Default: none.
|
||||
--@param transaction_id The identity of the transaction.
|
||||
--
|
||||
--@return status (true or false)
|
||||
@@ -444,7 +444,9 @@ function dhcp_build(request_type, ip_address, mac_address, options, request_opti
|
||||
end
|
||||
|
||||
packet = packet .. string.pack(">Bs1", 0x37, request_options) -- Request options
|
||||
packet = packet .. string.pack(">BBI4", 0x33, 4, lease_time or 1) -- Lease time
|
||||
if lease_time then
|
||||
packet = packet .. string.pack(">BBI4", 0x33, 4, lease_time) -- Lease time
|
||||
end
|
||||
|
||||
packet = packet .. "\xFF" -- Termination
|
||||
|
||||
@@ -599,7 +601,7 @@ end
|
||||
--@param overrides [optional] A table of overrides. If a field in the table matches a field in the DHCP
|
||||
-- packet (see rfc2131 section 2 for a list of possible fields), the value in the table
|
||||
-- will be sent instead of the default value.
|
||||
--@param lease_time [optional] The lease time used when requestint an IP. Default: 1 second.
|
||||
--@param lease_time [optional] The lease time used when requesting an IP. Default: none.
|
||||
--@return status (true or false)
|
||||
--@return The parsed response, as a table.
|
||||
function make_request(target, request_type, ip_address, mac_address, options, request_options, overrides, lease_time)
|
||||
|
||||
Reference in New Issue
Block a user