--- zzzz-none-000/linux-3.10.107/drivers/net/wireless/hostap/hostap_ap.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/net/wireless/hostap/hostap_ap.c 2021-02-04 17:41:59.000000000 +0000 @@ -24,6 +24,7 @@ #include #include #include +#include #include "hostap_wlan.h" #include "hostap.h" @@ -106,13 +107,12 @@ s = ap->sta_hash[STA_HASH(sta->addr)]; if (s == NULL) return; - if (memcmp(s->addr, sta->addr, ETH_ALEN) == 0) { + if (ether_addr_equal(s->addr, sta->addr)) { ap->sta_hash[STA_HASH(sta->addr)] = s->hnext; return; } - while (s->hnext != NULL && memcmp(s->hnext->addr, sta->addr, ETH_ALEN) - != 0) + while (s->hnext != NULL && !ether_addr_equal(s->hnext->addr, sta->addr)) s = s->hnext; if (s->hnext != NULL) s->hnext = s->hnext->hnext; @@ -145,9 +145,9 @@ if (sta->aid > 0) ap->sta_aid[sta->aid - 1] = NULL; - if (!sta->ap && sta->u.sta.challenge) + if (!sta->ap) kfree(sta->u.sta.challenge); - del_timer(&sta->timer); + del_timer_sync(&sta->timer); #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ kfree(sta); @@ -309,7 +309,7 @@ int i; PDEBUG(DEBUG_AP, "%s: Deauthenticate all stations\n", dev->name); - memset(addr, 0xff, ETH_ALEN); + eth_broadcast_addr(addr); resp = cpu_to_le16(WLAN_REASON_PREV_AUTH_NOT_VALID); @@ -435,7 +435,7 @@ ptr != &mac_restrictions->mac_list; ptr = ptr->next) { entry = list_entry(ptr, struct mac_entry, list); - if (memcmp(entry->addr, mac, ETH_ALEN) == 0) { + if (ether_addr_equal(entry->addr, mac)) { list_del(ptr); kfree(entry); mac_restrictions->entries--; @@ -459,7 +459,7 @@ spin_lock_bh(&mac_restrictions->lock); list_for_each_entry(entry, &mac_restrictions->mac_list, list) { - if (memcmp(entry->addr, mac, ETH_ALEN) == 0) { + if (ether_addr_equal(entry->addr, mac)) { found = 1; break; } @@ -957,7 +957,7 @@ struct sta_info *s; s = ap->sta_hash[STA_HASH(sta)]; - while (s != NULL && memcmp(s->addr, sta, ETH_ALEN) != 0) + while (s != NULL && !ether_addr_equal(s->addr, sta)) s = s->hnext; return s; } @@ -1015,8 +1015,8 @@ memcpy(hdr->addr3, dev->dev_addr, ETH_ALEN); /* SA */ } else if (ieee80211_is_ctl(hdr->frame_control)) { /* control:ACK does not have addr2 or addr3 */ - memset(hdr->addr2, 0, ETH_ALEN); - memset(hdr->addr3, 0, ETH_ALEN); + eth_zero_addr(hdr->addr2); + eth_zero_addr(hdr->addr3); } else { memcpy(hdr->addr2, dev->dev_addr, ETH_ALEN); /* SA */ memcpy(hdr->addr3, dev->dev_addr, ETH_ALEN); /* BSSID */ @@ -1391,7 +1391,7 @@ status_code = __le16_to_cpu(*pos); pos++; - if (memcmp(dev->dev_addr, hdr->addr2, ETH_ALEN) == 0 || + if (ether_addr_equal(dev->dev_addr, hdr->addr2) || ap_control_mac_deny(&ap->mac_restrictions, hdr->addr2)) { txt = "authentication denied"; resp = WLAN_STATUS_UNSPECIFIED_FAILURE; @@ -1601,7 +1601,7 @@ memcpy(prev_ap, pos, ETH_ALEN); pos++; pos++; pos++; left -= 6; } else - memset(prev_ap, 0, ETH_ALEN); + eth_zero_addr(prev_ap); if (left >= 2) { unsigned int ileft; @@ -1935,7 +1935,7 @@ PDEBUG(DEBUG_PS2, "handle_pspoll: BSSID=%pM, TA=%pM PWRMGT=%d\n", hdr->addr1, hdr->addr2, !!ieee80211_has_pm(hdr->frame_control)); - if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) { + if (!ether_addr_equal(hdr->addr1, dev->dev_addr)) { PDEBUG(DEBUG_AP, "handle_pspoll - addr1(BSSID)=%pM not own MAC\n", hdr->addr1); @@ -2230,7 +2230,7 @@ goto done; } - if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) { + if (!ether_addr_equal(hdr->addr1, dev->dev_addr)) { PDEBUG(DEBUG_AP, "handle_ap_item - addr1(BSSID)=%pM" " not own MAC\n", hdr->addr1); goto done; @@ -2267,13 +2267,13 @@ goto done; } - if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) { + if (!ether_addr_equal(hdr->addr1, dev->dev_addr)) { PDEBUG(DEBUG_AP, "handle_ap_item - addr1(DA)=%pM" " not own MAC\n", hdr->addr1); goto done; } - if (memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN)) { + if (!ether_addr_equal(hdr->addr3, dev->dev_addr)) { PDEBUG(DEBUG_AP, "handle_ap_item - addr3(BSSID)=%pM" " not own MAC\n", hdr->addr3); goto done; @@ -2403,13 +2403,13 @@ addr[count].sa_family = ARPHRD_ETHER; memcpy(addr[count].sa_data, sta->addr, ETH_ALEN); if (sta->last_rx_silence == 0) - qual[count].qual = sta->last_rx_signal < 27 ? - 0 : (sta->last_rx_signal - 27) * 92 / 127; + qual[count].qual = (sta->last_rx_signal - 156) == 0 ? + 0 : (sta->last_rx_signal - 156) * 92 / 64; else - qual[count].qual = sta->last_rx_signal - - sta->last_rx_silence - 35; - qual[count].level = HFA384X_LEVEL_TO_dBm(sta->last_rx_signal); - qual[count].noise = HFA384X_LEVEL_TO_dBm(sta->last_rx_silence); + qual[count].qual = (sta->last_rx_signal - + sta->last_rx_silence) * 92 / 64; + qual[count].level = sta->last_rx_signal; + qual[count].noise = sta->last_rx_silence; qual[count].updated = sta->last_rx_updated; sta->last_rx_updated = IW_QUAL_DBM; @@ -2475,13 +2475,13 @@ memset(&iwe, 0, sizeof(iwe)); iwe.cmd = IWEVQUAL; if (sta->last_rx_silence == 0) - iwe.u.qual.qual = sta->last_rx_signal < 27 ? - 0 : (sta->last_rx_signal - 27) * 92 / 127; + iwe.u.qual.qual = (sta->last_rx_signal -156) == 0 ? + 0 : (sta->last_rx_signal - 156) * 92 / 64; else - iwe.u.qual.qual = sta->last_rx_signal - - sta->last_rx_silence - 35; - iwe.u.qual.level = HFA384X_LEVEL_TO_dBm(sta->last_rx_signal); - iwe.u.qual.noise = HFA384X_LEVEL_TO_dBm(sta->last_rx_silence); + iwe.u.qual.qual = (sta->last_rx_signal - + sta->last_rx_silence) * 92 / 64; + iwe.u.qual.level = sta->last_rx_signal; + iwe.u.qual.noise = sta->last_rx_silence; iwe.u.qual.updated = sta->last_rx_updated; iwe.len = IW_EV_QUAL_LEN; current_ev = iwe_stream_add_event(info, current_ev, end_buf, @@ -3035,7 +3035,7 @@ if (!wds) { /* FromDS frame - not for us; probably * broadcast/multicast in another BSS - drop */ - if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) { + if (ether_addr_equal(hdr->addr1, dev->dev_addr)) { printk(KERN_DEBUG "Odd.. FromDS packet " "received with own BSSID\n"); hostap_dump_rx_80211(dev->name, skb, rx_stats); @@ -3044,7 +3044,7 @@ goto out; } } else if (stype == IEEE80211_STYPE_NULLFUNC && sta == NULL && - memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) { + ether_addr_equal(hdr->addr1, dev->dev_addr)) { if (local->hostapd) { prism2_rx_80211(local->apdev, skb, rx_stats, @@ -3073,7 +3073,7 @@ /* If BSSID (Addr3) is foreign, this frame is a normal * broadcast frame from an IBSS network. Drop it silently. * If BSSID is own, report the dropping of this frame. */ - if (memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN) == 0) { + if (ether_addr_equal(hdr->addr3, dev->dev_addr)) { printk(KERN_DEBUG "%s: dropped received packet from %pM" " with no ToDS flag " "(type=0x%02x, subtype=0x%02x)\n", dev->name,