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

Resolves ether_type incompatibility in packet.Frame

Frame:new() was populating the value as a 16-bit integer while
Frame:build_ether_frame() was expectng a two-byte string
Ethertype constants from various locations have been migrated to packet.lua
This commit is contained in:
nnposter
2024-08-25 17:43:17 +00:00
parent 5e35bc0952
commit 2646596f0f
6 changed files with 18 additions and 19 deletions

View File

@@ -105,14 +105,14 @@ ATAoE = {
-- Send a Config Info Request to the ethernet broadcast address
-- @param iface table as returned by nmap.get_interface_info()
local function sendConfigInfoRequest(iface)
local ETHER_BROADCAST, P_ATAOE = "ff:ff:ff:ff:ff:ff", 0x88a2
local ETHER_BROADCAST = "ff:ff:ff:ff:ff:ff"
local req = ATAoE.ConfigInfoRequest:new()
local tag = req.tag
local p = packet.Frame:new()
p.mac_src = iface.mac
p.mac_dst = packet.mactobin(ETHER_BROADCAST)
p.ether_type = string.pack(">I2", P_ATAOE)
p.ether_type = packet.ETHER_TYPE_ATAOE
p.buf = tostring(req)
p:build_ether_frame()

View File

@@ -147,8 +147,7 @@ local function dhcp_listener(sock, iface, macaddr, options, timeout, xid, result
-- Add the Ethernet header
frame:build_ether_frame(
"\xff\xff\xff\xff\xff\xff",
iface.mac, -- can't use macaddr or we won't see response
packet.ETHER_TYPE_IPV4)
iface.mac) -- can't use macaddr or we won't see response
local dnet = nmap.new_dnet()
dnet:ethernet_open(iface.device)