Fix packet socket to work. This implies: - setting device type to ARPHRD_IEEE80211; - sending ARP packets with ARPHRD_ETHER type; - clearing encryption in frame header after performing decryption. Signed-off-by: Jiri Benc Signed-off-by: Jirka Bohac Index: netdev/net/ipv4/arp.c =================================================================== --- netdev.orig/net/ipv4/arp.c 2005-09-07 11:20:41.000000000 +0200 +++ netdev/net/ipv4/arp.c 2005-09-17 14:58:56.000000000 +0200 @@ -636,6 +636,12 @@ struct sk_buff *arp_create(int type, int arp->ar_pro = htons(ETH_P_IP); break; #endif +#if defined(CONFIG_IEEE80211) || defined(CONFIG_IEEE80211_MODULE) + case ARPHRD_IEEE80211: + arp->ar_hrd = htons(ARPHRD_ETHER); + arp->ar_pro = htons(ETH_P_IP); + break; +#endif } arp->ar_hln = dev->addr_len; @@ -747,8 +753,12 @@ static int arp_process(struct sk_buff *s #ifdef CONFIG_NET_FC case ARPHRD_IEEE802: #endif +#if defined(CONFIG_IEEE80211) || defined(CONFIG_IEEE80211_MODULE) + case ARPHRD_IEEE80211: +#endif #if defined(CONFIG_NET_ETHERNET) || defined(CONFIG_TR) || \ - defined(CONFIG_FDDI) || defined(CONFIG_NET_FC) + defined(CONFIG_FDDI) || defined(CONFIG_NET_FC) || \ + defined(CONFIG_IEEE80211) || defined(CONFIG_IEEE80211_MODULE) /* * ETHERNET, Token Ring and Fibre Channel (which are IEEE 802 * devices, according to RFC 2625) devices will accept ARP Index: netdev/net/ieee80211/ieee80211_proto.c =================================================================== --- netdev.orig/net/ieee80211/ieee80211_proto.c 2005-09-17 14:58:51.000000000 +0200 +++ netdev/net/ieee80211/ieee80211_proto.c 2005-09-17 14:58:56.000000000 +0200 @@ -227,7 +227,7 @@ void ieee80211_setup(struct net_device * dev->hard_start_xmit = ieee80211_xmit; - dev->type = ARPHRD_ETHER; + dev->type = ARPHRD_IEEE80211; dev->hard_header_len = IEEE80211_3ADDR_LEN + SNAP_SIZE; dev->mtu = IEEE80211_DATA_LEN - 8 - SNAP_SIZE; dev->addr_len = IEEE80211_ALEN; Index: netdev/net/ieee80211/ieee80211_rx.c =================================================================== --- netdev.orig/net/ieee80211/ieee80211_rx.c 2005-09-17 14:58:51.000000000 +0200 +++ netdev/net/ieee80211/ieee80211_rx.c 2005-09-17 14:58:56.000000000 +0200 @@ -668,11 +668,14 @@ int ieee80211_rx(struct ieee80211_device /* skb: hdr + (possible reassembled) full MSDU payload; possibly still * encrypted/authenticated */ - if (ieee->host_decrypt && (fc & IEEE80211_FCTL_PROTECTED) && - ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt)) - goto rx_dropped; + if (ieee->host_decrypt && (fc & IEEE80211_FCTL_PROTECTED)) { + if (ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt)) + goto rx_dropped; + /* clear encryption flag so raw packet socket gets correct + * data; don't alter fc */ + hdr->frame_ctl = cpu_to_le16(fc & ~IEEE80211_FCTL_PROTECTED); + } - hdr = (struct ieee80211_hdr *)skb->data; if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !ieee->open_wep) { if ( /*ieee->ieee802_1x && */ ieee80211_is_eapol_frame(ieee, skb)) { Index: netdev/net/ieee80211/ieee80211_tx.c =================================================================== --- netdev.orig/net/ieee80211/ieee80211_tx.c 2005-09-17 14:58:36.000000000 +0200 +++ netdev/net/ieee80211/ieee80211_tx.c 2005-09-17 14:58:56.000000000 +0200 @@ -250,8 +250,6 @@ int ieee80211_xmit(struct sk_buff *skb, if (encrypt) fc |= IEEE80211_FCTL_PROTECTED; - header->frame_ctl = cpu_to_le16(fc); - /* Determine fragmentation size based on destination (multicast * and broadcast are not fragmented) */ if (!(ieee->config & IEEE80211_CFG_FRAGMENT) || @@ -319,6 +317,7 @@ int ieee80211_xmit(struct sk_buff *skb, cpu_to_le16(fc | IEEE80211_FCTL_MOREFRAGS); bytes = bytes_per_frag; } else { + frag_hdr->frame_ctl = cpu_to_le16(fc); /* The last fragment takes the remaining length */ bytes = bytes_last_frag; }