]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Replace hostapd_mac_comp_empty() with is_zero_ether_addr()
authorJouni Malinen <j@w1.fi>
Sun, 28 Feb 2016 16:00:48 +0000 (18:00 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 28 Feb 2016 18:11:58 +0000 (20:11 +0200)
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>
src/ap/ap_config.c
src/ap/ap_config.h
src/ap/hostapd.c

index 477ea5bb27f8df8068d3bef5096f81a15c36f020..66b843ca0f4d617e67fd772cb0efb034cd12a636 100644 (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++) {
index fcd97328734c8d646f99c8a384fed97be35260d8..f19cac6cf33880637c9003e591b89a65d946e0a6 100644 (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);
index 4e7c0378f8080fc96064a2e8a61cae104cae8149..303786b461bf17c4c701683b2994b1d3bb4a0068 100644 (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];