aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Barber <simon.barber@meraki.net>2017-09-13 16:06:56 -0700
committerAnders Broman <a.broman58@gmail.com>2017-11-07 13:38:09 +0000
commit99a53b2b95b7a297134007f5a6ebc6114db32d15 (patch)
tree9830d2aa6b4c5bff320abdf84e7e20de45133fb5
parent3593f0953fc0cffbe1999fc7f4b03656cc36e761 (diff)
packet-ieee80211: all frames have address 1 = RA
Change-Id: Ie4785376eae278713e998e23c96d8435e4dc07f2 Reviewed-on: https://code.wireshark.org/review/23526 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--epan/dissectors/packet-ieee80211.c148
1 files changed, 52 insertions, 96 deletions
diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c
index fdcfb84..a5ad41a 100644
--- a/epan/dissectors/packet-ieee80211.c
+++ b/epan/dissectors/packet-ieee80211.c
@@ -17475,8 +17475,7 @@ dissect_ieee80211_common(tvbuff_t *tvb, packet_info *pinfo,
char out_buff[SHORT_STR];
gint is_iv_bad;
guchar iv_buff[4];
- const char *addr1_str = NULL;
- int addr1_hf = -1, addr1_hf_resolved = -1;
+ const char *addr1_str = "RA";
guint offset;
const gchar *fts_str;
gchar flag_str[] = "opmPRMFTC";
@@ -17711,6 +17710,18 @@ dissect_ieee80211_common(tvbuff_t *tvb, packet_info *pinfo,
frag_number = 0;
seq_number = 0;
+ /* all frames have address 1 = RA */
+ if (tree) {
+ const gchar *ether_name = tvb_get_ether_name(tvb, 4);
+ proto_tree_add_item(hdr_tree, hf_ieee80211_addr_ra, tvb, 4, 6, ENC_NA);
+ hidden_item = proto_tree_add_string(hdr_tree, hf_ieee80211_addr_ra_resolved, tvb, 4, 6, ether_name);
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
+ hidden_item = proto_tree_add_item(hdr_tree, hf_ieee80211_addr, tvb, 4, 6, ENC_NA);
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
+ hidden_item = proto_tree_add_string(hdr_tree, hf_ieee80211_addr_resolved, tvb, 4, 6, ether_name);
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
+ }
+
switch (FCF_FRAME_TYPE (fcf))
{
@@ -17742,10 +17753,7 @@ dissect_ieee80211_common(tvbuff_t *tvb, packet_info *pinfo,
{
const gchar *ra_da_name, *ta_sa_name, *bssid_name;
- proto_tree_add_item(hdr_tree, hf_ieee80211_addr_ra, tvb, 4, 6, ENC_NA);
ra_da_name = tvb_get_ether_name(tvb, 4);
- hidden_item = proto_tree_add_string(hdr_tree, hf_ieee80211_addr_ra_resolved, tvb, 4, 6, ra_da_name);
- PROTO_ITEM_SET_HIDDEN(hidden_item);
proto_tree_add_item(hdr_tree, hf_ieee80211_addr_da, tvb, 4, 6, ENC_NA);
hidden_item = proto_tree_add_string(hdr_tree, hf_ieee80211_addr_da_resolved, tvb, 4, 6, ra_da_name);
PROTO_ITEM_SET_HIDDEN(hidden_item);
@@ -17774,10 +17782,6 @@ dissect_ieee80211_common(tvbuff_t *tvb, packet_info *pinfo,
PROTO_ITEM_SET_HIDDEN(hidden_item);
}
/* add items for wlan.addr filter */
- hidden_item = proto_tree_add_item(hdr_tree, hf_ieee80211_addr, tvb, 4, 6, ENC_NA);
- PROTO_ITEM_SET_HIDDEN(hidden_item);
- hidden_item = proto_tree_add_string(hdr_tree, hf_ieee80211_addr_resolved, tvb, 4, 6, ra_da_name);
- PROTO_ITEM_SET_HIDDEN(hidden_item);
hidden_item = proto_tree_add_item(hdr_tree, hf_ieee80211_addr, tvb, 10, 6, ENC_NA);
PROTO_ITEM_SET_HIDDEN(hidden_item);
hidden_item = proto_tree_add_string(hdr_tree, hf_ieee80211_addr_resolved, tvb, 10, 6, ta_sa_name);
@@ -17821,55 +17825,18 @@ dissect_ieee80211_common(tvbuff_t *tvb, packet_info *pinfo,
break;
}
- switch (ctrl_type_subtype)
- {
- case CTRL_PS_POLL:
- addr1_str = "BSSID";
- addr1_hf = hf_ieee80211_addr_bssid;
- addr1_hf_resolved = hf_ieee80211_addr_bssid_resolved;
-
- break;
- case CTRL_BEAMFORM_RPT_POLL:
- case CTRL_VHT_NDP_ANNC:
- case CTRL_RTS:
- case CTRL_POLL:
- case CTRL_SPR:
- case CTRL_GRANT:
- case CTRL_DMG_CTS:
- case CTRL_DMG_DTS:
- case CTRL_GRANT_ACK:
- case CTRL_SSW:
- case CTRL_SSW_FEEDBACK:
- case CTRL_SSW_ACK:
- case CTRL_CTS:
- case CTRL_ACKNOWLEDGEMENT:
- case CTRL_CFP_END:
- case CTRL_CFP_ENDACK:
- case CTRL_BLOCK_ACK_REQ:
- case CTRL_BLOCK_ACK:
- addr1_str = "RA";
- addr1_hf = hf_ieee80211_addr_ra;
- addr1_hf_resolved = hf_ieee80211_addr_ra_resolved;
- break;
- default:
- break;
+ if (ctrl_type_subtype == CTRL_PS_POLL) {
+ addr1_str = "BSSID";
+ if (tree) {
+ const gchar *ether_name = tvb_get_ether_name(tvb, 4);
+ proto_tree_add_item(hdr_tree, hf_ieee80211_addr_bssid, tvb, 4, 6, ENC_NA);
+ hidden_item = proto_tree_add_string(hdr_tree, hf_ieee80211_addr_bssid_resolved, tvb, 4, 6, ether_name);
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
+ }
}
- if (!addr1_str) /* XXX - Should we throw some sort of error? */
- break;
-
/* Add address 1 */
set_dst_addr_cols(pinfo, tvb, 4, addr1_str);
- if (tree) {
- const gchar *ether_name = tvb_get_ether_name(tvb, 4);
- proto_tree_add_item(hdr_tree, addr1_hf, tvb, 4, 6, ENC_NA);
- hidden_item = proto_tree_add_string(hdr_tree, addr1_hf_resolved, tvb, 4, 6, ether_name);
- PROTO_ITEM_SET_HIDDEN(hidden_item);
- hidden_item = proto_tree_add_item(hdr_tree, hf_ieee80211_addr, tvb, 4, 6, ENC_NA);
- PROTO_ITEM_SET_HIDDEN(hidden_item);
- hidden_item = proto_tree_add_string(hdr_tree, hf_ieee80211_addr_resolved, tvb, 4, 6, ether_name);
- PROTO_ITEM_SET_HIDDEN(hidden_item);
- }
/*
* Start shoving in other fields if needed.
@@ -17896,7 +17863,7 @@ dissect_ieee80211_common(tvbuff_t *tvb, packet_info *pinfo,
case CTRL_PS_POLL:
case CTRL_CFP_ENDACK:
{
- set_src_addr_cols(pinfo, tvb, offset, "BSSID");
+ set_src_addr_cols(pinfo, tvb, offset, "TA");
/* if (tree) */
{
const gchar *ether_name = tvb_get_ether_name(tvb, offset);
@@ -18362,7 +18329,7 @@ dissect_ieee80211_common(tvbuff_t *tvb, packet_info *pinfo,
case DATA_FRAME:
{
- guint32 ra_offset, da_offset, sa_offset, ta_offset, bssid_offset;
+ guint32 da_offset, sa_offset, ta_offset = 10, bssid_offset;
addr_type = FCF_ADDR_SELECTOR(fcf);
/* In order to show src/dst address we must always do the following */
@@ -18370,40 +18337,31 @@ dissect_ieee80211_common(tvbuff_t *tvb, packet_info *pinfo,
{
case DATA_ADDR_T1:
- ra_offset = 4;
da_offset = 4;
sa_offset = 10;
- ta_offset = 10;
bssid_offset = 16;
break;
case DATA_ADDR_T2:
- ra_offset = 4;
da_offset = 4;
sa_offset = 16;
- ta_offset = 10;
bssid_offset = 10;
break;
case DATA_ADDR_T3:
- ra_offset = 4;
da_offset = 16;
sa_offset = 10;
- ta_offset = 10;
bssid_offset = 4;
break;
case DATA_ADDR_T4:
- ra_offset = 4;
da_offset = 16;
sa_offset = 24;
- ta_offset = 10;
bssid_offset = 10;
break;
default:
/* Should never happen? */
- ra_offset = 0;
da_offset = 0;
sa_offset = 0;
ta_offset = 0;
@@ -18434,7 +18392,7 @@ dissect_ieee80211_common(tvbuff_t *tvb, packet_info *pinfo,
/* Now if we have a tree we start adding stuff */
if (tree)
{
- const gchar *ra_name, *ta_name, *sa_name, *da_name, *bssid_name = NULL;
+ const gchar *ta_name, *sa_name, *da_name, *bssid_name = NULL;
switch (addr_type)
{
@@ -18442,9 +18400,14 @@ dissect_ieee80211_common(tvbuff_t *tvb, packet_info *pinfo,
case DATA_ADDR_T2:
case DATA_ADDR_T3:
case DATA_ADDR_T4:
- proto_tree_add_item(hdr_tree, hf_ieee80211_addr_ra, tvb, ra_offset, 6, ENC_NA);
- ra_name = tvb_get_ether_name(tvb, ra_offset);
- hidden_item = proto_tree_add_string(hdr_tree, hf_ieee80211_addr_ra_resolved, tvb, ra_offset, 6, ra_name);
+ proto_tree_add_item(hdr_tree, hf_ieee80211_addr_ta, tvb, ta_offset, 6, ENC_NA);
+ ta_name = tvb_get_ether_name(tvb, ta_offset);
+ hidden_item = proto_tree_add_string(hdr_tree, hf_ieee80211_addr_ta_resolved, tvb, ta_offset, 6, ta_name);
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
+ /* TA is always in the wlan.addr filter */
+ hidden_item = proto_tree_add_item(hdr_tree, hf_ieee80211_addr, tvb, ta_offset, 6, ENC_NA);
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
+ hidden_item = proto_tree_add_string(hdr_tree, hf_ieee80211_addr_resolved, tvb, ta_offset, 6, ta_name);
PROTO_ITEM_SET_HIDDEN(hidden_item);
proto_tree_add_item(hdr_tree, hf_ieee80211_addr_da, tvb, da_offset, 6, ENC_NA);
@@ -18452,11 +18415,6 @@ dissect_ieee80211_common(tvbuff_t *tvb, packet_info *pinfo,
hidden_item = proto_tree_add_string(hdr_tree, hf_ieee80211_addr_da_resolved, tvb, da_offset, 6, da_name);
PROTO_ITEM_SET_HIDDEN(hidden_item);
- proto_tree_add_item(hdr_tree, hf_ieee80211_addr_ta, tvb, ta_offset, 6, ENC_NA);
- ta_name = tvb_get_ether_name(tvb, ta_offset);
- hidden_item = proto_tree_add_string(hdr_tree, hf_ieee80211_addr_ta_resolved, tvb, ta_offset, 6, ta_name);
- PROTO_ITEM_SET_HIDDEN(hidden_item);
-
proto_tree_add_item(hdr_tree, hf_ieee80211_addr_sa, tvb, sa_offset, 6, ENC_NA);
sa_name = tvb_get_ether_name(tvb, sa_offset);
hidden_item = proto_tree_add_string(hdr_tree, hf_ieee80211_addr_sa_resolved, tvb, sa_offset, 6, sa_name);
@@ -18468,7 +18426,7 @@ dissect_ieee80211_common(tvbuff_t *tvb, packet_info *pinfo,
PROTO_ITEM_SET_HIDDEN(hidden_item);
if ((flags & FROM_TO_DS) == FLAG_FROM_DS) { /* Receiver address */
- sta_addr_offset = ra_offset;
+ sta_addr_offset = 4;
} else if ((flags & FROM_TO_DS) == FLAG_TO_DS) { /* Transmitter address */
sta_addr_offset = ta_offset;
}
@@ -18481,27 +18439,25 @@ dissect_ieee80211_common(tvbuff_t *tvb, packet_info *pinfo,
proto_tree_add_item(hdr_tree, hf_ieee80211_frag_number, tvb, 22, 2, ENC_LITTLE_ENDIAN);
proto_tree_add_item(hdr_tree, hf_ieee80211_seq_number, tvb, 22, 2, ENC_LITTLE_ENDIAN);
- /* add items for wlan.addr filter */
- hidden_item = proto_tree_add_item(hdr_tree, hf_ieee80211_addr, tvb, ra_offset, 6, ENC_NA);
- PROTO_ITEM_SET_HIDDEN(hidden_item);
- hidden_item = proto_tree_add_string(hdr_tree, hf_ieee80211_addr_resolved, tvb, ra_offset, 6, ra_name);
- PROTO_ITEM_SET_HIDDEN(hidden_item);
- hidden_item = proto_tree_add_item(hdr_tree, hf_ieee80211_addr, tvb, ta_offset, 6, ENC_NA);
- PROTO_ITEM_SET_HIDDEN(hidden_item);
- hidden_item = proto_tree_add_string(hdr_tree, hf_ieee80211_addr_resolved, tvb, ta_offset, 6, ta_name);
- PROTO_ITEM_SET_HIDDEN(hidden_item);
- hidden_item = proto_tree_add_item(hdr_tree, hf_ieee80211_addr, tvb, sa_offset, 6, ENC_NA);
- PROTO_ITEM_SET_HIDDEN(hidden_item);
- hidden_item = proto_tree_add_string(hdr_tree, hf_ieee80211_addr_resolved, tvb, sa_offset, 6, sa_name);
- PROTO_ITEM_SET_HIDDEN(hidden_item);
- hidden_item = proto_tree_add_item(hdr_tree, hf_ieee80211_addr, tvb, da_offset, 6, ENC_NA);
- PROTO_ITEM_SET_HIDDEN(hidden_item);
- hidden_item = proto_tree_add_string(hdr_tree, hf_ieee80211_addr_resolved, tvb, da_offset, 6, da_name);
- PROTO_ITEM_SET_HIDDEN(hidden_item);
- hidden_item = proto_tree_add_item(hdr_tree, hf_ieee80211_addr, tvb, bssid_offset, 6, ENC_NA);
- PROTO_ITEM_SET_HIDDEN(hidden_item);
- hidden_item = proto_tree_add_string(hdr_tree, hf_ieee80211_addr_resolved, tvb, bssid_offset, 6, bssid_name);
- PROTO_ITEM_SET_HIDDEN(hidden_item);
+ /* add 3rd and 4th address for wlan.addr filter */
+ if (sa_offset != 4 && sa_offset != 10) {
+ hidden_item = proto_tree_add_item(hdr_tree, hf_ieee80211_addr, tvb, sa_offset, 6, ENC_NA);
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
+ hidden_item = proto_tree_add_string(hdr_tree, hf_ieee80211_addr_resolved, tvb, sa_offset, 6, sa_name);
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
+ }
+ if (da_offset != 4 && da_offset != 10 && da_offset != sa_offset) {
+ hidden_item = proto_tree_add_item(hdr_tree, hf_ieee80211_addr, tvb, da_offset, 6, ENC_NA);
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
+ hidden_item = proto_tree_add_string(hdr_tree, hf_ieee80211_addr_resolved, tvb, da_offset, 6, da_name);
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
+ }
+ if (bssid_offset != 4 && bssid_offset != 10 && bssid_offset != sa_offset && bssid_offset != da_offset) {
+ hidden_item = proto_tree_add_item(hdr_tree, hf_ieee80211_addr, tvb, bssid_offset, 6, ENC_NA);
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
+ hidden_item = proto_tree_add_string(hdr_tree, hf_ieee80211_addr_resolved, tvb, bssid_offset, 6, bssid_name);
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
+ }
break;
}