aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/rx.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/rx.c')
-rw-r--r--net/mac80211/rx.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index a6701ed87f0d..1236710f70e0 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1556,17 +1556,36 @@ __ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
1556{ 1556{
1557 struct ieee80211_sub_if_data *sdata = rx->sdata; 1557 struct ieee80211_sub_if_data *sdata = rx->sdata;
1558 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; 1558 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
1559 bool check_port_control = false;
1560 struct ethhdr *ehdr;
1561 int ret;
1559 1562
1560 if (ieee80211_has_a4(hdr->frame_control) && 1563 if (ieee80211_has_a4(hdr->frame_control) &&
1561 sdata->vif.type == NL80211_IFTYPE_AP_VLAN && !sdata->u.vlan.sta) 1564 sdata->vif.type == NL80211_IFTYPE_AP_VLAN && !sdata->u.vlan.sta)
1562 return -1; 1565 return -1;
1563 1566
1567 if (sdata->vif.type == NL80211_IFTYPE_STATION &&
1568 !!sdata->u.mgd.use_4addr != !!ieee80211_has_a4(hdr->frame_control)) {
1569
1570 if (!sdata->u.mgd.use_4addr)
1571 return -1;
1572 else
1573 check_port_control = true;
1574 }
1575
1564 if (is_multicast_ether_addr(hdr->addr1) && 1576 if (is_multicast_ether_addr(hdr->addr1) &&
1565 ((sdata->vif.type == NL80211_IFTYPE_AP_VLAN && sdata->u.vlan.sta) || 1577 sdata->vif.type == NL80211_IFTYPE_AP_VLAN && sdata->u.vlan.sta)
1566 (sdata->vif.type == NL80211_IFTYPE_STATION && sdata->u.mgd.use_4addr)))
1567 return -1; 1578 return -1;
1568 1579
1569 return ieee80211_data_to_8023(rx->skb, sdata->vif.addr, sdata->vif.type); 1580 ret = ieee80211_data_to_8023(rx->skb, sdata->vif.addr, sdata->vif.type);
1581 if (ret < 0 || !check_port_control)
1582 return ret;
1583
1584 ehdr = (struct ethhdr *) rx->skb->data;
1585 if (ehdr->h_proto != rx->sdata->control_port_protocol)
1586 return -1;
1587
1588 return 0;
1570} 1589}
1571 1590
1572/* 1591/*