[PATCH V2 4/7] rnr: move crc32 generation to config load time

John Crispin john at phrozen.org
Mon Sep 21 07:46:19 EDT 2020


During config reload the short_ssid was getting flushed. Move the
generation into the config loading code.

Signed-off-by: John Crispin <john at phrozen.org>
---
 hostapd/config_file.c | 7 +++++++
 src/ap/hostapd.c      | 7 -------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 6c1f629cf..68780cb98 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"
@@ -2355,6 +2356,12 @@ static int hostapd_config_fill(struct hostapd_config *conf,
 		}
 		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);
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 0d44852f0..ccb2fbc86 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -13,7 +13,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"
@@ -1251,12 +1250,6 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first)
 		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\"",
-- 
2.25.1




More information about the Hostap mailing list