Wireshark 4.05 to 4.07 broke lua dissector

asked 2024-04-03 02:36:10 +0000

kdwalkeraz gravatar image

I have a lua dissector that works just fine in 4.05 but in 4.07 it does not work. I get a range nil in the lua console window. I tracked it down to dissect_tcp_pdus. It does not call my get_len_func or dissect_func. Does anyone know if there was some breaking changed between the two version?


function cac_protocol.dissector(buffer, pinfo, tree)
  length = buffer:len()

  pinfo.cols.protocol = cac_protocol.name

  if length == 0 then
    return
  end

  local subtree = tree:add(cac_protocol, buffer(), "CAC Protocol Data")

--I get here
 print("dissect_tcp_pdus:"  )

 dissect_tcp_pdus(buffer, subtree, 4, get_pdu_len, do_dissection)

end

function get_pdu_len(tvb, pinfo, tree)
  --I dont get here
  print("get_pdu_len:")
  return tvb(0, 4):int() *4
end

function do_dissection(tvb, pinfo, tree)
  --I dont get here
  print("do_dissection:")
   --CODE Removed
end

edit retag flag offensive close merge delete

Comments

Is it possible to test with a more current version of Wireshark?

Download Wireshark

The current stable release of Wireshark is 4.2.4. It supersedes all previous releases.

Stable Release: 4.2.4
Old Stable Release: 4.0.14

Chuckc gravatar imageChuckc ( 2024-04-03 11:20:44 +0000 )edit

Same issue on 4.2.4, I showed the 4.05 to 4.07 because that's where it broke.

kdwalkeraz gravatar imagekdwalkeraz ( 2024-04-11 16:52:15 +0000 )edit

Registering as a post dissector produces this output:

dissect_tcp_pdus:

get_pdu_len:

do_dissection:


How are you registering the protocol?

Chuckc gravatar imageChuckc ( 2024-04-11 17:16:13 +0000 )edit

Well I had my plugins in the global plugins directory. I then moved them to the personal plugins directory to make it easier to edit them and bingo they work like they are supposed to. Move them back to global they don't work. Don't know why they will work in personal but not global I don't know.

kdwalkeraz gravatar imagekdwalkeraz ( 2024-04-12 21:06:16 +0000 )edit

YMMV but may be similar to gotchas in: 18589: Lua Personal vs Global Plugin Failure

Chuckc gravatar imageChuckc ( 2024-04-13 00:30:04 +0000 )edit