ba04a6fc3e2a52077c2704aa31dae9c0b1560576
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 560-mac80211_wds_sta_fix.patch
1 --- a/net/mac80211/rx.c
2 +++ b/net/mac80211/rx.c
3 @@ -1556,17 +1556,36 @@ __ieee80211_data_to_8023(struct ieee8021
4 {
5 struct ieee80211_sub_if_data *sdata = rx->sdata;
6 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
7 + bool check_port_control = false;
8 + struct ethhdr *ehdr;
9 + int ret;
10
11 if (ieee80211_has_a4(hdr->frame_control) &&
12 sdata->vif.type == NL80211_IFTYPE_AP_VLAN && !sdata->u.vlan.sta)
13 return -1;
14
15 + if (sdata->vif.type == NL80211_IFTYPE_STATION &&
16 + !!sdata->u.mgd.use_4addr != !!ieee80211_has_a4(hdr->frame_control)) {
17 +
18 + if (!sdata->u.mgd.use_4addr)
19 + return -1;
20 + else
21 + check_port_control = true;
22 + }
23 +
24 if (is_multicast_ether_addr(hdr->addr1) &&
25 - ((sdata->vif.type == NL80211_IFTYPE_AP_VLAN && sdata->u.vlan.sta) ||
26 - (sdata->vif.type == NL80211_IFTYPE_STATION && sdata->u.mgd.use_4addr)))
27 + sdata->vif.type == NL80211_IFTYPE_AP_VLAN && sdata->u.vlan.sta)
28 + return -1;
29 +
30 + ret = ieee80211_data_to_8023(rx->skb, sdata->vif.addr, sdata->vif.type);
31 + if (ret < 0 || !check_port_control)
32 + return ret;
33 +
34 + ehdr = (struct ethhdr *) rx->skb->data;
35 + if (ehdr->h_proto != rx->sdata->control_port_protocol)
36 return -1;
37
38 - return ieee80211_data_to_8023(rx->skb, sdata->vif.addr, sdata->vif.type);
39 + return 0;
40 }
41
42 /*