Skip to content

Commit

Permalink
Discard Ethernet header when scanning IPv6 headers
Browse files Browse the repository at this point in the history
This allows passing an offset to ipv6_walk_headers(), which allows to take
into account that packets have Ethernet headers at the start (possibly with
VLAN tags).
  • Loading branch information
aperezdc committed Apr 23, 2016
1 parent cc8280c commit 0fa645a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/apps/wall/scanner.lua
Expand Up @@ -177,8 +177,8 @@ local ipv6_walk_header_funcs = {
-- is the type of the upper level protocol code and pointer to the beginning
-- of the upper level protocol header data.
--
local function ipv6_walk_headers (p)
local ptr = p.data
local function ipv6_walk_headers (p, offset)
local ptr = p.data + offset
local nexthdr = ptr[IPv6_NEXTHDR_OFFSET]
while ipv6_walk_header_funcs[nexthdr] do
local new_nexthdr, new_ptr = ipv6_walk_header_funcs[nexthdr](ptr)
Expand Down Expand Up @@ -240,7 +240,7 @@ function Scanner:extract_packet_info(p)
end

local proto_header_ptr
ip_proto, proto_header_ptr = ipv6_walk_headers (p)
ip_proto, proto_header_ptr = ipv6_walk_headers (p, ip_offset)
if ip_proto == IPv6_NEXTHDR_TCP then
src_port = rd16(proto_header_ptr + TCP_SRC_PORT_OFFSET)
dst_port = rd16(proto_header_ptr + TCP_DST_PORT_OFFSET)
Expand Down

0 comments on commit 0fa645a

Please sign in to comment.