diff --git a/hostapd/config_file.c b/hostapd/config_file.c index 7b03edf36..a57797262 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -13,6 +13,7 @@ #include "utils/common.h" #include "utils/uuid.h" +#include "utils/crc32.h" #include "common/ieee802_11_defs.h" #include "common/sae.h" #include "crypto/sha256.h" @@ -2396,16 +2397,19 @@ static int hostapd_config_fill(struct hostapd_config *conf, wpa_printf(MSG_INFO, "Line %d: DEPRECATED: 'dump_file' configuration variable is not used anymore", line); } else if (os_strcmp(buf, "ssid") == 0) { - bss->ssid.ssid_len = os_strlen(pos); - if (bss->ssid.ssid_len > SSID_MAX_LEN || - bss->ssid.ssid_len < 1) { + struct hostapd_ssid *ssid = &bss->ssid; + + ssid->ssid_len = os_strlen(pos); + if (ssid->ssid_len > SSID_MAX_LEN || ssid->ssid_len < 1) { wpa_printf(MSG_ERROR, "Line %d: invalid SSID '%s'", line, pos); return 1; } - os_memcpy(bss->ssid.ssid, pos, bss->ssid.ssid_len); - bss->ssid.ssid_set = 1; + os_memcpy(ssid->ssid, pos, ssid->ssid_len); + ssid->ssid_set = 1; + ssid->short_ssid = crc32(ssid->ssid, ssid->ssid_len); } else if (os_strcmp(buf, "ssid2") == 0) { + struct hostapd_ssid *ssid = &bss->ssid; size_t slen; char *str = wpa_config_parse_string(pos, &slen); if (str == NULL || slen < 1 || slen > SSID_MAX_LEN) { @@ -2414,9 +2418,10 @@ static int hostapd_config_fill(struct hostapd_config *conf, os_free(str); return 1; } - os_memcpy(bss->ssid.ssid, str, slen); - bss->ssid.ssid_len = slen; - bss->ssid.ssid_set = 1; + os_memcpy(ssid->ssid, str, slen); + ssid->ssid_len = slen; + ssid->ssid_set = 1; + ssid->short_ssid = crc32(ssid->ssid, ssid->ssid_len); os_free(str); } else if (os_strcmp(buf, "utf8_ssid") == 0) { bss->ssid.utf8_ssid = atoi(pos) > 0; diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h index 07d0aaa92..bb9a35eb1 100644 --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h @@ -138,6 +138,7 @@ struct hostapd_neighbor_entry { /* LCI update time */ struct os_time lci_date; int stationary; + u32 short_ssid; }; struct hostapd_sae_commit_queue { diff --git a/src/ap/neighbor_db.c b/src/ap/neighbor_db.c index 2bbe31859..e9bdf0033 100644 --- a/src/ap/neighbor_db.c +++ b/src/ap/neighbor_db.c @@ -10,6 +10,7 @@ #include "utils/includes.h" #include "utils/common.h" +#include "utils/crc32.h" #include "hostapd.h" #include "ieee802_11.h" #include "neighbor_db.h" @@ -134,6 +135,7 @@ int hostapd_neighbor_set(struct hostapd_data *hapd, const u8 *bssid, os_memcpy(entry->bssid, bssid, ETH_ALEN); os_memcpy(&entry->ssid, ssid, sizeof(entry->ssid)); + entry->short_ssid = crc32(ssid->ssid, ssid->ssid_len); entry->nr = wpabuf_dup(nr); if (!entry->nr)