From e055b564a861f5bcbd032d48e9a370d1b4f69b9d Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Thu, 29 Aug 2024 13:49:52 +0200 Subject: more WIP --- wireshark/ieee.lua | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'wireshark/ieee.lua') diff --git a/wireshark/ieee.lua b/wireshark/ieee.lua index 97000db..9e08cf3 100644 --- a/wireshark/ieee.lua +++ b/wireshark/ieee.lua @@ -1,5 +1,4 @@ require "util" -local bit = require "bit" local p = Proto("ieee", "IEEE802.11 frame header") local dslmp = DissectorTable.new("dslmp") -- DS Local Multi-Player @@ -30,9 +29,9 @@ p.fields.ctl_wep = ProtoField.bool("ieee.ctl.wep", "WEP encrypt", base.DEC, nil, p.fields.ctl_order = ProtoField.bool("ieee.ctl.order", "Order", base.DEC, nil, bits(15)) p.fields.duration = ProtoField.uint16("ieee.duration", "Duration / ID", base.HEX, nil, 0xffff) -p.fields.addr1 = ProtoField.ether("ieee.addr1", "Address 1") -p.fields.addr2 = ProtoField.ether("ieee.addr2", "Address 2") -p.fields.addr3 = ProtoField.ether("ieee.addr3", "Address 3") +p.fields.addr1 = ProtoField.bytes("ieee.addr1", "Address 1", base.COLON) +p.fields.addr2 = ProtoField.bytes("ieee.addr2", "Address 2", base.COLON) +p.fields.addr3 = ProtoField.bytes("ieee.addr3", "Address 3", base.COLON) p.fields.seq = ProtoField.uint16("ieee.seq", "Sequence control") p.fields.seq_frag = ProtoField.uint16("ieee.seq.frag", "Fragment", base.DEC, nil, bits(0, 4)) p.fields.seq_num = ProtoField.uint16("ieee.seq.num", "Sequence number", base.DEC, nil, bits(4, 12)) @@ -58,9 +57,9 @@ function p.dissector(buffer, pinfo, tree) local ctl_tree = subtree:add_le(p.fields.ctl, buffer(0x00, 2)) ctl_tree:add_le(p.fields.ctl_ver, buffer(0x00, 2)) ctl_tree:add_le(p.fields.ctl_type, buffer(0x00, 2)) - local ctl_type = bit.rshift(bit.band(buffer(0x00, 2):le_uint(), bits(2, 2)), 2) + local ctl_type = buffer(0x00, 2):bitfield(14, 2) ctl_tree:add_le(p.fields.ctl_subtype, buffer(0x00, 2)) - local ctl_subtype = bit.rshift(bit.band(buffer(0x00, 2):le_uint(), bits(4, 4)), 4) + local ctl_subtype = buffer(0x00, 2):bitfield(12, 4) ctl_tree:add_le(p.fields.ctl_to_ds, buffer(0x00, 2)) ctl_tree:add_le(p.fields.ctl_from_ds, buffer(0x00, 2)) ctl_tree:add_le(p.fields.ctl_fragment, buffer(0x00, 2)) @@ -71,9 +70,9 @@ function p.dissector(buffer, pinfo, tree) ctl_tree:add_le(p.fields.ctl_order, buffer(0x00, 2)) subtree:add_le(p.fields.duration, buffer(0x02, 2)) - subtree:add(p.fields.addr1, buffer(0x04, 6)) - subtree:add(p.fields.addr2, buffer(0x0a, 6)) - subtree:add(p.fields.addr3, buffer(0x10, 6)) + add_addr(subtree, p.fields.addr1, buffer(0x04, 6)) + add_addr(subtree, p.fields.addr2, buffer(0x0a, 6)) + add_addr(subtree, p.fields.addr3, buffer(0x10, 6)) local seq_tree = subtree:add_le(p.fields.seq, buffer(0x16, 2)) seq_tree:add_le(p.fields.seq_frag, buffer(0x16, 2)) seq_tree:add_le(p.fields.seq_num, buffer(0x16, 2)) -- cgit v1.2.3