mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 15:27:29 +00:00
cfg80211: add ability to check DA/SA in A-MSDU decapsulation
We should not accept arbitrary DA/SA inside A-MSDUs, it could be used to circumvent protections, like allowing a station to send frames and make them seem to come from somewhere else. Add the necessary infrastructure in cfg80211 to allow such checks, in further patches we'll start using them. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
7f6990c830
commit
8b935ee2ea
4 changed files with 19 additions and 5 deletions
|
@ -739,7 +739,8 @@ __ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen,
|
|||
|
||||
void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
|
||||
const u8 *addr, enum nl80211_iftype iftype,
|
||||
const unsigned int extra_headroom)
|
||||
const unsigned int extra_headroom,
|
||||
const u8 *check_da, const u8 *check_sa)
|
||||
{
|
||||
unsigned int hlen = ALIGN(extra_headroom, 4);
|
||||
struct sk_buff *frame = NULL;
|
||||
|
@ -767,8 +768,17 @@ void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
|
|||
goto purge;
|
||||
|
||||
offset += sizeof(struct ethhdr);
|
||||
/* reuse skb for the last subframe */
|
||||
last = remaining <= subframe_len + padding;
|
||||
|
||||
/* FIXME: should we really accept multicast DA? */
|
||||
if ((check_da && !is_multicast_ether_addr(eth.h_dest) &&
|
||||
!ether_addr_equal(check_da, eth.h_dest)) ||
|
||||
(check_sa && !ether_addr_equal(check_sa, eth.h_source))) {
|
||||
offset += len + padding;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* reuse skb for the last subframe */
|
||||
if (!skb_is_nonlinear(skb) && !reuse_frag && last) {
|
||||
skb_pull(skb, offset);
|
||||
frame = skb;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue