Ask Your Question
0

LUA: pinfo affected by NSTime ?

asked 2021-09-17 20:56:58 +0000

sezb51 gravatar image

Hello,

I finally narrow down the issue I'm facing with the pinfo...

my LUA protocol dissector is iterating multiple TLV with specific function analysis which might return some valuable information to be added to "pinfo.cols.info"

There is one specific function though that once executed break the pinfo value:

function decode_tlv92(tlv_tree, buffer, offset, len)
  -- Event Timestamp
  local secs = buffer(offset,4):le_uint()
  local msecs = buffer(offset+4,4):le_uint()
  tlv_tree:add_le (f.secs, buffer(offset, 4))
  tlv_tree:add_le (f.msecs, buffer(offset+4, 4))
  local ti = tlv_tree:add(f.time, buffer(offset,8), NSTime.new(secs, msecs))
  tlv_tree:append_text (", " .. string.sub(ti.text, 12))
end

if I prevent such decode_tlv92 execution (or I comment out the line containing NSTime.new) then everything works fine.

If I let to run decode_tlv92 fully then pinfo can't be used anymore...

So my question for you is why NSTime affect pinfo and more important how I can prevent that.

Thx, A.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-09-18 08:44:51 +0000

sezb51 gravatar image

updated 2021-09-18 15:08:50 +0000

Fixed the issue... I had to wrap the below ti.text into a tostring()

So the NSTIme was not part of the problem.

function decode_tlv92(tlv_tree, buffer, offset, len)
  -- Event Timestamp
  local secs = buffer(offset,4):le_uint()
  local msecs = buffer(offset+4,4):le_uint()
  tlv_tree:add_le (f.secs, buffer(offset, 4))
  tlv_tree:add_le (f.msecs, buffer(offset+4, 4))
  local ti = tlv_tree:add(f.time, buffer(offset,8), NSTime.new(secs, msecs))
  tlv_tree:append_text (", " .. string.sub(tostring(ti.text), 12))
end
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-09-17 20:56:58 +0000

Seen: 132 times

Last updated: Sep 18 '21