From 96900cbc6ec0fa1af02458f7700301cbb1b56ca3 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Wed, 24 Jun 2020 15:12:09 +0200 Subject: [PATCH 1/4] RNR: move crc32 generation to config load time During config reload the short_ssid was getting flushed. Move the generation into the config loading code. Signed-off-by: John Crispin --- hostapd/config_file.c | 7 +++++++ src/ap/hostapd.c | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) --- 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" @@ -2395,6 +2396,12 @@ static int hostapd_config_fill(struct ho } os_memcpy(bss->ssid.ssid, pos, bss->ssid.ssid_len); bss->ssid.ssid_set = 1; + + /* + * Short SSID calculation is identical to FCS and it is defined in + * IEEE P802.11-REVmd/D3.0, 9.4.2.170.3 (Calculating the Short-SSID). + */ + bss->ssid.short_ssid = crc32(bss->ssid.ssid, bss->ssid.ssid_len); } else if (os_strcmp(buf, "ssid2") == 0) { size_t slen; char *str = wpa_config_parse_string(pos, &slen); --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -15,7 +15,6 @@ #include "utils/common.h" #include "utils/eloop.h" -#include "utils/crc32.h" #include "common/ieee802_11_defs.h" #include "common/wpa_ctrl.h" #include "common/hw_features_common.h" @@ -1356,12 +1355,6 @@ int hostapd_setup_bss(struct hostapd_dat os_memcpy(conf->ssid.ssid, ssid, conf->ssid.ssid_len); } - /* - * Short SSID calculation is identical to FCS and it is defined in - * IEEE P802.11-REVmd/D3.0, 9.4.2.170.3 (Calculating the Short-SSID). - */ - conf->ssid.short_ssid = crc32(conf->ssid.ssid, conf->ssid.ssid_len); - if (!hostapd_drv_none(hapd)) { wpa_printf(MSG_DEBUG, "Using interface %s with hwaddr " MACSTR " and ssid \"%s\"",