aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-07-25 18:04:46 -0700
committerGuy Harris <guy@alum.mit.edu>2018-07-26 01:09:57 +0000
commit8a0cbd49ad03495670e5803cbad9d083779ba351 (patch)
tree4577e3637db75ee72e996064cbfa19d3e4ecdea1
parent98ecf04f91fdfdac0348713716a14206a673e2cb (diff)
Add a preference to override the radiotap FCS bit.
This is separate from the 802.11 preference, which only affects packets where no file or packet metadata indicates whether there is an FCS (yes, that is intentional behavior). This is specifically for radiotap, in case some driver fails to set the FCS bit correctly (this is currently an issue with Npcap, which currently assumes that the packet has an FCS iff NDIS indicated the packet with the DOT11_RECV_FLAG_RAW_PACKET flag; that doesn't appear to be a reliable indicator, and it's not clear there *is* a reliable indicator, so Npcap might have to fall back on something really gross like a quirks database for particular adapters). Change-Id: Ia3b134d89004307442d42cfa5ed3cf8fb938235f Ping-Bug: 15010 Reviewed-on: https://code.wireshark.org/review/28855 Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r--epan/dissectors/packet-ieee80211-radiotap.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/epan/dissectors/packet-ieee80211-radiotap.c b/epan/dissectors/packet-ieee80211-radiotap.c
index 4876523bb0..e209c03629 100644
--- a/epan/dissectors/packet-ieee80211-radiotap.c
+++ b/epan/dissectors/packet-ieee80211-radiotap.c
@@ -365,6 +365,17 @@ static int radiotap_tap = -1;
static gboolean radiotap_bit14_fcs = FALSE;
static gboolean radiotap_interpret_high_rates_as_mcs = FALSE;
+#define USE_FCS_BIT 0
+#define ASSUME_FCS_PRESENT 1
+#define ASSUME_FCS_ABSENT 2
+static const enum_val_t fcs_handling[] = {
+ { "use_fcs_bit", "Use the FCS bit", USE_FCS_BIT },
+ { "assume_fcs_present", "Assume all packets have an FCS at the end", ASSUME_FCS_PRESENT },
+ { "assume_fcs_absent", "Assume all packets don't have an FCS at the end", ASSUME_FCS_ABSENT },
+ { NULL, NULL, 0 }
+};
+static int radiotap_fcs_handling = USE_FCS_BIT;
+
struct _radiotap_info {
guint radiotap_length;
guint32 rate;
@@ -1326,11 +1337,23 @@ dissect_radiotap_flags(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
*rflags = tvb_get_guint8(tvb, offset);
if (*rflags & IEEE80211_RADIOTAP_F_DATAPAD)
phdr->datapad = TRUE;
- if (*rflags & IEEE80211_RADIOTAP_F_FCS)
+ switch (radiotap_fcs_handling) {
+
+ case USE_FCS_BIT:
+ if (*rflags & IEEE80211_RADIOTAP_F_FCS)
+ phdr->fcs_len = 4;
+ else
+ phdr->fcs_len = 0;
+ break;
+
+ case ASSUME_FCS_PRESENT:
phdr->fcs_len = 4;
- else
- phdr->fcs_len = 0;
+ break;
+ case ASSUME_FCS_ABSENT:
+ phdr->fcs_len = 0;
+ break;
+ }
ft = proto_tree_add_item(tree, hf_radiotap_flags, tvb, offset,
1, ENC_LITTLE_ENDIAN);
flags_tree = proto_item_add_subtree(ft, ett_radiotap_flags);
@@ -4224,6 +4247,13 @@ void proto_register_radiotap(void)
"Some generators use rates with bit 7 set to indicate an MCS, e.g. BSD. "
"others (Linux, AirPcap) do not.",
&radiotap_interpret_high_rates_as_mcs);
+
+ prefs_register_enum_preference(radiotap_module, "fcs_handling",
+ "Whether and how to override the FCS bit",
+ "Whether to use the FCS bit, assume the FCS is always present, "
+ "or assume the FCS is never present.",
+ &radiotap_fcs_handling,
+ fcs_handling, FALSE);
}
void proto_reg_handoff_radiotap(void)