aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/dissectors/packet-caneth.c8
-rw-r--r--epan/dissectors/packet-ieee1722.c32
-rw-r--r--epan/dissectors/packet-tecmp.c22
3 files changed, 8 insertions, 54 deletions
diff --git a/epan/dissectors/packet-caneth.c b/epan/dissectors/packet-caneth.c
index 773f9e2c44..e9b320a081 100644
--- a/epan/dissectors/packet-caneth.c
+++ b/epan/dissectors/packet-caneth.c
@@ -56,7 +56,6 @@ static gint ett_caneth_can = -1;
static int proto_can = -1; // use CAN protocol for consistent filtering
-static dissector_table_t can_subdissector_table;
/* A sample #define of the minimum length (in bytes) of the protocol data.
* If data is received with fewer than this many bytes it is rejected by
* the current dissector. */
@@ -103,14 +102,15 @@ dissect_caneth_can(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
ext_flag = tvb_get_guint8(tvb, CAN_EXT_FLAG_OFFSET);
rtr_flag = tvb_get_guint8(tvb, CAN_RTR_FLAG_OFFSET);
- proto_tree_add_item_ret_uint(can_tree, hf_caneth_can_ident_ext, tvb, CAN_ID_OFFSET, 4, ENC_LITTLE_ENDIAN, &raw_can_id);
if (ext_flag)
{
+ proto_tree_add_item_ret_uint(can_tree, hf_caneth_can_ident_ext, tvb, CAN_ID_OFFSET, 4, ENC_LITTLE_ENDIAN, &raw_can_id);
can_info.id = raw_can_id & CAN_EFF_MASK;
}
else
{
+ proto_tree_add_item_ret_uint(can_tree, hf_caneth_can_ident_std, tvb, CAN_ID_OFFSET, 4, ENC_LITTLE_ENDIAN, &raw_can_id);
can_info.id = raw_can_id & CAN_SFF_MASK;
}
@@ -122,8 +122,7 @@ dissect_caneth_can(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
next_tvb = tvb_new_subset_length(tvb, CAN_DATA_OFFSET, data_len);
- if (!dissector_try_payload_new(can_subdissector_table, next_tvb, pinfo, tree, TRUE, &can_info))
- {
+ if (!socketcan_call_subdissectors(next_tvb, pinfo, tree, &can_info, FALSE)) {
call_data_dissector(next_tvb, pinfo, tree);
}
@@ -292,7 +291,6 @@ proto_reg_handoff_caneth(void)
heur_dissector_add("udp", dissect_caneth_heur_udp, "CAN-ETH over UDP", "caneth_udp", proto_caneth, HEURISTIC_ENABLE);
- can_subdissector_table = find_dissector_table("can.subdissector");
proto_can = proto_get_id_by_filter_name("can");
}
diff --git a/epan/dissectors/packet-ieee1722.c b/epan/dissectors/packet-ieee1722.c
index 962ace223a..facbcbb5aa 100644
--- a/epan/dissectors/packet-ieee1722.c
+++ b/epan/dissectors/packet-ieee1722.c
@@ -814,16 +814,9 @@ static expert_field ei_1722_canfd_invalid_payload_length = EI_INIT;
static dissector_handle_t avb1722_can_brief_handle;
static dissector_handle_t avb1722_can_handle;
-/* Link to `CAN` protocol for consistent filtering */
-static dissector_handle_t dissector_can;
-static dissector_handle_t dissector_canfd;
-
static int proto_can = -1;
static int proto_canfd = -1;
static gboolean can_heuristic_first = FALSE;
-static dissector_table_t can_subdissector_table;
-static heur_dissector_list_t can_heur_subdissector_table;
-static heur_dtbl_entry_t *can_heur_dtbl_entry;
/**************************************************************************************************/
/* ACF LIN Message */
@@ -2617,25 +2610,8 @@ static int dissect_1722_acf_can_common(tvbuff_t *tvb, packet_info *pinfo, proto_
next_tvb = tvb_new_subset_length(tvb, offset, parsed.datalen);
- if(!can_heuristic_first)
- {
- if (!dissector_try_payload_new(can_subdissector_table, next_tvb, pinfo, tree, TRUE, &can_info))
- {
- if(!dissector_try_heuristic(can_heur_subdissector_table, next_tvb, pinfo, tree, &can_heur_dtbl_entry, &can_info))
- {
- call_data_dissector(next_tvb, pinfo, tree);
- }
- }
- }
- else
- {
- if (!dissector_try_heuristic(can_heur_subdissector_table, next_tvb, pinfo, tree, &can_heur_dtbl_entry, &can_info))
- {
- if(!dissector_try_payload_new(can_subdissector_table, next_tvb, pinfo, tree, FALSE, &can_info))
- {
- call_data_dissector(next_tvb, pinfo, tree);
- }
- }
+ if (!socketcan_call_subdissectors(next_tvb, pinfo, tree, &can_info, can_heuristic_first)) {
+ call_data_dissector(next_tvb, pinfo, tree);
}
/* Add padding bytes to ACF-CAN tree if any */
@@ -2779,11 +2755,7 @@ void proto_reg_handoff_1722_acf_can(void)
register_depend_dissector("acf-can", "can");
register_depend_dissector("acf-can", "canfd");
- dissector_can = find_dissector("can-bigendian");
- dissector_canfd = find_dissector("canfd");
- can_subdissector_table = find_dissector_table("can.subdissector");
- can_heur_subdissector_table = find_heur_dissector_list("can");
proto_can = proto_get_id_by_filter_name("can");
proto_canfd = proto_get_id_by_filter_name("canfd");
}
diff --git a/epan/dissectors/packet-tecmp.c b/epan/dissectors/packet-tecmp.c
index 9c3f6dfd46..06dd607bc4 100644
--- a/epan/dissectors/packet-tecmp.c
+++ b/epan/dissectors/packet-tecmp.c
@@ -42,10 +42,6 @@ static int proto_vlan;
static gboolean heuristic_first = FALSE;
-static dissector_table_t can_subdissector_table;
-static heur_dissector_list_t can_heur_subdissector_list;
-static heur_dtbl_entry_t *can_heur_dtbl_entry;
-
static dissector_table_t fr_subdissector_table;
static heur_dissector_list_t fr_heur_subdissector_list;
static heur_dtbl_entry_t *fr_heur_dtbl_entry;
@@ -1197,19 +1193,10 @@ dissect_tecmp_log_or_replay_stream(tvbuff_t *tvb, packet_info *pinfo, proto_tree
can_info.id |= CAN_ERR_FLAG;
}
- if (!heuristic_first) {
- if (!dissector_try_payload_new(can_subdissector_table, payload_tvb, pinfo, tree, TRUE, &can_info)) {
- if (!dissector_try_heuristic(can_heur_subdissector_list, payload_tvb, pinfo, tree, &can_heur_dtbl_entry, &can_info)) {
- proto_tree_add_item(tecmp_tree, hf_tecmp_payload_data_payload, payload_tvb, 0, (gint)length2, ENC_NA);
- }
- }
- } else {
- if (!dissector_try_heuristic(can_heur_subdissector_list, payload_tvb, pinfo, tree, &can_heur_dtbl_entry, &can_info)) {
- if (!dissector_try_payload_new(can_subdissector_table, payload_tvb, pinfo, tree, FALSE, &can_info)) {
- proto_tree_add_item(tecmp_tree, hf_tecmp_payload_data_payload, payload_tvb, 0, (gint)length2, ENC_NA);
- }
- }
+ if (!socketcan_call_subdissectors(payload_tvb, pinfo, tree, &can_info, heuristic_first)) {
+ proto_tree_add_item(tecmp_tree, hf_tecmp_payload_data_payload, payload_tvb, 0, (gint)length2, ENC_NA);
}
+
}
break;
@@ -1805,9 +1792,6 @@ proto_reg_handoff_tecmp(void) {
tecmp_handle = create_dissector_handle(dissect_tecmp, proto_tecmp);
dissector_add_uint("ethertype", ETHERTYPE_TECMP, tecmp_handle);
- can_subdissector_table = find_dissector_table("can.subdissector");
- can_heur_subdissector_list = find_heur_dissector_list("can");
-
fr_subdissector_table = find_dissector_table("flexray.subdissector");
fr_heur_subdissector_list = find_heur_dissector_list("flexray");