On Tue, Feb 20, 2024 at 6:09 PM R Massink <robin....@gmail.com> wrote:

> Hello,
>
> I've been active in creating a dissector for IEC61850, which is mapped on
> top of mms. There is an integrated mms dissector that I'm using as a
> template, while mapping all mms names to the IEC61850 equivalent. I have
> been able to successfully use asn2wrs.py to generate a packet dissector
> from the .cnf and .asn files, and can build a static wireshark executable
> with my dissector included.
>
> However, I'm now trying to get the same dissector to work as an external
> plugin, so it can be loaded by others into their wireshark without having
> to use my compiled version of wireshark.
>
> While the external plugin compiled fine, i'm running into the problem that
> the dissector_acse_* external symbols cannot be
> resolved(dissect_acse_EXTERNALt is the first one) during runtime. The
> dissector relies on these symbols from epan/dissectors/packet-acse.c, and
> as statically build dissector they can of course be resolved. But when the
> plugin loads externally during runtime(manual or automatic), the symbol
> cannot be resolved anymore, while I can find it in libwireshark.so, which
> is in turn loaded into memory by the wireshark process.
>
> I was not able to find other wireshark examples where external plugins
> relied on symbols from statically linked dissectors. Is what I want simply
> not possible, and should I include all acse dissector, and sub dependencies
> as well in my plugin(lots of code duplication), or am I building the plugin
> not correct or missing a linker flag?
>

The issue is not exactly in your plugin, but in the other dissector.

Example where external plugins use symbols from dissectors in the main tree:

opcua/opcua.c uses tcp_dissect_pdus from epan/dissectors/packet-tcp.h

By default symbols are not visible. To make a symbol visible, it must have
WS_DLL_PUBLIC, which is defined in include/ws_symbol_export.h

(See some comments here:
https://gitlab.com/wireshark/wireshark/-/blob/master/CMakeLists.txt#L1087 )

WS_DLL_PUBLIC void
tcp_dissect_pdus(...);

For a ASN.1 generated dissector, to cause an existing symbol to be
exported, look at this commit:

https://gitlab.com/wireshark/wireshark/-/commit/7ce05b9dd77741bf28a1efece8429f43982e7fe2

Where I altered the .cnf file for the x509af dissector so that
dissect_x509af_Certificate
got the WS_DLL_PUBLIC
attribute added to it by the asn2wrs.py process.

Cheers,
John Thacker
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@wireshark.org>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe

Reply via email to