aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-fpp.c
diff options
context:
space:
mode:
authorJaap Keuter <jaap.keuter@xs4all.nl>2020-04-07 14:26:27 +0200
committerAnders Broman <a.broman58@gmail.com>2020-04-07 14:11:44 +0000
commitecebc071ad7ea5482147d88a27dc97df5dc7c355 (patch)
tree1e8cf3c79913a12b76faf43d45870918cd2c82e1 /epan/dissectors/packet-fpp.c
parenta4d4cb1409dcc2363a9231abc4d9a55f1889ae2a (diff)
FPP: Make dissector directionally aware
The IEEE 802.3br dissector does good work figuring out when a frame is preempted by another, in the same direction, and reassemble the continuation into a proper Ethernet frame. But when, at the same time, a frame appears in the other direction, not unheard of in a full duplex link, the reassembly is thrown in turmoil. This change makes the reassembly directionally aware, so that preemptions, either way and even simultanious, can be distinguised as long as the direction of the frame is known. Bug: 16470 Change-Id: Ic99353c1b95238e0d63c4cd14cd454d09e3675cc Reviewed-on: https://code.wireshark.org/review/36731 Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl> Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-fpp.c')
-rw-r--r--epan/dissectors/packet-fpp.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/epan/dissectors/packet-fpp.c b/epan/dissectors/packet-fpp.c
index e588db3786..f13cd028f8 100644
--- a/epan/dissectors/packet-fpp.c
+++ b/epan/dissectors/packet-fpp.c
@@ -88,8 +88,6 @@ static const fragment_items fpp_frag_items = {
#define FPP_PREAMBLE_LENGTH 8
#define FPP_CRC_LENGTH 4
-#define FPP_CONVERSATION_ID 0
-
typedef enum {
FPP_Packet_Expess,
FPP_Packet_Verify,
@@ -302,7 +300,7 @@ drop_conversation(conversation_t *conv) {
static void
drop_fragments(packet_info *pinfo) {
tvbuff_t *tvbuf;
- tvbuf = fragment_delete(&fpp_reassembly_table, pinfo, 1, NULL);
+ tvbuf = fragment_delete(&fpp_reassembly_table, pinfo, pinfo->p2p_dir, NULL);
if (tvbuf != NULL) {
tvb_free(tvbuf);
}
@@ -328,9 +326,9 @@ dissect_preemption(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32
conversation_t *conv;
fpp_ctx_t *ctx;
- conv = find_conversation_by_id(pinfo->num, ENDPOINT_NONE, FPP_CONVERSATION_ID, 0);
+ conv = find_conversation_by_id(pinfo->num, ENDPOINT_NONE, pinfo->p2p_dir, 0);
if (!conv) {
- conv = conversation_new_by_id(pinfo->num, ENDPOINT_NONE, FPP_CONVERSATION_ID, 0);
+ conv = conversation_new_by_id(pinfo->num, ENDPOINT_NONE, pinfo->p2p_dir, 0);
}
/* Create a tree for the preamble. */
@@ -377,7 +375,7 @@ dissect_preemption(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32
}
fragment_add_check(&fpp_reassembly_table,
- tvb, FPP_PREAMBLE_LENGTH, pinfo, 1, NULL,
+ tvb, FPP_PREAMBLE_LENGTH, pinfo, pinfo->p2p_dir, NULL,
0, frag_size, TRUE);
set_address_tvb(&pinfo->dl_dst, AT_ETHER, 6, tvb, 8);
@@ -405,7 +403,7 @@ dissect_preemption(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32
if ((ctx) && (ctx->preemption) && (ctx->frame_cnt == smd1) && (frag_cnt_next(ctx->frag_cnt) == smd2)) {
fpp_pdata_t *fpp_pdata = wmem_new(wmem_file_scope(), fpp_pdata_t);
fpp_pdata->offset = ctx->size;
- p_add_proto_data(wmem_file_scope(), pinfo, proto_fpp, 0, fpp_pdata);
+ p_add_proto_data(wmem_file_scope(), pinfo, proto_fpp, pinfo->p2p_dir, fpp_pdata);
ctx->size += frag_size;
ctx->frag_cnt = smd2;
@@ -415,10 +413,10 @@ dissect_preemption(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32
}
}
- fpp_pdata_t *fpp_pdata = (fpp_pdata_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_fpp, 0);
+ fpp_pdata_t *fpp_pdata = (fpp_pdata_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_fpp, pinfo->p2p_dir);
if (fpp_pdata) {
fragment_add_check(&fpp_reassembly_table,
- tvb, FPP_PREAMBLE_LENGTH, pinfo, 1, NULL,
+ tvb, FPP_PREAMBLE_LENGTH, pinfo, pinfo->p2p_dir, NULL,
fpp_pdata->offset, frag_size, TRUE);
} else {
drop_fragments(pinfo);
@@ -436,18 +434,18 @@ dissect_preemption(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32
if ((ctx) && (ctx->preemption) && (ctx->frame_cnt == smd1) && (frag_cnt_next(ctx->frag_cnt) == smd2)) {
fpp_pdata_t *fpp_pdata = wmem_new(wmem_file_scope(), fpp_pdata_t);
fpp_pdata->offset = ctx->size;
- p_add_proto_data(wmem_file_scope(), pinfo, proto_fpp, 0, fpp_pdata);
+ p_add_proto_data(wmem_file_scope(), pinfo, proto_fpp, pinfo->p2p_dir, fpp_pdata);
}
drop_conversation(conv);
}
- fpp_pdata_t *fpp_pdata = (fpp_pdata_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_fpp, 0);
+ fpp_pdata_t *fpp_pdata = (fpp_pdata_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_fpp, pinfo->p2p_dir);
if (fpp_pdata) {
save_fragmented = pinfo->fragmented;
pinfo->fragmented = TRUE;
frag_data = fragment_add_check(&fpp_reassembly_table,
- tvb, FPP_PREAMBLE_LENGTH, pinfo, 1, NULL,
+ tvb, FPP_PREAMBLE_LENGTH, pinfo, pinfo->p2p_dir, NULL,
fpp_pdata->offset, frag_size, FALSE);
// Attempt reassembly.
new_tvb = process_reassembled_data(tvb, FPP_PREAMBLE_LENGTH, pinfo,