Replace hostapd_mac_comp_empty() with is_zero_ether_addr()

There is no need to maintain two implementations of the functionality.
is_zero_ether_addr() is easier to understand, so use it.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2016-02-28 18:00:48 +02:00
parent 5aef495fda
commit 902c07a7af
3 changed files with 4 additions and 12 deletions

View file

@ -202,13 +202,6 @@ int hostapd_mac_comp(const void *a, const void *b)
}
int hostapd_mac_comp_empty(const void *a)
{
macaddr empty = { 0 };
return os_memcmp(a, empty, sizeof(macaddr));
}
static int hostapd_config_read_wpa_psk(const char *fname,
struct hostapd_ssid *ssid)
{
@ -790,7 +783,7 @@ static int hostapd_config_check_bss(struct hostapd_bss_config *bss,
return -1;
}
if (full_config && hostapd_mac_comp_empty(bss->bssid) != 0) {
if (full_config && !is_zero_ether_addr(bss->bssid)) {
size_t i;
for (i = 0; i < conf->num_bss; i++) {

View file

@ -694,7 +694,6 @@ struct hostapd_config {
int hostapd_mac_comp(const void *a, const void *b);
int hostapd_mac_comp_empty(const void *a);
struct hostapd_config * hostapd_config_defaults(void);
void hostapd_config_defaults_bss(struct hostapd_bss_config *bss);
void hostapd_config_free_eap_user(struct hostapd_eap_user *user);

View file

@ -521,7 +521,7 @@ static int hostapd_validate_bssid_configuration(struct hostapd_iface *iface)
/* Determine the bits necessary to any configured BSSIDs,
if they are higher than the number of BSSIDs. */
for (j = 0; j < iface->conf->num_bss; j++) {
if (hostapd_mac_comp_empty(iface->conf->bss[j]->bssid) == 0) {
if (is_zero_ether_addr(iface->conf->bss[j]->bssid)) {
if (j)
auto_addr++;
continue;
@ -905,7 +905,7 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first)
hapd->started = 1;
if (!first || first == -1) {
if (hostapd_mac_comp_empty(conf->bssid) == 0) {
if (is_zero_ether_addr(conf->bssid)) {
/* Allocate the next available BSSID. */
do {
inc_byte_array(hapd->own_addr, ETH_ALEN);
@ -1631,7 +1631,7 @@ static int hostapd_setup_interface_complete_sync(struct hostapd_iface *iface,
} while (j-- > 0);
goto fail;
}
if (hostapd_mac_comp_empty(hapd->conf->bssid) == 0)
if (is_zero_ether_addr(hapd->conf->bssid))
prev_addr = hapd->own_addr;
}
hapd = iface->bss[0];