diff options
author | Michael Mann <mmann78@netscape.net> | 2015-08-18 23:14:09 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-11-01 21:42:51 +0000 |
commit | ad1b785fe80df6ecffee396a617960e1af390274 (patch) | |
tree | 0243a68966024410257dc7004688bb3f3ef3869d /epan/dissectors/packet-dnp.c | |
parent | 69e61db3aea6fa70e8ff38c9184b0206ce85ebd3 (diff) |
udp_dissect_pdus follow-up
Add heuristic support
Better documentation
Change-Id: I236c1f4d3613aa58d608aee0e5edc40c3b158d25
Reviewed-on: https://code.wireshark.org/review/10120
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-dnp.c')
-rw-r--r-- | epan/dissectors/packet-dnp.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/epan/dissectors/packet-dnp.c b/epan/dissectors/packet-dnp.c index ce0f7221e7..7970b5144c 100644 --- a/epan/dissectors/packet-dnp.c +++ b/epan/dissectors/packet-dnp.c @@ -3521,30 +3521,31 @@ dissect_dnp3_tcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void return TRUE; } +static gboolean +dnp3_udp_check_header(packet_info *pinfo _U_, tvbuff_t *tvb, int offset _U_, void *data _U_) +{ + return check_dnp3_header(tvb, FALSE); +} + +static gboolean +dnp3_udp_check_header_heur(packet_info *pinfo _U_, tvbuff_t *tvb, int offset _U_, void *data _U_) +{ + return check_dnp3_header(tvb, TRUE); +} + static int dissect_dnp3_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { - if (!check_dnp3_header(tvb, FALSE)) { - return 0; - } - - udp_dissect_pdus(tvb, pinfo, tree, DNP_HDR_LEN, + return udp_dissect_pdus(tvb, pinfo, tree, DNP_HDR_LEN, dnp3_udp_check_header, get_dnp3_message_len, dissect_dnp3_message, data); - - return tvb_captured_length(tvb); } static gboolean dissect_dnp3_udp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { - if (!check_dnp3_header(tvb, FALSE)) { - return FALSE; - } + return (udp_dissect_pdus(tvb, pinfo, tree, DNP_HDR_LEN, dnp3_udp_check_header_heur, + get_dnp3_message_len, dissect_dnp3_message, data) != 0); - udp_dissect_pdus(tvb, pinfo, tree, DNP_HDR_LEN, - get_dnp3_message_len, dissect_dnp3_message, data); - - return TRUE; } static void |