aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-dnp.c
diff options
context:
space:
mode:
authorGraham Bloice <graham.bloice@trihedral.com>2007-02-02 10:21:43 +0000
committerGraham Bloice <graham.bloice@trihedral.com>2007-02-02 10:21:43 +0000
commit9cc5985cece2dc3910c03916a543a8590eed8f82 (patch)
tree2f840a9468af701684fb2940d34f2b415bd876a2 /epan/dissectors/packet-dnp.c
parent78042d4e77dbb67978d982c9a86b817854bf22ca (diff)
Corrected handling of udp messages, don't call tcp_dissect_pdus for udp fragments
svn path=/trunk/; revision=20683
Diffstat (limited to 'epan/dissectors/packet-dnp.c')
-rw-r--r--epan/dissectors/packet-dnp.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/epan/dissectors/packet-dnp.c b/epan/dissectors/packet-dnp.c
index 6811bbda21..2307291ff8 100644
--- a/epan/dissectors/packet-dnp.c
+++ b/epan/dissectors/packet-dnp.c
@@ -2386,7 +2386,7 @@ get_dnp3_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset)
}
static int
-dissect_dnp3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_dnp3_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
gint length = tvb_length_remaining(tvb, 0);
@@ -2402,6 +2402,20 @@ dissect_dnp3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
return tvb_length(tvb);
}
+static int
+dissect_dnp3_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+ gint length = tvb_length_remaining(tvb, 0);
+ /* Check for a dnp packet. It should begin with 0x0564 */
+ if(length < DNP_HDR_LEN || tvb_get_ntohs(tvb, 0) != 0x0564) {
+ /* Not a DNP 3.0 packet, just happened to use the same port */
+ return 0;
+ }
+
+ dissect_dnp3_message(tvb, pinfo, tree);
+ return length;
+}
+
static void
dnp3_init(void)
{
@@ -2852,9 +2866,11 @@ proto_register_dnp3(void)
void
proto_reg_handoff_dnp3(void)
{
- dissector_handle_t dnp3_handle;
+ dissector_handle_t dnp3_tcp_handle;
+ dissector_handle_t dnp3_udp_handle;
- dnp3_handle = create_dissector_handle(dissect_dnp3, proto_dnp3);
- dissector_add("tcp.port", TCP_PORT_DNP, dnp3_handle);
- dissector_add("udp.port", UDP_PORT_DNP, dnp3_handle);
+ dnp3_tcp_handle = create_dissector_handle(dissect_dnp3_tcp, proto_dnp3);
+ dnp3_udp_handle = create_dissector_handle(dissect_dnp3_udp, proto_dnp3);
+ dissector_add("tcp.port", TCP_PORT_DNP, dnp3_tcp_handle);
+ dissector_add("udp.port", UDP_PORT_DNP, dnp3_udp_handle);
}