Ask Your Question
0

frame.len not working as expected in Lua

asked 2017-12-20 03:45:45 +0000

derekyu gravatar image

updated 2017-12-21 10:40:29 +0000

Christian_R gravatar image

I want to use the frame.len to further dissect the packet. I used the following logic and it failed:

   frame_len_f     = Field.new("frame.len")
   local frame_len = frame_len_f()
   if frame_len == 62 then 
        local data_data   = data_data_f()
        local s_data_data = tostring(data_data)
        subtree:add(data_data_F,s_data_data)
   end

However, if I convert frame.len to string and compare to "62", it works:

   frame_len_f     = Field.new("frame.len")
   local frame_len = frame_len_f()
   local s_frame_len = tostring(frame_len)
   if s_frame_len == "62" then 
        local data_data   = data_data_f()
        local s_data_data = tostring(data_data)
        subtree:add(data_data_F,s_data_data)
   end

Can anyone explain what I did wrong in the first case. Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-12-20 15:30:35 +0000

cmaynard gravatar image

I think you want:

local frame_len = frame_len_f().value

Ref: Section 11.2.2.10. of the Wireshark Developers Guide.

edit flag offensive delete link more

Comments

Thanks. That works. According to https://www.wireshark.org/docs/dfref/..., frame.len is an unsigned integer. It seems using Field.new() to obtain the value changes it to a Fieldinfo object. Is there a easy way to get the frame.len?

derekyu gravatar imagederekyu ( 2017-12-20 19:13:22 +0000 )edit

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: 2017-12-20 03:45:45 +0000

Seen: 877 times

Last updated: Dec 20 '17