aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorJaap Keuter <jaap.keuter@xs4all.nl>2020-12-15 19:14:32 +0100
committerGuy Harris <gharris@sonic.net>2020-12-15 20:26:29 +0000
commit3f0fc1b232493815161b345368c7c41500e0153c (patch)
tree1d747b27a269e18a3f72591d2140d0c658cc9b31 /epan/dissectors
parent354a6fd0154c284b5c1b86987fde1e58cc73dbbb (diff)
FC: use ETHERTYPE_UNK when applicable, no excuses
Two interlocking problems cause the dissection of FC to fail in some cases, as shown in the capture of the related issue. The FC dissector assumes that ETHERTYPE_UNK in the data structure passed to it is coming from the MDS header dissector only, and thus that header sizes have to be taken into account. This is not / no longer the case. It always passes down ETHERTYPE_FCFT. Therefore the MDS header size checking does not apply to ETHERTYP_UNK, so is removed as condition. The other FC related dissectors were forced to setup a data structure to pass to FC for it to handle that part of the frame. Because these weren't related to ethernet, these lazily set the ethertype field in the data structure to 0. This unfortunately matches ETHERTYPE_UNK, triggering the MDS header size checking in FC, leading to this issue. With the first problem resolved, now make it explicit that unknown ethertype is indicated by ETHERTYPE_UNK, not '0'. Addresses primary part of issue #17084
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-brdwlk.c1
-rw-r--r--epan/dissectors/packet-cpfi.c2
-rw-r--r--epan/dissectors/packet-fc.c5
-rw-r--r--epan/dissectors/packet-fc.h1
-rw-r--r--epan/dissectors/packet-fcip.c2
-rw-r--r--epan/dissectors/packet-fcoe.c3
-rw-r--r--epan/dissectors/packet-fcoib.c2
-rw-r--r--epan/dissectors/packet-fip.c1
-rw-r--r--epan/dissectors/packet-ifcp.c2
-rw-r--r--epan/dissectors/packet-llc.c1
10 files changed, 8 insertions, 12 deletions
diff --git a/epan/dissectors/packet-brdwlk.c b/epan/dissectors/packet-brdwlk.c
index f88ea0ed56..7a8ca0277b 100644
--- a/epan/dissectors/packet-brdwlk.c
+++ b/epan/dissectors/packet-brdwlk.c
@@ -12,7 +12,6 @@
#include "config.h"
#include <epan/packet.h>
-#include <epan/etypes.h>
#include <epan/proto_data.h>
#include "packet-fc.h"
diff --git a/epan/dissectors/packet-cpfi.c b/epan/dissectors/packet-cpfi.c
index 536c919205..bb0a1f0b83 100644
--- a/epan/dissectors/packet-cpfi.c
+++ b/epan/dissectors/packet-cpfi.c
@@ -357,7 +357,7 @@ dissect_cpfi(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, void *
dissect_cpfi_header(header_tvb, pinfo, cpfi_tree);
body_tvb = tvb_new_subset_length_caplen(message_tvb, 8, body_length, reported_body_length);
- fc_data.ethertype = 0;
+ fc_data.ethertype = ETHERTYPE_UNK;
call_dissector_with_data(fc_handle, body_tvb, pinfo, tree, &fc_data);
/* add more info, now that FC added its */
diff --git a/epan/dissectors/packet-fc.c b/epan/dissectors/packet-fc.c
index cc5fbd0a0b..1d6aac62bc 100644
--- a/epan/dissectors/packet-fc.c
+++ b/epan/dissectors/packet-fc.c
@@ -20,7 +20,6 @@
#include <wiretap/wtap.h>
#include <epan/reassemble.h>
#include <epan/conversation_table.h>
-#include <epan/etypes.h>
#include <epan/srt_table.h>
#include "packet-fc.h"
#include "packet-fclctl.h"
@@ -1007,7 +1006,7 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean
* and are never fragmented and so we ignore the frag_size assertion for
* these frames.
*/
- if ((fc_data->ethertype == ETHERTYPE_UNK) || (fc_data->ethertype == ETHERTYPE_FCFT)) {
+ if (fc_data->ethertype == ETHERTYPE_FCFT) {
if ((frag_size < MDSHDR_TRAILER_SIZE) ||
((frag_size == MDSHDR_TRAILER_SIZE) && (ftype != FC_FTYPE_LINKCTL) &&
(ftype != FC_FTYPE_BLS) && (ftype != FC_FTYPE_OHMS))) {
@@ -1284,7 +1283,7 @@ dissect_fcsof(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U
next_tvb = tvb_new_subset_length(tvb, 4, crc_offset-4);
- fc_data.ethertype = 0;
+ fc_data.ethertype = ETHERTYPE_UNK;
fc_data.sof_eof = 0;
if (sof == FC_SOFI2 || sof == FC_SOFI3) {
fc_data.sof_eof = FC_DATA_SOF_FIRST_FRAME;
diff --git a/epan/dissectors/packet-fc.h b/epan/dissectors/packet-fc.h
index f2e6c1cd74..553dea247a 100644
--- a/epan/dissectors/packet-fc.h
+++ b/epan/dissectors/packet-fc.h
@@ -13,6 +13,7 @@
#define __PACKET_FC_H_
#include <epan/conversation.h>
+#include <epan/etypes.h>
#include "ws_symbol_export.h"
/* R_CTL upper bits creates a classification tree */
diff --git a/epan/dissectors/packet-fcip.c b/epan/dissectors/packet-fcip.c
index 5dc3a61e27..28323888ef 100644
--- a/epan/dissectors/packet-fcip.c
+++ b/epan/dissectors/packet-fcip.c
@@ -477,7 +477,7 @@ dissect_fcip (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* Special frame bit is not set */
next_tvb = tvb_new_subset_remaining (tvb, FCIP_ENCAP_HEADER_LEN+4);
if (fc_handle) {
- fc_data.ethertype = 0;
+ fc_data.ethertype = ETHERTYPE_UNK;
call_dissector_with_data(fc_handle, next_tvb, pinfo, tree, &fc_data);
}
else {
diff --git a/epan/dissectors/packet-fcoe.c b/epan/dissectors/packet-fcoe.c
index ea7fc8f022..6c8456f799 100644
--- a/epan/dissectors/packet-fcoe.c
+++ b/epan/dissectors/packet-fcoe.c
@@ -21,7 +21,6 @@
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/crc32-tvb.h>
-#include <epan/etypes.h>
#include <epan/expert.h>
#include "packet-fc.h"
@@ -277,7 +276,7 @@ dissect_fcoe(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
}
/* Call the FC Dissector if this is carrying an FC frame */
- fc_data.ethertype = 0;
+ fc_data.ethertype = ETHERTYPE_UNK;
if (fc_handle) {
call_dissector_with_data(fc_handle, next_tvb, pinfo, tree, &fc_data);
diff --git a/epan/dissectors/packet-fcoib.c b/epan/dissectors/packet-fcoib.c
index 8f897e4642..d8f0b24eee 100644
--- a/epan/dissectors/packet-fcoib.c
+++ b/epan/dissectors/packet-fcoib.c
@@ -216,7 +216,7 @@ dissect_fcoib(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
}
/* Call the FC Dissector if this is carrying an FC frame */
- fc_data.ethertype = 0;
+ fc_data.ethertype = ETHERTYPE_UNK;
if (fc_handle) {
call_dissector_with_data(fc_handle, next_tvb, pinfo, tree, &fc_data);
diff --git a/epan/dissectors/packet-fip.c b/epan/dissectors/packet-fip.c
index e8860f29e1..56c85ef499 100644
--- a/epan/dissectors/packet-fip.c
+++ b/epan/dissectors/packet-fip.c
@@ -24,7 +24,6 @@
#include <epan/packet.h>
#include <epan/to_str.h>
-#include <epan/etypes.h>
#include <epan/expert.h>
#include "packet-fc.h"
diff --git a/epan/dissectors/packet-ifcp.c b/epan/dissectors/packet-ifcp.c
index 3899c8a2db..2c71b78e7f 100644
--- a/epan/dissectors/packet-ifcp.c
+++ b/epan/dissectors/packet-ifcp.c
@@ -426,7 +426,7 @@ dissect_ifcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, voi
}
next_tvb=tvb_new_subset_length(tvb, offset, frame_len-offset-4);
- fc_data.ethertype = 0;
+ fc_data.ethertype = ETHERTYPE_UNK;
if(fc_handle){
call_dissector_with_data(fc_handle, next_tvb, pinfo, parent_tree, &fc_data);
diff --git a/epan/dissectors/packet-llc.c b/epan/dissectors/packet-llc.c
index 12b8c36338..91c573fea8 100644
--- a/epan/dissectors/packet-llc.c
+++ b/epan/dissectors/packet-llc.c
@@ -17,7 +17,6 @@
#include <wsutil/pint.h>
#include <epan/oui.h>
#include <epan/xdlc.h>
-#include <epan/etypes.h>
#include <epan/llcsaps.h>
#include <epan/bridged_pids.h>
#include <epan/ppptypes.h>