Commit f75f5c6f authored by Helmut Schaa's avatar Helmut Schaa Committed by John W. Linville

mac80211: Fill in skb->protocol information for injected frames

Some drivers (ath9k for example) are using skb->protocol to treat EAPOL
frames somehow special (disallow aggregation for example).

When running in AP mode hostapd injects the EAPOL frames through a
monitor interface and thus skb->protocol isn't set at all. Hence, if the
injected frame is a data frame and carries a rfc1042 headaer update the
skb->protocol field accordingly.
Signed-off-by: default avatarHelmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 12c5ffb5
...@@ -1608,7 +1608,9 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, ...@@ -1608,7 +1608,9 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
struct ieee80211_radiotap_header *prthdr = struct ieee80211_radiotap_header *prthdr =
(struct ieee80211_radiotap_header *)skb->data; (struct ieee80211_radiotap_header *)skb->data;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct ieee80211_hdr *hdr;
u16 len_rthdr; u16 len_rthdr;
u8 *payload;
/* /*
* Frame injection is not allowed if beaconing is not allowed * Frame injection is not allowed if beaconing is not allowed
...@@ -1659,6 +1661,24 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, ...@@ -1659,6 +1661,24 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
skb_set_network_header(skb, len_rthdr); skb_set_network_header(skb, len_rthdr);
skb_set_transport_header(skb, len_rthdr); skb_set_transport_header(skb, len_rthdr);
/*
* Initialize skb->protocol if the injected frame is a data frame
* carrying a rfc1042 header
*/
if (skb->len > len_rthdr + 2) {
hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr);
if (ieee80211_is_data(hdr->frame_control) &&
skb->len >= len_rthdr +
ieee80211_hdrlen(hdr->frame_control) +
sizeof(rfc1042_header) + 2) {
payload = (u8 *)hdr +
ieee80211_hdrlen(hdr->frame_control);
if (compare_ether_addr(payload, rfc1042_header) == 0)
skb->protocol = cpu_to_be16((payload[6] << 8) |
payload[7]);
}
}
memset(info, 0, sizeof(*info)); memset(info, 0, sizeof(*info));
info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
......
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