From 522450b7b1e2bcaae8cb091531611ae6992b7ecc Mon Sep 17 00:00:00 2001 From: Andrei Otcheretianski Date: Wed, 19 Jun 2019 15:49:15 +0300 Subject: [PATCH] AP: Determine Short SSID value for the BSS This can be used in the future to implement support for RNR and scanning extensions using a shorter field for the SSID. Signed-off-by: Andrei Otcheretianski --- hostapd/Android.mk | 1 + hostapd/Makefile | 1 + src/ap/ap_config.h | 1 + src/ap/hostapd.c | 7 +++++++ wpa_supplicant/Android.mk | 1 + wpa_supplicant/Makefile | 1 + 6 files changed, 12 insertions(+) diff --git a/hostapd/Android.mk b/hostapd/Android.mk index a87ac8144..82fa3ea73 100644 --- a/hostapd/Android.mk +++ b/hostapd/Android.mk @@ -145,6 +145,7 @@ OBJS += src/utils/wpa_debug.c OBJS += src/utils/wpabuf.c OBJS += src/utils/os_$(CONFIG_OS).c OBJS += src/utils/ip_addr.c +OBJS += src/utils/crc32.c OBJS += src/common/ieee802_11_common.c OBJS += src/common/wpa_common.c diff --git a/hostapd/Makefile b/hostapd/Makefile index 955e27856..f1896f2e3 100644 --- a/hostapd/Makefile +++ b/hostapd/Makefile @@ -158,6 +158,7 @@ OBJS_c += ../src/utils/wpa_debug.o OBJS += ../src/utils/wpabuf.o OBJS += ../src/utils/os_$(CONFIG_OS).o OBJS += ../src/utils/ip_addr.o +OBJS += ../src/utils/crc32.o OBJS += ../src/common/ieee802_11_common.o OBJS += ../src/common/wpa_common.o diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h index 83b8aee65..7e4b9262c 100644 --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h @@ -88,6 +88,7 @@ typedef enum hostap_security_policy { struct hostapd_ssid { u8 ssid[SSID_MAX_LEN]; size_t ssid_len; + u32 short_ssid; unsigned int ssid_set:1; unsigned int utf8_ssid:1; unsigned int wpa_passphrase_set:1; diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index e4950e3ed..516d571ae 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -13,6 +13,7 @@ #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" @@ -1190,6 +1191,12 @@ 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_ERROR, "Using interface %s with hwaddr " MACSTR " and ssid \"%s\"", diff --git a/wpa_supplicant/Android.mk b/wpa_supplicant/Android.mk index cd93d48b9..98f3b52a2 100644 --- a/wpa_supplicant/Android.mk +++ b/wpa_supplicant/Android.mk @@ -94,6 +94,7 @@ OBJS += src/utils/wpa_debug.c OBJS += src/utils/wpabuf.c OBJS += src/utils/bitfield.c OBJS += src/utils/ip_addr.c +OBJS += src/utils/crc32.c OBJS += wmm_ac.c OBJS += op_classes.c OBJS += rrm.c diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile index 94f9165bb..96dc5bd0f 100644 --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile @@ -104,6 +104,7 @@ OBJS += ../src/utils/wpa_debug.o OBJS += ../src/utils/wpabuf.o OBJS += ../src/utils/bitfield.o OBJS += ../src/utils/ip_addr.o +OBJS += ../src/utils/crc32.o OBJS += op_classes.o OBJS += rrm.o OBJS_p = wpa_passphrase.o