-
Notifications
You must be signed in to change notification settings - Fork 752
Wireshark Dissector: API Changes and Bugs #913
Description
Issue Description
Since Wireshark 4.6.0, the RFNoC dissectors can no longer be compiled (see error below). The problem is that the function definition of val_to_string() was changed in 4.6.0 (see commit 84799be2). A quick fix would be to change all usages of val_to_str() to val_to_str_const, which made it work again for me. I also discovered that when I try to analyze UDP frames from the SDR without a CHDR header (using the stream argument stream_mode=raw_payload ) with Wireshark, the installed RFNoC dissector causes Wireshark to crash and RAM usage to spike to 100% until the system freezes. Without the RFNoC dissector installed, there is no crash, and I can analyze the packets normally.
sparky@sparky:~/uhd/tools/dissectors/build$ make
[ 14%] Generating /home/sparky/uhd/tools/dissectors/build/epan/rfnoc/plugin.c
Updating plugin.c
[ 28%] Building C object epan/rfnoc/CMakeFiles/rfnoc64.dir/plugin.c.o
[ 42%] Building CXX object epan/rfnoc/CMakeFiles/rfnoc64.dir/packet-rfnoc.cpp.o
/home/sparky/uhd/tools/dissectors/epan/rfnoc/packet-rfnoc.cpp: In function ‘int dissect_rfnoc(tvbuff_t*, packet_info*, proto_tree*, void*)’:
/home/sparky/uhd/tools/dissectors/epan/rfnoc/packet-rfnoc.cpp:250:49: error: cannot convert ‘uhd::rfnoc::chdr::packet_type_t’ to ‘wmem_allocator_t*’ {aka ‘_wmem_allocator_t*’}
250 | val_to_str(chdr_hdr.get_pkt_type(), RFNOC_PACKET_TYPES_SHORT, "Unknown (0x%x)"), chdr_hdr.get_dst_epid()
| ~~~~~~~~~~~~~~~~~~~~~^~
| |
| uhd::rfnoc::chdr::packet_type_t
In file included from /usr/include/wireshark/epan/proto.h:28,
from /usr/include/wireshark/epan/packet.h:16,
from /home/sparky/uhd/tools/dissectors/epan/rfnoc/packet-rfnoc.cpp:18:
/usr/include/wireshark/wsutil/value_string.h:107:30: note: initializing argument 1 of ‘char* val_to_str(wmem_allocator_t*, uint32_t, const value_string*, const char*)’
107 | val_to_str(wmem_allocator_t *scope, const uint32_t val, const value_string *vs, const char *fmt)
| ~~~~~~~~~~~~~~~~~~^~~~~
/home/sparky/uhd/tools/dissectors/epan/rfnoc/packet-rfnoc.cpp:253:49: error: cannot convert ‘uhd::rfnoc::chdr::packet_type_t’ to ‘wmem_allocator_t*’ {aka ‘_wmem_allocator_t*’}
253 | val_to_str(chdr_hdr.get_pkt_type(), RFNOC_PACKET_TYPES, "Unknown (0x%x)"), chdr_hdr.get_dst_epid()
| ~~~~~~~~~~~~~~~~~~~~~^~
| |
| uhd::rfnoc::chdr::packet_type_t
/usr/include/wireshark/wsutil/value_string.h:107:30: note: initializing argument 1 of ‘char* val_to_str(wmem_allocator_t*, uint32_t, const value_string*, const char*)’
107 | val_to_str(wmem_allocator_t *scope, const uint32_t val, const value_string *vs, const char *fmt)
| ~~~~~~~~~~~~~~~~~~^~~~~
/home/sparky/uhd/tools/dissectors/epan/rfnoc/packet-rfnoc.cpp:262:49: error: cannot convert ‘uhd::rfnoc::chdr::packet_type_t’ to ‘wmem_allocator_t*’ {aka ‘_wmem_allocator_t*’}
262 | val_to_str(chdr_hdr.get_pkt_type(), RFNOC_PACKET_TYPES, "invalid")
| ~~~~~~~~~~~~~~~~~~~~~^~
| |
| uhd::rfnoc::chdr::packet_type_t
/usr/include/wireshark/wsutil/value_string.h:107:30: note: initializing argument 1 of ‘char* val_to_str(wmem_allocator_t*, uint32_t, const value_string*, const char*)’
107 | val_to_str(wmem_allocator_t *scope, const uint32_t val, const value_string *vs, const char *fmt)
| ~~~~~~~~~~~~~~~~~~^~~~~
/home/sparky/uhd/tools/dissectors/epan/rfnoc/packet-rfnoc.cpp:327:44: error: cannot convert ‘uhd::rfnoc::chdr::ctrl_opcode_t’ to ‘wmem_allocator_t*’ {aka ‘_wmem_allocator_t*’}
327 | val_to_str(payload.op_code, RFNOC_CTRL_OPCODES, "reserved")
| ~~~~~~~~^~~~~~~
| |
| uhd::rfnoc::chdr::ctrl_opcode_t
/usr/include/wireshark/wsutil/value_string.h:107:30: note: initializing argument 1 of ‘char* val_to_str(wmem_allocator_t*, uint32_t, const value_string*, const char*)’
107 | val_to_str(wmem_allocator_t *scope, const uint32_t val, const value_string *vs, const char *fmt)
| ~~~~~~~~~~~~~~~~~~^~~~~
/home/sparky/uhd/tools/dissectors/epan/rfnoc/packet-rfnoc.cpp:336:44: error: cannot convert ‘uhd::rfnoc::chdr::ctrl_status_t’ to ‘wmem_allocator_t*’ {aka ‘_wmem_allocator_t*’}
336 | val_to_str(payload.status, RFNOC_CTRL_STATUS, "reserved")
| ~~~~~~~~^~~~~~
| |
| uhd::rfnoc::chdr::ctrl_status_t
/usr/include/wireshark/wsutil/value_string.h:107:30: note: initializing argument 1 of ‘char* val_to_str(wmem_allocator_t*, uint32_t, const value_string*, const char*)’
107 | val_to_str(wmem_allocator_t *scope, const uint32_t val, const value_string *vs, const char *fmt)
| ~~~~~~~~~~~~~~~~~~^~~~~
/home/sparky/uhd/tools/dissectors/epan/rfnoc/packet-rfnoc.cpp:353:44: error: cannot convert ‘uhd::rfnoc::chdr::strs_status_t’ to ‘wmem_allocator_t*’ {aka ‘_wmem_allocator_t*’}
353 | val_to_str(payload.status, RFNOC_STRS_STATUS, "invalid")
| ~~~~~~~~^~~~~~
| |
| uhd::rfnoc::chdr::strs_status_t
/usr/include/wireshark/wsutil/value_string.h:107:30: note: initializing argument 1 of ‘char* val_to_str(wmem_allocator_t*, uint32_t, const value_string*, const char*)’
107 | val_to_str(wmem_allocator_t *scope, const uint32_t val, const value_string *vs, const char *fmt)
| ~~~~~~~~~~~~~~~~~~^~~~~
/home/sparky/uhd/tools/dissectors/epan/rfnoc/packet-rfnoc.cpp:375:44: error: cannot convert ‘uhd::rfnoc::chdr::strc_op_code_t’ to ‘wmem_allocator_t*’ {aka ‘_wmem_allocator_t*’}
375 | val_to_str(payload.op_code, RFNOC_STRC_OPCODES, "invalid")
| ~~~~~~~~^~~~~~~
| |
| uhd::rfnoc::chdr::strc_op_code_t
/usr/include/wireshark/wsutil/value_string.h:107:30: note: initializing argument 1 of ‘char* val_to_str(wmem_allocator_t*, uint32_t, const value_string*, const char*)’
107 | val_to_str(wmem_allocator_t *scope, const uint32_t val, const value_string *vs, const char *fmt)
| ~~~~~~~~~~~~~~~~~~^~~~~
/home/sparky/uhd/tools/dissectors/epan/rfnoc/packet-rfnoc.cpp:414:44: error: cannot convert ‘uhd::rfnoc::chdr::mgmt_op_t::op_code_t’ to ‘wmem_allocator_t*’ {aka ‘_wmem_allocator_t*’}
414 | val_to_str(opcode, RFNOC_MGMT_OPCODES, "invalid")
| ^~~~~~
| |
| uhd::rfnoc::chdr::mgmt_op_t::op_code_t
/usr/include/wireshark/wsutil/value_string.h:107:30: note: initializing argument 1 of ‘char* val_to_str(wmem_allocator_t*, uint32_t, const value_string*, const char*)’
107 | val_to_str(wmem_allocator_t *scope, const uint32_t val, const value_string *vs, const char *fmt)
| ~~~~~~~~~~~~~~~~~~^~~~~
make[2]: *** [epan/rfnoc/CMakeFiles/rfnoc64.dir/build.make:98: epan/rfnoc/CMakeFiles/rfnoc64.dir/packet-rfnoc.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:98: epan/rfnoc/CMakeFiles/rfnoc64.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Furthermore, ZPU support has not been able to compile since Wireshark 4.0.0:
uhd/tools/dissectors/epan/zpu/packet-zpu.c
Lines 126 to 134 in cfb9840
| #if VERSION_MAJOR == 1 | |
| guint8 *bytes = tvb_get_string(tvb, 8, 4); | |
| #elif VERSION_MAJOR == 2 | |
| guint8 *bytes = tvb_get_string(wmem_packet_scope(), tvb, 8, 4); | |
| #elif VERSION_MAJOR == 3 | |
| guint8 *bytes = tvb_get_string_enc(wmem_packet_scope(), tvb, 8, 4, ENC_ASCII); | |
| #else | |
| #error Wireshark version not found or not compatible | |
| #endif |
sparky@sparky:~/uhd/tools/dissectors/build$ make
[ 25%] Generating /home/sparky/uhd/tools/dissectors/build/epan/zpu/plugin.c
Updating plugin.c
[ 50%] Building C object epan/zpu/CMakeFiles/zpu.dir/plugin.c.o
[ 75%] Building C object epan/zpu/CMakeFiles/zpu.dir/packet-zpu.c.o
/home/sparky/uhd/tools/dissectors/epan/zpu/packet-zpu.c: In function ‘dissect_zpu’:
/home/sparky/uhd/tools/dissectors/epan/zpu/packet-zpu.c:133:2: error: #error Wireshark version not found or not compatible
133 | #error Wireshark version not found or not compatible
| ^~~~~
/home/sparky/uhd/tools/dissectors/epan/zpu/packet-zpu.c:136:35: error: ‘bytes’ undeclared (first use in this function); did you mean ‘GBytes’?
136 | memcpy(&addr, bytes, 4);
| ^~~~~
| GBytes
/home/sparky/uhd/tools/dissectors/epan/zpu/packet-zpu.c:136:35: note: each undeclared identifier is reported only once for each function it appears in
/home/sparky/uhd/tools/dissectors/epan/zpu/packet-zpu.c:150:44: warning: passing argument 1 of ‘val_to_str’ makes pointer from integer without a cast [-Wint-conversion]
150 | val_to_str(addr, X300_SHMEM_NAMES, "Unknown (0x%04x)")
| ^~~~
| |
| unsigned int
In file included from /usr/include/wireshark/epan/proto.h:28,
from /usr/include/wireshark/epan/packet.h:16,
from /home/sparky/uhd/tools/dissectors/epan/zpu/packet-zpu.c:30:
/usr/include/wireshark/wsutil/value_string.h:107:30: note: expected ‘wmem_allocator_t *’ {aka ‘struct _wmem_allocator_t *’} but argument is of type ‘unsigned int’
107 | val_to_str(wmem_allocator_t *scope, const uint32_t val, const value_string *vs, const char *fmt)
| ~~~~~~~~~~~~~~~~~~^~~~~
/home/sparky/uhd/tools/dissectors/epan/zpu/packet-zpu.c:150:50: warning: passing argument 2 of ‘val_to_str’ makes integer from pointer without a cast [-Wint-conversion]
150 | val_to_str(addr, X300_SHMEM_NAMES, "Unknown (0x%04x)")
| ^~~~~~~~~~~~~~~~
| |
| const value_string * {aka const struct _value_string *}
/usr/include/wireshark/wsutil/value_string.h:107:52: note: expected ‘uint32_t’ {aka ‘const unsigned int’} but argument is of type ‘const value_string *’ {aka ‘const struct _value_string *’}
107 | val_to_str(wmem_allocator_t *scope, const uint32_t val, const value_string *vs, const char *fmt)
| ~~~~~~~~~~~~~~~^~~
/home/sparky/uhd/tools/dissectors/epan/zpu/packet-zpu.c:150:68: warning: passing argument 3 of ‘val_to_str’ from incompatible pointer type [-Wincompatible-pointer-types]
150 | val_to_str(addr, X300_SHMEM_NAMES, "Unknown (0x%04x)")
| ^~~~~~~~~~~~~~~~~~
| |
| char *
/usr/include/wireshark/wsutil/value_string.h:107:77: note: expected ‘const value_string *’ {aka ‘const struct _value_string *’} but argument is of type ‘char *’
107 | val_to_str(wmem_allocator_t *scope, const uint32_t val, const value_string *vs, const char *fmt)
| ~~~~~~~~~~~~~~~~~~~~^~
/home/sparky/uhd/tools/dissectors/epan/zpu/packet-zpu.c:150:33: error: too few arguments to function ‘val_to_str’
150 | val_to_str(addr, X300_SHMEM_NAMES, "Unknown (0x%04x)")
| ^~~~~~~~~~
/usr/include/wireshark/wsutil/value_string.h:107:1: note: declared here
107 | val_to_str(wmem_allocator_t *scope, const uint32_t val, const value_string *vs, const char *fmt)
| ^~~~~~~~~~
/home/sparky/uhd/tools/dissectors/epan/zpu/packet-zpu.c: In function ‘proto_register_zpu’:
/home/sparky/uhd/tools/dissectors/epan/zpu/packet-zpu.c:179:26: error: ‘tfs_set_notset’ undeclared (first use in this function)
179 | TFS(&tfs_set_notset), 0x1,
| ^~~~~~~~~~~~~~
make[2]: *** [epan/zpu/CMakeFiles/zpu.dir/build.make:95: epan/zpu/CMakeFiles/zpu.dir/packet-zpu.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:98: epan/zpu/CMakeFiles/zpu.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Also the documentation for building the ZPU and Octoclock dissectors is outdated. The option -DETTUS_DISSECTOR_NAME=zpu/octoclock is no longer supported. Instead it should be -DENABLE_OCTOCLOCK=ON/OFF or -DENABLE_ZPU=ON/OFF.
uhd/tools/dissectors/README.txt
Lines 20 to 27 in cfb9840
| 3. To build and install the other dissectors, re-run the commands | |
| like so: | |
| $ cmake .. -DETTUS_DISSECTOR_NAME=zpu | |
| $ make && make install | |
| Replace "zpu" with the name of the dissector you wish to install | |
| (e.g. "octoclock"). |
Setup Details
- UHD 4.9.0.1
- Ubuntu 24.04.4 LTS
- Wireshark >= 4.6.0
Expected Behavior
Everything compiles succesfully
Actual Behaviour
No dissector can be compiled successfully
Steps to reproduce the problem
-
Building the RFNoC dissector:
cd tools/dissectors mkdir build && cd build cmake .. make -
Building the ZPU dissector:
cd tools/dissectors mkdir build && cd build cmake .. -DENABLE_RFNOC=OFF -DENABLE_ZPU=ON make