RNR: Short SSID assignment
Calculate and store short SSID in hostapd_data context during config load time and in neighbor report. Signed-off-by: John Crispin <john@phrozen.org> Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
This commit is contained in:
parent
8d881d9427
commit
9d0948ecc9
3 changed files with 16 additions and 8 deletions
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue