Preference not working in Wireshark 4.0

asked 2023-01-18 15:20:36 +0000

DavidA_2018 gravatar image

Using Wireshark 4.0.2 on Windows 11.

I have a protocol preference defined as:

local tx_antennas_enum = {
  { 32,  "32", 32 },
  { 64,  "64", 64  }
}

xran_protocol.prefs.tx_antennas_cnt = Pref.enum("Tx antennas", 0, "Tx antenna count", tx_antennas_enum, false)

This worked fine in Wireshark 3 (the returned value was 32 or 64), but when I access xran_protocol.prefs.tx_antennas_cnt in Wireshark 4.0.2, that value comes back as zero.

Is there a problem with my code?

edit retag flag offensive close merge delete

Comments

WSDG - 11.3.3. Pref:

11.3.3.5. Pref.enum(label, default, descr, enum, radio)

Should the default value be a valid value from the enum table?
dissector.lua and fpm.luahave preference example code (linked to on the Wiki - https://wiki.wireshark.org/Lua/Examples)
fileshark_pcap.lua on the Wiki Contrib page is another example.

Chuckc gravatar imageChuckc ( 2023-01-18 16:07:01 +0000 )edit

Thanks for your answer. That fixed my problem.

DavidA_2018 gravatar imageDavidA_2018 ( 2023-01-19 09:46:57 +0000 )edit