aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2008-06-03 15:08:48 (GMT)
committerJouni Malinen <j@w1.fi>2008-06-03 15:08:48 (GMT)
commita8e16edc8638d18b972e2b053d17b54167ce5aa5 (patch)
tree263bc8ddfe1b80a718d1f41ccc43d72e9569947b /src
parent957ed801e9261c051c2ca1bbc5a051ff38e11fde (diff)
downloadhostap-06-a8e16edc8638d18b972e2b053d17b54167ce5aa5.zip
hostap-06-a8e16edc8638d18b972e2b053d17b54167ce5aa5.tar.gz
hostap-06-a8e16edc8638d18b972e2b053d17b54167ce5aa5.tar.bz2
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.
Diffstat (limited to 'src')
-rw-r--r--src/drivers/driver_ndis.c3
-rw-r--r--src/drivers/driver_wext.c5
-rw-r--r--src/rsn_supp/preauth.c3
-rw-r--r--src/rsn_supp/wpa.c3
-rw-r--r--src/utils/common.h4
5 files changed, 9 insertions, 9 deletions
diff --git a/src/drivers/driver_ndis.c b/src/drivers/driver_ndis.c
index f306a52..baa95e6 100644
--- a/src/drivers/driver_ndis.c
+++ b/src/drivers/driver_ndis.c
@@ -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);
}
diff --git a/src/drivers/driver_wext.c b/src/drivers/driver_wext.c
index efa88a8..1226b94 100644
--- a/src/drivers/driver_wext.c
+++ b/src/drivers/driver_wext.c
@@ -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) {
diff --git a/src/rsn_supp/preauth.c b/src/rsn_supp/preauth.c
index e9bf7c6..7bc3c04 100644
--- a/src/rsn_supp/preauth.c
+++ b/src/rsn_supp/preauth.c
@@ -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",
diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c
index 1dada92..cb511e0 100644
--- a/src/rsn_supp/wpa.c
+++ b/src/rsn_supp/wpa.c
@@ -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.
diff --git a/src/utils/common.h b/src/utils/common.h
index d495a2e..d0a2eb3 100644
--- a/src/utils/common.h
+++ b/src/utils/common.h
@@ -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"