Commit a3e2f4b6 authored by Michael Braun's avatar Michael Braun Committed by Johannes Berg

mac80211: fix A-MSDU outer SA/DA

According to IEEE 802.11-2012 section 8.3.2 table 8-19, the outer SA/DA
of A-MSDU frames need to be changed depending on FromDS/ToDS values.
Signed-off-by: default avatarMichael Braun <michael-dev@fami-braun.de>
[use ether_addr_copy and add alignment annotations]
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 06f2bb1e
...@@ -1438,7 +1438,7 @@ enum ieee80211_vif_flags { ...@@ -1438,7 +1438,7 @@ enum ieee80211_vif_flags {
struct ieee80211_vif { struct ieee80211_vif {
enum nl80211_iftype type; enum nl80211_iftype type;
struct ieee80211_bss_conf bss_conf; struct ieee80211_bss_conf bss_conf;
u8 addr[ETH_ALEN]; u8 addr[ETH_ALEN] __aligned(2);
bool p2p; bool p2p;
bool csa_active; bool csa_active;
bool mu_mimo_owner; bool mu_mimo_owner;
......
...@@ -443,7 +443,7 @@ struct ieee80211_if_managed { ...@@ -443,7 +443,7 @@ struct ieee80211_if_managed {
struct ieee80211_mgd_auth_data *auth_data; struct ieee80211_mgd_auth_data *auth_data;
struct ieee80211_mgd_assoc_data *assoc_data; struct ieee80211_mgd_assoc_data *assoc_data;
u8 bssid[ETH_ALEN]; u8 bssid[ETH_ALEN] __aligned(2);
u16 aid; u16 aid;
......
...@@ -3064,6 +3064,7 @@ static bool ieee80211_amsdu_prepare_head(struct ieee80211_sub_if_data *sdata, ...@@ -3064,6 +3064,7 @@ static bool ieee80211_amsdu_prepare_head(struct ieee80211_sub_if_data *sdata,
int subframe_len = skb->len - hdr_len; int subframe_len = skb->len - hdr_len;
void *data; void *data;
u8 *qc, *h_80211_src, *h_80211_dst; u8 *qc, *h_80211_src, *h_80211_dst;
const u8 *bssid;
if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
return false; return false;
...@@ -3087,6 +3088,28 @@ static bool ieee80211_amsdu_prepare_head(struct ieee80211_sub_if_data *sdata, ...@@ -3087,6 +3088,28 @@ static bool ieee80211_amsdu_prepare_head(struct ieee80211_sub_if_data *sdata,
ether_addr_copy(amsdu_hdr->h_source, h_80211_src); ether_addr_copy(amsdu_hdr->h_source, h_80211_src);
ether_addr_copy(amsdu_hdr->h_dest, h_80211_dst); ether_addr_copy(amsdu_hdr->h_dest, h_80211_dst);
/* according to IEEE 802.11-2012 8.3.2 table 8-19, the outer SA/DA
* fields needs to be changed to BSSID for A-MSDU frames depending
* on FromDS/ToDS values.
*/
switch (sdata->vif.type) {
case NL80211_IFTYPE_STATION:
bssid = sdata->u.mgd.bssid;
break;
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_AP_VLAN:
bssid = sdata->vif.addr;
break;
default:
bssid = NULL;
}
if (bssid && ieee80211_has_fromds(hdr->frame_control))
ether_addr_copy(h_80211_src, bssid);
if (bssid && ieee80211_has_tods(hdr->frame_control))
ether_addr_copy(h_80211_dst, bssid);
qc = ieee80211_get_qos_ctl(hdr); qc = ieee80211_get_qos_ctl(hdr);
*qc |= IEEE80211_QOS_CTL_A_MSDU_PRESENT; *qc |= IEEE80211_QOS_CTL_A_MSDU_PRESENT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment