aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-cipmotion.c
diff options
context:
space:
mode:
authorDylan Ulis <daulis0@gmail.com>2018-06-15 10:45:01 -0400
committerAnders Broman <a.broman58@gmail.com>2018-06-18 04:07:02 +0000
commitbef062e56e458006b71c612717dccd32517bc459 (patch)
tree11ba9a005f0588d46c983d06f74888230f13e748 /epan/dissectors/packet-cipmotion.c
parent333e915cff0078215492dc01206edbb1d77886e7 (diff)
CIP: Improve I/O handling
1. Add new dissector table that allows for registration of CIP Class 0/1 I/O against CIP Class that was used in the Forward Open. CIP Safety is still a special case that gets checked before this table. The default handling is generic CIP Class 0/1 I/O. 2. Changed most I/O items labelled "ENIP" to "CIP I/O". ENIP is a separate protocol/layer, and all the I/O traffic is actually CIP. It was very confusing explaining to people they had to look at the wrong protocol layer in Wireshark before. 3. Add the generic Class 0/1 I/O as a separate tree layer. CIP Motion and CIP Safety I/O were already doing this. 4. Update CIP conversation filtering naming to be more accurate. 5. Clean up some offset handling Change-Id: I1c226fe1bd8974ed0e90640c875bef21f15f3095 Reviewed-on: https://code.wireshark.org/review/28290 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-cipmotion.c')
-rw-r--r--epan/dissectors/packet-cipmotion.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/epan/dissectors/packet-cipmotion.c b/epan/dissectors/packet-cipmotion.c
index 3e381f1639..6752fcb6d5 100644
--- a/epan/dissectors/packet-cipmotion.c
+++ b/epan/dissectors/packet-cipmotion.c
@@ -2,6 +2,9 @@
* Routines for CIP (Common Industrial Protocol) Motion dissection
* CIP Motion Home: www.odva.org
*
+ * This dissector includes items from:
+ * CIP Volume 9: CIP Motion, Edition 1.2
+ *
* Copyright 2006-2007
* Benjamin M. Stocks <bmstocks@ra.rockwell.com>
*
@@ -19,6 +22,7 @@
#include "packet-cipmotion.h"
#include "packet-cip.h"
+#include "packet-enip.h"
void proto_register_cipmotion(void);
/* The entry point to the actual dissection is: dissect_cipmotion */
@@ -1831,12 +1835,19 @@ dissect_var_devce_conn_header(tvbuff_t* tvb, proto_tree* tree, guint32* inst_cou
static int
dissect_cipmotion(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data)
{
+ cip_io_data_input* io_data_input = (cip_io_data_input*)data;
+
guint32 con_format;
guint32 update_id;
proto_item *proto_item_top;
proto_tree *proto_tree_top;
guint32 offset = 0;
- guint32 ConnPoint = GPOINTER_TO_UINT(data);
+
+ guint8 ConnPoint = 2;
+ if (io_data_input && io_data_input->conn_info)
+ {
+ ConnPoint = io_data_input->conn_info->ConnPoint;
+ }
/* Create display subtree for the protocol by creating an item and then
* creating a subtree from the item, the subtree must have been registered
@@ -1940,8 +1951,13 @@ dissect_cipmotion(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* dat
static int dissect_cipmotion3(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_)
{
- guint32 ConnPoint = 3;
- return dissect_cipmotion(tvb, pinfo, tree, GUINT_TO_POINTER(ConnPoint));
+ enip_conn_val_t conn_info;
+ conn_info.ConnPoint = 3;
+
+ cip_io_data_input io_data_input;
+ io_data_input.conn_info = &conn_info;
+
+ return dissect_cipmotion(tvb, pinfo, tree, &io_data_input);
}
/*
@@ -3030,8 +3046,10 @@ proto_register_cipmotion(void)
void proto_reg_handoff_cipmotion(void)
{
- dissector_add_for_decode_as("enip.io", cipmotion_handle);
- dissector_add_for_decode_as("enip.io", cipmotion3_handle);
+ dissector_add_for_decode_as("cip.io", cipmotion_handle);
+ dissector_add_for_decode_as("cip.io", cipmotion3_handle);
+
+ dissector_add_uint("cip.io.iface", 0x42, cipmotion_handle);
}
/*