diff options
author | Dr. Lars Völker <lars.voelker@technica-engineering.de> | 2021-01-15 20:28:08 +0100 |
---|---|---|
committer | AndersBroman <a.broman58@gmail.com> | 2021-01-16 07:26:08 +0000 |
commit | 8203e104888085086c5eaea68cf2bada71f09edc (patch) | |
tree | caf8b61402323772ff5f5837a90019537fb52fa5 /epan/dissectors | |
parent | 737e18d37b5c9170b709d79aa661b18080df61c8 (diff) |
SOME/IP: Fix subdissector support
Until now writing subdissectors for SOME/IP was not really possible.
While you could register for messages, the subdissector did not know
which message it was called for.
This patch fixes the subdissector support of SOME/IP by:
- adding header file to CMakeLists (was missing)
- creating a "data" struct so that subdissectors know what they dissect
- passing this "data" struct to the subdissector
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/CMakeLists.txt | 1 | ||||
-rw-r--r-- | epan/dissectors/packet-someip.c | 10 | ||||
-rw-r--r-- | epan/dissectors/packet-someip.h | 12 |
3 files changed, 19 insertions, 4 deletions
diff --git a/epan/dissectors/CMakeLists.txt b/epan/dissectors/CMakeLists.txt index 6e8a5b41be..01b05fb254 100644 --- a/epan/dissectors/CMakeLists.txt +++ b/epan/dissectors/CMakeLists.txt @@ -563,6 +563,7 @@ set(DISSECTOR_PUBLIC_HEADERS packet-smrse.h packet-snmp.h packet-socketcan.h + packet-someip.h packet-spice.h packet-sprt.h packet-sscop.h diff --git a/epan/dissectors/packet-someip.c b/epan/dissectors/packet-someip.c index b10dbb55ba..5e5c55e71f 100644 --- a/epan/dissectors/packet-someip.c +++ b/epan/dissectors/packet-someip.c @@ -1,7 +1,7 @@ /* packet-someip.c * SOME/IP dissector. * By Dr. Lars Voelker <lars.voelker@technica-engineering.de> / <lars.voelker@bmw.de> - * Copyright 2012-2020 Dr. Lars Voelker + * Copyright 2012-2021 Dr. Lars Voelker * Copyright 2019 Ana Pantar * Copyright 2019 Guenter Ebermann * @@ -2753,8 +2753,14 @@ dissect_someip_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void if (subtvb!=NULL) { tvb_length = tvb_captured_length_remaining(subtvb, 0); + someip_info_t someip_data; + someip_data.service_id = (guint16)someip_serviceid; + someip_data.method_id = (guint16)someip_methodid; + someip_data.message_type = (guint8)msgtype; + someip_data.major_version = (guint8)version; + if (tvb_length > 0) { - tmp = dissector_try_uint(someip_dissector_table, someip_messageid, subtvb, pinfo, tree); + tmp = dissector_try_uint_new(someip_dissector_table, someip_messageid, subtvb, pinfo, tree, FALSE, &someip_data); /* if no subdissector was found, the generic payload dissector takes over. */ if (tmp==0) { diff --git a/epan/dissectors/packet-someip.h b/epan/dissectors/packet-someip.h index 41eb7e8536..83e2fdc2b0 100644 --- a/epan/dissectors/packet-someip.h +++ b/epan/dissectors/packet-someip.h @@ -1,7 +1,7 @@ /* packet-someip.h * Definitions for SOME/IP packet disassembly structures and routines - * By Dr. Lars Voelker <lars-github@larsvoelker.de> / <lars.voelker@bmw.de> - * Copyright 2012-2019 Dr. Lars Voelker + * By Dr. Lars Voelker <lars.voelker@technica-engineering.de> / <lars.voelker@bmw.de> + * Copyright 2012-2021 Dr. Lars Voelker * * Wireshark - Network traffic analyzer * By Gerald Combs <gerald@wireshark.org> @@ -18,6 +18,14 @@ void register_someip_port_tcp(guint32 portnumber); char* someip_lookup_service_name(guint16 serviceid); char* someip_lookup_eventgroup_name(guint16 serviceid, guint16 eventgroupid); +typedef struct _someip_info +{ + guint16 service_id; + guint16 method_id; + guint8 message_type; + guint8 major_version; +} someip_info_t; + /* * Editor modelines * |