Introduced new helper function is_zero_ether_addr()
Use this inline function to replace os_memcmp(addr, "\x00\x00\x00\x00\x00\x00", ETH_ALEN) == 0.
This commit is contained in:
parent
957ed801e9
commit
a8e16edc86
12 changed files with 18 additions and 26 deletions
|
@ -1317,8 +1317,7 @@ static void wpa_driver_ndis_poll_timeout(void *eloop_ctx, void *timeout_ctx)
|
|||
|
||||
if (wpa_driver_ndis_get_bssid(drv, bssid)) {
|
||||
/* Disconnected */
|
||||
if (os_memcmp(drv->bssid, "\x00\x00\x00\x00\x00\x00", ETH_ALEN)
|
||||
!= 0) {
|
||||
if (!is_zero_ether_addr(drv->bssid)) {
|
||||
os_memset(drv->bssid, 0, ETH_ALEN);
|
||||
wpa_supplicant_event(drv->ctx, EVENT_DISASSOC, NULL);
|
||||
}
|
||||
|
|
|
@ -631,9 +631,8 @@ static void wpa_driver_wext_event_wireless(struct wpa_driver_wext_data *drv,
|
|||
wpa_printf(MSG_DEBUG, "Wireless event: new AP: "
|
||||
MACSTR,
|
||||
MAC2STR((u8 *) iwe->u.ap_addr.sa_data));
|
||||
if (os_memcmp(iwe->u.ap_addr.sa_data,
|
||||
"\x00\x00\x00\x00\x00\x00", ETH_ALEN) ==
|
||||
0 ||
|
||||
if (is_zero_ether_addr(
|
||||
(const u8 *) iwe->u.ap_addr.sa_data) ||
|
||||
os_memcmp(iwe->u.ap_addr.sa_data,
|
||||
"\x44\x44\x44\x44\x44\x44", ETH_ALEN) ==
|
||||
0) {
|
||||
|
|
|
@ -68,8 +68,7 @@ static void rsn_preauth_receive(void *ctx, const u8 *src_addr,
|
|||
wpa_hexdump(MSG_MSGDUMP, "RX pre-auth", buf, len);
|
||||
|
||||
if (sm->preauth_eapol == NULL ||
|
||||
os_memcmp(sm->preauth_bssid, "\x00\x00\x00\x00\x00\x00",
|
||||
ETH_ALEN) == 0 ||
|
||||
is_zero_ether_addr(sm->preauth_bssid) ||
|
||||
os_memcmp(sm->preauth_bssid, src_addr, ETH_ALEN) != 0) {
|
||||
wpa_printf(MSG_WARNING, "RSN pre-auth frame received from "
|
||||
"unexpected source " MACSTR " - dropped",
|
||||
|
|
|
@ -98,8 +98,7 @@ void wpa_eapol_key_send(struct wpa_sm *sm, const u8 *kck,
|
|||
int ver, const u8 *dest, u16 proto,
|
||||
u8 *msg, size_t msg_len, u8 *key_mic)
|
||||
{
|
||||
if (os_memcmp(dest, "\x00\x00\x00\x00\x00\x00", ETH_ALEN) == 0 &&
|
||||
os_memcmp(sm->bssid, "\x00\x00\x00\x00\x00\x00", ETH_ALEN) == 0) {
|
||||
if (is_zero_ether_addr(dest) && is_zero_ether_addr(sm->bssid)) {
|
||||
/*
|
||||
* Association event was not yet received; try to fetch
|
||||
* BSSID from the driver.
|
||||
|
|
|
@ -428,6 +428,10 @@ TCHAR * wpa_strdup_tchar(const char *str);
|
|||
|
||||
const char * wpa_ssid_txt(const u8 *ssid, size_t ssid_len);
|
||||
|
||||
static inline int is_zero_ether_addr(const u8 *a)
|
||||
{
|
||||
return !(a[0] | a[1] | a[2] | a[3] | a[4] | a[5]);
|
||||
}
|
||||
|
||||
#include "wpa_debug.h"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue