aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/hostap/hostap_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/hostap/hostap_main.c')
-rw-r--r--drivers/net/wireless/hostap/hostap_main.c47
1 files changed, 29 insertions, 18 deletions
diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c
index 4cb09d81b404..b75cf9205ce0 100644
--- a/drivers/net/wireless/hostap/hostap_main.c
+++ b/drivers/net/wireless/hostap/hostap_main.c
@@ -594,24 +594,27 @@ void hostap_dump_tx_header(const char *name, const struct hfa384x_tx_frame *tx)
594} 594}
595 595
596 596
597int hostap_80211_header_parse(struct sk_buff *skb, unsigned char *haddr) 597int hostap_80211_header_parse(const struct sk_buff *skb, unsigned char *haddr)
598{ 598{
599 memcpy(haddr, skb_mac_header(skb) + 10, ETH_ALEN); /* addr2 */ 599 struct hostap_interface *iface = netdev_priv(skb->dev);
600 return ETH_ALEN; 600 local_info_t *local = iface->local;
601} 601
602 602 if (local->monitor_type == PRISM2_MONITOR_PRISM ||
603 local->monitor_type == PRISM2_MONITOR_CAPHDR) {
604 const unsigned char *mac = skb_mac_header(skb);
605
606 if (*(u32 *)mac == LWNG_CAP_DID_BASE) {
607 memcpy(haddr,
608 mac + sizeof(struct linux_wlan_ng_prism_hdr) + 10,
609 ETH_ALEN); /* addr2 */
610 } else { /* (*(u32 *)mac == htonl(LWNG_CAPHDR_VERSION)) */
611 memcpy(haddr,
612 mac + sizeof(struct linux_wlan_ng_cap_hdr) + 10,
613 ETH_ALEN); /* addr2 */
614 }
615 } else
616 memcpy(haddr, skb_mac_header(skb) + 10, ETH_ALEN); /* addr2 */
603 617
604int hostap_80211_prism_header_parse(struct sk_buff *skb, unsigned char *haddr)
605{
606 const unsigned char *mac = skb_mac_header(skb);
607
608 if (*(u32 *)mac == LWNG_CAP_DID_BASE) {
609 memcpy(haddr, mac + sizeof(struct linux_wlan_ng_prism_hdr) + 10,
610 ETH_ALEN); /* addr2 */
611 } else { /* (*(u32 *)mac == htonl(LWNG_CAPHDR_VERSION)) */
612 memcpy(haddr, mac + sizeof(struct linux_wlan_ng_cap_hdr) + 10,
613 ETH_ALEN); /* addr2 */
614 }
615 return ETH_ALEN; 618 return ETH_ALEN;
616} 619}
617 620
@@ -843,6 +846,15 @@ static void prism2_tx_timeout(struct net_device *dev)
843 local->func->schedule_reset(local); 846 local->func->schedule_reset(local);
844} 847}
845 848
849const struct header_ops hostap_80211_ops = {
850 .create = eth_header,
851 .rebuild = eth_rebuild_header,
852 .cache = eth_header_cache,
853 .cache_update = eth_header_cache_update,
854
855 .parse = hostap_80211_header_parse,
856};
857EXPORT_SYMBOL(hostap_80211_ops);
846 858
847void hostap_setup_dev(struct net_device *dev, local_info_t *local, 859void hostap_setup_dev(struct net_device *dev, local_info_t *local,
848 int main_dev) 860 int main_dev)
@@ -883,7 +895,6 @@ void hostap_setup_dev(struct net_device *dev, local_info_t *local,
883 netif_stop_queue(dev); 895 netif_stop_queue(dev);
884} 896}
885 897
886
887static int hostap_enable_hostapd(local_info_t *local, int rtnl_locked) 898static int hostap_enable_hostapd(local_info_t *local, int rtnl_locked)
888{ 899{
889 struct net_device *dev = local->dev; 900 struct net_device *dev = local->dev;
@@ -901,7 +912,7 @@ static int hostap_enable_hostapd(local_info_t *local, int rtnl_locked)
901 912
902 local->apdev->hard_start_xmit = hostap_mgmt_start_xmit; 913 local->apdev->hard_start_xmit = hostap_mgmt_start_xmit;
903 local->apdev->type = ARPHRD_IEEE80211; 914 local->apdev->type = ARPHRD_IEEE80211;
904 local->apdev->hard_header_parse = hostap_80211_header_parse; 915 local->apdev->header_ops = &hostap_80211_ops;
905 916
906 return 0; 917 return 0;
907} 918}