aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/epan
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/epan')
-rw-r--r--plugins/epan/profinet/packet-dcerpc-pn-io.c28
-rw-r--r--plugins/epan/profinet/packet-pn-dcp.c27
2 files changed, 44 insertions, 11 deletions
diff --git a/plugins/epan/profinet/packet-dcerpc-pn-io.c b/plugins/epan/profinet/packet-dcerpc-pn-io.c
index e20c84a321..e2f34b7822 100644
--- a/plugins/epan/profinet/packet-dcerpc-pn-io.c
+++ b/plugins/epan/profinet/packet-dcerpc-pn-io.c
@@ -7653,10 +7653,10 @@ dissect_ARBlockReq_block(tvbuff_t *tvb, int offset,
/* Get current conversation endpoints using MAC addresses */
conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_UDP, 0, 0, 0);
if (conversation == NULL) {
- /* If conversation is null, then create new conversation */
- /* Connect Request is sent by controller and not by device. */
- /* All conversations are based on Controller MAC as address */
- conversation = conversation_new(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_UDP, 0, 0, 0);
+ /* Create new conversation, if no "Ident OK" frame as been dissected yet!
+ * Need to switch dl_src & dl_dst, as current packet is sent by controller and not by device.
+ * All conversations are based on Device MAC as addr1 */
+ conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, ENDPOINT_NONE, 0, 0, 0);
}
/* Try to get apdu status switch information from the conversation */
@@ -8672,7 +8672,10 @@ dissect_DataDescription(tvbuff_t *tvb, int offset,
/* Get current conversation endpoints using MAC addresses */
conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
if (conversation == NULL) {
- conversation = conversation_new(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
+ /* Create new conversation, if no "Ident OK" frame as been dissected yet!
+ * Need to switch dl_src & dl_dst, as current packet is sent by controller and not by device.
+ * All conversations are based on Device MAC as addr1 */
+ conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, ENDPOINT_NONE, 0, 0, 0);
}
station_info = (stationInfo*)conversation_get_proto_data(conversation, proto_pn_dcp);
@@ -8804,7 +8807,10 @@ dissect_ExpectedSubmoduleBlockReq_block(tvbuff_t *tvb, int offset,
/* Get current conversation endpoints using MAC addresses */
conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
if (conversation == NULL) {
- conversation = conversation_new(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
+ /* Create new conversation, if no "Ident OK" frame as been dissected yet!
+ * Need to switch dl_src & dl_dst, as current packet is sent by controller and not by device.
+ * All conversations are based on Device MAC as addr1 */
+ conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, ENDPOINT_NONE, 0, 0, 0);
}
station_info = (stationInfo*)conversation_get_proto_data(conversation, proto_pn_dcp);
@@ -10656,7 +10662,10 @@ dissect_ProfiSafeParameterRequest(tvbuff_t *tvb, int offset,
/* Get current conversation endpoints using MAC addresses */
conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
if (conversation == NULL) {
- conversation = conversation_new(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
+ /* Create new conversation, if no "Ident OK" frame as been dissected yet!
+ * Need to switch dl_src & dl_dst, as current packet is sent by controller and not by device.
+ * All conversations are based on Device MAC as addr1 */
+ conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, ENDPOINT_NONE, 0, 0, 0);
}
station_info = (stationInfo*)conversation_get_proto_data(conversation, proto_pn_dcp);
@@ -10721,7 +10730,10 @@ dissect_RecordDataWrite(tvbuff_t *tvb, int offset,
/* Get current conversation endpoints using MAC addresses */
conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
if (conversation == NULL) {
- conversation = conversation_new(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
+ /* Create new conversation, if no "Ident OK" frame as been dissected yet!
+ * Need to switch dl_src & dl_dst, as current packet is sent by controller and not by device.
+ * All conversations are based on Device MAC as addr1 */
+ conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, ENDPOINT_NONE, 0, 0, 0);
}
station_info = (stationInfo*)conversation_get_proto_data(conversation, proto_pn_dcp);
diff --git a/plugins/epan/profinet/packet-pn-dcp.c b/plugins/epan/profinet/packet-pn-dcp.c
index f440cc1bc4..4a4145734c 100644
--- a/plugins/epan/profinet/packet-pn-dcp.c
+++ b/plugins/epan/profinet/packet-pn-dcp.c
@@ -544,7 +544,14 @@ dissect_PNDCP_Suboption_Device(tvbuff_t *tvb, int offset, packet_info *pinfo,
/* Create a conversation between the MAC addresses */
conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
if (conversation == NULL) {
- conversation = conversation_new(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
+ /* Create new conversation, need to switch dl_src & dl_dst if not a response
+ * All conversations are based on Device MAC as addr1 */
+ if (is_response) {
+ conversation = conversation_new(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
+ }
+ else {
+ conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, ENDPOINT_NONE, 0, 0, 0);
+ }
}
station_info = (stationInfo*)conversation_get_proto_data(conversation, proto_pn_dcp);
@@ -582,7 +589,14 @@ dissect_PNDCP_Suboption_Device(tvbuff_t *tvb, int offset, packet_info *pinfo,
/* Create a conversation between the MAC addresses */
conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
if (conversation == NULL) {
- conversation = conversation_new(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
+ /* Create new conversation, need to switch dl_src & dl_dst if not a response
+ * All conversations are based on Device MAC as addr1 */
+ if (is_response) {
+ conversation = conversation_new(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
+ }
+ else {
+ conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, ENDPOINT_NONE, 0, 0, 0);
+ }
}
station_info = (stationInfo*)conversation_get_proto_data(conversation, proto_pn_dcp);
@@ -606,7 +620,14 @@ dissect_PNDCP_Suboption_Device(tvbuff_t *tvb, int offset, packet_info *pinfo,
/* Create a conversation between the MAC addresses */
conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
if (conversation == NULL) {
- conversation = conversation_new(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
+ /* Create new conversation, need to switch dl_src & dl_dst if not a response
+ * All conversations are based on Device MAC as addr1 */
+ if (is_response) {
+ conversation = conversation_new(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0);
+ }
+ else {
+ conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, ENDPOINT_NONE, 0, 0, 0);
+ }
}
station_info = (stationInfo*)conversation_get_proto_data(conversation, proto_pn_dcp);