From 06cafff10522682d239adb9af8b571a0a1c5c48a Mon Sep 17 00:00:00 2001 From: David Ventura Date: Wed, 1 May 2024 11:23:05 +0200 Subject: [PATCH] return nil from packet lut --- dissector.lua | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/dissector.lua b/dissector.lua index 0929aad..063f231 100644 --- a/dissector.lua +++ b/dissector.lua @@ -49,11 +49,7 @@ lut = { [0xf169] = "ListenReqAck", [0xf170] = "RlyHelloAck", [0xf171] = "RlyHelloAck2", - __index = function(tbl, key) - return "UNK " .. string.format("0x%X", key) - end } -setmetatable(lut, lut) -- Define a function to dissect the packets function ilnk_proto.dissector(buffer, pinfo, tree) @@ -62,8 +58,10 @@ function ilnk_proto.dissector(buffer, pinfo, tree) local subtree = tree:add(ilnk_proto, buffer(), "iLnkP2P") -- Add the entire packet as a field - local packetname = lut[buffer(0, 2):uint()] - subtree:add(ilnk_proto.fields.type, packetname) + local packettype = buffer(0, 2):uint() + local packetname = lut[packettype] + packetname = packetname or "UNK " .. string.format("0x%X", packettype) + subtree:add(ilnk_proto.fields.type, buffer(0, 2), packetname) -- Set the protocol description in the packet list pinfo.cols.protocol:set("iLnkP2P")