aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-infiniband.c
diff options
context:
space:
mode:
authorParav Pandit <paravpandit@yahoo.com>2016-12-10 03:00:09 -0500
committerMichael Mann <mmann78@netscape.net>2016-12-13 03:22:05 +0000
commit9f9086c392d75487087c1acf2eac246276b692a9 (patch)
treed7d2adf7ece30640a3492a88c06852d8b870fccf /epan/dissectors/packet-infiniband.c
parentdd816a121829f8129dc70b70c25d83eed08e279a (diff)
packet-infiniband: Update conversation src port for exact lookup
Dissectors above infiniband (such as RPC dissector) performs exact lookup on saddr, daddr, sport, dport. They are unaware that underlying transport is infiniband which doesn't have src_qp in packets. Due to which srcport remains uninitialized and exact lookup fails. In order to get them work seemlessly, this fix updates the sport to src_qp (similar to destport to dest_qp). With this upper level dissectors can perform direct lookup similar to TCP. Those which need to access private data of unidirectional CM messages, can still continue to perform unidirectional lookup as before. It also fixes the issue where req_qp and resp_qp were swapped during bidirectional conversation creation. This was caught during testing with packet-rpc.c by Chuck Lever. Tested protocols: 1. nfs-rdma over Infiniband with trace of Bug 13213 2. ICMP packets over Infiniband 3. NVMe fabrics over RDMA Tested with trace of Bug 13201 for Nvme. Bug: 13202 Bug: 13213 Change-Id: Ica1b6aae3ccaa6642dc3b3edfa9a5a4c335cc5da Tested-by: paravpandit@yahoo.com Reviewed-on: https://code.wireshark.org/review/19190 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Chuck Lever <chuck.lever@oracle.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-infiniband.c')
-rw-r--r--epan/dissectors/packet-infiniband.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/epan/dissectors/packet-infiniband.c b/epan/dissectors/packet-infiniband.c
index ad501244f3..a007d6a231 100644
--- a/epan/dissectors/packet-infiniband.c
+++ b/epan/dissectors/packet-infiniband.c
@@ -2369,6 +2369,23 @@ parse_IETH(proto_tree * parentTree, tvbuff_t *tvb, gint *offset)
*offset = local_offset;
}
+static void update_sport(packet_info *pinfo)
+{
+ conversation_t *conv;
+ conversation_infiniband_data *conv_data;
+
+ conv = find_conversation(pinfo->num, &pinfo->dst, &pinfo->dst,
+ PT_IBQP, pinfo->destport, pinfo->destport, NO_ADDR_B|NO_PORT_B);
+ if (!conv)
+ return;
+
+ conv_data = (conversation_infiniband_data *)conversation_get_proto_data(conv, proto_infiniband);
+ if (!conv_data)
+ return;
+
+ pinfo->srcport = conv_data->src_qp;
+}
+
/* Parse Payload - Packet Payload / Invariant CRC / maybe Variant CRC
* IN: parentTree to add the dissection to - in this code the all_headers_tree
* IN: pinfo - packet info from wireshark
@@ -2464,6 +2481,10 @@ static void parse_PAYLOAD(proto_tree *parentTree,
}
else /* Normal Data Packet - Parse as such */
{
+ /* update sport for the packet, for dissectors that performs
+ * exact match on saddr, dadr, sport, dport tuple.
+ */
+ update_sport(pinfo);
/* Calculation for Payload:
* (tvb_length) Length of entire packet - (local_offset) Starting byte of Payload Data
@@ -3228,9 +3249,8 @@ static void create_bidi_conv(packet_info *pinfo, connection_context *connection)
proto_data->client_to_server = FALSE;
memset(&proto_data->mad_private_data[0], 0, MAD_DATA_SIZE);
conv = conversation_new(pinfo->num, &pinfo->src, &pinfo->dst,
- PT_IBQP, connection->req_qp,
- connection->resp_qp, 0);
-
+ PT_IBQP, connection->resp_qp,
+ connection->req_qp, 0);
conversation_add_proto_data(conv, proto_infiniband, proto_data);
}