Initial commit
This commit is contained in:
96
package/network/services/hostapd/Config.in
Normal file
96
package/network/services/hostapd/Config.in
Normal file
@@ -0,0 +1,96 @@
|
||||
# wpa_supplicant config
|
||||
config WPA_SUPPLICANT_NO_TIMESTAMP_CHECK
|
||||
bool "Disable timestamp check"
|
||||
depends on PACKAGE_wpa-supplicant || \
|
||||
PACKAGE_wpa-supplicant-openssl || \
|
||||
PACKAGE_wpa-supplicant-wolfssl || \
|
||||
PACKAGE_wpa-supplicant-mesh-openssl || \
|
||||
PACKAGE_wpa-supplicant-mesh-wolfssl || \
|
||||
PACKAGE_wpa-supplicant-mini || \
|
||||
PACKAGE_wpa-supplicant-p2p || \
|
||||
PACKAGE_wpad || \
|
||||
PACKAGE_wpad-openssl || \
|
||||
PACKAGE_wpad-wolfssl || \
|
||||
PACKAGE_wpad-mini || \
|
||||
PACKAGE_wpad-mesh-openssl || \
|
||||
PACKAGE_wpad-mesh-wolfssl
|
||||
default n
|
||||
help
|
||||
This disables the timestamp check for certificates in wpa_supplicant
|
||||
Useful for devices without RTC that cannot reliably get the real date/time
|
||||
|
||||
config WPA_RFKILL_SUPPORT
|
||||
bool "Add rfkill support"
|
||||
depends on PACKAGE_wpa-supplicant || \
|
||||
PACKAGE_wpa-supplicant-openssl || \
|
||||
PACKAGE_wpa-supplicant-wolfssl || \
|
||||
PACKAGE_wpa-supplicant-mesh-openssl || \
|
||||
PACKAGE_wpa-supplicant-mesh-wolfssl || \
|
||||
PACKAGE_wpa-supplicant-mini || \
|
||||
PACKAGE_wpa-supplicant-p2p || \
|
||||
PACKAGE_wpad || \
|
||||
PACKAGE_wpad-openssl || \
|
||||
PACKAGE_wpad-wolfssl || \
|
||||
PACKAGE_wpad-mini || \
|
||||
PACKAGE_wpad-mesh-openssl || \
|
||||
PACKAGE_wpad-mesh-wolfssl
|
||||
default n
|
||||
|
||||
config WPA_MSG_MIN_PRIORITY
|
||||
int "Minimum debug message priority"
|
||||
depends on PACKAGE_wpa-supplicant || \
|
||||
PACKAGE_wpa-supplicant-openssl || \
|
||||
PACKAGE_wpa-supplicant-wolfssl || \
|
||||
PACKAGE_wpa-supplicant-mesh-openssl || \
|
||||
PACKAGE_wpa-supplicant-mesh-wolfssl || \
|
||||
PACKAGE_wpa-supplicant-mini || \
|
||||
PACKAGE_wpa-supplicant-p2p || \
|
||||
PACKAGE_wpad || \
|
||||
PACKAGE_wpad-openssl || \
|
||||
PACKAGE_wpad-wolfssl || \
|
||||
PACKAGE_wpad-mini || \
|
||||
PACKAGE_wpad-mesh-openssl || \
|
||||
PACKAGE_wpad-mesh-wolfssl
|
||||
default 3
|
||||
help
|
||||
Useful values are:
|
||||
0 = all messages
|
||||
1 = raw message dumps
|
||||
2 = most debugging messages
|
||||
3 = info messages
|
||||
4 = warnings
|
||||
5 = errors
|
||||
|
||||
config WPA_WOLFSSL
|
||||
bool
|
||||
default PACKAGE_wpa-supplicant-wolfssl ||\
|
||||
PACKAGE_wpad-wolfssl ||\
|
||||
PACKAGE_wpad-mesh-wolfssl ||\
|
||||
PACKAGE_eapol-test-wolfssl
|
||||
select PACKAGE_libwolfssl
|
||||
select WOLFSSL_HAS_AES_CCM
|
||||
select WOLFSSL_HAS_AES_GCM
|
||||
select WOLFSSL_HAS_ARC4
|
||||
select WOLFSSL_HAS_DES3
|
||||
select WOLFSSL_HAS_DH
|
||||
select WOLFSSL_HAS_ECC
|
||||
select WOLFSSL_HAS_OCSP
|
||||
select WOLFSSL_HAS_PSK
|
||||
select WOLFSSL_HAS_SESSION_TICKET
|
||||
select WOLFSSL_HAS_WPAS
|
||||
|
||||
config DRIVER_WEXT_SUPPORT
|
||||
bool
|
||||
default n
|
||||
|
||||
config DRIVER_11N_SUPPORT
|
||||
bool
|
||||
default n
|
||||
|
||||
config DRIVER_11AC_SUPPORT
|
||||
bool
|
||||
default n
|
||||
|
||||
config DRIVER_11W_SUPPORT
|
||||
bool
|
||||
default n
|
||||
596
package/network/services/hostapd/Makefile
Normal file
596
package/network/services/hostapd/Makefile
Normal file
@@ -0,0 +1,596 @@
|
||||
# Copyright (C) 2006-2014 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=hostapd
|
||||
PKG_RELEASE:=8
|
||||
|
||||
PKG_SOURCE_URL:=http://w1.fi/hostap.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_DATE:=2018-05-21
|
||||
PKG_SOURCE_VERSION:=62566bc23d041e88f8e35933d5fd8c2fd0f7cf2a
|
||||
PKG_MIRROR_HASH:=f234b24f9471ae9cb34460feec6d6614641691544101535673595272c91448eb
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_CPE_ID:=cpe:/a:w1.fi:hostapd
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK \
|
||||
CONFIG_PACKAGE_kmod-ath9k \
|
||||
CONFIG_PACKAGE_kmod-cfg80211 \
|
||||
CONFIG_PACKAGE_hostapd \
|
||||
CONFIG_PACKAGE_hostapd-mini \
|
||||
CONFIG_WPA_RFKILL_SUPPORT \
|
||||
CONFIG_DRIVER_WEXT_SUPPORT \
|
||||
CONFIG_DRIVER_11N_SUPPORT \
|
||||
CONFIG_DRIVER_11AC_SUPPORT \
|
||||
|
||||
EAPOL_TEST_PROVIDERS:=eapol-test eapol-test-openssl eapol-test-wolfssl
|
||||
|
||||
SUPPLICANT_PROVIDERS:=
|
||||
HOSTAPD_PROVIDERS:=
|
||||
|
||||
LOCAL_TYPE=$(strip \
|
||||
$(if $(findstring wpad,$(BUILD_VARIANT)),wpad, \
|
||||
$(if $(findstring supplicant,$(BUILD_VARIANT)),supplicant, \
|
||||
hostapd \
|
||||
)))
|
||||
|
||||
LOCAL_AND_LIB_VARIANT=$(patsubst hostapd-%,%,\
|
||||
$(patsubst wpad-%,%,\
|
||||
$(patsubst supplicant-%,%,\
|
||||
$(BUILD_VARIANT)\
|
||||
)))
|
||||
|
||||
LOCAL_VARIANT=$(patsubst %-internal,%,\
|
||||
$(patsubst %-openssl,%,\
|
||||
$(patsubst %-wolfssl,%,\
|
||||
$(LOCAL_AND_LIB_VARIANT)\
|
||||
)))
|
||||
|
||||
SSL_VARIANT=$(strip \
|
||||
$(if $(findstring openssl,$(LOCAL_AND_LIB_VARIANT)),openssl,\
|
||||
$(if $(findstring wolfssl,$(LOCAL_AND_LIB_VARIANT)),wolfssl,\
|
||||
internal\
|
||||
)))
|
||||
|
||||
CONFIG_VARIANT:=$(LOCAL_VARIANT)
|
||||
ifeq ($(LOCAL_VARIANT),mesh)
|
||||
CONFIG_VARIANT:=full
|
||||
endif
|
||||
|
||||
PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
STAMP_CONFIGURED:=$(STAMP_CONFIGURED)_$(CONFIG_WPA_MSG_MIN_PRIORITY)
|
||||
|
||||
|
||||
ifneq ($(CONFIG_DRIVER_11N_SUPPORT),)
|
||||
HOSTAPD_IEEE80211N:=y
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_DRIVER_11AC_SUPPORT),)
|
||||
HOSTAPD_IEEE80211AC:=y
|
||||
endif
|
||||
|
||||
DRIVER_MAKEOPTS= \
|
||||
CONFIG_ACS=$(CONFIG_PACKAGE_kmod-cfg80211) \
|
||||
CONFIG_DRIVER_NL80211=$(CONFIG_PACKAGE_kmod-cfg80211) \
|
||||
CONFIG_IEEE80211N=$(HOSTAPD_IEEE80211N) \
|
||||
CONFIG_IEEE80211AC=$(HOSTAPD_IEEE80211AC) \
|
||||
CONFIG_DRIVER_WEXT=$(CONFIG_DRIVER_WEXT_SUPPORT) \
|
||||
|
||||
ifeq ($(LOCAL_VARIANT),full)
|
||||
DRIVER_MAKEOPTS += CONFIG_IEEE80211W=$(CONFIG_DRIVER_11W_SUPPORT)
|
||||
endif
|
||||
|
||||
ifeq ($(LOCAL_VARIANT),full)
|
||||
ifeq ($(SSL_VARIANT),openssl)
|
||||
DRIVER_MAKEOPTS += CONFIG_TLS=openssl
|
||||
TARGET_LDFLAGS += -lcrypto -lssl
|
||||
endif
|
||||
ifeq ($(SSL_VARIANT),wolfssl)
|
||||
DRIVER_MAKEOPTS += CONFIG_TLS=wolfssl CONFIG_WPS_NFC=1
|
||||
TARGET_LDFLAGS += -lwolfssl
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(LOCAL_TYPE),hostapd)
|
||||
ifeq ($(LOCAL_VARIANT),mesh)
|
||||
ifeq ($(SSL_VARIANT),openssl)
|
||||
DRIVER_MAKEOPTS += CONFIG_TLS=openssl CONFIG_AP=y CONFIG_SAE=y CONFIG_MESH=y
|
||||
TARGET_LDFLAGS += -lcrypto -lssl
|
||||
endif
|
||||
ifeq ($(SSL_VARIANT),wolfssl)
|
||||
DRIVER_MAKEOPTS += CONFIG_TLS=wolfssl CONFIG_WPS_NFC=1 CONFIG_AP=y CONFIG_SAE=y CONFIG_MESH=y
|
||||
TARGET_LDFLAGS += -lwolfssl
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK
|
||||
TARGET_CFLAGS += -DNO_TIMESTAMP_CHECK
|
||||
endif
|
||||
ifdef CONFIG_WPA_RFKILL_SUPPORT
|
||||
DRIVER_MAKEOPTS += NEED_RFKILL=y
|
||||
endif
|
||||
DRIVER_MAKEOPTS += \
|
||||
CONFIG_DRIVER_ROBOSWITCH=$(CONFIG_PACKAGE_kmod-switch)
|
||||
endif
|
||||
|
||||
ifdef CONFIG_USE_GLIBC
|
||||
TARGET_LDFLAGS += -lrt
|
||||
TARGET_LDFLAGS_C += -lrt
|
||||
endif
|
||||
|
||||
DRV_DEPENDS:=+PACKAGE_kmod-cfg80211:libnl-tiny
|
||||
|
||||
|
||||
define Package/hostapd/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=IEEE 802.1x Authenticator
|
||||
URL:=http://hostap.epitest.fi/
|
||||
DEPENDS:=$(DRV_DEPENDS) +hostapd-common +libubus
|
||||
PROVIDES:=hostapd
|
||||
CONFLICTS:=$(HOSTAPD_PROVIDERS)
|
||||
HOSTAPD_PROVIDERS+=$(1)
|
||||
endef
|
||||
|
||||
define Package/hostapd
|
||||
$(call Package/hostapd/Default,$(1))
|
||||
TITLE+= (full)
|
||||
VARIANT:=full-internal
|
||||
endef
|
||||
|
||||
define Package/hostapd/description
|
||||
This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
|
||||
Authenticator.
|
||||
endef
|
||||
|
||||
define Package/hostapd-openssl
|
||||
$(call Package/hostapd/Default,$(1))
|
||||
TITLE+= (full)
|
||||
VARIANT:=full-openssl
|
||||
DEPENDS+=+libopenssl
|
||||
endef
|
||||
|
||||
Package/hostapd-openssl/description = $(Package/hostapd/description)
|
||||
|
||||
define Package/hostapd-wolfssl
|
||||
$(call Package/hostapd/Default,$(1))
|
||||
TITLE+= (full)
|
||||
VARIANT:=full-wolfssl
|
||||
DEPENDS+=+libwolfssl
|
||||
endef
|
||||
|
||||
Package/hostapd-wolfssl/description = $(Package/hostapd/description)
|
||||
|
||||
define Package/hostapd-mini
|
||||
$(call Package/hostapd/Default,$(1))
|
||||
TITLE+= (WPA-PSK only)
|
||||
VARIANT:=mini
|
||||
endef
|
||||
|
||||
define Package/hostapd-mini/description
|
||||
This package contains a minimal IEEE 802.1x/WPA Authenticator (WPA-PSK only).
|
||||
endef
|
||||
|
||||
|
||||
define Package/wpad/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=IEEE 802.1x Authenticator/Supplicant
|
||||
DEPENDS:=$(DRV_DEPENDS) +hostapd-common +libubus
|
||||
URL:=http://hostap.epitest.fi/
|
||||
PROVIDES:=hostapd wpa-supplicant
|
||||
CONFLICTS:=$(HOSTAPD_PROVIDERS) $(SUPPLICANT_PROVIDERS)
|
||||
HOSTAPD_PROVIDERS+=$(1)
|
||||
SUPPLICANT_PROVIDERS+=$(1)
|
||||
endef
|
||||
|
||||
define Package/wpad
|
||||
$(call Package/wpad/Default,$(1))
|
||||
TITLE+= (full)
|
||||
VARIANT:=wpad-full-internal
|
||||
endef
|
||||
|
||||
define Package/wpad/description
|
||||
This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
|
||||
Authenticator and Supplicant
|
||||
endef
|
||||
|
||||
define Package/wpad-openssl
|
||||
$(call Package/wpad/Default,$(1))
|
||||
TITLE+= (full)
|
||||
VARIANT:=wpad-full-openssl
|
||||
DEPENDS+=+libopenssl
|
||||
endef
|
||||
|
||||
Package/wpad-openssl/description = $(Package/wpad/description)
|
||||
|
||||
define Package/wpad-wolfssl
|
||||
$(call Package/wpad/Default,$(1))
|
||||
TITLE+= (full)
|
||||
VARIANT:=wpad-full-wolfssl
|
||||
DEPENDS+=+libwolfssl
|
||||
endef
|
||||
|
||||
Package/wpad-wolfssl/description = $(Package/wpad/description)
|
||||
|
||||
define Package/wpad-mini
|
||||
$(call Package/wpad/Default,$(1))
|
||||
TITLE+= (WPA-PSK only)
|
||||
VARIANT:=wpad-mini
|
||||
endef
|
||||
|
||||
define Package/wpad-mini/description
|
||||
This package contains a minimal IEEE 802.1x/WPA Authenticator and Supplicant (WPA-PSK only).
|
||||
endef
|
||||
|
||||
define Package/wpad-mesh
|
||||
$(call Package/wpad/Default,$(1))
|
||||
TITLE+= (with 802.11s mesh and SAE support)
|
||||
DEPENDS+=@PACKAGE_kmod-cfg80211 @(!TARGET_uml||BROKEN)
|
||||
PROVIDES+=wpa-supplicant-mesh wpad-mesh
|
||||
endef
|
||||
|
||||
define Package/wpad-mesh/description
|
||||
This package contains a minimal IEEE 802.1x/WPA Authenticator and Supplicant (with 802.11s mesh and SAE support).
|
||||
endef
|
||||
|
||||
define Package/wpad-mesh-openssl
|
||||
$(call Package/wpad-mesh,$(1))
|
||||
DEPENDS+=+libopenssl
|
||||
VARIANT:=wpad-mesh-openssl
|
||||
endef
|
||||
|
||||
Package/wpad-mesh-openssl/description = $(Package/wpad-mesh/description)
|
||||
|
||||
define Package/wpad-mesh-wolfssl
|
||||
$(call Package/wpad-mesh,$(1))
|
||||
DEPENDS+=+libwolfssl
|
||||
VARIANT:=wpad-mesh-wolfssl
|
||||
endef
|
||||
|
||||
Package/wpad-mesh-wolfssl/description = $(Package/wpad-mesh/description)
|
||||
|
||||
|
||||
define Package/wpa-supplicant/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=WPA Supplicant
|
||||
URL:=http://hostap.epitest.fi/wpa_supplicant/
|
||||
DEPENDS:=$(DRV_DEPENDS)
|
||||
PROVIDES:=wpa-supplicant
|
||||
CONFLICTS:=$(SUPPLICANT_PROVIDERS)
|
||||
SUPPLICANT_PROVIDERS+=$(1)
|
||||
endef
|
||||
|
||||
define Package/wpa-supplicant
|
||||
$(call Package/wpa-supplicant/Default,$(1))
|
||||
VARIANT:=supplicant-full-internal
|
||||
endef
|
||||
|
||||
define Package/wpa-supplicant-openssl
|
||||
$(call Package/wpa-supplicant/Default,$(1))
|
||||
VARIANT:=supplicant-full-openssl
|
||||
DEPENDS+=+libopenssl
|
||||
endef
|
||||
|
||||
define Package/wpa-supplicant-wolfssl
|
||||
$(call Package/wpa-supplicant/Default,$(1))
|
||||
VARIANT:=supplicant-full-wolfssl
|
||||
DEPENDS+=+libwolfssl
|
||||
endef
|
||||
|
||||
define Package/wpa-supplicant/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
define Package/wpa-supplicant-p2p
|
||||
$(call Package/wpa-supplicant/Default,$(1))
|
||||
TITLE+= (with Wi-Fi P2P support)
|
||||
DEPENDS+=@PACKAGE_kmod-cfg80211
|
||||
VARIANT:=supplicant-p2p-internal
|
||||
endef
|
||||
|
||||
define Package/wpa-supplicant-mesh/Default
|
||||
$(call Package/wpa-supplicant/Default,$(1))
|
||||
TITLE+= (with 802.11s and SAE)
|
||||
DEPENDS+=@PACKAGE_kmod-cfg80211 @(!TARGET_uml||BROKEN)
|
||||
PROVIDES+=wpa-supplicant-mesh
|
||||
endef
|
||||
|
||||
define Package/wpa-supplicant-mesh-openssl
|
||||
$(call Package/wpa-supplicant-mesh/Default,$(1))
|
||||
VARIANT:=supplicant-mesh-openssl
|
||||
DEPENDS+=+libopenssl
|
||||
endef
|
||||
|
||||
define Package/wpa-supplicant-mesh-wolfssl
|
||||
$(call Package/wpa-supplicant-mesh/Default,$(1))
|
||||
VARIANT:=supplicant-mesh-wolfssl
|
||||
DEPENDS+=+libwolfssl
|
||||
endef
|
||||
|
||||
define Package/wpa-supplicant-mini
|
||||
$(call Package/wpa-supplicant/Default,$(1))
|
||||
TITLE+= (minimal version)
|
||||
VARIANT:=supplicant-mini
|
||||
endef
|
||||
|
||||
|
||||
define Package/hostapd-common
|
||||
TITLE:=hostapd/wpa_supplicant common support files
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
endef
|
||||
|
||||
define Package/hostapd-utils
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=IEEE 802.1x Authenticator (utils)
|
||||
URL:=http://hostap.epitest.fi/
|
||||
DEPENDS:=@$(subst $(space),||,$(foreach pkg,$(HOSTAPD_PROVIDERS),PACKAGE_$(pkg)))
|
||||
endef
|
||||
|
||||
define Package/hostapd-utils/description
|
||||
This package contains a command line utility to control the
|
||||
IEEE 802.1x/WPA/EAP/RADIUS Authenticator.
|
||||
endef
|
||||
|
||||
define Package/wpa-cli
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
DEPENDS:=@$(subst $(space),||,$(foreach pkg,$(SUPPLICANT_PROVIDERS),PACKAGE_$(pkg)))
|
||||
TITLE:=WPA Supplicant command line control utility
|
||||
endef
|
||||
|
||||
define Package/eapol-test
|
||||
TITLE:=802.1x authentication test utility
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
VARIANT:=supplicant-full-internal
|
||||
DEPENDS:=$(DRV_DEPENDS)
|
||||
endef
|
||||
|
||||
define Package/eapol-test-openssl
|
||||
TITLE:=802.1x authentication test utility
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
VARIANT:=supplicant-full-openssl
|
||||
CONFLICTS:=$(filter-out eapol-test-openssl ,$(EAPOL_TEST_PROVIDERS))
|
||||
DEPENDS:=$(DRV_DEPENDS) +libopenssl
|
||||
PROVIDES:=eapol-test
|
||||
endef
|
||||
|
||||
define Package/eapol-test-wolfssl
|
||||
TITLE:=802.1x authentication test utility
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
VARIANT:=supplicant-full-wolfssl
|
||||
CONFLICTS:=$(filter-out eapol-test-openssl ,$(filter-out eapol-test-wolfssl ,$(EAPOL_TEST_PROVIDERS)))
|
||||
DEPENDS:=$(DRV_DEPENDS) +libwolfssl
|
||||
PROVIDES:=eapol-test
|
||||
endef
|
||||
|
||||
|
||||
ifneq ($(wildcard $(PKG_BUILD_DIR)/.config_*),$(subst .configured_,.config_,$(STAMP_CONFIGURED)))
|
||||
define Build/Configure/rebuild
|
||||
$(FIND) $(PKG_BUILD_DIR) -name \*.o -or -name \*.a | $(XARGS) rm -f
|
||||
rm -f $(PKG_BUILD_DIR)/hostapd/hostapd
|
||||
rm -f $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant
|
||||
rm -f $(PKG_BUILD_DIR)/.config_*
|
||||
touch $(subst .configured_,.config_,$(STAMP_CONFIGURED))
|
||||
endef
|
||||
endif
|
||||
|
||||
define Build/Configure
|
||||
$(Build/Configure/rebuild)
|
||||
$(if $(wildcard ./files/hostapd-$(CONFIG_VARIANT).config), \
|
||||
$(CP) ./files/hostapd-$(CONFIG_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config \
|
||||
)
|
||||
$(CP) ./files/wpa_supplicant-$(CONFIG_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
|
||||
endef
|
||||
|
||||
TARGET_CPPFLAGS := \
|
||||
-I$(STAGING_DIR)/usr/include/libnl-tiny \
|
||||
-I$(PKG_BUILD_DIR)/src/crypto \
|
||||
$(TARGET_CPPFLAGS) \
|
||||
-DCONFIG_LIBNL20 \
|
||||
-D_GNU_SOURCE \
|
||||
$(if $(CONFIG_WPA_MSG_MIN_PRIORITY),-DCONFIG_MSG_MIN_PRIORITY=$(CONFIG_WPA_MSG_MIN_PRIORITY))
|
||||
|
||||
TARGET_CFLAGS += -ffunction-sections -fdata-sections
|
||||
TARGET_LDFLAGS += -Wl,--gc-sections
|
||||
ifeq ($(findstring supplicant,$(BUILD_VARIANT)),)
|
||||
TARGET_LDFLAGS += -lubox -lubus
|
||||
endif
|
||||
|
||||
ifdef CONFIG_PACKAGE_kmod-cfg80211
|
||||
TARGET_LDFLAGS += -lm -lnl-tiny
|
||||
endif
|
||||
|
||||
define Build/RunMake
|
||||
CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
|
||||
$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(1) \
|
||||
$(TARGET_CONFIGURE_OPTS) \
|
||||
$(DRIVER_MAKEOPTS) \
|
||||
LIBS="$(TARGET_LDFLAGS)" \
|
||||
LIBS_c="$(TARGET_LDFLAGS_C)" \
|
||||
BCHECK= \
|
||||
$(2)
|
||||
endef
|
||||
|
||||
define Build/Compile/wpad
|
||||
echo ` \
|
||||
$(call Build/RunMake,hostapd,-s MULTICALL=1 dump_cflags); \
|
||||
$(call Build/RunMake,wpa_supplicant,-s MULTICALL=1 dump_cflags) | \
|
||||
sed -e 's,-n ,,g' -e 's^$(TARGET_CFLAGS)^^' \
|
||||
` > $(PKG_BUILD_DIR)/.cflags
|
||||
sed -i 's/"/\\"/g' $(PKG_BUILD_DIR)/.cflags
|
||||
+$(call Build/RunMake,hostapd, \
|
||||
CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
|
||||
MULTICALL=1 \
|
||||
hostapd_cli hostapd_multi.a \
|
||||
)
|
||||
+$(call Build/RunMake,wpa_supplicant, \
|
||||
CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
|
||||
MULTICALL=1 \
|
||||
wpa_cli wpa_supplicant_multi.a \
|
||||
)
|
||||
$(TARGET_CC) -o $(PKG_BUILD_DIR)/wpad \
|
||||
$(TARGET_CFLAGS) \
|
||||
./files/multicall.c \
|
||||
$(PKG_BUILD_DIR)/hostapd/hostapd_multi.a \
|
||||
$(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant_multi.a \
|
||||
$(TARGET_LDFLAGS)
|
||||
endef
|
||||
|
||||
define Build/Compile/hostapd
|
||||
+$(call Build/RunMake,hostapd, \
|
||||
hostapd hostapd_cli \
|
||||
)
|
||||
endef
|
||||
|
||||
define Build/Compile/supplicant
|
||||
+$(call Build/RunMake,wpa_supplicant, \
|
||||
wpa_cli wpa_supplicant \
|
||||
)
|
||||
endef
|
||||
|
||||
define Build/Compile/supplicant-full-internal
|
||||
+$(call Build/RunMake,wpa_supplicant, \
|
||||
eapol_test \
|
||||
)
|
||||
endef
|
||||
|
||||
define Build/Compile/supplicant-full-openssl
|
||||
+$(call Build/RunMake,wpa_supplicant, \
|
||||
eapol_test \
|
||||
)
|
||||
endef
|
||||
|
||||
define Build/Compile/supplicant-full-wolfssl
|
||||
+$(call Build/RunMake,wpa_supplicant, \
|
||||
eapol_test \
|
||||
)
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(Build/Compile/$(LOCAL_TYPE))
|
||||
$(Build/Compile/$(BUILD_VARIANT))
|
||||
endef
|
||||
|
||||
define Install/hostapd
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
endef
|
||||
|
||||
define Install/supplicant
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
endef
|
||||
|
||||
define Package/hostapd-common/install
|
||||
$(INSTALL_DIR) $(1)/lib/netifd
|
||||
$(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/netifd/hostapd.sh
|
||||
endef
|
||||
|
||||
define Package/hostapd/install
|
||||
$(call Install/hostapd,$(1))
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/
|
||||
endef
|
||||
Package/hostapd-mini/install = $(Package/hostapd/install)
|
||||
Package/hostapd-openssl/install = $(Package/hostapd/install)
|
||||
Package/hostapd-wolfssl/install = $(Package/hostapd/install)
|
||||
|
||||
ifneq ($(LOCAL_TYPE),supplicant)
|
||||
define Package/hostapd-utils/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/rc.button
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd_cli $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) ./files/wps-hotplug.sh $(1)/etc/rc.button/wps
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/wpad/install
|
||||
$(call Install/hostapd,$(1))
|
||||
$(call Install/supplicant,$(1))
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/wpad $(1)/usr/sbin/
|
||||
$(LN) wpad $(1)/usr/sbin/hostapd
|
||||
$(LN) wpad $(1)/usr/sbin/wpa_supplicant
|
||||
endef
|
||||
Package/wpad-mini/install = $(Package/wpad/install)
|
||||
Package/wpad-openssl/install = $(Package/wpad/install)
|
||||
Package/wpad-wolfssl/install = $(Package/wpad/install)
|
||||
Package/wpad-mesh-openssl/install = $(Package/wpad/install)
|
||||
Package/wpad-mesh-wolfssl/install = $(Package/wpad/install)
|
||||
|
||||
define Package/wpa-supplicant/install
|
||||
$(call Install/supplicant,$(1))
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant $(1)/usr/sbin/
|
||||
endef
|
||||
Package/wpa-supplicant-mini/install = $(Package/wpa-supplicant/install)
|
||||
Package/wpa-supplicant-p2p/install = $(Package/wpa-supplicant/install)
|
||||
Package/wpa-supplicant-openssl/install = $(Package/wpa-supplicant/install)
|
||||
Package/wpa-supplicant-wolfssl/install = $(Package/wpa-supplicant/install)
|
||||
Package/wpa-supplicant-mesh-openssl/install = $(Package/wpa-supplicant/install)
|
||||
Package/wpa-supplicant-mesh-wolfssl/install = $(Package/wpa-supplicant/install)
|
||||
|
||||
ifneq ($(LOCAL_TYPE),hostapd)
|
||||
define Package/wpa-cli/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_cli $(1)/usr/sbin/
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),supplicant-full-internal)
|
||||
define Package/eapol-test/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) $(PKG_BUILD_DIR)/wpa_supplicant/eapol_test $(1)/usr/sbin/
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),supplicant-full-openssl)
|
||||
define Package/eapol-test-openssl/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) $(PKG_BUILD_DIR)/wpa_supplicant/eapol_test $(1)/usr/sbin/
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),supplicant-full-wolfssl)
|
||||
define Package/eapol-test-wolfssl/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) $(PKG_BUILD_DIR)/wpa_supplicant/eapol_test $(1)/usr/sbin/
|
||||
endef
|
||||
endif
|
||||
|
||||
$(eval $(call BuildPackage,hostapd))
|
||||
$(eval $(call BuildPackage,hostapd-mini))
|
||||
$(eval $(call BuildPackage,hostapd-openssl))
|
||||
$(eval $(call BuildPackage,hostapd-wolfssl))
|
||||
$(eval $(call BuildPackage,wpad))
|
||||
$(eval $(call BuildPackage,wpad-mesh-openssl))
|
||||
$(eval $(call BuildPackage,wpad-mesh-wolfssl))
|
||||
$(eval $(call BuildPackage,wpad-mini))
|
||||
$(eval $(call BuildPackage,wpad-openssl))
|
||||
$(eval $(call BuildPackage,wpad-wolfssl))
|
||||
$(eval $(call BuildPackage,wpa-supplicant))
|
||||
$(eval $(call BuildPackage,wpa-supplicant-mesh-openssl))
|
||||
$(eval $(call BuildPackage,wpa-supplicant-mesh-wolfssl))
|
||||
$(eval $(call BuildPackage,wpa-supplicant-mini))
|
||||
$(eval $(call BuildPackage,wpa-supplicant-p2p))
|
||||
$(eval $(call BuildPackage,wpa-supplicant-openssl))
|
||||
$(eval $(call BuildPackage,wpa-supplicant-wolfssl))
|
||||
$(eval $(call BuildPackage,wpa-cli))
|
||||
$(eval $(call BuildPackage,hostapd-utils))
|
||||
$(eval $(call BuildPackage,hostapd-common))
|
||||
$(eval $(call BuildPackage,eapol-test))
|
||||
$(eval $(call BuildPackage,eapol-test-openssl))
|
||||
$(eval $(call BuildPackage,eapol-test-wolfssl))
|
||||
380
package/network/services/hostapd/files/hostapd-full.config
Normal file
380
package/network/services/hostapd/files/hostapd-full.config
Normal file
@@ -0,0 +1,380 @@
|
||||
# Example hostapd build time configuration
|
||||
#
|
||||
# This file lists the configuration options that are used when building the
|
||||
# hostapd binary. All lines starting with # are ignored. Configuration option
|
||||
# lines must be commented out complete, if they are not to be included, i.e.,
|
||||
# just setting VARIABLE=n is not disabling that variable.
|
||||
#
|
||||
# This file is included in Makefile, so variables like CFLAGS and LIBS can also
|
||||
# be modified from here. In most cass, these lines should use += in order not
|
||||
# to override previous values of the variables.
|
||||
|
||||
# Driver interface for Host AP driver
|
||||
#CONFIG_DRIVER_HOSTAP=y
|
||||
|
||||
# Driver interface for wired authenticator
|
||||
CONFIG_DRIVER_WIRED=y
|
||||
|
||||
# Driver interface for drivers using the nl80211 kernel interface
|
||||
CONFIG_DRIVER_NL80211=y
|
||||
|
||||
# QCA vendor extensions to nl80211
|
||||
#CONFIG_DRIVER_NL80211_QCA=y
|
||||
|
||||
# driver_nl80211.c requires libnl. If you are compiling it yourself
|
||||
# you may need to point hostapd to your version of libnl.
|
||||
#
|
||||
#CFLAGS += -I$<path to libnl include files>
|
||||
#LIBS += -L$<path to libnl library files>
|
||||
|
||||
# Use libnl v2.0 (or 3.0) libraries.
|
||||
#CONFIG_LIBNL20=y
|
||||
|
||||
# Use libnl 3.2 libraries (if this is selected, CONFIG_LIBNL20 is ignored)
|
||||
#CONFIG_LIBNL32=y
|
||||
|
||||
|
||||
# Driver interface for FreeBSD net80211 layer (e.g., Atheros driver)
|
||||
#CONFIG_DRIVER_BSD=y
|
||||
#CFLAGS += -I/usr/local/include
|
||||
#LIBS += -L/usr/local/lib
|
||||
#LIBS_p += -L/usr/local/lib
|
||||
#LIBS_c += -L/usr/local/lib
|
||||
|
||||
# Driver interface for no driver (e.g., RADIUS server only)
|
||||
#CONFIG_DRIVER_NONE=y
|
||||
|
||||
# IEEE 802.11F/IAPP
|
||||
CONFIG_IAPP=y
|
||||
|
||||
# WPA2/IEEE 802.11i RSN pre-authentication
|
||||
CONFIG_RSN_PREAUTH=y
|
||||
|
||||
# PeerKey handshake for Station to Station Link (IEEE 802.11e DLS)
|
||||
CONFIG_PEERKEY=y
|
||||
|
||||
# IEEE 802.11w (management frame protection)
|
||||
# Driver support is also needed for IEEE 802.11w.
|
||||
#CONFIG_IEEE80211W=y
|
||||
|
||||
# Integrated EAP server
|
||||
CONFIG_EAP=y
|
||||
|
||||
# EAP Re-authentication Protocol (ERP) in integrated EAP server
|
||||
#CONFIG_ERP=y
|
||||
|
||||
# EAP-MD5 for the integrated EAP server
|
||||
CONFIG_EAP_MD5=y
|
||||
|
||||
# EAP-TLS for the integrated EAP server
|
||||
CONFIG_EAP_TLS=y
|
||||
|
||||
# EAP-MSCHAPv2 for the integrated EAP server
|
||||
CONFIG_EAP_MSCHAPV2=y
|
||||
|
||||
# EAP-PEAP for the integrated EAP server
|
||||
CONFIG_EAP_PEAP=y
|
||||
|
||||
# EAP-GTC for the integrated EAP server
|
||||
CONFIG_EAP_GTC=y
|
||||
|
||||
# EAP-TTLS for the integrated EAP server
|
||||
CONFIG_EAP_TTLS=y
|
||||
|
||||
# EAP-SIM for the integrated EAP server
|
||||
#CONFIG_EAP_SIM=y
|
||||
|
||||
# EAP-AKA for the integrated EAP server
|
||||
#CONFIG_EAP_AKA=y
|
||||
|
||||
# EAP-AKA' for the integrated EAP server
|
||||
# This requires CONFIG_EAP_AKA to be enabled, too.
|
||||
#CONFIG_EAP_AKA_PRIME=y
|
||||
|
||||
# EAP-PAX for the integrated EAP server
|
||||
#CONFIG_EAP_PAX=y
|
||||
|
||||
# EAP-PSK for the integrated EAP server (this is _not_ needed for WPA-PSK)
|
||||
#CONFIG_EAP_PSK=y
|
||||
|
||||
# EAP-pwd for the integrated EAP server (secure authentication with a password)
|
||||
#CONFIG_EAP_PWD=y
|
||||
|
||||
# EAP-SAKE for the integrated EAP server
|
||||
#CONFIG_EAP_SAKE=y
|
||||
|
||||
# EAP-GPSK for the integrated EAP server
|
||||
#CONFIG_EAP_GPSK=y
|
||||
# Include support for optional SHA256 cipher suite in EAP-GPSK
|
||||
#CONFIG_EAP_GPSK_SHA256=y
|
||||
|
||||
# EAP-FAST for the integrated EAP server
|
||||
# Note: If OpenSSL is used as the TLS library, OpenSSL 1.0 or newer is needed
|
||||
# for EAP-FAST support. Older OpenSSL releases would need to be patched, e.g.,
|
||||
# with openssl-0.9.8x-tls-extensions.patch, to add the needed functions.
|
||||
CONFIG_EAP_FAST=y
|
||||
|
||||
# Wi-Fi Protected Setup (WPS)
|
||||
CONFIG_WPS=y
|
||||
# Enable UPnP support for external WPS Registrars
|
||||
#CONFIG_WPS_UPNP=y
|
||||
# Enable WPS support with NFC config method
|
||||
#CONFIG_WPS_NFC=y
|
||||
|
||||
# EAP-IKEv2
|
||||
#CONFIG_EAP_IKEV2=y
|
||||
|
||||
# Trusted Network Connect (EAP-TNC)
|
||||
#CONFIG_EAP_TNC=y
|
||||
|
||||
# EAP-EKE for the integrated EAP server
|
||||
#CONFIG_EAP_EKE=y
|
||||
|
||||
# PKCS#12 (PFX) support (used to read private key and certificate file from
|
||||
# a file that usually has extension .p12 or .pfx)
|
||||
CONFIG_PKCS12=y
|
||||
|
||||
# RADIUS authentication server. This provides access to the integrated EAP
|
||||
# server from external hosts using RADIUS.
|
||||
#CONFIG_RADIUS_SERVER=y
|
||||
|
||||
# Build IPv6 support for RADIUS operations
|
||||
CONFIG_IPV6=y
|
||||
|
||||
# IEEE Std 802.11r-2008 (Fast BSS Transition)
|
||||
CONFIG_IEEE80211R=y
|
||||
|
||||
# Use the hostapd's IEEE 802.11 authentication (ACL), but without
|
||||
# the IEEE 802.11 Management capability (e.g., FreeBSD/net80211)
|
||||
#CONFIG_DRIVER_RADIUS_ACL=y
|
||||
|
||||
# IEEE 802.11n (High Throughput) support
|
||||
CONFIG_IEEE80211N=y
|
||||
|
||||
# Wireless Network Management (IEEE Std 802.11v-2011)
|
||||
# Note: This is experimental and not complete implementation.
|
||||
CONFIG_WNM=y
|
||||
|
||||
# IEEE 802.11ac (Very High Throughput) support
|
||||
CONFIG_IEEE80211AC=y
|
||||
|
||||
# IEEE 802.11ax HE support
|
||||
# Note: This is experimental and work in progress. The definitions are still
|
||||
# subject to change and this should not be expected to interoperate with the
|
||||
# final IEEE 802.11ax version.
|
||||
#CONFIG_IEEE80211AX=y
|
||||
|
||||
# Remove debugging code that is printing out debug messages to stdout.
|
||||
# This can be used to reduce the size of the hostapd considerably if debugging
|
||||
# code is not needed.
|
||||
#CONFIG_NO_STDOUT_DEBUG=y
|
||||
|
||||
# Add support for writing debug log to a file: -f /tmp/hostapd.log
|
||||
# Disabled by default.
|
||||
#CONFIG_DEBUG_FILE=y
|
||||
|
||||
# Send debug messages to syslog instead of stdout
|
||||
CONFIG_DEBUG_SYSLOG=y
|
||||
|
||||
# Add support for sending all debug messages (regardless of debug verbosity)
|
||||
# to the Linux kernel tracing facility. This helps debug the entire stack by
|
||||
# making it easy to record everything happening from the driver up into the
|
||||
# same file, e.g., using trace-cmd.
|
||||
#CONFIG_DEBUG_LINUX_TRACING=y
|
||||
|
||||
# Remove support for RADIUS accounting
|
||||
#CONFIG_NO_ACCOUNTING=y
|
||||
|
||||
# Remove support for RADIUS
|
||||
#CONFIG_NO_RADIUS=y
|
||||
|
||||
# Remove support for VLANs
|
||||
#CONFIG_NO_VLAN=y
|
||||
|
||||
# Enable support for fully dynamic VLANs. This enables hostapd to
|
||||
# automatically create bridge and VLAN interfaces if necessary.
|
||||
CONFIG_FULL_DYNAMIC_VLAN=y
|
||||
|
||||
# Use netlink-based kernel API for VLAN operations instead of ioctl()
|
||||
# Note: This requires libnl 3.1 or newer.
|
||||
#CONFIG_VLAN_NETLINK=y
|
||||
|
||||
# Remove support for dumping internal state through control interface commands
|
||||
# This can be used to reduce binary size at the cost of disabling a debugging
|
||||
# option.
|
||||
CONFIG_NO_DUMP_STATE=y
|
||||
|
||||
# Enable tracing code for developer debugging
|
||||
# This tracks use of memory allocations and other registrations and reports
|
||||
# incorrect use with a backtrace of call (or allocation) location.
|
||||
#CONFIG_WPA_TRACE=y
|
||||
# For BSD, comment out these.
|
||||
#LIBS += -lexecinfo
|
||||
#LIBS_p += -lexecinfo
|
||||
#LIBS_c += -lexecinfo
|
||||
|
||||
# Use libbfd to get more details for developer debugging
|
||||
# This enables use of libbfd to get more detailed symbols for the backtraces
|
||||
# generated by CONFIG_WPA_TRACE=y.
|
||||
#CONFIG_WPA_TRACE_BFD=y
|
||||
# For BSD, comment out these.
|
||||
#LIBS += -lbfd -liberty -lz
|
||||
#LIBS_p += -lbfd -liberty -lz
|
||||
#LIBS_c += -lbfd -liberty -lz
|
||||
|
||||
# hostapd depends on strong random number generation being available from the
|
||||
# operating system. os_get_random() function is used to fetch random data when
|
||||
# needed, e.g., for key generation. On Linux and BSD systems, this works by
|
||||
# reading /dev/urandom. It should be noted that the OS entropy pool needs to be
|
||||
# properly initialized before hostapd is started. This is important especially
|
||||
# on embedded devices that do not have a hardware random number generator and
|
||||
# may by default start up with minimal entropy available for random number
|
||||
# generation.
|
||||
#
|
||||
# As a safety net, hostapd is by default trying to internally collect
|
||||
# additional entropy for generating random data to mix in with the data
|
||||
# fetched from the OS. This by itself is not considered to be very strong, but
|
||||
# it may help in cases where the system pool is not initialized properly.
|
||||
# However, it is very strongly recommended that the system pool is initialized
|
||||
# with enough entropy either by using hardware assisted random number
|
||||
# generator or by storing state over device reboots.
|
||||
#
|
||||
# hostapd can be configured to maintain its own entropy store over restarts to
|
||||
# enhance random number generation. This is not perfect, but it is much more
|
||||
# secure than using the same sequence of random numbers after every reboot.
|
||||
# This can be enabled with -e<entropy file> command line option. The specified
|
||||
# file needs to be readable and writable by hostapd.
|
||||
#
|
||||
# If the os_get_random() is known to provide strong random data (e.g., on
|
||||
# Linux/BSD, the board in question is known to have reliable source of random
|
||||
# data from /dev/urandom), the internal hostapd random pool can be disabled.
|
||||
# This will save some in binary size and CPU use. However, this should only be
|
||||
# considered for builds that are known to be used on devices that meet the
|
||||
# requirements described above.
|
||||
CONFIG_NO_RANDOM_POOL=y
|
||||
|
||||
# Should we use poll instead of select? Select is used by default.
|
||||
#CONFIG_ELOOP_POLL=y
|
||||
|
||||
# Should we use epoll instead of select? Select is used by default.
|
||||
#CONFIG_ELOOP_EPOLL=y
|
||||
|
||||
# Should we use kqueue instead of select? Select is used by default.
|
||||
#CONFIG_ELOOP_KQUEUE=y
|
||||
|
||||
# Select TLS implementation
|
||||
# openssl = OpenSSL (default)
|
||||
# gnutls = GnuTLS
|
||||
# internal = Internal TLSv1 implementation (experimental)
|
||||
# linux = Linux kernel AF_ALG and internal TLSv1 implementation (experimental)
|
||||
# none = Empty template
|
||||
CONFIG_TLS=internal
|
||||
|
||||
# TLS-based EAP methods require at least TLS v1.0. Newer version of TLS (v1.1)
|
||||
# can be enabled to get a stronger construction of messages when block ciphers
|
||||
# are used.
|
||||
#CONFIG_TLSV11=y
|
||||
|
||||
# TLS-based EAP methods require at least TLS v1.0. Newer version of TLS (v1.2)
|
||||
# can be enabled to enable use of stronger crypto algorithms.
|
||||
#CONFIG_TLSV12=y
|
||||
|
||||
# Select which ciphers to use by default with OpenSSL if the user does not
|
||||
# specify them.
|
||||
#CONFIG_TLS_DEFAULT_CIPHERS="DEFAULT:!EXP:!LOW"
|
||||
|
||||
# If CONFIG_TLS=internal is used, additional library and include paths are
|
||||
# needed for LibTomMath. Alternatively, an integrated, minimal version of
|
||||
# LibTomMath can be used. See beginning of libtommath.c for details on benefits
|
||||
# and drawbacks of this option.
|
||||
CONFIG_INTERNAL_LIBTOMMATH=y
|
||||
#ifndef CONFIG_INTERNAL_LIBTOMMATH
|
||||
#LTM_PATH=/usr/src/libtommath-0.39
|
||||
#CFLAGS += -I$(LTM_PATH)
|
||||
#LIBS += -L$(LTM_PATH)
|
||||
#LIBS_p += -L$(LTM_PATH)
|
||||
#endif
|
||||
# At the cost of about 4 kB of additional binary size, the internal LibTomMath
|
||||
# can be configured to include faster routines for exptmod, sqr, and div to
|
||||
# speed up DH and RSA calculation considerably
|
||||
#CONFIG_INTERNAL_LIBTOMMATH_FAST=y
|
||||
|
||||
# Interworking (IEEE 802.11u)
|
||||
# This can be used to enable functionality to improve interworking with
|
||||
# external networks.
|
||||
#CONFIG_INTERWORKING=y
|
||||
|
||||
# Hotspot 2.0
|
||||
#CONFIG_HS20=y
|
||||
|
||||
# Enable SQLite database support in hlr_auc_gw, EAP-SIM DB, and eap_user_file
|
||||
#CONFIG_SQLITE=y
|
||||
|
||||
# Enable Fast Session Transfer (FST)
|
||||
#CONFIG_FST=y
|
||||
|
||||
# Enable CLI commands for FST testing
|
||||
#CONFIG_FST_TEST=y
|
||||
|
||||
# Testing options
|
||||
# This can be used to enable some testing options (see also the example
|
||||
# configuration file) that are really useful only for testing clients that
|
||||
# connect to this hostapd. These options allow, for example, to drop a
|
||||
# certain percentage of probe requests or auth/(re)assoc frames.
|
||||
#
|
||||
#CONFIG_TESTING_OPTIONS=y
|
||||
|
||||
# Automatic Channel Selection
|
||||
# This will allow hostapd to pick the channel automatically when channel is set
|
||||
# to "acs_survey" or "0". Eventually, other ACS algorithms can be added in
|
||||
# similar way.
|
||||
#
|
||||
# Automatic selection is currently only done through initialization, later on
|
||||
# we hope to do background checks to keep us moving to more ideal channels as
|
||||
# time goes by. ACS is currently only supported through the nl80211 driver and
|
||||
# your driver must have survey dump capability that is filled by the driver
|
||||
# during scanning.
|
||||
#
|
||||
# You can customize the ACS survey algorithm with the hostapd.conf variable
|
||||
# acs_num_scans.
|
||||
#
|
||||
# Supported ACS drivers:
|
||||
# * ath9k
|
||||
# * ath5k
|
||||
# * ath10k
|
||||
#
|
||||
# For more details refer to:
|
||||
# http://wireless.kernel.org/en/users/Documentation/acs
|
||||
#
|
||||
#CONFIG_ACS=y
|
||||
|
||||
# Multiband Operation support
|
||||
# These extentions facilitate efficient use of multiple frequency bands
|
||||
# available to the AP and the devices that may associate with it.
|
||||
#CONFIG_MBO=y
|
||||
|
||||
# Client Taxonomy
|
||||
# Has the AP retain the Probe Request and (Re)Association Request frames from
|
||||
# a client, from which a signature can be produced which can identify the model
|
||||
# of client device like "Nexus 6P" or "iPhone 5s".
|
||||
CONFIG_TAXONOMY=y
|
||||
|
||||
# Fast Initial Link Setup (FILS) (IEEE 802.11ai)
|
||||
# Note: This is an experimental and not yet complete implementation. This
|
||||
# should not be enabled for production use.
|
||||
#CONFIG_FILS=y
|
||||
# FILS shared key authentication with PFS
|
||||
#CONFIG_FILS_SK_PFS=y
|
||||
|
||||
# Include internal line edit mode in hostapd_cli. This can be used to provide
|
||||
# limited command line editing and history support.
|
||||
#CONFIG_WPA_CLI_EDIT=y
|
||||
|
||||
# Opportunistic Wireless Encryption (OWE)
|
||||
# Experimental implementation of draft-harkins-owe-07.txt
|
||||
#CONFIG_OWE=y
|
||||
|
||||
# uBus IPC/RPC System
|
||||
# Services can connect to the bus and provide methods
|
||||
# that can be called by other services or clients.
|
||||
CONFIG_UBUS=y
|
||||
380
package/network/services/hostapd/files/hostapd-mini.config
Normal file
380
package/network/services/hostapd/files/hostapd-mini.config
Normal file
@@ -0,0 +1,380 @@
|
||||
# Example hostapd build time configuration
|
||||
#
|
||||
# This file lists the configuration options that are used when building the
|
||||
# hostapd binary. All lines starting with # are ignored. Configuration option
|
||||
# lines must be commented out complete, if they are not to be included, i.e.,
|
||||
# just setting VARIABLE=n is not disabling that variable.
|
||||
#
|
||||
# This file is included in Makefile, so variables like CFLAGS and LIBS can also
|
||||
# be modified from here. In most cass, these lines should use += in order not
|
||||
# to override previous values of the variables.
|
||||
|
||||
# Driver interface for Host AP driver
|
||||
#CONFIG_DRIVER_HOSTAP=y
|
||||
|
||||
# Driver interface for wired authenticator
|
||||
CONFIG_DRIVER_WIRED=y
|
||||
|
||||
# Driver interface for drivers using the nl80211 kernel interface
|
||||
CONFIG_DRIVER_NL80211=y
|
||||
|
||||
# QCA vendor extensions to nl80211
|
||||
#CONFIG_DRIVER_NL80211_QCA=y
|
||||
|
||||
# driver_nl80211.c requires libnl. If you are compiling it yourself
|
||||
# you may need to point hostapd to your version of libnl.
|
||||
#
|
||||
#CFLAGS += -I$<path to libnl include files>
|
||||
#LIBS += -L$<path to libnl library files>
|
||||
|
||||
# Use libnl v2.0 (or 3.0) libraries.
|
||||
#CONFIG_LIBNL20=y
|
||||
|
||||
# Use libnl 3.2 libraries (if this is selected, CONFIG_LIBNL20 is ignored)
|
||||
#CONFIG_LIBNL32=y
|
||||
|
||||
|
||||
# Driver interface for FreeBSD net80211 layer (e.g., Atheros driver)
|
||||
#CONFIG_DRIVER_BSD=y
|
||||
#CFLAGS += -I/usr/local/include
|
||||
#LIBS += -L/usr/local/lib
|
||||
#LIBS_p += -L/usr/local/lib
|
||||
#LIBS_c += -L/usr/local/lib
|
||||
|
||||
# Driver interface for no driver (e.g., RADIUS server only)
|
||||
#CONFIG_DRIVER_NONE=y
|
||||
|
||||
# IEEE 802.11F/IAPP
|
||||
#CONFIG_IAPP=y
|
||||
|
||||
# WPA2/IEEE 802.11i RSN pre-authentication
|
||||
CONFIG_RSN_PREAUTH=y
|
||||
|
||||
# PeerKey handshake for Station to Station Link (IEEE 802.11e DLS)
|
||||
CONFIG_PEERKEY=y
|
||||
|
||||
# IEEE 802.11w (management frame protection)
|
||||
# Driver support is also needed for IEEE 802.11w.
|
||||
#CONFIG_IEEE80211W=y
|
||||
|
||||
# Integrated EAP server
|
||||
#CONFIG_EAP=y
|
||||
|
||||
# EAP Re-authentication Protocol (ERP) in integrated EAP server
|
||||
#CONFIG_ERP=y
|
||||
|
||||
# EAP-MD5 for the integrated EAP server
|
||||
#CONFIG_EAP_MD5=y
|
||||
|
||||
# EAP-TLS for the integrated EAP server
|
||||
#CONFIG_EAP_TLS=y
|
||||
|
||||
# EAP-MSCHAPv2 for the integrated EAP server
|
||||
#CONFIG_EAP_MSCHAPV2=y
|
||||
|
||||
# EAP-PEAP for the integrated EAP server
|
||||
#CONFIG_EAP_PEAP=y
|
||||
|
||||
# EAP-GTC for the integrated EAP server
|
||||
#CONFIG_EAP_GTC=y
|
||||
|
||||
# EAP-TTLS for the integrated EAP server
|
||||
#CONFIG_EAP_TTLS=y
|
||||
|
||||
# EAP-SIM for the integrated EAP server
|
||||
#CONFIG_EAP_SIM=y
|
||||
|
||||
# EAP-AKA for the integrated EAP server
|
||||
#CONFIG_EAP_AKA=y
|
||||
|
||||
# EAP-AKA' for the integrated EAP server
|
||||
# This requires CONFIG_EAP_AKA to be enabled, too.
|
||||
#CONFIG_EAP_AKA_PRIME=y
|
||||
|
||||
# EAP-PAX for the integrated EAP server
|
||||
#CONFIG_EAP_PAX=y
|
||||
|
||||
# EAP-PSK for the integrated EAP server (this is _not_ needed for WPA-PSK)
|
||||
#CONFIG_EAP_PSK=y
|
||||
|
||||
# EAP-pwd for the integrated EAP server (secure authentication with a password)
|
||||
#CONFIG_EAP_PWD=y
|
||||
|
||||
# EAP-SAKE for the integrated EAP server
|
||||
#CONFIG_EAP_SAKE=y
|
||||
|
||||
# EAP-GPSK for the integrated EAP server
|
||||
#CONFIG_EAP_GPSK=y
|
||||
# Include support for optional SHA256 cipher suite in EAP-GPSK
|
||||
#CONFIG_EAP_GPSK_SHA256=y
|
||||
|
||||
# EAP-FAST for the integrated EAP server
|
||||
# Note: If OpenSSL is used as the TLS library, OpenSSL 1.0 or newer is needed
|
||||
# for EAP-FAST support. Older OpenSSL releases would need to be patched, e.g.,
|
||||
# with openssl-0.9.8x-tls-extensions.patch, to add the needed functions.
|
||||
#CONFIG_EAP_FAST=y
|
||||
|
||||
# Wi-Fi Protected Setup (WPS)
|
||||
#CONFIG_WPS=y
|
||||
# Enable UPnP support for external WPS Registrars
|
||||
#CONFIG_WPS_UPNP=y
|
||||
# Enable WPS support with NFC config method
|
||||
#CONFIG_WPS_NFC=y
|
||||
|
||||
# EAP-IKEv2
|
||||
#CONFIG_EAP_IKEV2=y
|
||||
|
||||
# Trusted Network Connect (EAP-TNC)
|
||||
#CONFIG_EAP_TNC=y
|
||||
|
||||
# EAP-EKE for the integrated EAP server
|
||||
#CONFIG_EAP_EKE=y
|
||||
|
||||
# PKCS#12 (PFX) support (used to read private key and certificate file from
|
||||
# a file that usually has extension .p12 or .pfx)
|
||||
#CONFIG_PKCS12=y
|
||||
|
||||
# RADIUS authentication server. This provides access to the integrated EAP
|
||||
# server from external hosts using RADIUS.
|
||||
#CONFIG_RADIUS_SERVER=y
|
||||
|
||||
# Build IPv6 support for RADIUS operations
|
||||
#CONFIG_IPV6=y
|
||||
|
||||
# IEEE Std 802.11r-2008 (Fast BSS Transition)
|
||||
#CONFIG_IEEE80211R=y
|
||||
|
||||
# Use the hostapd's IEEE 802.11 authentication (ACL), but without
|
||||
# the IEEE 802.11 Management capability (e.g., FreeBSD/net80211)
|
||||
#CONFIG_DRIVER_RADIUS_ACL=y
|
||||
|
||||
# IEEE 802.11n (High Throughput) support
|
||||
CONFIG_IEEE80211N=y
|
||||
|
||||
# Wireless Network Management (IEEE Std 802.11v-2011)
|
||||
# Note: This is experimental and not complete implementation.
|
||||
#CONFIG_WNM=y
|
||||
|
||||
# IEEE 802.11ac (Very High Throughput) support
|
||||
CONFIG_IEEE80211AC=y
|
||||
|
||||
# IEEE 802.11ax HE support
|
||||
# Note: This is experimental and work in progress. The definitions are still
|
||||
# subject to change and this should not be expected to interoperate with the
|
||||
# final IEEE 802.11ax version.
|
||||
#CONFIG_IEEE80211AX=y
|
||||
|
||||
# Remove debugging code that is printing out debug messages to stdout.
|
||||
# This can be used to reduce the size of the hostapd considerably if debugging
|
||||
# code is not needed.
|
||||
#CONFIG_NO_STDOUT_DEBUG=y
|
||||
|
||||
# Add support for writing debug log to a file: -f /tmp/hostapd.log
|
||||
# Disabled by default.
|
||||
#CONFIG_DEBUG_FILE=y
|
||||
|
||||
# Send debug messages to syslog instead of stdout
|
||||
CONFIG_DEBUG_SYSLOG=y
|
||||
|
||||
# Add support for sending all debug messages (regardless of debug verbosity)
|
||||
# to the Linux kernel tracing facility. This helps debug the entire stack by
|
||||
# making it easy to record everything happening from the driver up into the
|
||||
# same file, e.g., using trace-cmd.
|
||||
#CONFIG_DEBUG_LINUX_TRACING=y
|
||||
|
||||
# Remove support for RADIUS accounting
|
||||
CONFIG_NO_ACCOUNTING=y
|
||||
|
||||
# Remove support for RADIUS
|
||||
CONFIG_NO_RADIUS=y
|
||||
|
||||
# Remove support for VLANs
|
||||
#CONFIG_NO_VLAN=y
|
||||
|
||||
# Enable support for fully dynamic VLANs. This enables hostapd to
|
||||
# automatically create bridge and VLAN interfaces if necessary.
|
||||
#CONFIG_FULL_DYNAMIC_VLAN=y
|
||||
|
||||
# Use netlink-based kernel API for VLAN operations instead of ioctl()
|
||||
# Note: This requires libnl 3.1 or newer.
|
||||
#CONFIG_VLAN_NETLINK=y
|
||||
|
||||
# Remove support for dumping internal state through control interface commands
|
||||
# This can be used to reduce binary size at the cost of disabling a debugging
|
||||
# option.
|
||||
CONFIG_NO_DUMP_STATE=y
|
||||
|
||||
# Enable tracing code for developer debugging
|
||||
# This tracks use of memory allocations and other registrations and reports
|
||||
# incorrect use with a backtrace of call (or allocation) location.
|
||||
#CONFIG_WPA_TRACE=y
|
||||
# For BSD, comment out these.
|
||||
#LIBS += -lexecinfo
|
||||
#LIBS_p += -lexecinfo
|
||||
#LIBS_c += -lexecinfo
|
||||
|
||||
# Use libbfd to get more details for developer debugging
|
||||
# This enables use of libbfd to get more detailed symbols for the backtraces
|
||||
# generated by CONFIG_WPA_TRACE=y.
|
||||
#CONFIG_WPA_TRACE_BFD=y
|
||||
# For BSD, comment out these.
|
||||
#LIBS += -lbfd -liberty -lz
|
||||
#LIBS_p += -lbfd -liberty -lz
|
||||
#LIBS_c += -lbfd -liberty -lz
|
||||
|
||||
# hostapd depends on strong random number generation being available from the
|
||||
# operating system. os_get_random() function is used to fetch random data when
|
||||
# needed, e.g., for key generation. On Linux and BSD systems, this works by
|
||||
# reading /dev/urandom. It should be noted that the OS entropy pool needs to be
|
||||
# properly initialized before hostapd is started. This is important especially
|
||||
# on embedded devices that do not have a hardware random number generator and
|
||||
# may by default start up with minimal entropy available for random number
|
||||
# generation.
|
||||
#
|
||||
# As a safety net, hostapd is by default trying to internally collect
|
||||
# additional entropy for generating random data to mix in with the data
|
||||
# fetched from the OS. This by itself is not considered to be very strong, but
|
||||
# it may help in cases where the system pool is not initialized properly.
|
||||
# However, it is very strongly recommended that the system pool is initialized
|
||||
# with enough entropy either by using hardware assisted random number
|
||||
# generator or by storing state over device reboots.
|
||||
#
|
||||
# hostapd can be configured to maintain its own entropy store over restarts to
|
||||
# enhance random number generation. This is not perfect, but it is much more
|
||||
# secure than using the same sequence of random numbers after every reboot.
|
||||
# This can be enabled with -e<entropy file> command line option. The specified
|
||||
# file needs to be readable and writable by hostapd.
|
||||
#
|
||||
# If the os_get_random() is known to provide strong random data (e.g., on
|
||||
# Linux/BSD, the board in question is known to have reliable source of random
|
||||
# data from /dev/urandom), the internal hostapd random pool can be disabled.
|
||||
# This will save some in binary size and CPU use. However, this should only be
|
||||
# considered for builds that are known to be used on devices that meet the
|
||||
# requirements described above.
|
||||
CONFIG_NO_RANDOM_POOL=y
|
||||
|
||||
# Should we use poll instead of select? Select is used by default.
|
||||
#CONFIG_ELOOP_POLL=y
|
||||
|
||||
# Should we use epoll instead of select? Select is used by default.
|
||||
#CONFIG_ELOOP_EPOLL=y
|
||||
|
||||
# Should we use kqueue instead of select? Select is used by default.
|
||||
#CONFIG_ELOOP_KQUEUE=y
|
||||
|
||||
# Select TLS implementation
|
||||
# openssl = OpenSSL (default)
|
||||
# gnutls = GnuTLS
|
||||
# internal = Internal TLSv1 implementation (experimental)
|
||||
# linux = Linux kernel AF_ALG and internal TLSv1 implementation (experimental)
|
||||
# none = Empty template
|
||||
CONFIG_TLS=internal
|
||||
|
||||
# TLS-based EAP methods require at least TLS v1.0. Newer version of TLS (v1.1)
|
||||
# can be enabled to get a stronger construction of messages when block ciphers
|
||||
# are used.
|
||||
#CONFIG_TLSV11=y
|
||||
|
||||
# TLS-based EAP methods require at least TLS v1.0. Newer version of TLS (v1.2)
|
||||
# can be enabled to enable use of stronger crypto algorithms.
|
||||
#CONFIG_TLSV12=y
|
||||
|
||||
# Select which ciphers to use by default with OpenSSL if the user does not
|
||||
# specify them.
|
||||
#CONFIG_TLS_DEFAULT_CIPHERS="DEFAULT:!EXP:!LOW"
|
||||
|
||||
# If CONFIG_TLS=internal is used, additional library and include paths are
|
||||
# needed for LibTomMath. Alternatively, an integrated, minimal version of
|
||||
# LibTomMath can be used. See beginning of libtommath.c for details on benefits
|
||||
# and drawbacks of this option.
|
||||
#CONFIG_INTERNAL_LIBTOMMATH=y
|
||||
#ifndef CONFIG_INTERNAL_LIBTOMMATH
|
||||
#LTM_PATH=/usr/src/libtommath-0.39
|
||||
#CFLAGS += -I$(LTM_PATH)
|
||||
#LIBS += -L$(LTM_PATH)
|
||||
#LIBS_p += -L$(LTM_PATH)
|
||||
#endif
|
||||
# At the cost of about 4 kB of additional binary size, the internal LibTomMath
|
||||
# can be configured to include faster routines for exptmod, sqr, and div to
|
||||
# speed up DH and RSA calculation considerably
|
||||
#CONFIG_INTERNAL_LIBTOMMATH_FAST=y
|
||||
|
||||
# Interworking (IEEE 802.11u)
|
||||
# This can be used to enable functionality to improve interworking with
|
||||
# external networks.
|
||||
#CONFIG_INTERWORKING=y
|
||||
|
||||
# Hotspot 2.0
|
||||
#CONFIG_HS20=y
|
||||
|
||||
# Enable SQLite database support in hlr_auc_gw, EAP-SIM DB, and eap_user_file
|
||||
#CONFIG_SQLITE=y
|
||||
|
||||
# Enable Fast Session Transfer (FST)
|
||||
#CONFIG_FST=y
|
||||
|
||||
# Enable CLI commands for FST testing
|
||||
#CONFIG_FST_TEST=y
|
||||
|
||||
# Testing options
|
||||
# This can be used to enable some testing options (see also the example
|
||||
# configuration file) that are really useful only for testing clients that
|
||||
# connect to this hostapd. These options allow, for example, to drop a
|
||||
# certain percentage of probe requests or auth/(re)assoc frames.
|
||||
#
|
||||
#CONFIG_TESTING_OPTIONS=y
|
||||
|
||||
# Automatic Channel Selection
|
||||
# This will allow hostapd to pick the channel automatically when channel is set
|
||||
# to "acs_survey" or "0". Eventually, other ACS algorithms can be added in
|
||||
# similar way.
|
||||
#
|
||||
# Automatic selection is currently only done through initialization, later on
|
||||
# we hope to do background checks to keep us moving to more ideal channels as
|
||||
# time goes by. ACS is currently only supported through the nl80211 driver and
|
||||
# your driver must have survey dump capability that is filled by the driver
|
||||
# during scanning.
|
||||
#
|
||||
# You can customize the ACS survey algorithm with the hostapd.conf variable
|
||||
# acs_num_scans.
|
||||
#
|
||||
# Supported ACS drivers:
|
||||
# * ath9k
|
||||
# * ath5k
|
||||
# * ath10k
|
||||
#
|
||||
# For more details refer to:
|
||||
# http://wireless.kernel.org/en/users/Documentation/acs
|
||||
#
|
||||
#CONFIG_ACS=y
|
||||
|
||||
# Multiband Operation support
|
||||
# These extentions facilitate efficient use of multiple frequency bands
|
||||
# available to the AP and the devices that may associate with it.
|
||||
#CONFIG_MBO=y
|
||||
|
||||
# Client Taxonomy
|
||||
# Has the AP retain the Probe Request and (Re)Association Request frames from
|
||||
# a client, from which a signature can be produced which can identify the model
|
||||
# of client device like "Nexus 6P" or "iPhone 5s".
|
||||
#CONFIG_TAXONOMY=y
|
||||
|
||||
# Fast Initial Link Setup (FILS) (IEEE 802.11ai)
|
||||
# Note: This is an experimental and not yet complete implementation. This
|
||||
# should not be enabled for production use.
|
||||
#CONFIG_FILS=y
|
||||
# FILS shared key authentication with PFS
|
||||
#CONFIG_FILS_SK_PFS=y
|
||||
|
||||
# Include internal line edit mode in hostapd_cli. This can be used to provide
|
||||
# limited command line editing and history support.
|
||||
#CONFIG_WPA_CLI_EDIT=y
|
||||
|
||||
# Opportunistic Wireless Encryption (OWE)
|
||||
# Experimental implementation of draft-harkins-owe-07.txt
|
||||
#CONFIG_OWE=y
|
||||
|
||||
# uBus IPC/RPC System
|
||||
# Services can connect to the bus and provide methods
|
||||
# that can be called by other services or clients.
|
||||
CONFIG_UBUS=y
|
||||
854
package/network/services/hostapd/files/hostapd.sh
Normal file
854
package/network/services/hostapd/files/hostapd.sh
Normal file
@@ -0,0 +1,854 @@
|
||||
. /lib/functions/network.sh
|
||||
|
||||
wpa_supplicant_add_rate() {
|
||||
local var="$1"
|
||||
local val="$(($2 / 1000))"
|
||||
local sub="$((($2 / 100) % 10))"
|
||||
append $var "$val" ","
|
||||
[ $sub -gt 0 ] && append $var "."
|
||||
}
|
||||
|
||||
hostapd_add_rate() {
|
||||
local var="$1"
|
||||
local val="$(($2 / 100))"
|
||||
append $var "$val" " "
|
||||
}
|
||||
|
||||
hostapd_append_wep_key() {
|
||||
local var="$1"
|
||||
|
||||
wep_keyidx=0
|
||||
set_default key 1
|
||||
case "$key" in
|
||||
[1234])
|
||||
for idx in 1 2 3 4; do
|
||||
local zidx
|
||||
zidx=$(($idx - 1))
|
||||
json_get_var ckey "key${idx}"
|
||||
[ -n "$ckey" ] && \
|
||||
append $var "wep_key${zidx}=$(prepare_key_wep "$ckey")" "$N$T"
|
||||
done
|
||||
wep_keyidx=$((key - 1))
|
||||
;;
|
||||
*)
|
||||
append $var "wep_key0=$(prepare_key_wep "$key")" "$N$T"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
hostapd_append_wpa_key_mgmt() {
|
||||
local auth_type="$(echo $auth_type | tr 'a-z' 'A-Z')"
|
||||
|
||||
append wpa_key_mgmt "WPA-$auth_type"
|
||||
[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-${auth_type}"
|
||||
[ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-${auth_type}-SHA256"
|
||||
}
|
||||
|
||||
hostapd_add_log_config() {
|
||||
config_add_boolean \
|
||||
log_80211 \
|
||||
log_8021x \
|
||||
log_radius \
|
||||
log_wpa \
|
||||
log_driver \
|
||||
log_iapp \
|
||||
log_mlme
|
||||
|
||||
config_add_int log_level
|
||||
}
|
||||
|
||||
hostapd_common_add_device_config() {
|
||||
config_add_array basic_rate
|
||||
config_add_array supported_rates
|
||||
|
||||
config_add_string country
|
||||
config_add_boolean country_ie doth
|
||||
config_add_string require_mode
|
||||
config_add_boolean legacy_rates
|
||||
|
||||
config_add_string acs_chan_bias
|
||||
config_add_array hostapd_options
|
||||
|
||||
hostapd_add_log_config
|
||||
}
|
||||
|
||||
hostapd_prepare_device_config() {
|
||||
local config="$1"
|
||||
local driver="$2"
|
||||
|
||||
local base="${config%%.conf}"
|
||||
local base_cfg=
|
||||
|
||||
json_get_vars country country_ie beacon_int:100 doth require_mode legacy_rates acs_chan_bias
|
||||
|
||||
hostapd_set_log_options base_cfg
|
||||
|
||||
set_default country_ie 1
|
||||
set_default doth 1
|
||||
set_default legacy_rates 1
|
||||
|
||||
[ "$hwmode" = "b" ] && legacy_rates=1
|
||||
|
||||
[ -n "$country" ] && {
|
||||
append base_cfg "country_code=$country" "$N"
|
||||
|
||||
[ "$country_ie" -gt 0 ] && append base_cfg "ieee80211d=1" "$N"
|
||||
[ "$hwmode" = "a" -a "$doth" -gt 0 ] && append base_cfg "ieee80211h=1" "$N"
|
||||
}
|
||||
|
||||
[ -n "$acs_chan_bias" ] && append base_cfg "acs_chan_bias=$acs_chan_bias" "$N"
|
||||
|
||||
local brlist= br
|
||||
json_get_values basic_rate_list basic_rate
|
||||
local rlist= r
|
||||
json_get_values rate_list supported_rates
|
||||
|
||||
[ -n "$hwmode" ] && append base_cfg "hw_mode=$hwmode" "$N"
|
||||
[ "$legacy_rates" -eq 0 ] && set_default require_mode g
|
||||
|
||||
[ "$hwmode" = "g" ] && {
|
||||
[ "$legacy_rates" -eq 0 ] && set_default rate_list "6000 9000 12000 18000 24000 36000 48000 54000"
|
||||
[ -n "$require_mode" ] && set_default basic_rate_list "6000 12000 24000"
|
||||
}
|
||||
|
||||
case "$require_mode" in
|
||||
n) append base_cfg "require_ht=1" "$N";;
|
||||
ac) append base_cfg "require_vht=1" "$N";;
|
||||
esac
|
||||
|
||||
for r in $rate_list; do
|
||||
hostapd_add_rate rlist "$r"
|
||||
done
|
||||
|
||||
for br in $basic_rate_list; do
|
||||
hostapd_add_rate brlist "$br"
|
||||
done
|
||||
|
||||
[ -n "$rlist" ] && append base_cfg "supported_rates=$rlist" "$N"
|
||||
[ -n "$brlist" ] && append base_cfg "basic_rates=$brlist" "$N"
|
||||
append base_cfg "beacon_int=$beacon_int" "$N"
|
||||
|
||||
json_get_values opts hostapd_options
|
||||
for val in $opts; do
|
||||
append base_cfg "$val" "$N"
|
||||
done
|
||||
|
||||
cat > "$config" <<EOF
|
||||
driver=$driver
|
||||
$base_cfg
|
||||
EOF
|
||||
}
|
||||
|
||||
hostapd_common_add_bss_config() {
|
||||
config_add_string 'bssid:macaddr' 'ssid:string'
|
||||
config_add_boolean wds wmm uapsd hidden
|
||||
|
||||
config_add_int maxassoc max_inactivity
|
||||
config_add_boolean disassoc_low_ack isolate short_preamble
|
||||
|
||||
config_add_int \
|
||||
wep_rekey eap_reauth_period \
|
||||
wpa_group_rekey wpa_pair_rekey wpa_master_rekey
|
||||
config_add_boolean wpa_disable_eapol_key_retries
|
||||
|
||||
config_add_boolean tdls_prohibit
|
||||
|
||||
config_add_boolean rsn_preauth auth_cache
|
||||
config_add_int ieee80211w
|
||||
config_add_int eapol_version
|
||||
|
||||
config_add_string 'auth_server:host' 'server:host'
|
||||
config_add_string auth_secret
|
||||
config_add_int 'auth_port:port' 'port:port'
|
||||
|
||||
config_add_string acct_server
|
||||
config_add_string acct_secret
|
||||
config_add_int acct_port
|
||||
config_add_int acct_interval
|
||||
|
||||
config_add_string dae_client
|
||||
config_add_string dae_secret
|
||||
config_add_int dae_port
|
||||
|
||||
config_add_string nasid
|
||||
config_add_string ownip
|
||||
config_add_string radius_client_addr
|
||||
config_add_string iapp_interface
|
||||
config_add_string eap_type ca_cert client_cert identity anonymous_identity auth priv_key priv_key_pwd
|
||||
config_add_string ieee80211w_mgmt_cipher
|
||||
|
||||
config_add_int dynamic_vlan vlan_naming
|
||||
config_add_string vlan_tagged_interface vlan_bridge
|
||||
config_add_string vlan_file
|
||||
|
||||
config_add_string 'key1:wepkey' 'key2:wepkey' 'key3:wepkey' 'key4:wepkey' 'password:wpakey'
|
||||
|
||||
config_add_string wpa_psk_file
|
||||
|
||||
config_add_boolean wps_pushbutton wps_label ext_registrar wps_pbc_in_m1
|
||||
config_add_int wps_ap_setup_locked wps_independent
|
||||
config_add_string wps_device_type wps_device_name wps_manufacturer wps_pin
|
||||
|
||||
config_add_boolean ieee80211v wnm_sleep_mode bss_transition
|
||||
config_add_int time_advertisement
|
||||
config_add_string time_zone
|
||||
|
||||
config_add_boolean ieee80211r pmk_r1_push ft_psk_generate_local ft_over_ds
|
||||
config_add_int r0_key_lifetime reassociation_deadline
|
||||
config_add_string mobility_domain r1_key_holder
|
||||
config_add_array r0kh r1kh
|
||||
|
||||
config_add_int ieee80211w_max_timeout ieee80211w_retry_timeout
|
||||
|
||||
config_add_string macfilter 'macfile:file'
|
||||
config_add_array 'maclist:list(macaddr)'
|
||||
|
||||
config_add_array bssid_blacklist
|
||||
config_add_array bssid_whitelist
|
||||
|
||||
config_add_int mcast_rate
|
||||
config_add_array basic_rate
|
||||
config_add_array supported_rates
|
||||
}
|
||||
|
||||
hostapd_set_bss_options() {
|
||||
local var="$1"
|
||||
local phy="$2"
|
||||
local vif="$3"
|
||||
|
||||
wireless_vif_parse_encryption
|
||||
|
||||
local bss_conf
|
||||
local wep_rekey wpa_group_rekey wpa_pair_rekey wpa_master_rekey wpa_key_mgmt
|
||||
|
||||
json_get_vars \
|
||||
wep_rekey wpa_group_rekey wpa_pair_rekey wpa_master_rekey \
|
||||
wpa_disable_eapol_key_retries tdls_prohibit \
|
||||
maxassoc max_inactivity disassoc_low_ack isolate auth_cache \
|
||||
wps_pushbutton wps_label ext_registrar wps_pbc_in_m1 wps_ap_setup_locked \
|
||||
wps_independent wps_device_type wps_device_name wps_manufacturer wps_pin \
|
||||
macfilter ssid wmm uapsd hidden short_preamble rsn_preauth \
|
||||
iapp_interface eapol_version dynamic_vlan ieee80211w nasid \
|
||||
acct_server acct_secret acct_port acct_interval \
|
||||
bss_load_update_period chan_util_avg_period
|
||||
|
||||
set_default isolate 0
|
||||
set_default maxassoc 0
|
||||
set_default max_inactivity 0
|
||||
set_default short_preamble 1
|
||||
set_default disassoc_low_ack 1
|
||||
set_default hidden 0
|
||||
set_default wmm 1
|
||||
set_default uapsd 1
|
||||
set_default wpa_disable_eapol_key_retries 0
|
||||
set_default tdls_prohibit 0
|
||||
set_default eapol_version 0
|
||||
set_default acct_port 1813
|
||||
set_default bss_load_update_period 60
|
||||
set_default chan_util_avg_period 600
|
||||
|
||||
append bss_conf "ctrl_interface=/var/run/hostapd"
|
||||
if [ "$isolate" -gt 0 ]; then
|
||||
append bss_conf "ap_isolate=$isolate" "$N"
|
||||
fi
|
||||
if [ "$maxassoc" -gt 0 ]; then
|
||||
append bss_conf "max_num_sta=$maxassoc" "$N"
|
||||
fi
|
||||
if [ "$max_inactivity" -gt 0 ]; then
|
||||
append bss_conf "ap_max_inactivity=$max_inactivity" "$N"
|
||||
fi
|
||||
|
||||
append bss_conf "bss_load_update_period=$bss_load_update_period" "$N"
|
||||
append bss_conf "chan_util_avg_period=$chan_util_avg_period" "$N"
|
||||
append bss_conf "disassoc_low_ack=$disassoc_low_ack" "$N"
|
||||
append bss_conf "preamble=$short_preamble" "$N"
|
||||
append bss_conf "wmm_enabled=$wmm" "$N"
|
||||
append bss_conf "ignore_broadcast_ssid=$hidden" "$N"
|
||||
append bss_conf "uapsd_advertisement_enabled=$uapsd" "$N"
|
||||
|
||||
[ "$tdls_prohibit" -gt 0 ] && append bss_conf "tdls_prohibit=$tdls_prohibit" "$N"
|
||||
|
||||
[ "$wpa" -gt 0 ] && {
|
||||
[ -n "$wpa_group_rekey" ] && append bss_conf "wpa_group_rekey=$wpa_group_rekey" "$N"
|
||||
[ -n "$wpa_pair_rekey" ] && append bss_conf "wpa_ptk_rekey=$wpa_pair_rekey" "$N"
|
||||
[ -n "$wpa_master_rekey" ] && append bss_conf "wpa_gmk_rekey=$wpa_master_rekey" "$N"
|
||||
}
|
||||
|
||||
[ -n "$nasid" ] && append bss_conf "nas_identifier=$nasid" "$N"
|
||||
[ -n "$acct_server" ] && {
|
||||
append bss_conf "acct_server_addr=$acct_server" "$N"
|
||||
append bss_conf "acct_server_port=$acct_port" "$N"
|
||||
[ -n "$acct_secret" ] && \
|
||||
append bss_conf "acct_server_shared_secret=$acct_secret" "$N"
|
||||
[ -n "$acct_interval" ] && \
|
||||
append bss_conf "radius_acct_interim_interval=$acct_interval" "$N"
|
||||
}
|
||||
|
||||
local vlan_possible=""
|
||||
|
||||
case "$auth_type" in
|
||||
none)
|
||||
wps_possible=1
|
||||
# Here we make the assumption that if we're in open mode
|
||||
# with WPS enabled, we got to be in unconfigured state.
|
||||
wps_not_configured=1
|
||||
;;
|
||||
psk)
|
||||
json_get_vars key wpa_psk_file
|
||||
if [ ${#key} -lt 8 ]; then
|
||||
wireless_setup_vif_failed INVALID_WPA_PSK
|
||||
return 1
|
||||
elif [ ${#key} -eq 64 ]; then
|
||||
append bss_conf "wpa_psk=$key" "$N"
|
||||
else
|
||||
append bss_conf "wpa_passphrase=$key" "$N"
|
||||
fi
|
||||
[ -n "$wpa_psk_file" ] && {
|
||||
[ -e "$wpa_psk_file" ] || touch "$wpa_psk_file"
|
||||
append bss_conf "wpa_psk_file=$wpa_psk_file" "$N"
|
||||
}
|
||||
[ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N"
|
||||
|
||||
wps_possible=1
|
||||
;;
|
||||
eap)
|
||||
json_get_vars \
|
||||
auth_server auth_secret auth_port \
|
||||
dae_client dae_secret dae_port \
|
||||
ownip radius_client_addr \
|
||||
eap_reauth_period
|
||||
|
||||
# radius can provide VLAN ID for clients
|
||||
vlan_possible=1
|
||||
|
||||
# legacy compatibility
|
||||
[ -n "$auth_server" ] || json_get_var auth_server server
|
||||
[ -n "$auth_port" ] || json_get_var auth_port port
|
||||
[ -n "$auth_secret" ] || json_get_var auth_secret key
|
||||
|
||||
set_default auth_port 1812
|
||||
set_default dae_port 3799
|
||||
|
||||
|
||||
append bss_conf "auth_server_addr=$auth_server" "$N"
|
||||
append bss_conf "auth_server_port=$auth_port" "$N"
|
||||
append bss_conf "auth_server_shared_secret=$auth_secret" "$N"
|
||||
|
||||
[ -n "$eap_reauth_period" ] && append bss_conf "eap_reauth_period=$eap_reauth_period" "$N"
|
||||
|
||||
[ -n "$dae_client" -a -n "$dae_secret" ] && {
|
||||
append bss_conf "radius_das_port=$dae_port" "$N"
|
||||
append bss_conf "radius_das_client=$dae_client $dae_secret" "$N"
|
||||
}
|
||||
|
||||
[ -n "$ownip" ] && append bss_conf "own_ip_addr=$ownip" "$N"
|
||||
[ -n "$radius_client_addr" ] && append bss_conf "radius_client_addr=$radius_client_addr" "$N"
|
||||
append bss_conf "eapol_key_index_workaround=1" "$N"
|
||||
append bss_conf "ieee8021x=1" "$N"
|
||||
|
||||
[ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N"
|
||||
;;
|
||||
wep)
|
||||
local wep_keyidx=0
|
||||
json_get_vars key
|
||||
hostapd_append_wep_key bss_conf
|
||||
append bss_conf "wep_default_key=$wep_keyidx" "$N"
|
||||
[ -n "$wep_rekey" ] && append bss_conf "wep_rekey_period=$wep_rekey" "$N"
|
||||
;;
|
||||
esac
|
||||
|
||||
local auth_algs=$((($auth_mode_shared << 1) | $auth_mode_open))
|
||||
append bss_conf "auth_algs=${auth_algs:-1}" "$N"
|
||||
append bss_conf "wpa=$wpa" "$N"
|
||||
[ -n "$wpa_pairwise" ] && append bss_conf "wpa_pairwise=$wpa_pairwise" "$N"
|
||||
|
||||
set_default wps_pushbutton 0
|
||||
set_default wps_label 0
|
||||
set_default wps_pbc_in_m1 0
|
||||
|
||||
config_methods=
|
||||
[ "$wps_pushbutton" -gt 0 ] && append config_methods push_button
|
||||
[ "$wps_label" -gt 0 ] && append config_methods label
|
||||
|
||||
[ -n "$wps_possible" -a -n "$config_methods" ] && {
|
||||
set_default ext_registrar 0
|
||||
set_default wps_device_type "6-0050F204-1"
|
||||
set_default wps_device_name "OpenWrt AP"
|
||||
set_default wps_manufacturer "www.openwrt.org"
|
||||
set_default wps_independent 1
|
||||
|
||||
wps_state=2
|
||||
[ -n "$wps_configured" ] && wps_state=1
|
||||
|
||||
[ "$ext_registrar" -gt 0 -a -n "$network_bridge" ] && append bss_conf "upnp_iface=$network_bridge" "$N"
|
||||
|
||||
append bss_conf "eap_server=1" "$N"
|
||||
[ -n "$wps_pin" ] && append bss_conf "ap_pin=$wps_pin" "$N"
|
||||
append bss_conf "wps_state=$wps_state" "$N"
|
||||
append bss_conf "device_type=$wps_device_type" "$N"
|
||||
append bss_conf "device_name=$wps_device_name" "$N"
|
||||
append bss_conf "manufacturer=$wps_manufacturer" "$N"
|
||||
append bss_conf "config_methods=$config_methods" "$N"
|
||||
append bss_conf "wps_independent=$wps_independent" "$N"
|
||||
[ -n "$wps_ap_setup_locked" ] && append bss_conf "ap_setup_locked=$wps_ap_setup_locked" "$N"
|
||||
[ "$wps_pbc_in_m1" -gt 0 ] && append bss_conf "pbc_in_m1=$wps_pbc_in_m1" "$N"
|
||||
}
|
||||
|
||||
append bss_conf "ssid=$ssid" "$N"
|
||||
[ -n "$network_bridge" ] && append bss_conf "bridge=$network_bridge" "$N"
|
||||
[ -n "$iapp_interface" ] && {
|
||||
local ifname
|
||||
network_get_device ifname "$iapp_interface" || ifname="$iapp_interface"
|
||||
append bss_conf "iapp_interface=$ifname" "$N"
|
||||
}
|
||||
|
||||
json_get_vars ieee80211v
|
||||
set_default ieee80211v 0
|
||||
if [ "$ieee80211v" -eq "1" ]; then
|
||||
json_get_vars time_advertisement time_zone wnm_sleep_mode bss_transition
|
||||
|
||||
set_default time_advertisement 0
|
||||
set_default wnm_sleep_mode 0
|
||||
set_default bss_transition 0
|
||||
|
||||
append bss_conf "time_advertisement=$time_advertisement" "$N"
|
||||
[ -n "$time_zone" ] && append bss_conf "time_zone=$time_zone" "$N"
|
||||
append bss_conf "wnm_sleep_mode=$wnm_sleep_mode" "$N"
|
||||
append bss_conf "bss_transition=$bss_transition" "$N"
|
||||
fi
|
||||
|
||||
if [ "$wpa" -ge "1" ]; then
|
||||
json_get_vars ieee80211r
|
||||
set_default ieee80211r 0
|
||||
|
||||
if [ "$ieee80211r" -gt "0" ]; then
|
||||
json_get_vars mobility_domain ft_psk_generate_local ft_over_ds reassociation_deadline
|
||||
|
||||
set_default mobility_domain "$(echo "$ssid" | md5sum | head -c 4)"
|
||||
set_default ft_psk_generate_local 1
|
||||
set_default ft_over_ds 1
|
||||
set_default reassociation_deadline 1000
|
||||
|
||||
append bss_conf "mobility_domain=$mobility_domain" "$N"
|
||||
append bss_conf "ft_psk_generate_local=$ft_psk_generate_local" "$N"
|
||||
append bss_conf "ft_over_ds=$ft_over_ds" "$N"
|
||||
append bss_conf "reassociation_deadline=$reassociation_deadline" "$N"
|
||||
[ -n "$nasid" ] || append bss_conf "nas_identifier=${macaddr//\:}" "$N"
|
||||
|
||||
if [ "$ft_psk_generate_local" -eq "0" ]; then
|
||||
json_get_vars r0_key_lifetime r1_key_holder pmk_r1_push
|
||||
json_get_values r0kh r0kh
|
||||
json_get_values r1kh r1kh
|
||||
|
||||
set_default r0_key_lifetime 10000
|
||||
set_default pmk_r1_push 0
|
||||
|
||||
[ -n "$r1_key_holder" ] && append bss_conf "r1_key_holder=$r1_key_holder" "$N"
|
||||
append bss_conf "r0_key_lifetime=$r0_key_lifetime" "$N"
|
||||
append bss_conf "pmk_r1_push=$pmk_r1_push" "$N"
|
||||
|
||||
for kh in $r0kh; do
|
||||
append bss_conf "r0kh=${kh//,/ }" "$N"
|
||||
done
|
||||
for kh in $r1kh; do
|
||||
append bss_conf "r1kh=${kh//,/ }" "$N"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
append bss_conf "wpa_disable_eapol_key_retries=$wpa_disable_eapol_key_retries" "$N"
|
||||
|
||||
hostapd_append_wpa_key_mgmt
|
||||
[ -n "$wpa_key_mgmt" ] && append bss_conf "wpa_key_mgmt=$wpa_key_mgmt" "$N"
|
||||
fi
|
||||
|
||||
if [ "$wpa" -ge "2" ]; then
|
||||
if [ -n "$network_bridge" -a "$rsn_preauth" = 1 ]; then
|
||||
set_default auth_cache 1
|
||||
append bss_conf "rsn_preauth=1" "$N"
|
||||
append bss_conf "rsn_preauth_interfaces=$network_bridge" "$N"
|
||||
else
|
||||
set_default auth_cache 0
|
||||
fi
|
||||
|
||||
append bss_conf "okc=$auth_cache" "$N"
|
||||
[ "$auth_cache" = 0 ] && append bss_conf "disable_pmksa_caching=1" "$N"
|
||||
|
||||
# RSN -> allow management frame protection
|
||||
case "$ieee80211w" in
|
||||
[012])
|
||||
json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout
|
||||
append bss_conf "ieee80211w=$ieee80211w" "$N"
|
||||
[ "$ieee80211w" -gt "0" ] && {
|
||||
append bss_conf "group_mgmt_cipher=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N"
|
||||
[ -n "$ieee80211w_max_timeout" ] && \
|
||||
append bss_conf "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N"
|
||||
[ -n "$ieee80211w_retry_timeout" ] && \
|
||||
append bss_conf "assoc_sa_query_retry_timeout=$ieee80211w_retry_timeout" "$N"
|
||||
}
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
_macfile="/var/run/hostapd-$ifname.maclist"
|
||||
case "$macfilter" in
|
||||
allow)
|
||||
append bss_conf "macaddr_acl=1" "$N"
|
||||
append bss_conf "accept_mac_file=$_macfile" "$N"
|
||||
# accept_mac_file can be used to set MAC to VLAN ID mapping
|
||||
vlan_possible=1
|
||||
;;
|
||||
deny)
|
||||
append bss_conf "macaddr_acl=0" "$N"
|
||||
append bss_conf "deny_mac_file=$_macfile" "$N"
|
||||
;;
|
||||
*)
|
||||
_macfile=""
|
||||
;;
|
||||
esac
|
||||
|
||||
[ -n "$_macfile" ] && {
|
||||
json_get_vars macfile
|
||||
json_get_values maclist maclist
|
||||
|
||||
rm -f "$_macfile"
|
||||
(
|
||||
for mac in $maclist; do
|
||||
echo "$mac"
|
||||
done
|
||||
[ -n "$macfile" -a -f "$macfile" ] && cat "$macfile"
|
||||
) > "$_macfile"
|
||||
}
|
||||
|
||||
[ -n "$vlan_possible" -a -n "$dynamic_vlan" ] && {
|
||||
json_get_vars vlan_naming vlan_tagged_interface vlan_bridge vlan_file
|
||||
set_default vlan_naming 1
|
||||
append bss_conf "dynamic_vlan=$dynamic_vlan" "$N"
|
||||
append bss_conf "vlan_naming=$vlan_naming" "$N"
|
||||
[ -n "$vlan_bridge" ] && \
|
||||
append bss_conf "vlan_bridge=$vlan_bridge" "$N"
|
||||
[ -n "$vlan_tagged_interface" ] && \
|
||||
append bss_conf "vlan_tagged_interface=$vlan_tagged_interface" "$N"
|
||||
[ -n "$vlan_file" ] && {
|
||||
[ -e "$vlan_file" ] || touch "$vlan_file"
|
||||
append bss_conf "vlan_file=$vlan_file" "$N"
|
||||
}
|
||||
}
|
||||
|
||||
append "$var" "$bss_conf" "$N"
|
||||
return 0
|
||||
}
|
||||
|
||||
hostapd_set_log_options() {
|
||||
local var="$1"
|
||||
|
||||
local log_level log_80211 log_8021x log_radius log_wpa log_driver log_iapp log_mlme
|
||||
json_get_vars log_level log_80211 log_8021x log_radius log_wpa log_driver log_iapp log_mlme
|
||||
|
||||
set_default log_level 2
|
||||
set_default log_80211 1
|
||||
set_default log_8021x 1
|
||||
set_default log_radius 1
|
||||
set_default log_wpa 1
|
||||
set_default log_driver 1
|
||||
set_default log_iapp 1
|
||||
set_default log_mlme 1
|
||||
|
||||
local log_mask=$(( \
|
||||
($log_80211 << 0) | \
|
||||
($log_8021x << 1) | \
|
||||
($log_radius << 2) | \
|
||||
($log_wpa << 3) | \
|
||||
($log_driver << 4) | \
|
||||
($log_iapp << 5) | \
|
||||
($log_mlme << 6) \
|
||||
))
|
||||
|
||||
append "$var" "logger_syslog=$log_mask" "$N"
|
||||
append "$var" "logger_syslog_level=$log_level" "$N"
|
||||
append "$var" "logger_stdout=$log_mask" "$N"
|
||||
append "$var" "logger_stdout_level=$log_level" "$N"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
_wpa_supplicant_common() {
|
||||
local ifname="$1"
|
||||
|
||||
_rpath="/var/run/wpa_supplicant"
|
||||
_config="${_rpath}-$ifname.conf"
|
||||
}
|
||||
|
||||
wpa_supplicant_teardown_interface() {
|
||||
_wpa_supplicant_common "$1"
|
||||
rm -rf "$_rpath/$1" "$_config"
|
||||
}
|
||||
|
||||
wpa_supplicant_prepare_interface() {
|
||||
local ifname="$1"
|
||||
_w_driver="$2"
|
||||
|
||||
_wpa_supplicant_common "$1"
|
||||
|
||||
json_get_vars mode wds
|
||||
|
||||
[ -n "$network_bridge" ] && {
|
||||
fail=
|
||||
case "$mode" in
|
||||
adhoc)
|
||||
fail=1
|
||||
;;
|
||||
sta)
|
||||
[ "$wds" = 1 ] || fail=1
|
||||
;;
|
||||
esac
|
||||
|
||||
[ -n "$fail" ] && {
|
||||
wireless_setup_vif_failed BRIDGE_NOT_ALLOWED
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
local ap_scan=
|
||||
|
||||
_w_mode="$mode"
|
||||
_w_modestr=
|
||||
|
||||
[[ "$mode" = adhoc ]] && {
|
||||
ap_scan="ap_scan=2"
|
||||
|
||||
_w_modestr="mode=1"
|
||||
}
|
||||
|
||||
local country_str=
|
||||
[ -n "$country" ] && {
|
||||
country_str="country=$country"
|
||||
}
|
||||
|
||||
wpa_supplicant_teardown_interface "$ifname"
|
||||
cat > "$_config" <<EOF
|
||||
$ap_scan
|
||||
$country_str
|
||||
EOF
|
||||
return 0
|
||||
}
|
||||
|
||||
wpa_supplicant_set_fixed_freq() {
|
||||
local freq="$1"
|
||||
local htmode="$2"
|
||||
|
||||
append network_data "fixed_freq=1" "$N$T"
|
||||
append network_data "frequency=$freq" "$N$T"
|
||||
case "$htmode" in
|
||||
NOHT) append network_data "disable_ht=1" "$N$T";;
|
||||
HT20|VHT20) append network_data "disable_ht40=1" "$N$T";;
|
||||
HT40*|VHT40*|VHT80*|VHT160*) append network_data "ht40=1" "$N$T";;
|
||||
esac
|
||||
case "$htmode" in
|
||||
VHT*) append network_data "vht=1" "$N$T";;
|
||||
esac
|
||||
case "$htmode" in
|
||||
VHT80) append network_data "max_oper_chwidth=1" "$N$T";;
|
||||
VHT160) append network_data "max_oper_chwidth=2" "$N$T";;
|
||||
*) append network_data "max_oper_chwidth=0" "$N$T";;
|
||||
esac
|
||||
}
|
||||
|
||||
wpa_supplicant_add_network() {
|
||||
local ifname="$1"
|
||||
local freq="$2"
|
||||
local htmode="$3"
|
||||
local noscan="$4"
|
||||
|
||||
_wpa_supplicant_common "$1"
|
||||
wireless_vif_parse_encryption
|
||||
|
||||
json_get_vars \
|
||||
ssid bssid key \
|
||||
basic_rate mcast_rate \
|
||||
ieee80211w ieee80211r
|
||||
|
||||
set_default ieee80211r 0
|
||||
|
||||
local key_mgmt='NONE'
|
||||
local enc_str=
|
||||
local network_data=
|
||||
local T=" "
|
||||
|
||||
local scan_ssid="scan_ssid=1"
|
||||
local freq wpa_key_mgmt
|
||||
|
||||
[[ "$_w_mode" = "adhoc" ]] && {
|
||||
append network_data "mode=1" "$N$T"
|
||||
[ -n "$freq" ] && wpa_supplicant_set_fixed_freq "$freq" "$htmode"
|
||||
|
||||
scan_ssid="scan_ssid=0"
|
||||
|
||||
[ "$_w_driver" = "nl80211" ] || append wpa_key_mgmt "WPA-NONE"
|
||||
}
|
||||
|
||||
[[ "$_w_mode" = "mesh" ]] && {
|
||||
json_get_vars mesh_id mesh_fwding mesh_rssi_threshold
|
||||
[ -n "$mesh_id" ] && ssid="${mesh_id}"
|
||||
|
||||
append network_data "mode=5" "$N$T"
|
||||
[ -n "$mesh_fwding" ] && append network_data "mesh_fwding=${mesh_fwding}" "$N$T"
|
||||
[ -n "$mesh_rssi_threshold" ] && append network_data "mesh_rssi_threshold=${mesh_rssi_threshold}" "$N$T"
|
||||
[ -n "$freq" ] && wpa_supplicant_set_fixed_freq "$freq" "$htmode"
|
||||
[ "$noscan" = "1" ] && append network_data "noscan=1" "$N$T"
|
||||
append wpa_key_mgmt "SAE"
|
||||
scan_ssid=""
|
||||
}
|
||||
|
||||
[ "$_w_mode" = "adhoc" -o "$_w_mode" = "mesh" ] && append network_data "$_w_modestr" "$N$T"
|
||||
|
||||
case "$auth_type" in
|
||||
none) ;;
|
||||
wep)
|
||||
local wep_keyidx=0
|
||||
hostapd_append_wep_key network_data
|
||||
append network_data "wep_tx_keyidx=$wep_keyidx" "$N$T"
|
||||
;;
|
||||
psk)
|
||||
local passphrase
|
||||
|
||||
if [ "$_w_mode" != "mesh" ]; then
|
||||
hostapd_append_wpa_key_mgmt
|
||||
fi
|
||||
|
||||
key_mgmt="$wpa_key_mgmt"
|
||||
|
||||
if [ ${#key} -eq 64 ]; then
|
||||
passphrase="psk=${key}"
|
||||
else
|
||||
if [ "$_w_mode" = "mesh" ]; then
|
||||
passphrase="sae_password=\"${key}\""
|
||||
else
|
||||
passphrase="psk=\"${key}\""
|
||||
fi
|
||||
fi
|
||||
append network_data "$passphrase" "$N$T"
|
||||
;;
|
||||
eap)
|
||||
hostapd_append_wpa_key_mgmt
|
||||
key_mgmt="$wpa_key_mgmt"
|
||||
|
||||
json_get_vars eap_type identity anonymous_identity ca_cert
|
||||
[ -n "$ca_cert" ] && append network_data "ca_cert=\"$ca_cert\"" "$N$T"
|
||||
[ -n "$identity" ] && append network_data "identity=\"$identity\"" "$N$T"
|
||||
[ -n "$anonymous_identity" ] && append network_data "anonymous_identity=\"$anonymous_identity\"" "$N$T"
|
||||
case "$eap_type" in
|
||||
tls)
|
||||
json_get_vars client_cert priv_key priv_key_pwd
|
||||
append network_data "client_cert=\"$client_cert\"" "$N$T"
|
||||
append network_data "private_key=\"$priv_key\"" "$N$T"
|
||||
append network_data "private_key_passwd=\"$priv_key_pwd\"" "$N$T"
|
||||
;;
|
||||
fast|peap|ttls)
|
||||
json_get_vars auth password ca_cert2 client_cert2 priv_key2 priv_key2_pwd
|
||||
set_default auth MSCHAPV2
|
||||
|
||||
if [ "$auth" = "EAP-TLS" ]; then
|
||||
[ -n "$ca_cert2" ] &&
|
||||
append network_data "ca_cert2=\"$ca_cert2\"" "$N$T"
|
||||
append network_data "client_cert2=\"$client_cert2\"" "$N$T"
|
||||
append network_data "private_key2=\"$priv_key2\"" "$N$T"
|
||||
append network_data "private_key2_passwd=\"$priv_key2_pwd\"" "$N$T"
|
||||
else
|
||||
append network_data "password=\"$password\"" "$N$T"
|
||||
fi
|
||||
|
||||
phase2proto="auth="
|
||||
case "$auth" in
|
||||
"auth"*)
|
||||
phase2proto=""
|
||||
;;
|
||||
"EAP-"*)
|
||||
auth="$(echo $auth | cut -b 5- )"
|
||||
[ "$eap_type" = "ttls" ] &&
|
||||
phase2proto="autheap="
|
||||
;;
|
||||
esac
|
||||
append network_data "phase2=\"$phase2proto$auth\"" "$N$T"
|
||||
;;
|
||||
esac
|
||||
append network_data "eap=$(echo $eap_type | tr 'a-z' 'A-Z')" "$N$T"
|
||||
;;
|
||||
esac
|
||||
|
||||
[ "$mode" = mesh ] || {
|
||||
case "$wpa" in
|
||||
1)
|
||||
append network_data "proto=WPA" "$N$T"
|
||||
;;
|
||||
2)
|
||||
append network_data "proto=RSN" "$N$T"
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$ieee80211w" in
|
||||
[012])
|
||||
[ "$wpa" -ge 2 ] && append network_data "ieee80211w=$ieee80211w" "$N$T"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
[ -n "$bssid" ] && append network_data "bssid=$bssid" "$N$T"
|
||||
[ -n "$beacon_int" ] && append network_data "beacon_int=$beacon_int" "$N$T"
|
||||
|
||||
local bssid_blacklist bssid_whitelist
|
||||
json_get_values bssid_blacklist bssid_blacklist
|
||||
json_get_values bssid_whitelist bssid_whitelist
|
||||
|
||||
[ -n "$bssid_blacklist" ] && append network_data "bssid_blacklist=$bssid_blacklist" "$N$T"
|
||||
[ -n "$bssid_whitelist" ] && append network_data "bssid_whitelist=$bssid_whitelist" "$N$T"
|
||||
|
||||
[ -n "$basic_rate" ] && {
|
||||
local br rate_list=
|
||||
for br in $basic_rate; do
|
||||
wpa_supplicant_add_rate rate_list "$br"
|
||||
done
|
||||
[ -n "$rate_list" ] && append network_data "rates=$rate_list" "$N$T"
|
||||
}
|
||||
|
||||
[ -n "$mcast_rate" ] && {
|
||||
local mc_rate=
|
||||
wpa_supplicant_add_rate mc_rate "$mcast_rate"
|
||||
append network_data "mcast_rate=$mc_rate" "$N$T"
|
||||
}
|
||||
|
||||
cat >> "$_config" <<EOF
|
||||
network={
|
||||
$scan_ssid
|
||||
ssid="$ssid"
|
||||
key_mgmt=$key_mgmt
|
||||
$network_data
|
||||
}
|
||||
EOF
|
||||
return 0
|
||||
}
|
||||
|
||||
wpa_supplicant_run() {
|
||||
local ifname="$1"; shift
|
||||
|
||||
_wpa_supplicant_common "$ifname"
|
||||
|
||||
/usr/sbin/wpa_supplicant -B \
|
||||
${network_bridge:+-b $network_bridge} \
|
||||
-P "/var/run/wpa_supplicant-${ifname}.pid" \
|
||||
-D ${_w_driver:-wext} \
|
||||
-i "$ifname" \
|
||||
-c "$_config" \
|
||||
-C "$_rpath" \
|
||||
"$@"
|
||||
|
||||
ret="$?"
|
||||
wireless_add_process "$(cat "/var/run/wpa_supplicant-${ifname}.pid")" /usr/sbin/wpa_supplicant 1
|
||||
|
||||
[ "$ret" != 0 ] && wireless_setup_vif_failed WPA_SUPPLICANT_FAILED
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
hostapd_common_cleanup() {
|
||||
killall hostapd wpa_supplicant meshd-nl80211
|
||||
}
|
||||
28
package/network/services/hostapd/files/multicall.c
Normal file
28
package/network/services/hostapd/files/multicall.c
Normal file
@@ -0,0 +1,28 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
extern int hostapd_main(int argc, char **argv);
|
||||
extern int wpa_supplicant_main(int argc, char **argv);
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
bool restart = false;
|
||||
const char *prog = argv[0];
|
||||
|
||||
restart:
|
||||
if (strstr(argv[0], "hostapd"))
|
||||
return hostapd_main(argc, argv);
|
||||
else if (strstr(argv[0], "wpa_supplicant"))
|
||||
return wpa_supplicant_main(argc, argv);
|
||||
|
||||
if (!restart && argc > 1) {
|
||||
argv++;
|
||||
argc--;
|
||||
restart = true;
|
||||
goto restart;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Invalid command.\nUsage: %s wpa_supplicant|hostapd [<arguments>]\n", prog);
|
||||
return 255;
|
||||
}
|
||||
@@ -0,0 +1,593 @@
|
||||
# Example wpa_supplicant build time configuration
|
||||
#
|
||||
# This file lists the configuration options that are used when building the
|
||||
# wpa_supplicant binary. All lines starting with # are ignored. Configuration
|
||||
# option lines must be commented out complete, if they are not to be included,
|
||||
# i.e., just setting VARIABLE=n is not disabling that variable.
|
||||
#
|
||||
# This file is included in Makefile, so variables like CFLAGS and LIBS can also
|
||||
# be modified from here. In most cases, these lines should use += in order not
|
||||
# to override previous values of the variables.
|
||||
|
||||
|
||||
# Uncomment following two lines and fix the paths if you have installed OpenSSL
|
||||
# or GnuTLS in non-default location
|
||||
#CFLAGS += -I/usr/local/openssl/include
|
||||
#LIBS += -L/usr/local/openssl/lib
|
||||
|
||||
# Some Red Hat versions seem to include kerberos header files from OpenSSL, but
|
||||
# the kerberos files are not in the default include path. Following line can be
|
||||
# used to fix build issues on such systems (krb5.h not found).
|
||||
#CFLAGS += -I/usr/include/kerberos
|
||||
|
||||
# Driver interface for generic Linux wireless extensions
|
||||
# Note: WEXT is deprecated in the current Linux kernel version and no new
|
||||
# functionality is added to it. nl80211-based interface is the new
|
||||
# replacement for WEXT and its use allows wpa_supplicant to properly control
|
||||
# the driver to improve existing functionality like roaming and to support new
|
||||
# functionality.
|
||||
CONFIG_DRIVER_WEXT=y
|
||||
|
||||
# Driver interface for Linux drivers using the nl80211 kernel interface
|
||||
CONFIG_DRIVER_NL80211=y
|
||||
|
||||
# QCA vendor extensions to nl80211
|
||||
#CONFIG_DRIVER_NL80211_QCA=y
|
||||
|
||||
# driver_nl80211.c requires libnl. If you are compiling it yourself
|
||||
# you may need to point hostapd to your version of libnl.
|
||||
#
|
||||
#CFLAGS += -I$<path to libnl include files>
|
||||
#LIBS += -L$<path to libnl library files>
|
||||
|
||||
# Use libnl v2.0 (or 3.0) libraries.
|
||||
#CONFIG_LIBNL20=y
|
||||
|
||||
# Use libnl 3.2 libraries (if this is selected, CONFIG_LIBNL20 is ignored)
|
||||
#CONFIG_LIBNL32=y
|
||||
|
||||
|
||||
# Driver interface for FreeBSD net80211 layer (e.g., Atheros driver)
|
||||
#CONFIG_DRIVER_BSD=y
|
||||
#CFLAGS += -I/usr/local/include
|
||||
#LIBS += -L/usr/local/lib
|
||||
#LIBS_p += -L/usr/local/lib
|
||||
#LIBS_c += -L/usr/local/lib
|
||||
|
||||
# Driver interface for Windows NDIS
|
||||
#CONFIG_DRIVER_NDIS=y
|
||||
#CFLAGS += -I/usr/include/w32api/ddk
|
||||
#LIBS += -L/usr/local/lib
|
||||
# For native build using mingw
|
||||
#CONFIG_NATIVE_WINDOWS=y
|
||||
# Additional directories for cross-compilation on Linux host for mingw target
|
||||
#CFLAGS += -I/opt/mingw/mingw32/include/ddk
|
||||
#LIBS += -L/opt/mingw/mingw32/lib
|
||||
#CC=mingw32-gcc
|
||||
# By default, driver_ndis uses WinPcap for low-level operations. This can be
|
||||
# replaced with the following option which replaces WinPcap calls with NDISUIO.
|
||||
# However, this requires that WZC is disabled (net stop wzcsvc) before starting
|
||||
# wpa_supplicant.
|
||||
# CONFIG_USE_NDISUIO=y
|
||||
|
||||
# Driver interface for wired Ethernet drivers
|
||||
CONFIG_DRIVER_WIRED=y
|
||||
|
||||
# Driver interface for the Broadcom RoboSwitch family
|
||||
#CONFIG_DRIVER_ROBOSWITCH=y
|
||||
|
||||
# Driver interface for no driver (e.g., WPS ER only)
|
||||
#CONFIG_DRIVER_NONE=y
|
||||
|
||||
# Solaris libraries
|
||||
#LIBS += -lsocket -ldlpi -lnsl
|
||||
#LIBS_c += -lsocket
|
||||
|
||||
# Enable IEEE 802.1X Supplicant (automatically included if any EAP method is
|
||||
# included)
|
||||
CONFIG_IEEE8021X_EAPOL=y
|
||||
|
||||
# EAP-MD5
|
||||
CONFIG_EAP_MD5=y
|
||||
|
||||
# EAP-MSCHAPv2
|
||||
CONFIG_EAP_MSCHAPV2=y
|
||||
|
||||
# EAP-TLS
|
||||
CONFIG_EAP_TLS=y
|
||||
|
||||
# EAL-PEAP
|
||||
CONFIG_EAP_PEAP=y
|
||||
|
||||
# EAP-TTLS
|
||||
CONFIG_EAP_TTLS=y
|
||||
|
||||
# EAP-FAST
|
||||
# Note: If OpenSSL is used as the TLS library, OpenSSL 1.0 or newer is needed
|
||||
# for EAP-FAST support. Older OpenSSL releases would need to be patched, e.g.,
|
||||
# with openssl-0.9.8x-tls-extensions.patch, to add the needed functions.
|
||||
CONFIG_EAP_FAST=y
|
||||
|
||||
# EAP-GTC
|
||||
CONFIG_EAP_GTC=y
|
||||
|
||||
# EAP-OTP
|
||||
CONFIG_EAP_OTP=y
|
||||
|
||||
# EAP-SIM (enable CONFIG_PCSC, if EAP-SIM is used)
|
||||
#CONFIG_EAP_SIM=y
|
||||
|
||||
# EAP-PSK (experimental; this is _not_ needed for WPA-PSK)
|
||||
#CONFIG_EAP_PSK=y
|
||||
|
||||
# EAP-pwd (secure authentication using only a password)
|
||||
#CONFIG_EAP_PWD=y
|
||||
|
||||
# EAP-PAX
|
||||
#CONFIG_EAP_PAX=y
|
||||
|
||||
# LEAP
|
||||
CONFIG_EAP_LEAP=y
|
||||
|
||||
# EAP-AKA (enable CONFIG_PCSC, if EAP-AKA is used)
|
||||
#CONFIG_EAP_AKA=y
|
||||
|
||||
# EAP-AKA' (enable CONFIG_PCSC, if EAP-AKA' is used).
|
||||
# This requires CONFIG_EAP_AKA to be enabled, too.
|
||||
#CONFIG_EAP_AKA_PRIME=y
|
||||
|
||||
# Enable USIM simulator (Milenage) for EAP-AKA
|
||||
#CONFIG_USIM_SIMULATOR=y
|
||||
|
||||
# EAP-SAKE
|
||||
#CONFIG_EAP_SAKE=y
|
||||
|
||||
# EAP-GPSK
|
||||
#CONFIG_EAP_GPSK=y
|
||||
# Include support for optional SHA256 cipher suite in EAP-GPSK
|
||||
#CONFIG_EAP_GPSK_SHA256=y
|
||||
|
||||
# EAP-TNC and related Trusted Network Connect support (experimental)
|
||||
#CONFIG_EAP_TNC=y
|
||||
|
||||
# Wi-Fi Protected Setup (WPS)
|
||||
CONFIG_WPS=y
|
||||
# Enable WPS external registrar functionality
|
||||
#CONFIG_WPS_ER=y
|
||||
# Disable credentials for an open network by default when acting as a WPS
|
||||
# registrar.
|
||||
#CONFIG_WPS_REG_DISABLE_OPEN=y
|
||||
# Enable WPS support with NFC config method
|
||||
#CONFIG_WPS_NFC=y
|
||||
|
||||
# EAP-IKEv2
|
||||
#CONFIG_EAP_IKEV2=y
|
||||
|
||||
# EAP-EKE
|
||||
#CONFIG_EAP_EKE=y
|
||||
|
||||
# PKCS#12 (PFX) support (used to read private key and certificate file from
|
||||
# a file that usually has extension .p12 or .pfx)
|
||||
CONFIG_PKCS12=y
|
||||
|
||||
# Smartcard support (i.e., private key on a smartcard), e.g., with openssl
|
||||
# engine.
|
||||
CONFIG_SMARTCARD=y
|
||||
|
||||
# PC/SC interface for smartcards (USIM, GSM SIM)
|
||||
# Enable this if EAP-SIM or EAP-AKA is included
|
||||
#CONFIG_PCSC=y
|
||||
|
||||
# Support HT overrides (disable HT/HT40, mask MCS rates, etc.)
|
||||
CONFIG_HT_OVERRIDES=y
|
||||
|
||||
# Support VHT overrides (disable VHT, mask MCS rates, etc.)
|
||||
CONFIG_VHT_OVERRIDES=y
|
||||
|
||||
# Development testing
|
||||
#CONFIG_EAPOL_TEST=y
|
||||
|
||||
# Select control interface backend for external programs, e.g, wpa_cli:
|
||||
# unix = UNIX domain sockets (default for Linux/*BSD)
|
||||
# udp = UDP sockets using localhost (127.0.0.1)
|
||||
# udp6 = UDP IPv6 sockets using localhost (::1)
|
||||
# named_pipe = Windows Named Pipe (default for Windows)
|
||||
# udp-remote = UDP sockets with remote access (only for tests systems/purpose)
|
||||
# udp6-remote = UDP IPv6 sockets with remote access (only for tests purpose)
|
||||
# y = use default (backwards compatibility)
|
||||
# If this option is commented out, control interface is not included in the
|
||||
# build.
|
||||
CONFIG_CTRL_IFACE=y
|
||||
|
||||
# Include support for GNU Readline and History Libraries in wpa_cli.
|
||||
# When building a wpa_cli binary for distribution, please note that these
|
||||
# libraries are licensed under GPL and as such, BSD license may not apply for
|
||||
# the resulting binary.
|
||||
#CONFIG_READLINE=y
|
||||
|
||||
# Include internal line edit mode in wpa_cli. This can be used as a replacement
|
||||
# for GNU Readline to provide limited command line editing and history support.
|
||||
#CONFIG_WPA_CLI_EDIT=y
|
||||
|
||||
# Remove debugging code that is printing out debug message to stdout.
|
||||
# This can be used to reduce the size of the wpa_supplicant considerably
|
||||
# if debugging code is not needed. The size reduction can be around 35%
|
||||
# (e.g., 90 kB).
|
||||
#CONFIG_NO_STDOUT_DEBUG=y
|
||||
|
||||
# Remove WPA support, e.g., for wired-only IEEE 802.1X supplicant, to save
|
||||
# 35-50 kB in code size.
|
||||
#CONFIG_NO_WPA=y
|
||||
|
||||
# Remove IEEE 802.11i/WPA-Personal ASCII passphrase support
|
||||
# This option can be used to reduce code size by removing support for
|
||||
# converting ASCII passphrases into PSK. If this functionality is removed, the
|
||||
# PSK can only be configured as the 64-octet hexstring (e.g., from
|
||||
# wpa_passphrase). This saves about 0.5 kB in code size.
|
||||
#CONFIG_NO_WPA_PASSPHRASE=y
|
||||
|
||||
# Disable scan result processing (ap_mode=1) to save code size by about 1 kB.
|
||||
# This can be used if ap_scan=1 mode is never enabled.
|
||||
#CONFIG_NO_SCAN_PROCESSING=y
|
||||
|
||||
# Select configuration backend:
|
||||
# file = text file (e.g., wpa_supplicant.conf; note: the configuration file
|
||||
# path is given on command line, not here; this option is just used to
|
||||
# select the backend that allows configuration files to be used)
|
||||
# winreg = Windows registry (see win_example.reg for an example)
|
||||
CONFIG_BACKEND=file
|
||||
|
||||
# Remove configuration write functionality (i.e., to allow the configuration
|
||||
# file to be updated based on runtime configuration changes). The runtime
|
||||
# configuration can still be changed, the changes are just not going to be
|
||||
# persistent over restarts. This option can be used to reduce code size by
|
||||
# about 3.5 kB.
|
||||
#CONFIG_NO_CONFIG_WRITE=y
|
||||
|
||||
# Remove support for configuration blobs to reduce code size by about 1.5 kB.
|
||||
#CONFIG_NO_CONFIG_BLOBS=y
|
||||
|
||||
# Select program entry point implementation:
|
||||
# main = UNIX/POSIX like main() function (default)
|
||||
# main_winsvc = Windows service (read parameters from registry)
|
||||
# main_none = Very basic example (development use only)
|
||||
#CONFIG_MAIN=main
|
||||
|
||||
# Select wrapper for operating system and C library specific functions
|
||||
# unix = UNIX/POSIX like systems (default)
|
||||
# win32 = Windows systems
|
||||
# none = Empty template
|
||||
#CONFIG_OS=unix
|
||||
|
||||
# Select event loop implementation
|
||||
# eloop = select() loop (default)
|
||||
# eloop_win = Windows events and WaitForMultipleObject() loop
|
||||
#CONFIG_ELOOP=eloop
|
||||
|
||||
# Should we use poll instead of select? Select is used by default.
|
||||
#CONFIG_ELOOP_POLL=y
|
||||
|
||||
# Should we use epoll instead of select? Select is used by default.
|
||||
#CONFIG_ELOOP_EPOLL=y
|
||||
|
||||
# Should we use kqueue instead of select? Select is used by default.
|
||||
#CONFIG_ELOOP_KQUEUE=y
|
||||
|
||||
# Select layer 2 packet implementation
|
||||
# linux = Linux packet socket (default)
|
||||
# pcap = libpcap/libdnet/WinPcap
|
||||
# freebsd = FreeBSD libpcap
|
||||
# winpcap = WinPcap with receive thread
|
||||
# ndis = Windows NDISUIO (note: requires CONFIG_USE_NDISUIO=y)
|
||||
# none = Empty template
|
||||
#CONFIG_L2_PACKET=linux
|
||||
|
||||
# Disable Linux packet socket workaround applicable for station interface
|
||||
# in a bridge for EAPOL frames. This should be uncommented only if the kernel
|
||||
# is known to not have the regression issue in packet socket behavior with
|
||||
# bridge interfaces (commit 'bridge: respect RFC2863 operational state')').
|
||||
#CONFIG_NO_LINUX_PACKET_SOCKET_WAR=y
|
||||
|
||||
# PeerKey handshake for Station to Station Link (IEEE 802.11e DLS)
|
||||
CONFIG_PEERKEY=y
|
||||
|
||||
# IEEE 802.11w (management frame protection), also known as PMF
|
||||
# Driver support is also needed for IEEE 802.11w.
|
||||
#CONFIG_IEEE80211W=y
|
||||
|
||||
# Select TLS implementation
|
||||
# openssl = OpenSSL (default)
|
||||
# gnutls = GnuTLS
|
||||
# internal = Internal TLSv1 implementation (experimental)
|
||||
# linux = Linux kernel AF_ALG and internal TLSv1 implementation (experimental)
|
||||
# none = Empty template
|
||||
CONFIG_TLS=internal
|
||||
|
||||
# TLS-based EAP methods require at least TLS v1.0. Newer version of TLS (v1.1)
|
||||
# can be enabled to get a stronger construction of messages when block ciphers
|
||||
# are used. It should be noted that some existing TLS v1.0 -based
|
||||
# implementation may not be compatible with TLS v1.1 message (ClientHello is
|
||||
# sent prior to negotiating which version will be used)
|
||||
#CONFIG_TLSV11=y
|
||||
|
||||
# TLS-based EAP methods require at least TLS v1.0. Newer version of TLS (v1.2)
|
||||
# can be enabled to enable use of stronger crypto algorithms. It should be
|
||||
# noted that some existing TLS v1.0 -based implementation may not be compatible
|
||||
# with TLS v1.2 message (ClientHello is sent prior to negotiating which version
|
||||
# will be used)
|
||||
#CONFIG_TLSV12=y
|
||||
|
||||
# Select which ciphers to use by default with OpenSSL if the user does not
|
||||
# specify them.
|
||||
#CONFIG_TLS_DEFAULT_CIPHERS="DEFAULT:!EXP:!LOW"
|
||||
|
||||
# If CONFIG_TLS=internal is used, additional library and include paths are
|
||||
# needed for LibTomMath. Alternatively, an integrated, minimal version of
|
||||
# LibTomMath can be used. See beginning of libtommath.c for details on benefits
|
||||
# and drawbacks of this option.
|
||||
CONFIG_INTERNAL_LIBTOMMATH=y
|
||||
#ifndef CONFIG_INTERNAL_LIBTOMMATH
|
||||
#LTM_PATH=/usr/src/libtommath-0.39
|
||||
#CFLAGS += -I$(LTM_PATH)
|
||||
#LIBS += -L$(LTM_PATH)
|
||||
#LIBS_p += -L$(LTM_PATH)
|
||||
#endif
|
||||
# At the cost of about 4 kB of additional binary size, the internal LibTomMath
|
||||
# can be configured to include faster routines for exptmod, sqr, and div to
|
||||
# speed up DH and RSA calculation considerably
|
||||
CONFIG_INTERNAL_LIBTOMMATH_FAST=y
|
||||
|
||||
# Include NDIS event processing through WMI into wpa_supplicant/wpasvc.
|
||||
# This is only for Windows builds and requires WMI-related header files and
|
||||
# WbemUuid.Lib from Platform SDK even when building with MinGW.
|
||||
#CONFIG_NDIS_EVENTS_INTEGRATED=y
|
||||
#PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib"
|
||||
|
||||
# Add support for old DBus control interface
|
||||
# (fi.epitest.hostap.WPASupplicant)
|
||||
#CONFIG_CTRL_IFACE_DBUS=y
|
||||
|
||||
# Add support for new DBus control interface
|
||||
# (fi.w1.hostap.wpa_supplicant1)
|
||||
#CONFIG_CTRL_IFACE_DBUS_NEW=y
|
||||
|
||||
# Add introspection support for new DBus control interface
|
||||
#CONFIG_CTRL_IFACE_DBUS_INTRO=y
|
||||
|
||||
# Add support for loading EAP methods dynamically as shared libraries.
|
||||
# When this option is enabled, each EAP method can be either included
|
||||
# statically (CONFIG_EAP_<method>=y) or dynamically (CONFIG_EAP_<method>=dyn).
|
||||
# Dynamic EAP methods are build as shared objects (eap_*.so) and they need to
|
||||
# be loaded in the beginning of the wpa_supplicant configuration file
|
||||
# (see load_dynamic_eap parameter in the example file) before being used in
|
||||
# the network blocks.
|
||||
#
|
||||
# Note that some shared parts of EAP methods are included in the main program
|
||||
# and in order to be able to use dynamic EAP methods using these parts, the
|
||||
# main program must have been build with the EAP method enabled (=y or =dyn).
|
||||
# This means that EAP-TLS/PEAP/TTLS/FAST cannot be added as dynamic libraries
|
||||
# unless at least one of them was included in the main build to force inclusion
|
||||
# of the shared code. Similarly, at least one of EAP-SIM/AKA must be included
|
||||
# in the main build to be able to load these methods dynamically.
|
||||
#
|
||||
# Please also note that using dynamic libraries will increase the total binary
|
||||
# size. Thus, it may not be the best option for targets that have limited
|
||||
# amount of memory/flash.
|
||||
#CONFIG_DYNAMIC_EAP_METHODS=y
|
||||
|
||||
# IEEE Std 802.11r-2008 (Fast BSS Transition) for station mode
|
||||
CONFIG_IEEE80211R=y
|
||||
|
||||
# IEEE Std 802.11r-2008 (Fast BSS Transition) for AP mode (implies
|
||||
# CONFIG_IEEE80211R).
|
||||
#CONFIG_IEEE80211R_AP=y
|
||||
|
||||
# Add support for writing debug log to a file (/tmp/wpa_supplicant-log-#.txt)
|
||||
#CONFIG_DEBUG_FILE=y
|
||||
|
||||
# Send debug messages to syslog instead of stdout
|
||||
#CONFIG_DEBUG_SYSLOG=y
|
||||
# Set syslog facility for debug messages
|
||||
#CONFIG_DEBUG_SYSLOG_FACILITY=LOG_DAEMON
|
||||
|
||||
# Add support for sending all debug messages (regardless of debug verbosity)
|
||||
# to the Linux kernel tracing facility. This helps debug the entire stack by
|
||||
# making it easy to record everything happening from the driver up into the
|
||||
# same file, e.g., using trace-cmd.
|
||||
#CONFIG_DEBUG_LINUX_TRACING=y
|
||||
|
||||
# Add support for writing debug log to Android logcat instead of standard
|
||||
# output
|
||||
#CONFIG_ANDROID_LOG=y
|
||||
|
||||
# Enable privilege separation (see README 'Privilege separation' for details)
|
||||
#CONFIG_PRIVSEP=y
|
||||
|
||||
# Enable mitigation against certain attacks against TKIP by delaying Michael
|
||||
# MIC error reports by a random amount of time between 0 and 60 seconds
|
||||
#CONFIG_DELAYED_MIC_ERROR_REPORT=y
|
||||
|
||||
# Enable tracing code for developer debugging
|
||||
# This tracks use of memory allocations and other registrations and reports
|
||||
# incorrect use with a backtrace of call (or allocation) location.
|
||||
#CONFIG_WPA_TRACE=y
|
||||
# For BSD, uncomment these.
|
||||
#LIBS += -lexecinfo
|
||||
#LIBS_p += -lexecinfo
|
||||
#LIBS_c += -lexecinfo
|
||||
|
||||
# Use libbfd to get more details for developer debugging
|
||||
# This enables use of libbfd to get more detailed symbols for the backtraces
|
||||
# generated by CONFIG_WPA_TRACE=y.
|
||||
#CONFIG_WPA_TRACE_BFD=y
|
||||
# For BSD, uncomment these.
|
||||
#LIBS += -lbfd -liberty -lz
|
||||
#LIBS_p += -lbfd -liberty -lz
|
||||
#LIBS_c += -lbfd -liberty -lz
|
||||
|
||||
# wpa_supplicant depends on strong random number generation being available
|
||||
# from the operating system. os_get_random() function is used to fetch random
|
||||
# data when needed, e.g., for key generation. On Linux and BSD systems, this
|
||||
# works by reading /dev/urandom. It should be noted that the OS entropy pool
|
||||
# needs to be properly initialized before wpa_supplicant is started. This is
|
||||
# important especially on embedded devices that do not have a hardware random
|
||||
# number generator and may by default start up with minimal entropy available
|
||||
# for random number generation.
|
||||
#
|
||||
# As a safety net, wpa_supplicant is by default trying to internally collect
|
||||
# additional entropy for generating random data to mix in with the data fetched
|
||||
# from the OS. This by itself is not considered to be very strong, but it may
|
||||
# help in cases where the system pool is not initialized properly. However, it
|
||||
# is very strongly recommended that the system pool is initialized with enough
|
||||
# entropy either by using hardware assisted random number generator or by
|
||||
# storing state over device reboots.
|
||||
#
|
||||
# wpa_supplicant can be configured to maintain its own entropy store over
|
||||
# restarts to enhance random number generation. This is not perfect, but it is
|
||||
# much more secure than using the same sequence of random numbers after every
|
||||
# reboot. This can be enabled with -e<entropy file> command line option. The
|
||||
# specified file needs to be readable and writable by wpa_supplicant.
|
||||
#
|
||||
# If the os_get_random() is known to provide strong random data (e.g., on
|
||||
# Linux/BSD, the board in question is known to have reliable source of random
|
||||
# data from /dev/urandom), the internal wpa_supplicant random pool can be
|
||||
# disabled. This will save some in binary size and CPU use. However, this
|
||||
# should only be considered for builds that are known to be used on devices
|
||||
# that meet the requirements described above.
|
||||
CONFIG_NO_RANDOM_POOL=y
|
||||
|
||||
# IEEE 802.11n (High Throughput) support (mainly for AP mode)
|
||||
#CONFIG_IEEE80211N=y
|
||||
|
||||
# IEEE 802.11ac (Very High Throughput) support (mainly for AP mode)
|
||||
# (depends on CONFIG_IEEE80211N)
|
||||
#CONFIG_IEEE80211AC=y
|
||||
|
||||
# Wireless Network Management (IEEE Std 802.11v-2011)
|
||||
# Note: This is experimental and not complete implementation.
|
||||
CONFIG_WNM=y
|
||||
|
||||
# Interworking (IEEE 802.11u)
|
||||
# This can be used to enable functionality to improve interworking with
|
||||
# external networks (GAS/ANQP to learn more about the networks and network
|
||||
# selection based on available credentials).
|
||||
#CONFIG_INTERWORKING=y
|
||||
|
||||
# Hotspot 2.0
|
||||
#CONFIG_HS20=y
|
||||
|
||||
# Enable interface matching in wpa_supplicant
|
||||
#CONFIG_MATCH_IFACE=y
|
||||
|
||||
# Disable roaming in wpa_supplicant
|
||||
#CONFIG_NO_ROAMING=y
|
||||
|
||||
# AP mode operations with wpa_supplicant
|
||||
# This can be used for controlling AP mode operations with wpa_supplicant. It
|
||||
# should be noted that this is mainly aimed at simple cases like
|
||||
# WPA2-Personal while more complex configurations like WPA2-Enterprise with an
|
||||
# external RADIUS server can be supported with hostapd.
|
||||
#CONFIG_AP=y
|
||||
|
||||
# P2P (Wi-Fi Direct)
|
||||
# This can be used to enable P2P support in wpa_supplicant. See README-P2P for
|
||||
# more information on P2P operations.
|
||||
#CONFIG_P2P=y
|
||||
|
||||
# Enable TDLS support
|
||||
#CONFIG_TDLS=y
|
||||
|
||||
# Wi-Fi Direct
|
||||
# This can be used to enable Wi-Fi Direct extensions for P2P using an external
|
||||
# program to control the additional information exchanges in the messages.
|
||||
#CONFIG_WIFI_DISPLAY=y
|
||||
|
||||
# Autoscan
|
||||
# This can be used to enable automatic scan support in wpa_supplicant.
|
||||
# See wpa_supplicant.conf for more information on autoscan usage.
|
||||
#
|
||||
# Enabling directly a module will enable autoscan support.
|
||||
# For exponential module:
|
||||
#CONFIG_AUTOSCAN_EXPONENTIAL=y
|
||||
# For periodic module:
|
||||
#CONFIG_AUTOSCAN_PERIODIC=y
|
||||
|
||||
# Password (and passphrase, etc.) backend for external storage
|
||||
# These optional mechanisms can be used to add support for storing passwords
|
||||
# and other secrets in external (to wpa_supplicant) location. This allows, for
|
||||
# example, operating system specific key storage to be used
|
||||
#
|
||||
# External password backend for testing purposes (developer use)
|
||||
#CONFIG_EXT_PASSWORD_TEST=y
|
||||
|
||||
# Enable Fast Session Transfer (FST)
|
||||
#CONFIG_FST=y
|
||||
|
||||
# Enable CLI commands for FST testing
|
||||
#CONFIG_FST_TEST=y
|
||||
|
||||
# OS X builds. This is only for building eapol_test.
|
||||
#CONFIG_OSX=y
|
||||
|
||||
# Automatic Channel Selection
|
||||
# This will allow wpa_supplicant to pick the channel automatically when channel
|
||||
# is set to "0".
|
||||
#
|
||||
# TODO: Extend parser to be able to parse "channel=acs_survey" as an alternative
|
||||
# to "channel=0". This would enable us to eventually add other ACS algorithms in
|
||||
# similar way.
|
||||
#
|
||||
# Automatic selection is currently only done through initialization, later on
|
||||
# we hope to do background checks to keep us moving to more ideal channels as
|
||||
# time goes by. ACS is currently only supported through the nl80211 driver and
|
||||
# your driver must have survey dump capability that is filled by the driver
|
||||
# during scanning.
|
||||
#
|
||||
# TODO: In analogy to hostapd be able to customize the ACS survey algorithm with
|
||||
# a newly to create wpa_supplicant.conf variable acs_num_scans.
|
||||
#
|
||||
# Supported ACS drivers:
|
||||
# * ath9k
|
||||
# * ath5k
|
||||
# * ath10k
|
||||
#
|
||||
# For more details refer to:
|
||||
# http://wireless.kernel.org/en/users/Documentation/acs
|
||||
#CONFIG_ACS=y
|
||||
|
||||
# Support Multi Band Operation
|
||||
#CONFIG_MBO=y
|
||||
|
||||
# Fast Initial Link Setup (FILS) (IEEE 802.11ai)
|
||||
# Note: This is an experimental and not yet complete implementation. This
|
||||
# should not be enabled for production use.
|
||||
#CONFIG_FILS=y
|
||||
# FILS shared key authentication with PFS
|
||||
#CONFIG_FILS_SK_PFS=y
|
||||
|
||||
# Support RSN on IBSS networks
|
||||
# This is needed to be able to use mode=1 network profile with proto=RSN and
|
||||
# key_mgmt=WPA-PSK (i.e., full key management instead of WPA-None).
|
||||
CONFIG_IBSS_RSN=y
|
||||
|
||||
# External PMKSA cache control
|
||||
# This can be used to enable control interface commands that allow the current
|
||||
# PMKSA cache entries to be fetched and new entries to be added.
|
||||
#CONFIG_PMKSA_CACHE_EXTERNAL=y
|
||||
|
||||
# Mesh Networking (IEEE 802.11s)
|
||||
#CONFIG_MESH=y
|
||||
|
||||
# Background scanning modules
|
||||
# These can be used to request wpa_supplicant to perform background scanning
|
||||
# operations for roaming within an ESS (same SSID). See the bgscan parameter in
|
||||
# the wpa_supplicant.conf file for more details.
|
||||
# Periodic background scans based on signal strength
|
||||
#CONFIG_BGSCAN_SIMPLE=y
|
||||
# Learn channels used by the network and try to avoid bgscans on other
|
||||
# channels (experimental)
|
||||
#CONFIG_BGSCAN_LEARN=y
|
||||
|
||||
# Opportunistic Wireless Encryption (OWE)
|
||||
# Experimental implementation of draft-harkins-owe-07.txt
|
||||
#CONFIG_OWE=y
|
||||
@@ -0,0 +1,593 @@
|
||||
# Example wpa_supplicant build time configuration
|
||||
#
|
||||
# This file lists the configuration options that are used when building the
|
||||
# wpa_supplicant binary. All lines starting with # are ignored. Configuration
|
||||
# option lines must be commented out complete, if they are not to be included,
|
||||
# i.e., just setting VARIABLE=n is not disabling that variable.
|
||||
#
|
||||
# This file is included in Makefile, so variables like CFLAGS and LIBS can also
|
||||
# be modified from here. In most cases, these lines should use += in order not
|
||||
# to override previous values of the variables.
|
||||
|
||||
|
||||
# Uncomment following two lines and fix the paths if you have installed OpenSSL
|
||||
# or GnuTLS in non-default location
|
||||
#CFLAGS += -I/usr/local/openssl/include
|
||||
#LIBS += -L/usr/local/openssl/lib
|
||||
|
||||
# Some Red Hat versions seem to include kerberos header files from OpenSSL, but
|
||||
# the kerberos files are not in the default include path. Following line can be
|
||||
# used to fix build issues on such systems (krb5.h not found).
|
||||
#CFLAGS += -I/usr/include/kerberos
|
||||
|
||||
# Driver interface for generic Linux wireless extensions
|
||||
# Note: WEXT is deprecated in the current Linux kernel version and no new
|
||||
# functionality is added to it. nl80211-based interface is the new
|
||||
# replacement for WEXT and its use allows wpa_supplicant to properly control
|
||||
# the driver to improve existing functionality like roaming and to support new
|
||||
# functionality.
|
||||
CONFIG_DRIVER_WEXT=y
|
||||
|
||||
# Driver interface for Linux drivers using the nl80211 kernel interface
|
||||
CONFIG_DRIVER_NL80211=y
|
||||
|
||||
# QCA vendor extensions to nl80211
|
||||
#CONFIG_DRIVER_NL80211_QCA=y
|
||||
|
||||
# driver_nl80211.c requires libnl. If you are compiling it yourself
|
||||
# you may need to point hostapd to your version of libnl.
|
||||
#
|
||||
#CFLAGS += -I$<path to libnl include files>
|
||||
#LIBS += -L$<path to libnl library files>
|
||||
|
||||
# Use libnl v2.0 (or 3.0) libraries.
|
||||
#CONFIG_LIBNL20=y
|
||||
|
||||
# Use libnl 3.2 libraries (if this is selected, CONFIG_LIBNL20 is ignored)
|
||||
#CONFIG_LIBNL32=y
|
||||
|
||||
|
||||
# Driver interface for FreeBSD net80211 layer (e.g., Atheros driver)
|
||||
#CONFIG_DRIVER_BSD=y
|
||||
#CFLAGS += -I/usr/local/include
|
||||
#LIBS += -L/usr/local/lib
|
||||
#LIBS_p += -L/usr/local/lib
|
||||
#LIBS_c += -L/usr/local/lib
|
||||
|
||||
# Driver interface for Windows NDIS
|
||||
#CONFIG_DRIVER_NDIS=y
|
||||
#CFLAGS += -I/usr/include/w32api/ddk
|
||||
#LIBS += -L/usr/local/lib
|
||||
# For native build using mingw
|
||||
#CONFIG_NATIVE_WINDOWS=y
|
||||
# Additional directories for cross-compilation on Linux host for mingw target
|
||||
#CFLAGS += -I/opt/mingw/mingw32/include/ddk
|
||||
#LIBS += -L/opt/mingw/mingw32/lib
|
||||
#CC=mingw32-gcc
|
||||
# By default, driver_ndis uses WinPcap for low-level operations. This can be
|
||||
# replaced with the following option which replaces WinPcap calls with NDISUIO.
|
||||
# However, this requires that WZC is disabled (net stop wzcsvc) before starting
|
||||
# wpa_supplicant.
|
||||
# CONFIG_USE_NDISUIO=y
|
||||
|
||||
# Driver interface for wired Ethernet drivers
|
||||
CONFIG_DRIVER_WIRED=y
|
||||
|
||||
# Driver interface for the Broadcom RoboSwitch family
|
||||
#CONFIG_DRIVER_ROBOSWITCH=y
|
||||
|
||||
# Driver interface for no driver (e.g., WPS ER only)
|
||||
#CONFIG_DRIVER_NONE=y
|
||||
|
||||
# Solaris libraries
|
||||
#LIBS += -lsocket -ldlpi -lnsl
|
||||
#LIBS_c += -lsocket
|
||||
|
||||
# Enable IEEE 802.1X Supplicant (automatically included if any EAP method is
|
||||
# included)
|
||||
#CONFIG_IEEE8021X_EAPOL=y
|
||||
|
||||
# EAP-MD5
|
||||
#CONFIG_EAP_MD5=y
|
||||
|
||||
# EAP-MSCHAPv2
|
||||
#CONFIG_EAP_MSCHAPV2=y
|
||||
|
||||
# EAP-TLS
|
||||
#CONFIG_EAP_TLS=y
|
||||
|
||||
# EAL-PEAP
|
||||
#CONFIG_EAP_PEAP=y
|
||||
|
||||
# EAP-TTLS
|
||||
#CONFIG_EAP_TTLS=y
|
||||
|
||||
# EAP-FAST
|
||||
# Note: If OpenSSL is used as the TLS library, OpenSSL 1.0 or newer is needed
|
||||
# for EAP-FAST support. Older OpenSSL releases would need to be patched, e.g.,
|
||||
# with openssl-0.9.8x-tls-extensions.patch, to add the needed functions.
|
||||
#CONFIG_EAP_FAST=y
|
||||
|
||||
# EAP-GTC
|
||||
#CONFIG_EAP_GTC=y
|
||||
|
||||
# EAP-OTP
|
||||
#CONFIG_EAP_OTP=y
|
||||
|
||||
# EAP-SIM (enable CONFIG_PCSC, if EAP-SIM is used)
|
||||
#CONFIG_EAP_SIM=y
|
||||
|
||||
# EAP-PSK (experimental; this is _not_ needed for WPA-PSK)
|
||||
#CONFIG_EAP_PSK=y
|
||||
|
||||
# EAP-pwd (secure authentication using only a password)
|
||||
#CONFIG_EAP_PWD=y
|
||||
|
||||
# EAP-PAX
|
||||
#CONFIG_EAP_PAX=y
|
||||
|
||||
# LEAP
|
||||
#CONFIG_EAP_LEAP=y
|
||||
|
||||
# EAP-AKA (enable CONFIG_PCSC, if EAP-AKA is used)
|
||||
#CONFIG_EAP_AKA=y
|
||||
|
||||
# EAP-AKA' (enable CONFIG_PCSC, if EAP-AKA' is used).
|
||||
# This requires CONFIG_EAP_AKA to be enabled, too.
|
||||
#CONFIG_EAP_AKA_PRIME=y
|
||||
|
||||
# Enable USIM simulator (Milenage) for EAP-AKA
|
||||
#CONFIG_USIM_SIMULATOR=y
|
||||
|
||||
# EAP-SAKE
|
||||
#CONFIG_EAP_SAKE=y
|
||||
|
||||
# EAP-GPSK
|
||||
#CONFIG_EAP_GPSK=y
|
||||
# Include support for optional SHA256 cipher suite in EAP-GPSK
|
||||
#CONFIG_EAP_GPSK_SHA256=y
|
||||
|
||||
# EAP-TNC and related Trusted Network Connect support (experimental)
|
||||
#CONFIG_EAP_TNC=y
|
||||
|
||||
# Wi-Fi Protected Setup (WPS)
|
||||
#CONFIG_WPS=y
|
||||
# Enable WPS external registrar functionality
|
||||
#CONFIG_WPS_ER=y
|
||||
# Disable credentials for an open network by default when acting as a WPS
|
||||
# registrar.
|
||||
#CONFIG_WPS_REG_DISABLE_OPEN=y
|
||||
# Enable WPS support with NFC config method
|
||||
#CONFIG_WPS_NFC=y
|
||||
|
||||
# EAP-IKEv2
|
||||
#CONFIG_EAP_IKEV2=y
|
||||
|
||||
# EAP-EKE
|
||||
#CONFIG_EAP_EKE=y
|
||||
|
||||
# PKCS#12 (PFX) support (used to read private key and certificate file from
|
||||
# a file that usually has extension .p12 or .pfx)
|
||||
#CONFIG_PKCS12=y
|
||||
|
||||
# Smartcard support (i.e., private key on a smartcard), e.g., with openssl
|
||||
# engine.
|
||||
#CONFIG_SMARTCARD=y
|
||||
|
||||
# PC/SC interface for smartcards (USIM, GSM SIM)
|
||||
# Enable this if EAP-SIM or EAP-AKA is included
|
||||
#CONFIG_PCSC=y
|
||||
|
||||
# Support HT overrides (disable HT/HT40, mask MCS rates, etc.)
|
||||
CONFIG_HT_OVERRIDES=y
|
||||
|
||||
# Support VHT overrides (disable VHT, mask MCS rates, etc.)
|
||||
CONFIG_VHT_OVERRIDES=y
|
||||
|
||||
# Development testing
|
||||
#CONFIG_EAPOL_TEST=y
|
||||
|
||||
# Select control interface backend for external programs, e.g, wpa_cli:
|
||||
# unix = UNIX domain sockets (default for Linux/*BSD)
|
||||
# udp = UDP sockets using localhost (127.0.0.1)
|
||||
# udp6 = UDP IPv6 sockets using localhost (::1)
|
||||
# named_pipe = Windows Named Pipe (default for Windows)
|
||||
# udp-remote = UDP sockets with remote access (only for tests systems/purpose)
|
||||
# udp6-remote = UDP IPv6 sockets with remote access (only for tests purpose)
|
||||
# y = use default (backwards compatibility)
|
||||
# If this option is commented out, control interface is not included in the
|
||||
# build.
|
||||
CONFIG_CTRL_IFACE=y
|
||||
|
||||
# Include support for GNU Readline and History Libraries in wpa_cli.
|
||||
# When building a wpa_cli binary for distribution, please note that these
|
||||
# libraries are licensed under GPL and as such, BSD license may not apply for
|
||||
# the resulting binary.
|
||||
#CONFIG_READLINE=y
|
||||
|
||||
# Include internal line edit mode in wpa_cli. This can be used as a replacement
|
||||
# for GNU Readline to provide limited command line editing and history support.
|
||||
#CONFIG_WPA_CLI_EDIT=y
|
||||
|
||||
# Remove debugging code that is printing out debug message to stdout.
|
||||
# This can be used to reduce the size of the wpa_supplicant considerably
|
||||
# if debugging code is not needed. The size reduction can be around 35%
|
||||
# (e.g., 90 kB).
|
||||
#CONFIG_NO_STDOUT_DEBUG=y
|
||||
|
||||
# Remove WPA support, e.g., for wired-only IEEE 802.1X supplicant, to save
|
||||
# 35-50 kB in code size.
|
||||
#CONFIG_NO_WPA=y
|
||||
|
||||
# Remove IEEE 802.11i/WPA-Personal ASCII passphrase support
|
||||
# This option can be used to reduce code size by removing support for
|
||||
# converting ASCII passphrases into PSK. If this functionality is removed, the
|
||||
# PSK can only be configured as the 64-octet hexstring (e.g., from
|
||||
# wpa_passphrase). This saves about 0.5 kB in code size.
|
||||
#CONFIG_NO_WPA_PASSPHRASE=y
|
||||
|
||||
# Disable scan result processing (ap_mode=1) to save code size by about 1 kB.
|
||||
# This can be used if ap_scan=1 mode is never enabled.
|
||||
#CONFIG_NO_SCAN_PROCESSING=y
|
||||
|
||||
# Select configuration backend:
|
||||
# file = text file (e.g., wpa_supplicant.conf; note: the configuration file
|
||||
# path is given on command line, not here; this option is just used to
|
||||
# select the backend that allows configuration files to be used)
|
||||
# winreg = Windows registry (see win_example.reg for an example)
|
||||
CONFIG_BACKEND=file
|
||||
|
||||
# Remove configuration write functionality (i.e., to allow the configuration
|
||||
# file to be updated based on runtime configuration changes). The runtime
|
||||
# configuration can still be changed, the changes are just not going to be
|
||||
# persistent over restarts. This option can be used to reduce code size by
|
||||
# about 3.5 kB.
|
||||
#CONFIG_NO_CONFIG_WRITE=y
|
||||
|
||||
# Remove support for configuration blobs to reduce code size by about 1.5 kB.
|
||||
#CONFIG_NO_CONFIG_BLOBS=y
|
||||
|
||||
# Select program entry point implementation:
|
||||
# main = UNIX/POSIX like main() function (default)
|
||||
# main_winsvc = Windows service (read parameters from registry)
|
||||
# main_none = Very basic example (development use only)
|
||||
#CONFIG_MAIN=main
|
||||
|
||||
# Select wrapper for operating system and C library specific functions
|
||||
# unix = UNIX/POSIX like systems (default)
|
||||
# win32 = Windows systems
|
||||
# none = Empty template
|
||||
#CONFIG_OS=unix
|
||||
|
||||
# Select event loop implementation
|
||||
# eloop = select() loop (default)
|
||||
# eloop_win = Windows events and WaitForMultipleObject() loop
|
||||
#CONFIG_ELOOP=eloop
|
||||
|
||||
# Should we use poll instead of select? Select is used by default.
|
||||
#CONFIG_ELOOP_POLL=y
|
||||
|
||||
# Should we use epoll instead of select? Select is used by default.
|
||||
#CONFIG_ELOOP_EPOLL=y
|
||||
|
||||
# Should we use kqueue instead of select? Select is used by default.
|
||||
#CONFIG_ELOOP_KQUEUE=y
|
||||
|
||||
# Select layer 2 packet implementation
|
||||
# linux = Linux packet socket (default)
|
||||
# pcap = libpcap/libdnet/WinPcap
|
||||
# freebsd = FreeBSD libpcap
|
||||
# winpcap = WinPcap with receive thread
|
||||
# ndis = Windows NDISUIO (note: requires CONFIG_USE_NDISUIO=y)
|
||||
# none = Empty template
|
||||
#CONFIG_L2_PACKET=linux
|
||||
|
||||
# Disable Linux packet socket workaround applicable for station interface
|
||||
# in a bridge for EAPOL frames. This should be uncommented only if the kernel
|
||||
# is known to not have the regression issue in packet socket behavior with
|
||||
# bridge interfaces (commit 'bridge: respect RFC2863 operational state')').
|
||||
#CONFIG_NO_LINUX_PACKET_SOCKET_WAR=y
|
||||
|
||||
# PeerKey handshake for Station to Station Link (IEEE 802.11e DLS)
|
||||
#CONFIG_PEERKEY=y
|
||||
|
||||
# IEEE 802.11w (management frame protection), also known as PMF
|
||||
# Driver support is also needed for IEEE 802.11w.
|
||||
#CONFIG_IEEE80211W=y
|
||||
|
||||
# Select TLS implementation
|
||||
# openssl = OpenSSL (default)
|
||||
# gnutls = GnuTLS
|
||||
# internal = Internal TLSv1 implementation (experimental)
|
||||
# linux = Linux kernel AF_ALG and internal TLSv1 implementation (experimental)
|
||||
# none = Empty template
|
||||
CONFIG_TLS=internal
|
||||
|
||||
# TLS-based EAP methods require at least TLS v1.0. Newer version of TLS (v1.1)
|
||||
# can be enabled to get a stronger construction of messages when block ciphers
|
||||
# are used. It should be noted that some existing TLS v1.0 -based
|
||||
# implementation may not be compatible with TLS v1.1 message (ClientHello is
|
||||
# sent prior to negotiating which version will be used)
|
||||
#CONFIG_TLSV11=y
|
||||
|
||||
# TLS-based EAP methods require at least TLS v1.0. Newer version of TLS (v1.2)
|
||||
# can be enabled to enable use of stronger crypto algorithms. It should be
|
||||
# noted that some existing TLS v1.0 -based implementation may not be compatible
|
||||
# with TLS v1.2 message (ClientHello is sent prior to negotiating which version
|
||||
# will be used)
|
||||
#CONFIG_TLSV12=y
|
||||
|
||||
# Select which ciphers to use by default with OpenSSL if the user does not
|
||||
# specify them.
|
||||
#CONFIG_TLS_DEFAULT_CIPHERS="DEFAULT:!EXP:!LOW"
|
||||
|
||||
# If CONFIG_TLS=internal is used, additional library and include paths are
|
||||
# needed for LibTomMath. Alternatively, an integrated, minimal version of
|
||||
# LibTomMath can be used. See beginning of libtommath.c for details on benefits
|
||||
# and drawbacks of this option.
|
||||
#CONFIG_INTERNAL_LIBTOMMATH=y
|
||||
#ifndef CONFIG_INTERNAL_LIBTOMMATH
|
||||
#LTM_PATH=/usr/src/libtommath-0.39
|
||||
#CFLAGS += -I$(LTM_PATH)
|
||||
#LIBS += -L$(LTM_PATH)
|
||||
#LIBS_p += -L$(LTM_PATH)
|
||||
#endif
|
||||
# At the cost of about 4 kB of additional binary size, the internal LibTomMath
|
||||
# can be configured to include faster routines for exptmod, sqr, and div to
|
||||
# speed up DH and RSA calculation considerably
|
||||
#CONFIG_INTERNAL_LIBTOMMATH_FAST=y
|
||||
|
||||
# Include NDIS event processing through WMI into wpa_supplicant/wpasvc.
|
||||
# This is only for Windows builds and requires WMI-related header files and
|
||||
# WbemUuid.Lib from Platform SDK even when building with MinGW.
|
||||
#CONFIG_NDIS_EVENTS_INTEGRATED=y
|
||||
#PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib"
|
||||
|
||||
# Add support for old DBus control interface
|
||||
# (fi.epitest.hostap.WPASupplicant)
|
||||
#CONFIG_CTRL_IFACE_DBUS=y
|
||||
|
||||
# Add support for new DBus control interface
|
||||
# (fi.w1.hostap.wpa_supplicant1)
|
||||
#CONFIG_CTRL_IFACE_DBUS_NEW=y
|
||||
|
||||
# Add introspection support for new DBus control interface
|
||||
#CONFIG_CTRL_IFACE_DBUS_INTRO=y
|
||||
|
||||
# Add support for loading EAP methods dynamically as shared libraries.
|
||||
# When this option is enabled, each EAP method can be either included
|
||||
# statically (CONFIG_EAP_<method>=y) or dynamically (CONFIG_EAP_<method>=dyn).
|
||||
# Dynamic EAP methods are build as shared objects (eap_*.so) and they need to
|
||||
# be loaded in the beginning of the wpa_supplicant configuration file
|
||||
# (see load_dynamic_eap parameter in the example file) before being used in
|
||||
# the network blocks.
|
||||
#
|
||||
# Note that some shared parts of EAP methods are included in the main program
|
||||
# and in order to be able to use dynamic EAP methods using these parts, the
|
||||
# main program must have been build with the EAP method enabled (=y or =dyn).
|
||||
# This means that EAP-TLS/PEAP/TTLS/FAST cannot be added as dynamic libraries
|
||||
# unless at least one of them was included in the main build to force inclusion
|
||||
# of the shared code. Similarly, at least one of EAP-SIM/AKA must be included
|
||||
# in the main build to be able to load these methods dynamically.
|
||||
#
|
||||
# Please also note that using dynamic libraries will increase the total binary
|
||||
# size. Thus, it may not be the best option for targets that have limited
|
||||
# amount of memory/flash.
|
||||
#CONFIG_DYNAMIC_EAP_METHODS=y
|
||||
|
||||
# IEEE Std 802.11r-2008 (Fast BSS Transition) for station mode
|
||||
#CONFIG_IEEE80211R=y
|
||||
|
||||
# IEEE Std 802.11r-2008 (Fast BSS Transition) for AP mode (implies
|
||||
# CONFIG_IEEE80211R).
|
||||
#CONFIG_IEEE80211R_AP=y
|
||||
|
||||
# Add support for writing debug log to a file (/tmp/wpa_supplicant-log-#.txt)
|
||||
#CONFIG_DEBUG_FILE=y
|
||||
|
||||
# Send debug messages to syslog instead of stdout
|
||||
#CONFIG_DEBUG_SYSLOG=y
|
||||
# Set syslog facility for debug messages
|
||||
#CONFIG_DEBUG_SYSLOG_FACILITY=LOG_DAEMON
|
||||
|
||||
# Add support for sending all debug messages (regardless of debug verbosity)
|
||||
# to the Linux kernel tracing facility. This helps debug the entire stack by
|
||||
# making it easy to record everything happening from the driver up into the
|
||||
# same file, e.g., using trace-cmd.
|
||||
#CONFIG_DEBUG_LINUX_TRACING=y
|
||||
|
||||
# Add support for writing debug log to Android logcat instead of standard
|
||||
# output
|
||||
#CONFIG_ANDROID_LOG=y
|
||||
|
||||
# Enable privilege separation (see README 'Privilege separation' for details)
|
||||
#CONFIG_PRIVSEP=y
|
||||
|
||||
# Enable mitigation against certain attacks against TKIP by delaying Michael
|
||||
# MIC error reports by a random amount of time between 0 and 60 seconds
|
||||
#CONFIG_DELAYED_MIC_ERROR_REPORT=y
|
||||
|
||||
# Enable tracing code for developer debugging
|
||||
# This tracks use of memory allocations and other registrations and reports
|
||||
# incorrect use with a backtrace of call (or allocation) location.
|
||||
#CONFIG_WPA_TRACE=y
|
||||
# For BSD, uncomment these.
|
||||
#LIBS += -lexecinfo
|
||||
#LIBS_p += -lexecinfo
|
||||
#LIBS_c += -lexecinfo
|
||||
|
||||
# Use libbfd to get more details for developer debugging
|
||||
# This enables use of libbfd to get more detailed symbols for the backtraces
|
||||
# generated by CONFIG_WPA_TRACE=y.
|
||||
#CONFIG_WPA_TRACE_BFD=y
|
||||
# For BSD, uncomment these.
|
||||
#LIBS += -lbfd -liberty -lz
|
||||
#LIBS_p += -lbfd -liberty -lz
|
||||
#LIBS_c += -lbfd -liberty -lz
|
||||
|
||||
# wpa_supplicant depends on strong random number generation being available
|
||||
# from the operating system. os_get_random() function is used to fetch random
|
||||
# data when needed, e.g., for key generation. On Linux and BSD systems, this
|
||||
# works by reading /dev/urandom. It should be noted that the OS entropy pool
|
||||
# needs to be properly initialized before wpa_supplicant is started. This is
|
||||
# important especially on embedded devices that do not have a hardware random
|
||||
# number generator and may by default start up with minimal entropy available
|
||||
# for random number generation.
|
||||
#
|
||||
# As a safety net, wpa_supplicant is by default trying to internally collect
|
||||
# additional entropy for generating random data to mix in with the data fetched
|
||||
# from the OS. This by itself is not considered to be very strong, but it may
|
||||
# help in cases where the system pool is not initialized properly. However, it
|
||||
# is very strongly recommended that the system pool is initialized with enough
|
||||
# entropy either by using hardware assisted random number generator or by
|
||||
# storing state over device reboots.
|
||||
#
|
||||
# wpa_supplicant can be configured to maintain its own entropy store over
|
||||
# restarts to enhance random number generation. This is not perfect, but it is
|
||||
# much more secure than using the same sequence of random numbers after every
|
||||
# reboot. This can be enabled with -e<entropy file> command line option. The
|
||||
# specified file needs to be readable and writable by wpa_supplicant.
|
||||
#
|
||||
# If the os_get_random() is known to provide strong random data (e.g., on
|
||||
# Linux/BSD, the board in question is known to have reliable source of random
|
||||
# data from /dev/urandom), the internal wpa_supplicant random pool can be
|
||||
# disabled. This will save some in binary size and CPU use. However, this
|
||||
# should only be considered for builds that are known to be used on devices
|
||||
# that meet the requirements described above.
|
||||
CONFIG_NO_RANDOM_POOL=y
|
||||
|
||||
# IEEE 802.11n (High Throughput) support (mainly for AP mode)
|
||||
#CONFIG_IEEE80211N=y
|
||||
|
||||
# IEEE 802.11ac (Very High Throughput) support (mainly for AP mode)
|
||||
# (depends on CONFIG_IEEE80211N)
|
||||
#CONFIG_IEEE80211AC=y
|
||||
|
||||
# Wireless Network Management (IEEE Std 802.11v-2011)
|
||||
# Note: This is experimental and not complete implementation.
|
||||
#CONFIG_WNM=y
|
||||
|
||||
# Interworking (IEEE 802.11u)
|
||||
# This can be used to enable functionality to improve interworking with
|
||||
# external networks (GAS/ANQP to learn more about the networks and network
|
||||
# selection based on available credentials).
|
||||
#CONFIG_INTERWORKING=y
|
||||
|
||||
# Hotspot 2.0
|
||||
#CONFIG_HS20=y
|
||||
|
||||
# Enable interface matching in wpa_supplicant
|
||||
#CONFIG_MATCH_IFACE=y
|
||||
|
||||
# Disable roaming in wpa_supplicant
|
||||
#CONFIG_NO_ROAMING=y
|
||||
|
||||
# AP mode operations with wpa_supplicant
|
||||
# This can be used for controlling AP mode operations with wpa_supplicant. It
|
||||
# should be noted that this is mainly aimed at simple cases like
|
||||
# WPA2-Personal while more complex configurations like WPA2-Enterprise with an
|
||||
# external RADIUS server can be supported with hostapd.
|
||||
#CONFIG_AP=y
|
||||
|
||||
# P2P (Wi-Fi Direct)
|
||||
# This can be used to enable P2P support in wpa_supplicant. See README-P2P for
|
||||
# more information on P2P operations.
|
||||
#CONFIG_P2P=y
|
||||
|
||||
# Enable TDLS support
|
||||
#CONFIG_TDLS=y
|
||||
|
||||
# Wi-Fi Direct
|
||||
# This can be used to enable Wi-Fi Direct extensions for P2P using an external
|
||||
# program to control the additional information exchanges in the messages.
|
||||
#CONFIG_WIFI_DISPLAY=y
|
||||
|
||||
# Autoscan
|
||||
# This can be used to enable automatic scan support in wpa_supplicant.
|
||||
# See wpa_supplicant.conf for more information on autoscan usage.
|
||||
#
|
||||
# Enabling directly a module will enable autoscan support.
|
||||
# For exponential module:
|
||||
#CONFIG_AUTOSCAN_EXPONENTIAL=y
|
||||
# For periodic module:
|
||||
#CONFIG_AUTOSCAN_PERIODIC=y
|
||||
|
||||
# Password (and passphrase, etc.) backend for external storage
|
||||
# These optional mechanisms can be used to add support for storing passwords
|
||||
# and other secrets in external (to wpa_supplicant) location. This allows, for
|
||||
# example, operating system specific key storage to be used
|
||||
#
|
||||
# External password backend for testing purposes (developer use)
|
||||
#CONFIG_EXT_PASSWORD_TEST=y
|
||||
|
||||
# Enable Fast Session Transfer (FST)
|
||||
#CONFIG_FST=y
|
||||
|
||||
# Enable CLI commands for FST testing
|
||||
#CONFIG_FST_TEST=y
|
||||
|
||||
# OS X builds. This is only for building eapol_test.
|
||||
#CONFIG_OSX=y
|
||||
|
||||
# Automatic Channel Selection
|
||||
# This will allow wpa_supplicant to pick the channel automatically when channel
|
||||
# is set to "0".
|
||||
#
|
||||
# TODO: Extend parser to be able to parse "channel=acs_survey" as an alternative
|
||||
# to "channel=0". This would enable us to eventually add other ACS algorithms in
|
||||
# similar way.
|
||||
#
|
||||
# Automatic selection is currently only done through initialization, later on
|
||||
# we hope to do background checks to keep us moving to more ideal channels as
|
||||
# time goes by. ACS is currently only supported through the nl80211 driver and
|
||||
# your driver must have survey dump capability that is filled by the driver
|
||||
# during scanning.
|
||||
#
|
||||
# TODO: In analogy to hostapd be able to customize the ACS survey algorithm with
|
||||
# a newly to create wpa_supplicant.conf variable acs_num_scans.
|
||||
#
|
||||
# Supported ACS drivers:
|
||||
# * ath9k
|
||||
# * ath5k
|
||||
# * ath10k
|
||||
#
|
||||
# For more details refer to:
|
||||
# http://wireless.kernel.org/en/users/Documentation/acs
|
||||
#CONFIG_ACS=y
|
||||
|
||||
# Support Multi Band Operation
|
||||
#CONFIG_MBO=y
|
||||
|
||||
# Fast Initial Link Setup (FILS) (IEEE 802.11ai)
|
||||
# Note: This is an experimental and not yet complete implementation. This
|
||||
# should not be enabled for production use.
|
||||
#CONFIG_FILS=y
|
||||
# FILS shared key authentication with PFS
|
||||
#CONFIG_FILS_SK_PFS=y
|
||||
|
||||
# Support RSN on IBSS networks
|
||||
# This is needed to be able to use mode=1 network profile with proto=RSN and
|
||||
# key_mgmt=WPA-PSK (i.e., full key management instead of WPA-None).
|
||||
#CONFIG_IBSS_RSN=y
|
||||
|
||||
# External PMKSA cache control
|
||||
# This can be used to enable control interface commands that allow the current
|
||||
# PMKSA cache entries to be fetched and new entries to be added.
|
||||
#CONFIG_PMKSA_CACHE_EXTERNAL=y
|
||||
|
||||
# Mesh Networking (IEEE 802.11s)
|
||||
#CONFIG_MESH=y
|
||||
|
||||
# Background scanning modules
|
||||
# These can be used to request wpa_supplicant to perform background scanning
|
||||
# operations for roaming within an ESS (same SSID). See the bgscan parameter in
|
||||
# the wpa_supplicant.conf file for more details.
|
||||
# Periodic background scans based on signal strength
|
||||
#CONFIG_BGSCAN_SIMPLE=y
|
||||
# Learn channels used by the network and try to avoid bgscans on other
|
||||
# channels (experimental)
|
||||
#CONFIG_BGSCAN_LEARN=y
|
||||
|
||||
# Opportunistic Wireless Encryption (OWE)
|
||||
# Experimental implementation of draft-harkins-owe-07.txt
|
||||
#CONFIG_OWE=y
|
||||
593
package/network/services/hostapd/files/wpa_supplicant-p2p.config
Normal file
593
package/network/services/hostapd/files/wpa_supplicant-p2p.config
Normal file
@@ -0,0 +1,593 @@
|
||||
# Example wpa_supplicant build time configuration
|
||||
#
|
||||
# This file lists the configuration options that are used when building the
|
||||
# wpa_supplicant binary. All lines starting with # are ignored. Configuration
|
||||
# option lines must be commented out complete, if they are not to be included,
|
||||
# i.e., just setting VARIABLE=n is not disabling that variable.
|
||||
#
|
||||
# This file is included in Makefile, so variables like CFLAGS and LIBS can also
|
||||
# be modified from here. In most cases, these lines should use += in order not
|
||||
# to override previous values of the variables.
|
||||
|
||||
|
||||
# Uncomment following two lines and fix the paths if you have installed OpenSSL
|
||||
# or GnuTLS in non-default location
|
||||
#CFLAGS += -I/usr/local/openssl/include
|
||||
#LIBS += -L/usr/local/openssl/lib
|
||||
|
||||
# Some Red Hat versions seem to include kerberos header files from OpenSSL, but
|
||||
# the kerberos files are not in the default include path. Following line can be
|
||||
# used to fix build issues on such systems (krb5.h not found).
|
||||
#CFLAGS += -I/usr/include/kerberos
|
||||
|
||||
# Driver interface for generic Linux wireless extensions
|
||||
# Note: WEXT is deprecated in the current Linux kernel version and no new
|
||||
# functionality is added to it. nl80211-based interface is the new
|
||||
# replacement for WEXT and its use allows wpa_supplicant to properly control
|
||||
# the driver to improve existing functionality like roaming and to support new
|
||||
# functionality.
|
||||
CONFIG_DRIVER_WEXT=y
|
||||
|
||||
# Driver interface for Linux drivers using the nl80211 kernel interface
|
||||
CONFIG_DRIVER_NL80211=y
|
||||
|
||||
# QCA vendor extensions to nl80211
|
||||
#CONFIG_DRIVER_NL80211_QCA=y
|
||||
|
||||
# driver_nl80211.c requires libnl. If you are compiling it yourself
|
||||
# you may need to point hostapd to your version of libnl.
|
||||
#
|
||||
#CFLAGS += -I$<path to libnl include files>
|
||||
#LIBS += -L$<path to libnl library files>
|
||||
|
||||
# Use libnl v2.0 (or 3.0) libraries.
|
||||
#CONFIG_LIBNL20=y
|
||||
|
||||
# Use libnl 3.2 libraries (if this is selected, CONFIG_LIBNL20 is ignored)
|
||||
#CONFIG_LIBNL32=y
|
||||
|
||||
|
||||
# Driver interface for FreeBSD net80211 layer (e.g., Atheros driver)
|
||||
#CONFIG_DRIVER_BSD=y
|
||||
#CFLAGS += -I/usr/local/include
|
||||
#LIBS += -L/usr/local/lib
|
||||
#LIBS_p += -L/usr/local/lib
|
||||
#LIBS_c += -L/usr/local/lib
|
||||
|
||||
# Driver interface for Windows NDIS
|
||||
#CONFIG_DRIVER_NDIS=y
|
||||
#CFLAGS += -I/usr/include/w32api/ddk
|
||||
#LIBS += -L/usr/local/lib
|
||||
# For native build using mingw
|
||||
#CONFIG_NATIVE_WINDOWS=y
|
||||
# Additional directories for cross-compilation on Linux host for mingw target
|
||||
#CFLAGS += -I/opt/mingw/mingw32/include/ddk
|
||||
#LIBS += -L/opt/mingw/mingw32/lib
|
||||
#CC=mingw32-gcc
|
||||
# By default, driver_ndis uses WinPcap for low-level operations. This can be
|
||||
# replaced with the following option which replaces WinPcap calls with NDISUIO.
|
||||
# However, this requires that WZC is disabled (net stop wzcsvc) before starting
|
||||
# wpa_supplicant.
|
||||
# CONFIG_USE_NDISUIO=y
|
||||
|
||||
# Driver interface for wired Ethernet drivers
|
||||
CONFIG_DRIVER_WIRED=y
|
||||
|
||||
# Driver interface for the Broadcom RoboSwitch family
|
||||
#CONFIG_DRIVER_ROBOSWITCH=y
|
||||
|
||||
# Driver interface for no driver (e.g., WPS ER only)
|
||||
#CONFIG_DRIVER_NONE=y
|
||||
|
||||
# Solaris libraries
|
||||
#LIBS += -lsocket -ldlpi -lnsl
|
||||
#LIBS_c += -lsocket
|
||||
|
||||
# Enable IEEE 802.1X Supplicant (automatically included if any EAP method is
|
||||
# included)
|
||||
CONFIG_IEEE8021X_EAPOL=y
|
||||
|
||||
# EAP-MD5
|
||||
CONFIG_EAP_MD5=y
|
||||
|
||||
# EAP-MSCHAPv2
|
||||
CONFIG_EAP_MSCHAPV2=y
|
||||
|
||||
# EAP-TLS
|
||||
CONFIG_EAP_TLS=y
|
||||
|
||||
# EAL-PEAP
|
||||
CONFIG_EAP_PEAP=y
|
||||
|
||||
# EAP-TTLS
|
||||
CONFIG_EAP_TTLS=y
|
||||
|
||||
# EAP-FAST
|
||||
# Note: If OpenSSL is used as the TLS library, OpenSSL 1.0 or newer is needed
|
||||
# for EAP-FAST support. Older OpenSSL releases would need to be patched, e.g.,
|
||||
# with openssl-0.9.8x-tls-extensions.patch, to add the needed functions.
|
||||
CONFIG_EAP_FAST=y
|
||||
|
||||
# EAP-GTC
|
||||
CONFIG_EAP_GTC=y
|
||||
|
||||
# EAP-OTP
|
||||
CONFIG_EAP_OTP=y
|
||||
|
||||
# EAP-SIM (enable CONFIG_PCSC, if EAP-SIM is used)
|
||||
#CONFIG_EAP_SIM=y
|
||||
|
||||
# EAP-PSK (experimental; this is _not_ needed for WPA-PSK)
|
||||
#CONFIG_EAP_PSK=y
|
||||
|
||||
# EAP-pwd (secure authentication using only a password)
|
||||
#CONFIG_EAP_PWD=y
|
||||
|
||||
# EAP-PAX
|
||||
#CONFIG_EAP_PAX=y
|
||||
|
||||
# LEAP
|
||||
CONFIG_EAP_LEAP=y
|
||||
|
||||
# EAP-AKA (enable CONFIG_PCSC, if EAP-AKA is used)
|
||||
#CONFIG_EAP_AKA=y
|
||||
|
||||
# EAP-AKA' (enable CONFIG_PCSC, if EAP-AKA' is used).
|
||||
# This requires CONFIG_EAP_AKA to be enabled, too.
|
||||
#CONFIG_EAP_AKA_PRIME=y
|
||||
|
||||
# Enable USIM simulator (Milenage) for EAP-AKA
|
||||
#CONFIG_USIM_SIMULATOR=y
|
||||
|
||||
# EAP-SAKE
|
||||
#CONFIG_EAP_SAKE=y
|
||||
|
||||
# EAP-GPSK
|
||||
#CONFIG_EAP_GPSK=y
|
||||
# Include support for optional SHA256 cipher suite in EAP-GPSK
|
||||
#CONFIG_EAP_GPSK_SHA256=y
|
||||
|
||||
# EAP-TNC and related Trusted Network Connect support (experimental)
|
||||
#CONFIG_EAP_TNC=y
|
||||
|
||||
# Wi-Fi Protected Setup (WPS)
|
||||
CONFIG_WPS=y
|
||||
# Enable WPS external registrar functionality
|
||||
#CONFIG_WPS_ER=y
|
||||
# Disable credentials for an open network by default when acting as a WPS
|
||||
# registrar.
|
||||
#CONFIG_WPS_REG_DISABLE_OPEN=y
|
||||
# Enable WPS support with NFC config method
|
||||
#CONFIG_WPS_NFC=y
|
||||
|
||||
# EAP-IKEv2
|
||||
#CONFIG_EAP_IKEV2=y
|
||||
|
||||
# EAP-EKE
|
||||
#CONFIG_EAP_EKE=y
|
||||
|
||||
# PKCS#12 (PFX) support (used to read private key and certificate file from
|
||||
# a file that usually has extension .p12 or .pfx)
|
||||
CONFIG_PKCS12=y
|
||||
|
||||
# Smartcard support (i.e., private key on a smartcard), e.g., with openssl
|
||||
# engine.
|
||||
CONFIG_SMARTCARD=y
|
||||
|
||||
# PC/SC interface for smartcards (USIM, GSM SIM)
|
||||
# Enable this if EAP-SIM or EAP-AKA is included
|
||||
#CONFIG_PCSC=y
|
||||
|
||||
# Support HT overrides (disable HT/HT40, mask MCS rates, etc.)
|
||||
CONFIG_HT_OVERRIDES=y
|
||||
|
||||
# Support VHT overrides (disable VHT, mask MCS rates, etc.)
|
||||
CONFIG_VHT_OVERRIDES=y
|
||||
|
||||
# Development testing
|
||||
#CONFIG_EAPOL_TEST=y
|
||||
|
||||
# Select control interface backend for external programs, e.g, wpa_cli:
|
||||
# unix = UNIX domain sockets (default for Linux/*BSD)
|
||||
# udp = UDP sockets using localhost (127.0.0.1)
|
||||
# udp6 = UDP IPv6 sockets using localhost (::1)
|
||||
# named_pipe = Windows Named Pipe (default for Windows)
|
||||
# udp-remote = UDP sockets with remote access (only for tests systems/purpose)
|
||||
# udp6-remote = UDP IPv6 sockets with remote access (only for tests purpose)
|
||||
# y = use default (backwards compatibility)
|
||||
# If this option is commented out, control interface is not included in the
|
||||
# build.
|
||||
CONFIG_CTRL_IFACE=y
|
||||
|
||||
# Include support for GNU Readline and History Libraries in wpa_cli.
|
||||
# When building a wpa_cli binary for distribution, please note that these
|
||||
# libraries are licensed under GPL and as such, BSD license may not apply for
|
||||
# the resulting binary.
|
||||
#CONFIG_READLINE=y
|
||||
|
||||
# Include internal line edit mode in wpa_cli. This can be used as a replacement
|
||||
# for GNU Readline to provide limited command line editing and history support.
|
||||
#CONFIG_WPA_CLI_EDIT=y
|
||||
|
||||
# Remove debugging code that is printing out debug message to stdout.
|
||||
# This can be used to reduce the size of the wpa_supplicant considerably
|
||||
# if debugging code is not needed. The size reduction can be around 35%
|
||||
# (e.g., 90 kB).
|
||||
#CONFIG_NO_STDOUT_DEBUG=y
|
||||
|
||||
# Remove WPA support, e.g., for wired-only IEEE 802.1X supplicant, to save
|
||||
# 35-50 kB in code size.
|
||||
#CONFIG_NO_WPA=y
|
||||
|
||||
# Remove IEEE 802.11i/WPA-Personal ASCII passphrase support
|
||||
# This option can be used to reduce code size by removing support for
|
||||
# converting ASCII passphrases into PSK. If this functionality is removed, the
|
||||
# PSK can only be configured as the 64-octet hexstring (e.g., from
|
||||
# wpa_passphrase). This saves about 0.5 kB in code size.
|
||||
#CONFIG_NO_WPA_PASSPHRASE=y
|
||||
|
||||
# Disable scan result processing (ap_mode=1) to save code size by about 1 kB.
|
||||
# This can be used if ap_scan=1 mode is never enabled.
|
||||
#CONFIG_NO_SCAN_PROCESSING=y
|
||||
|
||||
# Select configuration backend:
|
||||
# file = text file (e.g., wpa_supplicant.conf; note: the configuration file
|
||||
# path is given on command line, not here; this option is just used to
|
||||
# select the backend that allows configuration files to be used)
|
||||
# winreg = Windows registry (see win_example.reg for an example)
|
||||
CONFIG_BACKEND=file
|
||||
|
||||
# Remove configuration write functionality (i.e., to allow the configuration
|
||||
# file to be updated based on runtime configuration changes). The runtime
|
||||
# configuration can still be changed, the changes are just not going to be
|
||||
# persistent over restarts. This option can be used to reduce code size by
|
||||
# about 3.5 kB.
|
||||
#CONFIG_NO_CONFIG_WRITE=y
|
||||
|
||||
# Remove support for configuration blobs to reduce code size by about 1.5 kB.
|
||||
#CONFIG_NO_CONFIG_BLOBS=y
|
||||
|
||||
# Select program entry point implementation:
|
||||
# main = UNIX/POSIX like main() function (default)
|
||||
# main_winsvc = Windows service (read parameters from registry)
|
||||
# main_none = Very basic example (development use only)
|
||||
#CONFIG_MAIN=main
|
||||
|
||||
# Select wrapper for operating system and C library specific functions
|
||||
# unix = UNIX/POSIX like systems (default)
|
||||
# win32 = Windows systems
|
||||
# none = Empty template
|
||||
#CONFIG_OS=unix
|
||||
|
||||
# Select event loop implementation
|
||||
# eloop = select() loop (default)
|
||||
# eloop_win = Windows events and WaitForMultipleObject() loop
|
||||
#CONFIG_ELOOP=eloop
|
||||
|
||||
# Should we use poll instead of select? Select is used by default.
|
||||
#CONFIG_ELOOP_POLL=y
|
||||
|
||||
# Should we use epoll instead of select? Select is used by default.
|
||||
#CONFIG_ELOOP_EPOLL=y
|
||||
|
||||
# Should we use kqueue instead of select? Select is used by default.
|
||||
#CONFIG_ELOOP_KQUEUE=y
|
||||
|
||||
# Select layer 2 packet implementation
|
||||
# linux = Linux packet socket (default)
|
||||
# pcap = libpcap/libdnet/WinPcap
|
||||
# freebsd = FreeBSD libpcap
|
||||
# winpcap = WinPcap with receive thread
|
||||
# ndis = Windows NDISUIO (note: requires CONFIG_USE_NDISUIO=y)
|
||||
# none = Empty template
|
||||
#CONFIG_L2_PACKET=linux
|
||||
|
||||
# Disable Linux packet socket workaround applicable for station interface
|
||||
# in a bridge for EAPOL frames. This should be uncommented only if the kernel
|
||||
# is known to not have the regression issue in packet socket behavior with
|
||||
# bridge interfaces (commit 'bridge: respect RFC2863 operational state')').
|
||||
#CONFIG_NO_LINUX_PACKET_SOCKET_WAR=y
|
||||
|
||||
# PeerKey handshake for Station to Station Link (IEEE 802.11e DLS)
|
||||
CONFIG_PEERKEY=y
|
||||
|
||||
# IEEE 802.11w (management frame protection), also known as PMF
|
||||
# Driver support is also needed for IEEE 802.11w.
|
||||
CONFIG_IEEE80211W=y
|
||||
|
||||
# Select TLS implementation
|
||||
# openssl = OpenSSL (default)
|
||||
# gnutls = GnuTLS
|
||||
# internal = Internal TLSv1 implementation (experimental)
|
||||
# linux = Linux kernel AF_ALG and internal TLSv1 implementation (experimental)
|
||||
# none = Empty template
|
||||
CONFIG_TLS=internal
|
||||
|
||||
# TLS-based EAP methods require at least TLS v1.0. Newer version of TLS (v1.1)
|
||||
# can be enabled to get a stronger construction of messages when block ciphers
|
||||
# are used. It should be noted that some existing TLS v1.0 -based
|
||||
# implementation may not be compatible with TLS v1.1 message (ClientHello is
|
||||
# sent prior to negotiating which version will be used)
|
||||
#CONFIG_TLSV11=y
|
||||
|
||||
# TLS-based EAP methods require at least TLS v1.0. Newer version of TLS (v1.2)
|
||||
# can be enabled to enable use of stronger crypto algorithms. It should be
|
||||
# noted that some existing TLS v1.0 -based implementation may not be compatible
|
||||
# with TLS v1.2 message (ClientHello is sent prior to negotiating which version
|
||||
# will be used)
|
||||
#CONFIG_TLSV12=y
|
||||
|
||||
# Select which ciphers to use by default with OpenSSL if the user does not
|
||||
# specify them.
|
||||
#CONFIG_TLS_DEFAULT_CIPHERS="DEFAULT:!EXP:!LOW"
|
||||
|
||||
# If CONFIG_TLS=internal is used, additional library and include paths are
|
||||
# needed for LibTomMath. Alternatively, an integrated, minimal version of
|
||||
# LibTomMath can be used. See beginning of libtommath.c for details on benefits
|
||||
# and drawbacks of this option.
|
||||
CONFIG_INTERNAL_LIBTOMMATH=y
|
||||
#ifndef CONFIG_INTERNAL_LIBTOMMATH
|
||||
#LTM_PATH=/usr/src/libtommath-0.39
|
||||
#CFLAGS += -I$(LTM_PATH)
|
||||
#LIBS += -L$(LTM_PATH)
|
||||
#LIBS_p += -L$(LTM_PATH)
|
||||
#endif
|
||||
# At the cost of about 4 kB of additional binary size, the internal LibTomMath
|
||||
# can be configured to include faster routines for exptmod, sqr, and div to
|
||||
# speed up DH and RSA calculation considerably
|
||||
CONFIG_INTERNAL_LIBTOMMATH_FAST=y
|
||||
|
||||
# Include NDIS event processing through WMI into wpa_supplicant/wpasvc.
|
||||
# This is only for Windows builds and requires WMI-related header files and
|
||||
# WbemUuid.Lib from Platform SDK even when building with MinGW.
|
||||
#CONFIG_NDIS_EVENTS_INTEGRATED=y
|
||||
#PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib"
|
||||
|
||||
# Add support for old DBus control interface
|
||||
# (fi.epitest.hostap.WPASupplicant)
|
||||
#CONFIG_CTRL_IFACE_DBUS=y
|
||||
|
||||
# Add support for new DBus control interface
|
||||
# (fi.w1.hostap.wpa_supplicant1)
|
||||
#CONFIG_CTRL_IFACE_DBUS_NEW=y
|
||||
|
||||
# Add introspection support for new DBus control interface
|
||||
#CONFIG_CTRL_IFACE_DBUS_INTRO=y
|
||||
|
||||
# Add support for loading EAP methods dynamically as shared libraries.
|
||||
# When this option is enabled, each EAP method can be either included
|
||||
# statically (CONFIG_EAP_<method>=y) or dynamically (CONFIG_EAP_<method>=dyn).
|
||||
# Dynamic EAP methods are build as shared objects (eap_*.so) and they need to
|
||||
# be loaded in the beginning of the wpa_supplicant configuration file
|
||||
# (see load_dynamic_eap parameter in the example file) before being used in
|
||||
# the network blocks.
|
||||
#
|
||||
# Note that some shared parts of EAP methods are included in the main program
|
||||
# and in order to be able to use dynamic EAP methods using these parts, the
|
||||
# main program must have been build with the EAP method enabled (=y or =dyn).
|
||||
# This means that EAP-TLS/PEAP/TTLS/FAST cannot be added as dynamic libraries
|
||||
# unless at least one of them was included in the main build to force inclusion
|
||||
# of the shared code. Similarly, at least one of EAP-SIM/AKA must be included
|
||||
# in the main build to be able to load these methods dynamically.
|
||||
#
|
||||
# Please also note that using dynamic libraries will increase the total binary
|
||||
# size. Thus, it may not be the best option for targets that have limited
|
||||
# amount of memory/flash.
|
||||
#CONFIG_DYNAMIC_EAP_METHODS=y
|
||||
|
||||
# IEEE Std 802.11r-2008 (Fast BSS Transition) for station mode
|
||||
#CONFIG_IEEE80211R=y
|
||||
|
||||
# IEEE Std 802.11r-2008 (Fast BSS Transition) for AP mode (implies
|
||||
# CONFIG_IEEE80211R).
|
||||
#CONFIG_IEEE80211R_AP=y
|
||||
|
||||
# Add support for writing debug log to a file (/tmp/wpa_supplicant-log-#.txt)
|
||||
#CONFIG_DEBUG_FILE=y
|
||||
|
||||
# Send debug messages to syslog instead of stdout
|
||||
#CONFIG_DEBUG_SYSLOG=y
|
||||
# Set syslog facility for debug messages
|
||||
#CONFIG_DEBUG_SYSLOG_FACILITY=LOG_DAEMON
|
||||
|
||||
# Add support for sending all debug messages (regardless of debug verbosity)
|
||||
# to the Linux kernel tracing facility. This helps debug the entire stack by
|
||||
# making it easy to record everything happening from the driver up into the
|
||||
# same file, e.g., using trace-cmd.
|
||||
#CONFIG_DEBUG_LINUX_TRACING=y
|
||||
|
||||
# Add support for writing debug log to Android logcat instead of standard
|
||||
# output
|
||||
#CONFIG_ANDROID_LOG=y
|
||||
|
||||
# Enable privilege separation (see README 'Privilege separation' for details)
|
||||
#CONFIG_PRIVSEP=y
|
||||
|
||||
# Enable mitigation against certain attacks against TKIP by delaying Michael
|
||||
# MIC error reports by a random amount of time between 0 and 60 seconds
|
||||
#CONFIG_DELAYED_MIC_ERROR_REPORT=y
|
||||
|
||||
# Enable tracing code for developer debugging
|
||||
# This tracks use of memory allocations and other registrations and reports
|
||||
# incorrect use with a backtrace of call (or allocation) location.
|
||||
#CONFIG_WPA_TRACE=y
|
||||
# For BSD, uncomment these.
|
||||
#LIBS += -lexecinfo
|
||||
#LIBS_p += -lexecinfo
|
||||
#LIBS_c += -lexecinfo
|
||||
|
||||
# Use libbfd to get more details for developer debugging
|
||||
# This enables use of libbfd to get more detailed symbols for the backtraces
|
||||
# generated by CONFIG_WPA_TRACE=y.
|
||||
#CONFIG_WPA_TRACE_BFD=y
|
||||
# For BSD, uncomment these.
|
||||
#LIBS += -lbfd -liberty -lz
|
||||
#LIBS_p += -lbfd -liberty -lz
|
||||
#LIBS_c += -lbfd -liberty -lz
|
||||
|
||||
# wpa_supplicant depends on strong random number generation being available
|
||||
# from the operating system. os_get_random() function is used to fetch random
|
||||
# data when needed, e.g., for key generation. On Linux and BSD systems, this
|
||||
# works by reading /dev/urandom. It should be noted that the OS entropy pool
|
||||
# needs to be properly initialized before wpa_supplicant is started. This is
|
||||
# important especially on embedded devices that do not have a hardware random
|
||||
# number generator and may by default start up with minimal entropy available
|
||||
# for random number generation.
|
||||
#
|
||||
# As a safety net, wpa_supplicant is by default trying to internally collect
|
||||
# additional entropy for generating random data to mix in with the data fetched
|
||||
# from the OS. This by itself is not considered to be very strong, but it may
|
||||
# help in cases where the system pool is not initialized properly. However, it
|
||||
# is very strongly recommended that the system pool is initialized with enough
|
||||
# entropy either by using hardware assisted random number generator or by
|
||||
# storing state over device reboots.
|
||||
#
|
||||
# wpa_supplicant can be configured to maintain its own entropy store over
|
||||
# restarts to enhance random number generation. This is not perfect, but it is
|
||||
# much more secure than using the same sequence of random numbers after every
|
||||
# reboot. This can be enabled with -e<entropy file> command line option. The
|
||||
# specified file needs to be readable and writable by wpa_supplicant.
|
||||
#
|
||||
# If the os_get_random() is known to provide strong random data (e.g., on
|
||||
# Linux/BSD, the board in question is known to have reliable source of random
|
||||
# data from /dev/urandom), the internal wpa_supplicant random pool can be
|
||||
# disabled. This will save some in binary size and CPU use. However, this
|
||||
# should only be considered for builds that are known to be used on devices
|
||||
# that meet the requirements described above.
|
||||
CONFIG_NO_RANDOM_POOL=y
|
||||
|
||||
# IEEE 802.11n (High Throughput) support (mainly for AP mode)
|
||||
#CONFIG_IEEE80211N=y
|
||||
|
||||
# IEEE 802.11ac (Very High Throughput) support (mainly for AP mode)
|
||||
# (depends on CONFIG_IEEE80211N)
|
||||
#CONFIG_IEEE80211AC=y
|
||||
|
||||
# Wireless Network Management (IEEE Std 802.11v-2011)
|
||||
# Note: This is experimental and not complete implementation.
|
||||
#CONFIG_WNM=y
|
||||
|
||||
# Interworking (IEEE 802.11u)
|
||||
# This can be used to enable functionality to improve interworking with
|
||||
# external networks (GAS/ANQP to learn more about the networks and network
|
||||
# selection based on available credentials).
|
||||
#CONFIG_INTERWORKING=y
|
||||
|
||||
# Hotspot 2.0
|
||||
#CONFIG_HS20=y
|
||||
|
||||
# Enable interface matching in wpa_supplicant
|
||||
#CONFIG_MATCH_IFACE=y
|
||||
|
||||
# Disable roaming in wpa_supplicant
|
||||
#CONFIG_NO_ROAMING=y
|
||||
|
||||
# AP mode operations with wpa_supplicant
|
||||
# This can be used for controlling AP mode operations with wpa_supplicant. It
|
||||
# should be noted that this is mainly aimed at simple cases like
|
||||
# WPA2-Personal while more complex configurations like WPA2-Enterprise with an
|
||||
# external RADIUS server can be supported with hostapd.
|
||||
CONFIG_AP=y
|
||||
|
||||
# P2P (Wi-Fi Direct)
|
||||
# This can be used to enable P2P support in wpa_supplicant. See README-P2P for
|
||||
# more information on P2P operations.
|
||||
CONFIG_P2P=y
|
||||
|
||||
# Enable TDLS support
|
||||
#CONFIG_TDLS=y
|
||||
|
||||
# Wi-Fi Direct
|
||||
# This can be used to enable Wi-Fi Direct extensions for P2P using an external
|
||||
# program to control the additional information exchanges in the messages.
|
||||
#CONFIG_WIFI_DISPLAY=y
|
||||
|
||||
# Autoscan
|
||||
# This can be used to enable automatic scan support in wpa_supplicant.
|
||||
# See wpa_supplicant.conf for more information on autoscan usage.
|
||||
#
|
||||
# Enabling directly a module will enable autoscan support.
|
||||
# For exponential module:
|
||||
#CONFIG_AUTOSCAN_EXPONENTIAL=y
|
||||
# For periodic module:
|
||||
#CONFIG_AUTOSCAN_PERIODIC=y
|
||||
|
||||
# Password (and passphrase, etc.) backend for external storage
|
||||
# These optional mechanisms can be used to add support for storing passwords
|
||||
# and other secrets in external (to wpa_supplicant) location. This allows, for
|
||||
# example, operating system specific key storage to be used
|
||||
#
|
||||
# External password backend for testing purposes (developer use)
|
||||
#CONFIG_EXT_PASSWORD_TEST=y
|
||||
|
||||
# Enable Fast Session Transfer (FST)
|
||||
#CONFIG_FST=y
|
||||
|
||||
# Enable CLI commands for FST testing
|
||||
#CONFIG_FST_TEST=y
|
||||
|
||||
# OS X builds. This is only for building eapol_test.
|
||||
#CONFIG_OSX=y
|
||||
|
||||
# Automatic Channel Selection
|
||||
# This will allow wpa_supplicant to pick the channel automatically when channel
|
||||
# is set to "0".
|
||||
#
|
||||
# TODO: Extend parser to be able to parse "channel=acs_survey" as an alternative
|
||||
# to "channel=0". This would enable us to eventually add other ACS algorithms in
|
||||
# similar way.
|
||||
#
|
||||
# Automatic selection is currently only done through initialization, later on
|
||||
# we hope to do background checks to keep us moving to more ideal channels as
|
||||
# time goes by. ACS is currently only supported through the nl80211 driver and
|
||||
# your driver must have survey dump capability that is filled by the driver
|
||||
# during scanning.
|
||||
#
|
||||
# TODO: In analogy to hostapd be able to customize the ACS survey algorithm with
|
||||
# a newly to create wpa_supplicant.conf variable acs_num_scans.
|
||||
#
|
||||
# Supported ACS drivers:
|
||||
# * ath9k
|
||||
# * ath5k
|
||||
# * ath10k
|
||||
#
|
||||
# For more details refer to:
|
||||
# http://wireless.kernel.org/en/users/Documentation/acs
|
||||
#CONFIG_ACS=y
|
||||
|
||||
# Support Multi Band Operation
|
||||
#CONFIG_MBO=y
|
||||
|
||||
# Fast Initial Link Setup (FILS) (IEEE 802.11ai)
|
||||
# Note: This is an experimental and not yet complete implementation. This
|
||||
# should not be enabled for production use.
|
||||
#CONFIG_FILS=y
|
||||
# FILS shared key authentication with PFS
|
||||
#CONFIG_FILS_SK_PFS=y
|
||||
|
||||
# Support RSN on IBSS networks
|
||||
# This is needed to be able to use mode=1 network profile with proto=RSN and
|
||||
# key_mgmt=WPA-PSK (i.e., full key management instead of WPA-None).
|
||||
CONFIG_IBSS_RSN=y
|
||||
|
||||
# External PMKSA cache control
|
||||
# This can be used to enable control interface commands that allow the current
|
||||
# PMKSA cache entries to be fetched and new entries to be added.
|
||||
#CONFIG_PMKSA_CACHE_EXTERNAL=y
|
||||
|
||||
# Mesh Networking (IEEE 802.11s)
|
||||
#CONFIG_MESH=y
|
||||
|
||||
# Background scanning modules
|
||||
# These can be used to request wpa_supplicant to perform background scanning
|
||||
# operations for roaming within an ESS (same SSID). See the bgscan parameter in
|
||||
# the wpa_supplicant.conf file for more details.
|
||||
# Periodic background scans based on signal strength
|
||||
#CONFIG_BGSCAN_SIMPLE=y
|
||||
# Learn channels used by the network and try to avoid bgscans on other
|
||||
# channels (experimental)
|
||||
#CONFIG_BGSCAN_LEARN=y
|
||||
|
||||
# Opportunistic Wireless Encryption (OWE)
|
||||
# Experimental implementation of draft-harkins-owe-07.txt
|
||||
#CONFIG_OWE=y
|
||||
11
package/network/services/hostapd/files/wps-hotplug.sh
Normal file
11
package/network/services/hostapd/files/wps-hotplug.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$ACTION" = "pressed" -a "$BUTTON" = "wps" ]; then
|
||||
cd /var/run/hostapd
|
||||
for socket in *; do
|
||||
[ -S "$socket" ] || continue
|
||||
hostapd_cli -i "$socket" wps_pbc
|
||||
done
|
||||
fi
|
||||
|
||||
return 0
|
||||
@@ -0,0 +1,39 @@
|
||||
From 6588f712220797c69dbd019daa19b82a50d92782 Mon Sep 17 00:00:00 2001
|
||||
From: Jouni Malinen <j@w1.fi>
|
||||
Date: Sun, 14 Oct 2018 19:57:22 +0300
|
||||
Subject: Reduce undesired logging of ACL rejection events from AP mode
|
||||
|
||||
When Probe Request frame handling was extended to use MAC ACL through
|
||||
ieee802_11_allowed_address(), the MSG_INFO level log print ("Station
|
||||
<addr> not allowed to authenticate") from that function ended up getting
|
||||
printed even for Probe Request frames. That was not by design and it can
|
||||
result in excessive logging and MSG_INFO level if MAC ACL is used.
|
||||
|
||||
Fix this by printing this log entry only for authentication and
|
||||
association frames. In addition, drop the priority of that log entry to
|
||||
MSG_DEBUG since this is not really an unexpected behavior in most MAC
|
||||
ACL use cases.
|
||||
|
||||
Fixes: 92eb00aec2a0 ("Extend ACL check for Probe Request frames")
|
||||
Signed-off-by: Jouni Malinen <j@w1.fi>
|
||||
---
|
||||
src/ap/ieee802_11.c | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/src/ap/ieee802_11.c
|
||||
+++ b/src/ap/ieee802_11.c
|
||||
@@ -1636,9 +1636,11 @@ ieee802_11_allowed_address(struct hostap
|
||||
is_probe_req);
|
||||
|
||||
if (res == HOSTAPD_ACL_REJECT) {
|
||||
- wpa_printf(MSG_INFO,
|
||||
- "Station " MACSTR " not allowed to authenticate",
|
||||
- MAC2STR(addr));
|
||||
+ if (!is_probe_req)
|
||||
+ wpa_printf(MSG_DEBUG,
|
||||
+ "Station " MACSTR
|
||||
+ " not allowed to authenticate",
|
||||
+ MAC2STR(addr));
|
||||
return HOSTAPD_ACL_REJECT;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
From dc1b1c8db7905639be6f4de8173e2d97bf6df90d Mon Sep 17 00:00:00 2001
|
||||
From: Jouni Malinen <j@w1.fi>
|
||||
Date: Sun, 14 Oct 2018 20:03:55 +0300
|
||||
Subject: Drop logging priority for handle_auth_cb no-STA-match messages
|
||||
|
||||
This message was printed and MSG_INFO level which would be more
|
||||
reasonable for error cases where hostapd has accepted authentication.
|
||||
However, this is not really an error case for the cases where
|
||||
authentication was rejected (e.g., due to MAC ACL). Drop this to use
|
||||
MSG_DEBUG level.
|
||||
|
||||
Signed-off-by: Jouni Malinen <j@w1.fi>
|
||||
---
|
||||
src/ap/ieee802_11.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/src/ap/ieee802_11.c
|
||||
+++ b/src/ap/ieee802_11.c
|
||||
@@ -4018,7 +4018,8 @@ static void handle_auth_cb(struct hostap
|
||||
|
||||
sta = ap_get_sta(hapd, mgmt->da);
|
||||
if (!sta) {
|
||||
- wpa_printf(MSG_INFO, "handle_auth_cb: STA " MACSTR " not found",
|
||||
+ wpa_printf(MSG_DEBUG, "handle_auth_cb: STA " MACSTR
|
||||
+ " not found",
|
||||
MAC2STR(mgmt->da));
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
From 3e34cfdff6b192fe337c6fb3f487f73e96582961 Mon Sep 17 00:00:00 2001
|
||||
From: Mathy Vanhoef <Mathy.Vanhoef@cs.kuleuven.be>
|
||||
Date: Sun, 15 Jul 2018 01:25:53 +0200
|
||||
Subject: [PATCH] WPA: Ignore unauthenticated encrypted EAPOL-Key data
|
||||
|
||||
Ignore unauthenticated encrypted EAPOL-Key data in supplicant
|
||||
processing. When using WPA2, these are frames that have the Encrypted
|
||||
flag set, but not the MIC flag.
|
||||
|
||||
When using WPA2, EAPOL-Key frames that had the Encrypted flag set but
|
||||
not the MIC flag, had their data field decrypted without first verifying
|
||||
the MIC. In case the data field was encrypted using RC4 (i.e., when
|
||||
negotiating TKIP as the pairwise cipher), this meant that
|
||||
unauthenticated but decrypted data would then be processed. An adversary
|
||||
could abuse this as a decryption oracle to recover sensitive information
|
||||
in the data field of EAPOL-Key messages (e.g., the group key).
|
||||
(CVE-2018-14526)
|
||||
|
||||
Signed-off-by: Mathy Vanhoef <Mathy.Vanhoef@cs.kuleuven.be>
|
||||
---
|
||||
src/rsn_supp/wpa.c | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
--- a/src/rsn_supp/wpa.c
|
||||
+++ b/src/rsn_supp/wpa.c
|
||||
@@ -2208,6 +2208,17 @@ int wpa_sm_rx_eapol(struct wpa_sm *sm, c
|
||||
|
||||
if ((sm->proto == WPA_PROTO_RSN || sm->proto == WPA_PROTO_OSEN) &&
|
||||
(key_info & WPA_KEY_INFO_ENCR_KEY_DATA) && mic_len) {
|
||||
+ /*
|
||||
+ * Only decrypt the Key Data field if the frame's authenticity
|
||||
+ * was verified. When using AES-SIV (FILS), the MIC flag is not
|
||||
+ * set, so this check should only be performed if mic_len != 0
|
||||
+ * which is the case in this code branch.
|
||||
+ */
|
||||
+ if (!(key_info & WPA_KEY_INFO_MIC)) {
|
||||
+ wpa_msg(sm->ctx->msg_ctx, MSG_WARNING,
|
||||
+ "WPA: Ignore EAPOL-Key with encrypted but unauthenticated data");
|
||||
+ goto out;
|
||||
+ }
|
||||
if (wpa_supplicant_decrypt_key_data(sm, key, mic_len,
|
||||
ver, key_data,
|
||||
&key_data_len))
|
||||
@@ -0,0 +1,211 @@
|
||||
From 02ae4382f45f772e3630460459eb4e5af64e71b4 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:05 -0700
|
||||
Subject: [PATCH 01/18] mesh: factor out mesh join function
|
||||
|
||||
mesh join function consitss of 2 parts which are preparing
|
||||
configurations and sending join event to driver.
|
||||
Since physical mesh join event could happen either right
|
||||
after mesh configuration is done or after CAC is done
|
||||
in case of DFS channel is used, factor out the function
|
||||
into 2 parts to reduce redundant calls.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
wpa_supplicant/mesh.c | 119 ++++++++++++++++--------------
|
||||
wpa_supplicant/mesh.h | 1 +
|
||||
wpa_supplicant/wpa_supplicant_i.h | 1 +
|
||||
3 files changed, 67 insertions(+), 54 deletions(-)
|
||||
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -364,13 +364,48 @@ void wpa_supplicant_mesh_add_scan_ie(str
|
||||
}
|
||||
|
||||
|
||||
+void wpas_join_mesh(struct wpa_supplicant *wpa_s)
|
||||
+{
|
||||
+ struct wpa_driver_mesh_join_params *params = wpa_s->mesh_params;
|
||||
+ struct wpa_ssid *ssid = wpa_s->current_ssid;
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ if (ssid->key_mgmt & WPA_KEY_MGMT_SAE) {
|
||||
+ wpa_s->pairwise_cipher = wpa_s->mesh_rsn->pairwise_cipher;
|
||||
+ wpa_s->group_cipher = wpa_s->mesh_rsn->group_cipher;
|
||||
+ wpa_s->mgmt_group_cipher = wpa_s->mesh_rsn->mgmt_group_cipher;
|
||||
+ }
|
||||
+
|
||||
+ if (wpa_s->ifmsh) {
|
||||
+ params->ies = wpa_s->ifmsh->mconf->rsn_ie;
|
||||
+ params->ie_len = wpa_s->ifmsh->mconf->rsn_ie_len;
|
||||
+ params->basic_rates = wpa_s->ifmsh->basic_rates;
|
||||
+ params->conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_HT_OP_MODE;
|
||||
+ params->conf.ht_opmode = wpa_s->ifmsh->bss[0]->iface->ht_op_mode;
|
||||
+ }
|
||||
+
|
||||
+ ret = wpa_drv_join_mesh(wpa_s, params);
|
||||
+ if (ret)
|
||||
+ wpa_msg(wpa_s, MSG_ERROR, "mesh join error=%d\n", ret);
|
||||
+
|
||||
+ /* hostapd sets the interface down until we associate */
|
||||
+ wpa_drv_set_operstate(wpa_s, 1);
|
||||
+
|
||||
+ if (!ret)
|
||||
+ wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);
|
||||
+
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
+
|
||||
int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid)
|
||||
{
|
||||
- struct wpa_driver_mesh_join_params params;
|
||||
+ struct wpa_driver_mesh_join_params *params =
|
||||
+ os_zalloc(sizeof(struct wpa_driver_mesh_join_params));
|
||||
int ret = 0;
|
||||
|
||||
- if (!ssid || !ssid->ssid || !ssid->ssid_len || !ssid->frequency) {
|
||||
+ if (!ssid || !ssid->ssid || !ssid->ssid_len || !ssid->frequency || !params) {
|
||||
ret = -ENOENT;
|
||||
goto out;
|
||||
}
|
||||
@@ -381,22 +416,22 @@ int wpa_supplicant_join_mesh(struct wpa_
|
||||
wpa_s->group_cipher = WPA_CIPHER_NONE;
|
||||
wpa_s->mgmt_group_cipher = 0;
|
||||
|
||||
- os_memset(¶ms, 0, sizeof(params));
|
||||
- params.meshid = ssid->ssid;
|
||||
- params.meshid_len = ssid->ssid_len;
|
||||
- ibss_mesh_setup_freq(wpa_s, ssid, ¶ms.freq);
|
||||
- wpa_s->mesh_ht_enabled = !!params.freq.ht_enabled;
|
||||
- wpa_s->mesh_vht_enabled = !!params.freq.vht_enabled;
|
||||
- if (params.freq.ht_enabled && params.freq.sec_channel_offset)
|
||||
- ssid->ht40 = params.freq.sec_channel_offset;
|
||||
+ params->meshid = ssid->ssid;
|
||||
+ params->meshid_len = ssid->ssid_len;
|
||||
+ ibss_mesh_setup_freq(wpa_s, ssid, ¶ms->freq);
|
||||
+ wpa_s->mesh_ht_enabled = !!params->freq.ht_enabled;
|
||||
+ wpa_s->mesh_vht_enabled = !!params->freq.vht_enabled;
|
||||
+ if (params->freq.ht_enabled && params->freq.sec_channel_offset)
|
||||
+ ssid->ht40 = params->freq.sec_channel_offset;
|
||||
+
|
||||
if (wpa_s->mesh_vht_enabled) {
|
||||
ssid->vht = 1;
|
||||
- switch (params.freq.bandwidth) {
|
||||
+ switch (params->freq.bandwidth) {
|
||||
case 80:
|
||||
- if (params.freq.center_freq2) {
|
||||
+ if (params->freq.center_freq2) {
|
||||
ssid->max_oper_chwidth = VHT_CHANWIDTH_80P80MHZ;
|
||||
ssid->vht_center_freq2 =
|
||||
- params.freq.center_freq2;
|
||||
+ params->freq.center_freq2;
|
||||
} else {
|
||||
ssid->max_oper_chwidth = VHT_CHANWIDTH_80MHZ;
|
||||
}
|
||||
@@ -410,67 +445,43 @@ int wpa_supplicant_join_mesh(struct wpa_
|
||||
}
|
||||
}
|
||||
if (ssid->beacon_int > 0)
|
||||
- params.beacon_int = ssid->beacon_int;
|
||||
+ params->beacon_int = ssid->beacon_int;
|
||||
else if (wpa_s->conf->beacon_int > 0)
|
||||
- params.beacon_int = wpa_s->conf->beacon_int;
|
||||
+ params->beacon_int = wpa_s->conf->beacon_int;
|
||||
if (ssid->dtim_period > 0)
|
||||
- params.dtim_period = ssid->dtim_period;
|
||||
+ params->dtim_period = ssid->dtim_period;
|
||||
else if (wpa_s->conf->dtim_period > 0)
|
||||
- params.dtim_period = wpa_s->conf->dtim_period;
|
||||
- params.conf.max_peer_links = wpa_s->conf->max_peer_links;
|
||||
+ params->dtim_period = wpa_s->conf->dtim_period;
|
||||
+ params->conf.max_peer_links = wpa_s->conf->max_peer_links;
|
||||
if (ssid->mesh_rssi_threshold < DEFAULT_MESH_RSSI_THRESHOLD) {
|
||||
- params.conf.rssi_threshold = ssid->mesh_rssi_threshold;
|
||||
- params.conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD;
|
||||
+ params->conf.rssi_threshold = ssid->mesh_rssi_threshold;
|
||||
+ params->conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD;
|
||||
}
|
||||
|
||||
if (ssid->key_mgmt & WPA_KEY_MGMT_SAE) {
|
||||
- params.flags |= WPA_DRIVER_MESH_FLAG_SAE_AUTH;
|
||||
- params.flags |= WPA_DRIVER_MESH_FLAG_AMPE;
|
||||
+ params->flags |= WPA_DRIVER_MESH_FLAG_SAE_AUTH;
|
||||
+ params->flags |= WPA_DRIVER_MESH_FLAG_AMPE;
|
||||
wpa_s->conf->user_mpm = 1;
|
||||
}
|
||||
|
||||
if (wpa_s->conf->user_mpm) {
|
||||
- params.flags |= WPA_DRIVER_MESH_FLAG_USER_MPM;
|
||||
- params.conf.auto_plinks = 0;
|
||||
+ params->flags |= WPA_DRIVER_MESH_FLAG_USER_MPM;
|
||||
+ params->conf.auto_plinks = 0;
|
||||
} else {
|
||||
- params.flags |= WPA_DRIVER_MESH_FLAG_DRIVER_MPM;
|
||||
- params.conf.auto_plinks = 1;
|
||||
+ params->flags |= WPA_DRIVER_MESH_FLAG_DRIVER_MPM;
|
||||
+ params->conf.auto_plinks = 1;
|
||||
}
|
||||
- params.conf.peer_link_timeout = wpa_s->conf->mesh_max_inactivity;
|
||||
+ params->conf.peer_link_timeout = wpa_s->conf->mesh_max_inactivity;
|
||||
|
||||
- if (wpa_supplicant_mesh_init(wpa_s, ssid, ¶ms.freq)) {
|
||||
+ wpa_s->mesh_params = params;
|
||||
+ if (wpa_supplicant_mesh_init(wpa_s, ssid, ¶ms->freq)) {
|
||||
wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh");
|
||||
wpa_drv_leave_mesh(wpa_s);
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
- if (ssid->key_mgmt & WPA_KEY_MGMT_SAE) {
|
||||
- wpa_s->pairwise_cipher = wpa_s->mesh_rsn->pairwise_cipher;
|
||||
- wpa_s->group_cipher = wpa_s->mesh_rsn->group_cipher;
|
||||
- wpa_s->mgmt_group_cipher = wpa_s->mesh_rsn->mgmt_group_cipher;
|
||||
- }
|
||||
-
|
||||
- if (wpa_s->ifmsh) {
|
||||
- params.ies = wpa_s->ifmsh->mconf->rsn_ie;
|
||||
- params.ie_len = wpa_s->ifmsh->mconf->rsn_ie_len;
|
||||
- params.basic_rates = wpa_s->ifmsh->basic_rates;
|
||||
- params.conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_HT_OP_MODE;
|
||||
- params.conf.ht_opmode = wpa_s->ifmsh->bss[0]->iface->ht_op_mode;
|
||||
- }
|
||||
-
|
||||
- wpa_msg(wpa_s, MSG_INFO, "joining mesh %s",
|
||||
- wpa_ssid_txt(ssid->ssid, ssid->ssid_len));
|
||||
- ret = wpa_drv_join_mesh(wpa_s, ¶ms);
|
||||
- if (ret)
|
||||
- wpa_msg(wpa_s, MSG_ERROR, "mesh join error=%d", ret);
|
||||
-
|
||||
- /* hostapd sets the interface down until we associate */
|
||||
- wpa_drv_set_operstate(wpa_s, 1);
|
||||
-
|
||||
- if (!ret)
|
||||
- wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);
|
||||
-
|
||||
+ wpas_join_mesh(wpa_s);
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
--- a/wpa_supplicant/mesh.h
|
||||
+++ b/wpa_supplicant/mesh.h
|
||||
@@ -21,6 +21,7 @@ int wpas_mesh_add_interface(struct wpa_s
|
||||
int wpas_mesh_peer_remove(struct wpa_supplicant *wpa_s, const u8 *addr);
|
||||
int wpas_mesh_peer_add(struct wpa_supplicant *wpa_s, const u8 *addr,
|
||||
int duration);
|
||||
+void wpas_join_mesh(struct wpa_supplicant *wpa_s);
|
||||
|
||||
#ifdef CONFIG_MESH
|
||||
|
||||
--- a/wpa_supplicant/wpa_supplicant_i.h
|
||||
+++ b/wpa_supplicant/wpa_supplicant_i.h
|
||||
@@ -810,6 +810,7 @@ struct wpa_supplicant {
|
||||
unsigned int mesh_if_created:1;
|
||||
unsigned int mesh_ht_enabled:1;
|
||||
unsigned int mesh_vht_enabled:1;
|
||||
+ struct wpa_driver_mesh_join_params *mesh_params;
|
||||
#ifdef CONFIG_PMKSA_CACHE_EXTERNAL
|
||||
/* struct external_pmksa_cache::list */
|
||||
struct dl_list mesh_external_pmksa_cache;
|
||||
@@ -0,0 +1,133 @@
|
||||
From 89db76eeff6502dfa39b011962ec9d560ed4c2ee Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:06 -0700
|
||||
Subject: [PATCH 02/18] mesh: factor out rsn initialization
|
||||
|
||||
RSN initialization can be used in different phases
|
||||
if mesh initialization and mesh join don't happen
|
||||
in sequence such as DFS CAC is done in between,
|
||||
hence factor it out to help convering the case.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
wpa_supplicant/mesh.c | 84 +++++++++++++++++++++++++------------------
|
||||
wpa_supplicant/mesh.h | 1 +
|
||||
2 files changed, 50 insertions(+), 35 deletions(-)
|
||||
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -147,6 +147,53 @@ static void wpas_mesh_copy_groups(struct
|
||||
}
|
||||
|
||||
|
||||
+int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s)
|
||||
+{
|
||||
+ struct hostapd_iface *ifmsh = wpa_s->ifmsh;
|
||||
+ struct mesh_conf *mconf = wpa_s->ifmsh->mconf;
|
||||
+ struct wpa_ssid *ssid = wpa_s->current_ssid;
|
||||
+ struct hostapd_data *bss = ifmsh->bss[0];
|
||||
+ static int default_groups[] = { 19, 20, 21, 25, 26, -1 };
|
||||
+ const char *password;
|
||||
+ size_t len;
|
||||
+
|
||||
+ if (mconf->security != MESH_CONF_SEC_NONE) {
|
||||
+ password = ssid->sae_password;
|
||||
+ if (!password)
|
||||
+ password = ssid->passphrase;
|
||||
+ if (!password) {
|
||||
+ wpa_printf(MSG_ERROR,
|
||||
+ "mesh: Passphrase for SAE not configured");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ bss->conf->wpa = ssid->proto;
|
||||
+ bss->conf->wpa_key_mgmt = ssid->key_mgmt;
|
||||
+
|
||||
+ if (wpa_s->conf->sae_groups &&
|
||||
+ wpa_s->conf->sae_groups[0] > 0) {
|
||||
+ wpas_mesh_copy_groups(bss, wpa_s);
|
||||
+ } else {
|
||||
+ bss->conf->sae_groups =
|
||||
+ os_memdup(default_groups,
|
||||
+ sizeof(default_groups));
|
||||
+ if (!bss->conf->sae_groups)
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ len = os_strlen(password);
|
||||
+ bss->conf->ssid.wpa_passphrase =
|
||||
+ dup_binstr(password, len);
|
||||
+
|
||||
+ wpa_s->mesh_rsn = mesh_rsn_auth_init(wpa_s, mconf);
|
||||
+ if (!wpa_s->mesh_rsn)
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid,
|
||||
struct hostapd_freq_params *freq)
|
||||
@@ -156,9 +203,6 @@ static int wpa_supplicant_mesh_init(stru
|
||||
struct hostapd_config *conf;
|
||||
struct mesh_conf *mconf;
|
||||
int basic_rates_erp[] = { 10, 20, 55, 60, 110, 120, 240, -1 };
|
||||
- static int default_groups[] = { 19, 20, 21, 25, 26, -1 };
|
||||
- const char *password;
|
||||
- size_t len;
|
||||
int rate_len;
|
||||
int frequency;
|
||||
|
||||
@@ -292,38 +336,8 @@ static int wpa_supplicant_mesh_init(stru
|
||||
return -1;
|
||||
}
|
||||
|
||||
- if (mconf->security != MESH_CONF_SEC_NONE) {
|
||||
- password = ssid->sae_password;
|
||||
- if (!password)
|
||||
- password = ssid->passphrase;
|
||||
- if (!password) {
|
||||
- wpa_printf(MSG_ERROR,
|
||||
- "mesh: Passphrase for SAE not configured");
|
||||
- goto out_free;
|
||||
- }
|
||||
-
|
||||
- bss->conf->wpa = ssid->proto;
|
||||
- bss->conf->wpa_key_mgmt = ssid->key_mgmt;
|
||||
-
|
||||
- if (wpa_s->conf->sae_groups &&
|
||||
- wpa_s->conf->sae_groups[0] > 0) {
|
||||
- wpas_mesh_copy_groups(bss, wpa_s);
|
||||
- } else {
|
||||
- bss->conf->sae_groups =
|
||||
- os_memdup(default_groups,
|
||||
- sizeof(default_groups));
|
||||
- if (!bss->conf->sae_groups)
|
||||
- goto out_free;
|
||||
- }
|
||||
-
|
||||
- len = os_strlen(password);
|
||||
- bss->conf->ssid.wpa_passphrase =
|
||||
- dup_binstr(password, len);
|
||||
-
|
||||
- wpa_s->mesh_rsn = mesh_rsn_auth_init(wpa_s, mconf);
|
||||
- if (!wpa_s->mesh_rsn)
|
||||
- goto out_free;
|
||||
- }
|
||||
+ if (wpas_mesh_init_rsn(wpa_s))
|
||||
+ goto out_free;
|
||||
|
||||
wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf);
|
||||
|
||||
--- a/wpa_supplicant/mesh.h
|
||||
+++ b/wpa_supplicant/mesh.h
|
||||
@@ -22,6 +22,7 @@ int wpas_mesh_peer_remove(struct wpa_sup
|
||||
int wpas_mesh_peer_add(struct wpa_supplicant *wpa_s, const u8 *addr,
|
||||
int duration);
|
||||
void wpas_join_mesh(struct wpa_supplicant *wpa_s);
|
||||
+int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s);
|
||||
|
||||
#ifdef CONFIG_MESH
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
From 07bad5f256cbe8a4b45d32c5b43b870ee815fb42 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:07 -0700
|
||||
Subject: [PATCH 03/18] mesh: relocate RSN init function
|
||||
|
||||
RSN init function should work together with mesh join
|
||||
when it's used. Since mesh join could be called at different stage
|
||||
if DFS channel is used, relocate the function to mesh join.
|
||||
It is still the same call flows of mesh join before this changes
|
||||
if non-DFS channels are used, hence no side effect will occur.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
wpa_supplicant/mesh.c | 9 ++++++---
|
||||
1 file changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -336,9 +336,6 @@ static int wpa_supplicant_mesh_init(stru
|
||||
return -1;
|
||||
}
|
||||
|
||||
- if (wpas_mesh_init_rsn(wpa_s))
|
||||
- goto out_free;
|
||||
-
|
||||
wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf);
|
||||
|
||||
return 0;
|
||||
@@ -384,6 +381,12 @@ void wpas_join_mesh(struct wpa_supplican
|
||||
struct wpa_ssid *ssid = wpa_s->current_ssid;
|
||||
int ret = 0;
|
||||
|
||||
+ if (wpas_mesh_init_rsn(wpa_s)) {
|
||||
+ wpa_printf(MSG_ERROR, "Init RSN failed. Deinit mesh...");
|
||||
+ wpa_supplicant_mesh_deinit(wpa_s);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if (ssid->key_mgmt & WPA_KEY_MGMT_SAE) {
|
||||
wpa_s->pairwise_cipher = wpa_s->mesh_rsn->pairwise_cipher;
|
||||
wpa_s->group_cipher = wpa_s->mesh_rsn->group_cipher;
|
||||
@@ -0,0 +1,73 @@
|
||||
From bd05de484bfa61def530d717c7234381f6b33cf7 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:08 -0700
|
||||
Subject: [PATCH 04/18] mesh: use setup completion callback to complete mesh
|
||||
join
|
||||
|
||||
mesh join function is the last function to be called during
|
||||
mesh join process, but it's been called a bit earlier than
|
||||
it's supposed to be, so that some mesh parameter values
|
||||
such as VHT capabilities not applied correct when mesh join
|
||||
is in process. Moreover current design of mesh join that is called
|
||||
directly after mesh initialization is not suitable for DFS channels
|
||||
to use, since mesh join process should be paused until DFS CAC is
|
||||
done and resumed once it's done.
|
||||
Using setup completion callback is how AP mode is using for DFS channels
|
||||
and mesh can use the same way.
|
||||
The callback will be called by hostapd_setup_interface_complete_sync.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
wpa_supplicant/mesh.c | 7 +++++--
|
||||
wpa_supplicant/mesh.h | 2 +-
|
||||
2 files changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -217,6 +217,7 @@ static int wpa_supplicant_mesh_init(stru
|
||||
if (!ifmsh)
|
||||
return -ENOMEM;
|
||||
|
||||
+ ifmsh->owner = wpa_s;
|
||||
ifmsh->drv_flags = wpa_s->drv_flags;
|
||||
ifmsh->num_bss = 1;
|
||||
ifmsh->bss = os_calloc(wpa_s->ifmsh->num_bss,
|
||||
@@ -234,6 +235,8 @@ static int wpa_supplicant_mesh_init(stru
|
||||
bss->drv_priv = wpa_s->drv_priv;
|
||||
bss->iface = ifmsh;
|
||||
bss->mesh_sta_free_cb = mesh_mpm_free_sta;
|
||||
+ bss->setup_complete_cb = wpas_mesh_complete_cb;
|
||||
+ bss->setup_complete_cb_ctx = wpa_s;
|
||||
frequency = ssid->frequency;
|
||||
if (frequency != freq->freq &&
|
||||
frequency == freq->freq + freq->sec_channel_offset * 20) {
|
||||
@@ -375,8 +378,9 @@ void wpa_supplicant_mesh_add_scan_ie(str
|
||||
}
|
||||
|
||||
|
||||
-void wpas_join_mesh(struct wpa_supplicant *wpa_s)
|
||||
+void wpas_mesh_complete_cb(void *ctx)
|
||||
{
|
||||
+ struct wpa_supplicant *wpa_s = (struct wpa_supplicant *)ctx;
|
||||
struct wpa_driver_mesh_join_params *params = wpa_s->mesh_params;
|
||||
struct wpa_ssid *ssid = wpa_s->current_ssid;
|
||||
int ret = 0;
|
||||
@@ -498,7 +502,6 @@ int wpa_supplicant_join_mesh(struct wpa_
|
||||
goto out;
|
||||
}
|
||||
|
||||
- wpas_join_mesh(wpa_s);
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
--- a/wpa_supplicant/mesh.h
|
||||
+++ b/wpa_supplicant/mesh.h
|
||||
@@ -21,7 +21,7 @@ int wpas_mesh_add_interface(struct wpa_s
|
||||
int wpas_mesh_peer_remove(struct wpa_supplicant *wpa_s, const u8 *addr);
|
||||
int wpas_mesh_peer_add(struct wpa_supplicant *wpa_s, const u8 *addr,
|
||||
int duration);
|
||||
-void wpas_join_mesh(struct wpa_supplicant *wpa_s);
|
||||
+void wpas_mesh_complete_cb(void *ctx);
|
||||
int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s);
|
||||
|
||||
#ifdef CONFIG_MESH
|
||||
@@ -0,0 +1,35 @@
|
||||
From dbe9afab3b2dceb35d478ac43dfcf8fdc5e23a22 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:09 -0700
|
||||
Subject: [PATCH 05/18] mesh: reflect country setting to mesh configuration
|
||||
|
||||
wpa_supplicant configuration has country parameter that is
|
||||
supposed to be used in AP mode to indicate supporting 802.11h
|
||||
and 802.11d. Reflect this configuration to Mesh also since Mesh
|
||||
is required to support 802.11h and 802.11d to use DFS channels.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
[daniel@makrotopia.org: adapted to changed ieee80211_is_dfs prototype]
|
||||
---
|
||||
wpa_supplicant/mesh.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -255,6 +255,15 @@ static int wpa_supplicant_mesh_init(stru
|
||||
bss->conf->start_disabled = 1;
|
||||
bss->conf->mesh = MESH_ENABLED;
|
||||
bss->conf->ap_max_inactivity = wpa_s->conf->mesh_max_inactivity;
|
||||
+
|
||||
+ if (ieee80211_is_dfs(ssid->frequency, wpa_s->hw.modes,
|
||||
+ wpa_s->hw.num_modes) && wpa_s->conf->country[0]) {
|
||||
+ conf->ieee80211h = 1;
|
||||
+ conf->ieee80211d = 1;
|
||||
+ conf->country[0] = wpa_s->conf->country[0];
|
||||
+ conf->country[1] = wpa_s->conf->country[1];
|
||||
+ }
|
||||
+
|
||||
bss->iconf = conf;
|
||||
ifmsh->conf = conf;
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
From 51e759da5026b3e64f801135b5d53f2198bbd2f0 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:10 -0700
|
||||
Subject: [PATCH 06/18] mesh: inform kernel driver DFS handler in userspace
|
||||
|
||||
NL80211_ATTR_HANDLE_DFS is required by kerenel space
|
||||
to enable DFS channels that indicates DFS handler
|
||||
resides in userspace.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
src/drivers/driver.h | 1 +
|
||||
src/drivers/driver_nl80211.c | 3 +++
|
||||
wpa_supplicant/mesh.c | 1 +
|
||||
3 files changed, 5 insertions(+)
|
||||
|
||||
--- a/src/drivers/driver.h
|
||||
+++ b/src/drivers/driver.h
|
||||
@@ -1390,6 +1390,7 @@ struct wpa_driver_mesh_join_params {
|
||||
#define WPA_DRIVER_MESH_FLAG_SAE_AUTH 0x00000004
|
||||
#define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008
|
||||
unsigned int flags;
|
||||
+ u8 handle_dfs;
|
||||
};
|
||||
|
||||
/**
|
||||
--- a/src/drivers/driver_nl80211.c
|
||||
+++ b/src/drivers/driver_nl80211.c
|
||||
@@ -9270,6 +9270,9 @@ static int nl80211_join_mesh(struct i802
|
||||
|
||||
wpa_printf(MSG_DEBUG, " * flags=%08X", params->flags);
|
||||
|
||||
+ if (params->handle_dfs)
|
||||
+ if (nla_put_flag(msg, NL80211_ATTR_HANDLE_DFS))
|
||||
+ goto fail;
|
||||
container = nla_nest_start(msg, NL80211_ATTR_MESH_SETUP);
|
||||
if (!container)
|
||||
goto fail;
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -262,6 +262,7 @@ static int wpa_supplicant_mesh_init(stru
|
||||
conf->ieee80211d = 1;
|
||||
conf->country[0] = wpa_s->conf->country[0];
|
||||
conf->country[1] = wpa_s->conf->country[1];
|
||||
+ wpa_s->mesh_params->handle_dfs = 1;
|
||||
}
|
||||
|
||||
bss->iconf = conf;
|
||||
@@ -0,0 +1,33 @@
|
||||
From bdc77efe681d5b88f3256e2bb6e706d4eaf09518 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:11 -0700
|
||||
Subject: [PATCH 07/18] mesh: apply channel attributes before running Mesh
|
||||
|
||||
This helps mesh interface initializes with correct
|
||||
channel parameters.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
wpa_supplicant/mesh.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -338,6 +338,8 @@ static int wpa_supplicant_mesh_init(stru
|
||||
conf->basic_rates[rate_len] = -1;
|
||||
}
|
||||
|
||||
+ wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf);
|
||||
+
|
||||
if (hostapd_setup_interface(ifmsh)) {
|
||||
wpa_printf(MSG_ERROR,
|
||||
"Failed to initialize hostapd interface for mesh");
|
||||
@@ -349,8 +351,6 @@ static int wpa_supplicant_mesh_init(stru
|
||||
return -1;
|
||||
}
|
||||
|
||||
- wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf);
|
||||
-
|
||||
return 0;
|
||||
out_free:
|
||||
wpa_supplicant_mesh_deinit(wpa_s);
|
||||
@@ -0,0 +1,36 @@
|
||||
From eb9888ba41faaeb8fd07392ad46808b7d894cc14 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:12 -0700
|
||||
Subject: [PATCH 08/18] mesh: set interface type to mesh before setting
|
||||
interface
|
||||
|
||||
Correct interface type is required to start DFS CAC that can be
|
||||
triggered during interface setup.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
wpa_supplicant/mesh.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -340,14 +340,14 @@ static int wpa_supplicant_mesh_init(stru
|
||||
|
||||
wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf);
|
||||
|
||||
- if (hostapd_setup_interface(ifmsh)) {
|
||||
- wpa_printf(MSG_ERROR,
|
||||
- "Failed to initialize hostapd interface for mesh");
|
||||
+ if (wpa_drv_init_mesh(wpa_s)) {
|
||||
+ wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh in driver");
|
||||
return -1;
|
||||
}
|
||||
|
||||
- if (wpa_drv_init_mesh(wpa_s)) {
|
||||
- wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh in driver");
|
||||
+ if (hostapd_setup_interface(ifmsh)) {
|
||||
+ wpa_printf(MSG_ERROR,
|
||||
+ "Failed to initialize hostapd interface for mesh");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
From fa3af966032267e618b19bbf06a536ddb81ddbdf Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:13 -0700
|
||||
Subject: [PATCH 09/18] mesh: set mesh center frequency
|
||||
|
||||
vht center frequency value is required to compose the correct channel info.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
wpa_supplicant/mesh.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -457,6 +457,7 @@ int wpa_supplicant_join_mesh(struct wpa_
|
||||
|
||||
if (wpa_s->mesh_vht_enabled) {
|
||||
ssid->vht = 1;
|
||||
+ ssid->vht_center_freq1 = params->freq.center_freq1;
|
||||
switch (params->freq.bandwidth) {
|
||||
case 80:
|
||||
if (params->freq.center_freq2) {
|
||||
@@ -0,0 +1,176 @@
|
||||
From 9a8ca54a264a2820af614043e7af853166b320b0 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:14 -0700
|
||||
Subject: [PATCH 10/18] mesh: consider mesh interface on dfs event handler
|
||||
|
||||
Once mesh starts supporting DFS channels, it has to handle DFS related events
|
||||
from drivers, hence add mesh interface to the check list.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
|
||||
---
|
||||
wpa_supplicant/ap.c | 71 ++++++++++++++++++++++++++++++-----------
|
||||
wpa_supplicant/events.c | 7 ++--
|
||||
2 files changed, 57 insertions(+), 21 deletions(-)
|
||||
|
||||
--- a/wpa_supplicant/ap.c
|
||||
+++ b/wpa_supplicant/ap.c
|
||||
@@ -1337,13 +1337,18 @@ int ap_ctrl_iface_chanswitch(struct wpa_
|
||||
void wpas_ap_ch_switch(struct wpa_supplicant *wpa_s, int freq, int ht,
|
||||
int offset, int width, int cf1, int cf2)
|
||||
{
|
||||
- if (!wpa_s->ap_iface)
|
||||
- return;
|
||||
+ struct hostapd_iface *iface = wpa_s->ap_iface;
|
||||
|
||||
+ if (!wpa_s->ap_iface) {
|
||||
+ if (!wpa_s->ifmsh)
|
||||
+ return;
|
||||
+ else
|
||||
+ iface = wpa_s->ifmsh;
|
||||
+ }
|
||||
wpa_s->assoc_freq = freq;
|
||||
if (wpa_s->current_ssid)
|
||||
wpa_s->current_ssid->frequency = freq;
|
||||
- hostapd_event_ch_switch(wpa_s->ap_iface->bss[0], freq, ht,
|
||||
+ hostapd_event_ch_switch(iface->bss[0], freq, ht,
|
||||
offset, width, cf1, cf2);
|
||||
}
|
||||
|
||||
@@ -1540,10 +1545,16 @@ int wpas_ap_pmksa_cache_add_external(str
|
||||
void wpas_ap_event_dfs_radar_detected(struct wpa_supplicant *wpa_s,
|
||||
struct dfs_event *radar)
|
||||
{
|
||||
- if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
|
||||
- return;
|
||||
+ struct hostapd_iface *iface = wpa_s->ap_iface;
|
||||
+
|
||||
+ if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
|
||||
+ if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
|
||||
+ return;
|
||||
+ else
|
||||
+ iface = wpa_s->ifmsh;
|
||||
+ }
|
||||
wpa_printf(MSG_DEBUG, "DFS radar detected on %d MHz", radar->freq);
|
||||
- hostapd_dfs_radar_detected(wpa_s->ap_iface, radar->freq,
|
||||
+ hostapd_dfs_radar_detected(iface, radar->freq,
|
||||
radar->ht_enabled, radar->chan_offset,
|
||||
radar->chan_width,
|
||||
radar->cf1, radar->cf2);
|
||||
@@ -1553,10 +1564,16 @@ void wpas_ap_event_dfs_radar_detected(st
|
||||
void wpas_ap_event_dfs_cac_started(struct wpa_supplicant *wpa_s,
|
||||
struct dfs_event *radar)
|
||||
{
|
||||
- if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
|
||||
- return;
|
||||
+ struct hostapd_iface *iface = wpa_s->ap_iface;
|
||||
+
|
||||
+ if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
|
||||
+ if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
|
||||
+ return;
|
||||
+ else
|
||||
+ iface = wpa_s->ifmsh;
|
||||
+ }
|
||||
wpa_printf(MSG_DEBUG, "DFS CAC started on %d MHz", radar->freq);
|
||||
- hostapd_dfs_start_cac(wpa_s->ap_iface, radar->freq,
|
||||
+ hostapd_dfs_start_cac(iface, radar->freq,
|
||||
radar->ht_enabled, radar->chan_offset,
|
||||
radar->chan_width, radar->cf1, radar->cf2);
|
||||
}
|
||||
@@ -1565,10 +1582,16 @@ void wpas_ap_event_dfs_cac_started(struc
|
||||
void wpas_ap_event_dfs_cac_finished(struct wpa_supplicant *wpa_s,
|
||||
struct dfs_event *radar)
|
||||
{
|
||||
- if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
|
||||
- return;
|
||||
+ struct hostapd_iface *iface = wpa_s->ap_iface;
|
||||
+
|
||||
+ if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
|
||||
+ if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
|
||||
+ return;
|
||||
+ else
|
||||
+ iface = wpa_s->ifmsh;
|
||||
+ }
|
||||
wpa_printf(MSG_DEBUG, "DFS CAC finished on %d MHz", radar->freq);
|
||||
- hostapd_dfs_complete_cac(wpa_s->ap_iface, 1, radar->freq,
|
||||
+ hostapd_dfs_complete_cac(iface, 1, radar->freq,
|
||||
radar->ht_enabled, radar->chan_offset,
|
||||
radar->chan_width, radar->cf1, radar->cf2);
|
||||
}
|
||||
@@ -1577,10 +1600,16 @@ void wpas_ap_event_dfs_cac_finished(stru
|
||||
void wpas_ap_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s,
|
||||
struct dfs_event *radar)
|
||||
{
|
||||
- if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
|
||||
- return;
|
||||
+ struct hostapd_iface *iface = wpa_s->ap_iface;
|
||||
+
|
||||
+ if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
|
||||
+ if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
|
||||
+ return;
|
||||
+ else
|
||||
+ iface = wpa_s->ifmsh;
|
||||
+ }
|
||||
wpa_printf(MSG_DEBUG, "DFS CAC aborted on %d MHz", radar->freq);
|
||||
- hostapd_dfs_complete_cac(wpa_s->ap_iface, 0, radar->freq,
|
||||
+ hostapd_dfs_complete_cac(iface, 0, radar->freq,
|
||||
radar->ht_enabled, radar->chan_offset,
|
||||
radar->chan_width, radar->cf1, radar->cf2);
|
||||
}
|
||||
@@ -1589,10 +1618,16 @@ void wpas_ap_event_dfs_cac_aborted(struc
|
||||
void wpas_ap_event_dfs_cac_nop_finished(struct wpa_supplicant *wpa_s,
|
||||
struct dfs_event *radar)
|
||||
{
|
||||
- if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
|
||||
- return;
|
||||
+ struct hostapd_iface *iface = wpa_s->ap_iface;
|
||||
+
|
||||
+ if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
|
||||
+ if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
|
||||
+ return;
|
||||
+ else
|
||||
+ iface = wpa_s->ifmsh;
|
||||
+ }
|
||||
wpa_printf(MSG_DEBUG, "DFS NOP finished on %d MHz", radar->freq);
|
||||
- hostapd_dfs_nop_finished(wpa_s->ap_iface, radar->freq,
|
||||
+ hostapd_dfs_nop_finished(iface, radar->freq,
|
||||
radar->ht_enabled, radar->chan_offset,
|
||||
radar->chan_width, radar->cf1, radar->cf2);
|
||||
}
|
||||
--- a/wpa_supplicant/events.c
|
||||
+++ b/wpa_supplicant/events.c
|
||||
@@ -3802,7 +3802,7 @@ static void wpas_event_dfs_cac_started(s
|
||||
struct dfs_event *radar)
|
||||
{
|
||||
#if defined(NEED_AP_MLME) && defined(CONFIG_AP)
|
||||
- if (wpa_s->ap_iface) {
|
||||
+ if (wpa_s->ap_iface || wpa_s->ifmsh) {
|
||||
wpas_ap_event_dfs_cac_started(wpa_s, radar);
|
||||
} else
|
||||
#endif /* NEED_AP_MLME && CONFIG_AP */
|
||||
@@ -3823,7 +3823,7 @@ static void wpas_event_dfs_cac_finished(
|
||||
struct dfs_event *radar)
|
||||
{
|
||||
#if defined(NEED_AP_MLME) && defined(CONFIG_AP)
|
||||
- if (wpa_s->ap_iface) {
|
||||
+ if (wpa_s->ap_iface || wpa_s->ifmsh) {
|
||||
wpas_ap_event_dfs_cac_finished(wpa_s, radar);
|
||||
} else
|
||||
#endif /* NEED_AP_MLME && CONFIG_AP */
|
||||
@@ -3839,7 +3839,7 @@ static void wpas_event_dfs_cac_aborted(s
|
||||
struct dfs_event *radar)
|
||||
{
|
||||
#if defined(NEED_AP_MLME) && defined(CONFIG_AP)
|
||||
- if (wpa_s->ap_iface) {
|
||||
+ if (wpa_s->ap_iface || wpa_s->ifmsh) {
|
||||
wpas_ap_event_dfs_cac_aborted(wpa_s, radar);
|
||||
} else
|
||||
#endif /* NEED_AP_MLME && CONFIG_AP */
|
||||
@@ -4278,6 +4278,7 @@ void wpa_supplicant_event(void *ctx, enu
|
||||
#ifdef CONFIG_AP
|
||||
if (wpa_s->current_ssid->mode == WPAS_MODE_AP ||
|
||||
wpa_s->current_ssid->mode == WPAS_MODE_P2P_GO ||
|
||||
+ wpa_s->current_ssid->mode == WPAS_MODE_MESH ||
|
||||
wpa_s->current_ssid->mode ==
|
||||
WPAS_MODE_P2P_GROUP_FORMATION) {
|
||||
wpas_ap_ch_switch(wpa_s, data->ch_switch.freq,
|
||||
@@ -0,0 +1,79 @@
|
||||
From ce3e491e445ebea9705e76ac7ee3d4841ace1cad Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 17 Apr 2018 21:55:08 -0700
|
||||
Subject: [PATCH 11/16] mesh: Allow DFS channels to be selected if dfs is
|
||||
enabled
|
||||
|
||||
Note: DFS is assumed to be usable if a country code has been set
|
||||
|
||||
Signed-off-by: Benjamin Berg <benjamin@sipsolutions.net>
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
wpa_supplicant/wpa_supplicant.c | 24 ++++++++++++++++++------
|
||||
1 file changed, 18 insertions(+), 6 deletions(-)
|
||||
|
||||
--- a/wpa_supplicant/wpa_supplicant.c
|
||||
+++ b/wpa_supplicant/wpa_supplicant.c
|
||||
@@ -2060,6 +2060,8 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
struct hostapd_freq_params vht_freq;
|
||||
int chwidth, seg0, seg1;
|
||||
u32 vht_caps = 0;
|
||||
+ int dfs_enabled = wpa_s->conf->country[0] &&
|
||||
+ (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR);
|
||||
|
||||
freq->freq = ssid->frequency;
|
||||
|
||||
@@ -2136,8 +2138,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
return;
|
||||
|
||||
/* Check primary channel flags */
|
||||
- if (pri_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
|
||||
+ if (pri_chan->flag & HOSTAPD_CHAN_DISABLED)
|
||||
return;
|
||||
+ if (pri_chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR))
|
||||
+ if (!dfs_enabled)
|
||||
+ return;
|
||||
|
||||
#ifdef CONFIG_HT_OVERRIDES
|
||||
if (ssid->disable_ht40)
|
||||
@@ -2163,8 +2168,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
return;
|
||||
|
||||
/* Check secondary channel flags */
|
||||
- if (sec_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
|
||||
+ if (sec_chan->flag & HOSTAPD_CHAN_DISABLED)
|
||||
return;
|
||||
+ if (sec_chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR))
|
||||
+ if (!dfs_enabled)
|
||||
+ return;
|
||||
|
||||
freq->channel = pri_chan->chan;
|
||||
|
||||
@@ -2254,8 +2262,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
return;
|
||||
|
||||
/* Back to HT configuration if channel not usable */
|
||||
- if (chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
|
||||
+ if (chan->flag & HOSTAPD_CHAN_DISABLED)
|
||||
return;
|
||||
+ if (chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR))
|
||||
+ if (!dfs_enabled)
|
||||
+ return;
|
||||
}
|
||||
|
||||
chwidth = VHT_CHANWIDTH_80MHZ;
|
||||
@@ -2275,10 +2286,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
if (!chan)
|
||||
continue;
|
||||
|
||||
- if (chan->flag & (HOSTAPD_CHAN_DISABLED |
|
||||
- HOSTAPD_CHAN_NO_IR |
|
||||
- HOSTAPD_CHAN_RADAR))
|
||||
+ if (chan->flag & HOSTAPD_CHAN_DISABLED)
|
||||
continue;
|
||||
+ if (chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR))
|
||||
+ if (!dfs_enabled)
|
||||
+ continue;
|
||||
|
||||
/* Found a suitable second segment for 80+80 */
|
||||
chwidth = VHT_CHANWIDTH_80P80MHZ;
|
||||
@@ -0,0 +1,25 @@
|
||||
From 4a8245ec2e9d48e464488477a3e7ed234009c216 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:16 -0700
|
||||
Subject: [PATCH 12/18] mesh: allow mesh to send channel switch request
|
||||
|
||||
add mesh type to nl80211 channel switch request,
|
||||
so mesh is able to send the request to kernel drivers.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
src/drivers/driver_nl80211.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/src/drivers/driver_nl80211.c
|
||||
+++ b/src/drivers/driver_nl80211.c
|
||||
@@ -8685,7 +8685,8 @@ static int nl80211_switch_channel(void *
|
||||
}
|
||||
|
||||
if ((drv->nlmode != NL80211_IFTYPE_AP) &&
|
||||
- (drv->nlmode != NL80211_IFTYPE_P2P_GO))
|
||||
+ (drv->nlmode != NL80211_IFTYPE_P2P_GO) &&
|
||||
+ (drv->nlmode != NL80211_IFTYPE_MESH_POINT) )
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
/*
|
||||
@@ -0,0 +1,27 @@
|
||||
From 267395271c1a36b54ef21070acff2cadce241035 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:17 -0700
|
||||
Subject: [PATCH 13/18] mesh: do not allow pri/sec channel switch
|
||||
|
||||
We don't want mesh to switch the channel from primary to secondary,
|
||||
since mesh points are not able to join each other in that case.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
wpa_supplicant/mesh.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -337,7 +337,10 @@ static int wpa_supplicant_mesh_init(stru
|
||||
rate_len * sizeof(int));
|
||||
conf->basic_rates[rate_len] = -1;
|
||||
}
|
||||
-
|
||||
+ /* Do not allow primary/secondary channel switch in mesh mode,
|
||||
+ * since mesh is not able to establish a physical link for it
|
||||
+ */
|
||||
+ conf->no_pri_sec_switch = 1;
|
||||
wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf);
|
||||
|
||||
if (wpa_drv_init_mesh(wpa_s)) {
|
||||
@@ -0,0 +1,24 @@
|
||||
From cf2ba81fb307f3e87e13896f9dbf93c0c2a9eb92 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 17 Apr 2018 21:55:11 -0700
|
||||
Subject: [PATCH 14/16] mesh: do not allow scan result to swap pri/sec
|
||||
|
||||
Swapping between primary and secondary channel will break
|
||||
mesh from joining, hence don't allow it.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
wpa_supplicant/wpa_supplicant.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/wpa_supplicant/wpa_supplicant.c
|
||||
+++ b/wpa_supplicant/wpa_supplicant.c
|
||||
@@ -2185,7 +2185,7 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
}
|
||||
freq->sec_channel_offset = ht40;
|
||||
|
||||
- if (obss_scan) {
|
||||
+ if (ssid->mode != WPAS_MODE_MESH && obss_scan) {
|
||||
struct wpa_scan_results *scan_res;
|
||||
|
||||
scan_res = wpa_supplicant_get_scan_results(wpa_s, NULL, 0);
|
||||
@@ -0,0 +1,49 @@
|
||||
From 9423e8be0393e82c8622806a0529e47fd5583c0b Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:19 -0700
|
||||
Subject: [PATCH 15/18] mesh: do not use offchan mgmt tx on DFS
|
||||
|
||||
Drivers don't allow mesh to use offchannel on management Tx.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
[daniel@makrotopia.org: adapted to changed ieee80211_is_dfs prototype]
|
||||
---
|
||||
src/drivers/driver_nl80211.c | 12 ++++++++++--
|
||||
1 file changed, 10 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/src/drivers/driver_nl80211.c
|
||||
+++ b/src/drivers/driver_nl80211.c
|
||||
@@ -7165,6 +7165,10 @@ static int wpa_driver_nl80211_send_actio
|
||||
struct wpa_driver_nl80211_data *drv = bss->drv;
|
||||
int ret = -1;
|
||||
u8 *buf;
|
||||
+ int offchanok = 1;
|
||||
+ u16 num_modes, flags;
|
||||
+ struct hostapd_hw_modes *modes;
|
||||
+ u8 dfs_domain;
|
||||
struct ieee80211_hdr *hdr;
|
||||
|
||||
wpa_printf(MSG_DEBUG, "nl80211: Send Action frame (ifindex=%d, "
|
||||
@@ -7189,7 +7193,11 @@ static int wpa_driver_nl80211_send_actio
|
||||
} else {
|
||||
os_memset(bss->rand_addr, 0, ETH_ALEN);
|
||||
}
|
||||
-
|
||||
+ if (is_mesh_interface(drv->nlmode) &&
|
||||
+ (modes = nl80211_get_hw_feature_data(bss, &num_modes, &flags,
|
||||
+ &dfs_domain)) &&
|
||||
+ ieee80211_is_dfs(freq, modes, num_modes))
|
||||
+ offchanok = 0;
|
||||
if (is_ap_interface(drv->nlmode) &&
|
||||
(!(drv->capa.flags & WPA_DRIVER_FLAGS_OFFCHANNEL_TX) ||
|
||||
(int) freq == bss->freq || drv->device_ap_sme ||
|
||||
@@ -7201,7 +7209,7 @@ static int wpa_driver_nl80211_send_actio
|
||||
ret = nl80211_send_frame_cmd(bss, freq, wait_time, buf,
|
||||
24 + data_len,
|
||||
&drv->send_action_cookie,
|
||||
- no_cck, 0, 1, NULL, 0);
|
||||
+ no_cck, 0, offchanok, NULL, 0);
|
||||
|
||||
os_free(buf);
|
||||
return ret;
|
||||
@@ -0,0 +1,64 @@
|
||||
From fa9d565fe8841b288f29137c23a7ab2584dd9510 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:20 -0700
|
||||
Subject: [PATCH 16/18] mesh: fix channel switch error during CAC
|
||||
|
||||
Mesh interface has used its channel parameters that configured
|
||||
during its initialization even after channel switched due to
|
||||
DFS radar detection during CAC which caused channel switch error.
|
||||
This change fixes the error by updating its channel parameters
|
||||
when channel's been changed from initial one.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
[daniel@makrotopia.org: added hw_features_common.h include]
|
||||
---
|
||||
wpa_supplicant/mesh.c | 25 +++++++++++++++++++++++++
|
||||
1 file changed, 25 insertions(+)
|
||||
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "utils/common.h"
|
||||
#include "utils/eloop.h"
|
||||
#include "utils/uuid.h"
|
||||
+#include "common/hw_features_common.h"
|
||||
#include "common/ieee802_11_defs.h"
|
||||
#include "common/wpa_ctrl.h"
|
||||
#include "ap/sta_info.h"
|
||||
@@ -394,10 +395,35 @@ void wpa_supplicant_mesh_add_scan_ie(str
|
||||
void wpas_mesh_complete_cb(void *ctx)
|
||||
{
|
||||
struct wpa_supplicant *wpa_s = (struct wpa_supplicant *)ctx;
|
||||
+ struct hostapd_iface *ifmsh = wpa_s->ifmsh;
|
||||
struct wpa_driver_mesh_join_params *params = wpa_s->mesh_params;
|
||||
struct wpa_ssid *ssid = wpa_s->current_ssid;
|
||||
int ret = 0;
|
||||
|
||||
+ /*
|
||||
+ * inspect if channel's been changed since initialized.
|
||||
+ * i.e. DFS radar detection
|
||||
+ */
|
||||
+ if (ifmsh->freq != params->freq.freq) {
|
||||
+ wpa_s->assoc_freq = ifmsh->freq;
|
||||
+ ssid->frequency = ifmsh->freq;
|
||||
+ if (hostapd_set_freq_params(¶ms->freq,
|
||||
+ ifmsh->conf->hw_mode,
|
||||
+ ifmsh->freq,
|
||||
+ ifmsh->conf->channel,
|
||||
+ ifmsh->conf->ieee80211n,
|
||||
+ ifmsh->conf->ieee80211ac,
|
||||
+ ifmsh->conf->secondary_channel,
|
||||
+ ifmsh->conf->vht_oper_chwidth,
|
||||
+ ifmsh->conf->vht_oper_centr_freq_seg0_idx,
|
||||
+ ifmsh->conf->vht_oper_centr_freq_seg1_idx,
|
||||
+ ifmsh->conf->vht_capab)) {
|
||||
+ wpa_printf(MSG_ERROR, "Error updating mesh frequency params.");
|
||||
+ wpa_supplicant_mesh_deinit(wpa_s);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (wpas_mesh_init_rsn(wpa_s)) {
|
||||
wpa_printf(MSG_ERROR, "Init RSN failed. Deinit mesh...");
|
||||
wpa_supplicant_mesh_deinit(wpa_s);
|
||||
@@ -0,0 +1,107 @@
|
||||
From d3201adfe7d2219217a07ef16ef365ad59c1a89b Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:21 -0700
|
||||
Subject: [PATCH 17/18] mesh: use right interface context to send DFS event
|
||||
messages
|
||||
|
||||
use mesh interface context to send DFS event messages when
|
||||
DFS events are on mesh interface.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
|
||||
---
|
||||
src/ap/dfs.c | 27 +++++++++++++++++++--------
|
||||
1 file changed, 19 insertions(+), 8 deletions(-)
|
||||
|
||||
--- a/src/ap/dfs.c
|
||||
+++ b/src/ap/dfs.c
|
||||
@@ -637,6 +637,17 @@ static unsigned int dfs_get_cac_time(str
|
||||
}
|
||||
|
||||
|
||||
+static void *get_message_ctx(struct hostapd_iface *iface)
|
||||
+{
|
||||
+#ifdef CONFIG_MESH
|
||||
+ if (iface->mconf)
|
||||
+ return iface->owner;
|
||||
+#endif /* CONFIG_MESH */
|
||||
+
|
||||
+ return iface->bss[0]->msg_ctx;
|
||||
+}
|
||||
+
|
||||
+
|
||||
/*
|
||||
* Main DFS handler
|
||||
* 1 - continue channel/ap setup
|
||||
@@ -719,7 +730,7 @@ int hostapd_handle_dfs(struct hostapd_if
|
||||
/* Finally start CAC */
|
||||
hostapd_set_state(iface, HAPD_IFACE_DFS);
|
||||
wpa_printf(MSG_DEBUG, "DFS start CAC on %d MHz", iface->freq);
|
||||
- wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START
|
||||
+ wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_CAC_START
|
||||
"freq=%d chan=%d sec_chan=%d, width=%d, seg0=%d, seg1=%d, cac_time=%ds",
|
||||
iface->freq,
|
||||
iface->conf->channel, iface->conf->secondary_channel,
|
||||
@@ -768,7 +779,7 @@ int hostapd_dfs_complete_cac(struct host
|
||||
int ht_enabled, int chan_offset, int chan_width,
|
||||
int cf1, int cf2)
|
||||
{
|
||||
- wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_COMPLETED
|
||||
+ wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_CAC_COMPLETED
|
||||
"success=%d freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d",
|
||||
success, freq, ht_enabled, chan_offset, chan_width, cf1, cf2);
|
||||
|
||||
@@ -810,7 +821,7 @@ int hostapd_dfs_pre_cac_expired(struct h
|
||||
int ht_enabled, int chan_offset, int chan_width,
|
||||
int cf1, int cf2)
|
||||
{
|
||||
- wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_PRE_CAC_EXPIRED
|
||||
+ wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_PRE_CAC_EXPIRED
|
||||
"freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d",
|
||||
freq, ht_enabled, chan_offset, chan_width, cf1, cf2);
|
||||
|
||||
@@ -848,7 +859,7 @@ static int hostapd_dfs_start_channel_swi
|
||||
|
||||
wpa_printf(MSG_DEBUG, "DFS will switch to a new channel %d",
|
||||
channel->chan);
|
||||
- wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NEW_CHANNEL
|
||||
+ wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_NEW_CHANNEL
|
||||
"freq=%d chan=%d sec_chan=%d", channel->freq,
|
||||
channel->chan, secondary_channel);
|
||||
|
||||
@@ -935,7 +946,7 @@ static int hostapd_dfs_start_channel_swi
|
||||
|
||||
wpa_printf(MSG_DEBUG, "DFS will switch to a new channel %d",
|
||||
channel->chan);
|
||||
- wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NEW_CHANNEL
|
||||
+ wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_NEW_CHANNEL
|
||||
"freq=%d chan=%d sec_chan=%d", channel->freq,
|
||||
channel->chan, secondary_channel);
|
||||
|
||||
@@ -997,7 +1008,7 @@ int hostapd_dfs_radar_detected(struct ho
|
||||
{
|
||||
int res;
|
||||
|
||||
- wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_RADAR_DETECTED
|
||||
+ wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_RADAR_DETECTED
|
||||
"freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d",
|
||||
freq, ht_enabled, chan_offset, chan_width, cf1, cf2);
|
||||
|
||||
@@ -1028,7 +1039,7 @@ int hostapd_dfs_nop_finished(struct host
|
||||
int ht_enabled, int chan_offset, int chan_width,
|
||||
int cf1, int cf2)
|
||||
{
|
||||
- wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NOP_FINISHED
|
||||
+ wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_NOP_FINISHED
|
||||
"freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d",
|
||||
freq, ht_enabled, chan_offset, chan_width, cf1, cf2);
|
||||
|
||||
@@ -1078,7 +1089,7 @@ int hostapd_dfs_start_cac(struct hostapd
|
||||
int ht_enabled, int chan_offset, int chan_width,
|
||||
int cf1, int cf2)
|
||||
{
|
||||
- wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START
|
||||
+ wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_CAC_START
|
||||
"freq=%d chan=%d chan_offset=%d width=%d seg0=%d "
|
||||
"seg1=%d cac_time=%ds",
|
||||
freq, (freq - 5000) / 5, chan_offset, chan_width, cf1, cf2, 60);
|
||||
@@ -0,0 +1,219 @@
|
||||
From 9a01d7f21bd33725dc33325a437c3cc4185ee8bd Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Wed, 18 Apr 2018 19:24:31 +0200
|
||||
Subject: [PATCH 16/16] mesh: make forwarding configurable
|
||||
|
||||
Allow mesh_fwding to be specified in a mesh bss config, pass that
|
||||
to the driver (only nl80211 implemented for now) and announce
|
||||
forwarding capability accordingly.
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
---
|
||||
src/ap/ap_config.h | 2 ++
|
||||
src/drivers/driver.h | 2 ++
|
||||
src/drivers/driver_nl80211.c | 3 +++
|
||||
wpa_supplicant/config.c | 4 ++++
|
||||
wpa_supplicant/config.h | 9 +++++++++
|
||||
wpa_supplicant/config_file.c | 4 ++++
|
||||
wpa_supplicant/config_ssid.h | 5 +++++
|
||||
wpa_supplicant/mesh.c | 6 ++++++
|
||||
wpa_supplicant/mesh_mpm.c | 4 ++--
|
||||
wpa_supplicant/wpa_supplicant.conf | 3 +++
|
||||
10 files changed, 40 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/src/ap/ap_config.h
|
||||
+++ b/src/ap/ap_config.h
|
||||
@@ -49,6 +49,7 @@ struct mesh_conf {
|
||||
int dot11MeshRetryTimeout; /* msec */
|
||||
int dot11MeshConfirmTimeout; /* msec */
|
||||
int dot11MeshHoldingTimeout; /* msec */
|
||||
+ int mesh_fwding;
|
||||
};
|
||||
|
||||
#define MAX_STA_COUNT 2007
|
||||
@@ -624,6 +625,7 @@ struct hostapd_bss_config {
|
||||
|
||||
#define MESH_ENABLED BIT(0)
|
||||
int mesh;
|
||||
+ int mesh_fwding;
|
||||
|
||||
u8 radio_measurements[RRM_CAPABILITIES_IE_LEN];
|
||||
|
||||
--- a/src/drivers/driver.h
|
||||
+++ b/src/drivers/driver.h
|
||||
@@ -1363,6 +1363,7 @@ struct wpa_driver_mesh_bss_params {
|
||||
#define WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS 0x00000004
|
||||
#define WPA_DRIVER_MESH_CONF_FLAG_HT_OP_MODE 0x00000008
|
||||
#define WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD 0x00000010
|
||||
+#define WPA_DRIVER_MESH_CONF_FLAG_FORWARDING 0x00000020
|
||||
/*
|
||||
* TODO: Other mesh configuration parameters would go here.
|
||||
* See NL80211_MESHCONF_* for all the mesh config parameters.
|
||||
@@ -1372,6 +1373,7 @@ struct wpa_driver_mesh_bss_params {
|
||||
int peer_link_timeout;
|
||||
int max_peer_links;
|
||||
int rssi_threshold;
|
||||
+ int forwarding;
|
||||
u16 ht_opmode;
|
||||
};
|
||||
|
||||
--- a/src/drivers/driver_nl80211.c
|
||||
+++ b/src/drivers/driver_nl80211.c
|
||||
@@ -9228,6 +9228,9 @@ static int nl80211_put_mesh_config(struc
|
||||
if (((params->flags & WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS) &&
|
||||
nla_put_u8(msg, NL80211_MESHCONF_AUTO_OPEN_PLINKS,
|
||||
params->auto_plinks)) ||
|
||||
+ ((params->flags & WPA_DRIVER_MESH_CONF_FLAG_FORWARDING) &&
|
||||
+ nla_put_u8(msg, NL80211_MESHCONF_FORWARDING,
|
||||
+ params->forwarding)) ||
|
||||
((params->flags & WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS) &&
|
||||
nla_put_u16(msg, NL80211_MESHCONF_MAX_PEER_LINKS,
|
||||
params->max_peer_links)) ||
|
||||
--- a/wpa_supplicant/config.c
|
||||
+++ b/wpa_supplicant/config.c
|
||||
@@ -2212,6 +2212,7 @@ static const struct parse_data ssid_fiel
|
||||
#ifdef CONFIG_MESH
|
||||
{ INT_RANGE(mode, 0, 5) },
|
||||
{ INT_RANGE(no_auto_peer, 0, 1) },
|
||||
+ { INT_RANGE(mesh_fwding, 0, 1) },
|
||||
{ INT_RANGE(mesh_rssi_threshold, -255, 1) },
|
||||
#else /* CONFIG_MESH */
|
||||
{ INT_RANGE(mode, 0, 4) },
|
||||
@@ -2763,6 +2764,7 @@ void wpa_config_set_network_defaults(str
|
||||
ssid->dot11MeshRetryTimeout = DEFAULT_MESH_RETRY_TIMEOUT;
|
||||
ssid->dot11MeshConfirmTimeout = DEFAULT_MESH_CONFIRM_TIMEOUT;
|
||||
ssid->dot11MeshHoldingTimeout = DEFAULT_MESH_HOLDING_TIMEOUT;
|
||||
+ ssid->mesh_fwding = DEFAULT_MESH_FWDING;
|
||||
ssid->mesh_rssi_threshold = DEFAULT_MESH_RSSI_THRESHOLD;
|
||||
#endif /* CONFIG_MESH */
|
||||
#ifdef CONFIG_HT_OVERRIDES
|
||||
@@ -3978,6 +3980,7 @@ struct wpa_config * wpa_config_alloc_emp
|
||||
config->user_mpm = DEFAULT_USER_MPM;
|
||||
config->max_peer_links = DEFAULT_MAX_PEER_LINKS;
|
||||
config->mesh_max_inactivity = DEFAULT_MESH_MAX_INACTIVITY;
|
||||
+ config->mesh_fwding = DEFAULT_MESH_FWDING;
|
||||
config->dot11RSNASAERetransPeriod =
|
||||
DEFAULT_DOT11_RSNA_SAE_RETRANS_PERIOD;
|
||||
config->fast_reauth = DEFAULT_FAST_REAUTH;
|
||||
@@ -4600,6 +4603,7 @@ static const struct global_parse_data gl
|
||||
{ INT(user_mpm), 0 },
|
||||
{ INT_RANGE(max_peer_links, 0, 255), 0 },
|
||||
{ INT(mesh_max_inactivity), 0 },
|
||||
+ { INT_RANGE(mesh_fwding, 0, 1), 0 },
|
||||
{ INT(dot11RSNASAERetransPeriod), 0 },
|
||||
#endif /* CONFIG_MESH */
|
||||
{ INT(disable_scan_offload), 0 },
|
||||
--- a/wpa_supplicant/config.h
|
||||
+++ b/wpa_supplicant/config.h
|
||||
@@ -18,6 +18,7 @@
|
||||
#define DEFAULT_USER_MPM 1
|
||||
#define DEFAULT_MAX_PEER_LINKS 99
|
||||
#define DEFAULT_MESH_MAX_INACTIVITY 300
|
||||
+#define DEFAULT_MESH_FWDING 1
|
||||
/*
|
||||
* The default dot11RSNASAERetransPeriod is defined as 40 ms in the standard,
|
||||
* but use 1000 ms in practice to avoid issues on low power CPUs.
|
||||
@@ -1306,6 +1307,14 @@ struct wpa_config {
|
||||
int mesh_max_inactivity;
|
||||
|
||||
/**
|
||||
+ * mesh_fwding - Mesh network layer-2 forwarding
|
||||
+ *
|
||||
+ * This controls whether to enable layer-2 forwarding.
|
||||
+ * By default: 1: enabled
|
||||
+ */
|
||||
+ int mesh_fwding;
|
||||
+
|
||||
+ /**
|
||||
* dot11RSNASAERetransPeriod - Timeout to retransmit SAE Auth frame
|
||||
*
|
||||
* This timeout value is used in mesh STA to retransmit
|
||||
--- a/wpa_supplicant/config_file.c
|
||||
+++ b/wpa_supplicant/config_file.c
|
||||
@@ -818,6 +818,7 @@ static void wpa_config_write_network(FIL
|
||||
#endif /* IEEE8021X_EAPOL */
|
||||
INT(mode);
|
||||
INT(no_auto_peer);
|
||||
+ INT(mesh_fwding);
|
||||
INT(frequency);
|
||||
INT(fixed_freq);
|
||||
#ifdef CONFIG_ACS
|
||||
@@ -1450,6 +1451,9 @@ static void wpa_config_write_global(FILE
|
||||
fprintf(f, "mesh_max_inactivity=%d\n",
|
||||
config->mesh_max_inactivity);
|
||||
|
||||
+ if (config->mesh_fwding != DEFAULT_MESH_FWDING)
|
||||
+ fprintf(f, "mesh_fwding=%d\n", config->mesh_fwding);
|
||||
+
|
||||
if (config->dot11RSNASAERetransPeriod !=
|
||||
DEFAULT_DOT11_RSNA_SAE_RETRANS_PERIOD)
|
||||
fprintf(f, "dot11RSNASAERetransPeriod=%d\n",
|
||||
--- a/wpa_supplicant/config_ssid.h
|
||||
+++ b/wpa_supplicant/config_ssid.h
|
||||
@@ -500,6 +500,11 @@ struct wpa_ssid {
|
||||
int dot11MeshConfirmTimeout; /* msec */
|
||||
int dot11MeshHoldingTimeout; /* msec */
|
||||
|
||||
+ /**
|
||||
+ * Mesh network layer-2 forwarding
|
||||
+ */
|
||||
+ int mesh_fwding;
|
||||
+
|
||||
int ht;
|
||||
int ht40;
|
||||
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -121,6 +121,7 @@ static struct mesh_conf * mesh_config_cr
|
||||
conf->mesh_cc_id = 0;
|
||||
conf->mesh_sp_id = MESH_SYNC_METHOD_NEIGHBOR_OFFSET;
|
||||
conf->mesh_auth_id = (conf->security & MESH_CONF_SEC_AUTH) ? 1 : 0;
|
||||
+ conf->mesh_fwding = ssid->mesh_fwding;
|
||||
conf->dot11MeshMaxRetries = ssid->dot11MeshMaxRetries;
|
||||
conf->dot11MeshRetryTimeout = ssid->dot11MeshRetryTimeout;
|
||||
conf->dot11MeshConfirmTimeout = ssid->dot11MeshConfirmTimeout;
|
||||
@@ -256,6 +257,7 @@ static int wpa_supplicant_mesh_init(stru
|
||||
bss->conf->start_disabled = 1;
|
||||
bss->conf->mesh = MESH_ENABLED;
|
||||
bss->conf->ap_max_inactivity = wpa_s->conf->mesh_max_inactivity;
|
||||
+ bss->conf->mesh_fwding = wpa_s->conf->mesh_fwding;
|
||||
|
||||
if (ieee80211_is_dfs(ssid->frequency, wpa_s->hw.modes,
|
||||
wpa_s->hw.num_modes) && wpa_s->conf->country[0]) {
|
||||
@@ -534,6 +536,10 @@ int wpa_supplicant_join_mesh(struct wpa_
|
||||
}
|
||||
params->conf.peer_link_timeout = wpa_s->conf->mesh_max_inactivity;
|
||||
|
||||
+ /* always explicitely set forwarding to on or off for now */
|
||||
+ params->conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_FORWARDING;
|
||||
+ params->conf.forwarding = ssid->mesh_fwding;
|
||||
+
|
||||
wpa_s->mesh_params = params;
|
||||
if (wpa_supplicant_mesh_init(wpa_s, ssid, ¶ms->freq)) {
|
||||
wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh");
|
||||
--- a/wpa_supplicant/mesh_mpm.c
|
||||
+++ b/wpa_supplicant/mesh_mpm.c
|
||||
@@ -288,9 +288,9 @@ static void mesh_mpm_send_plink_action(s
|
||||
info = (bss->num_plinks > 63 ? 63 : bss->num_plinks) << 1;
|
||||
/* TODO: Add Connected to Mesh Gate/AS subfields */
|
||||
wpabuf_put_u8(buf, info);
|
||||
- /* always forwarding & accepting plinks for now */
|
||||
+ /* set forwarding & always accepting plinks for now */
|
||||
wpabuf_put_u8(buf, MESH_CAP_ACCEPT_ADDITIONAL_PEER |
|
||||
- MESH_CAP_FORWARDING);
|
||||
+ (conf->mesh_fwding ? MESH_CAP_FORWARDING : 0));
|
||||
} else { /* Peer closing frame */
|
||||
/* IE: Mesh ID */
|
||||
wpabuf_put_u8(buf, WLAN_EID_MESH_ID);
|
||||
--- a/wpa_supplicant/wpa_supplicant.conf
|
||||
+++ b/wpa_supplicant/wpa_supplicant.conf
|
||||
@@ -153,6 +153,9 @@ ap_scan=1
|
||||
# This timeout value is used in mesh STA to clean up inactive stations.
|
||||
#mesh_max_inactivity=300
|
||||
|
||||
+# Enable 802.11s layer-2 routing and forwarding
|
||||
+#mesh_fwding=1
|
||||
+
|
||||
# cert_in_cb - Whether to include a peer certificate dump in events
|
||||
# This controls whether peer certificates for authentication server and
|
||||
# its certificate chain are included in EAP peer certificate events. This is
|
||||
@@ -0,0 +1,23 @@
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Thu, 3 May 2018 12:34:31 +0200
|
||||
Subject: [PATCH] mesh: fix crash with CONFIG_TAXONOMY enabled
|
||||
|
||||
wpa_s->ifmsh needs to be allocated using hostapd_alloc_iface() instead
|
||||
of a direct call to os_zalloc, otherwise the linked list for station
|
||||
taxonomy items remains uninitialized, leading to a crash on the first
|
||||
attempt to traverse that list
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -215,7 +215,7 @@ static int wpa_supplicant_mesh_init(stru
|
||||
return 0;
|
||||
}
|
||||
|
||||
- wpa_s->ifmsh = ifmsh = os_zalloc(sizeof(*wpa_s->ifmsh));
|
||||
+ wpa_s->ifmsh = ifmsh = hostapd_alloc_iface();
|
||||
if (!ifmsh)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
From 838225f2319348e430b553fd9bb3680bd7434ae3 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Wed, 18 Apr 2018 14:14:18 -0700
|
||||
Subject: [PATCH 1/2] mesh: add VHT_CHANWIDTH_USE_HT to max_oper_chwidth
|
||||
|
||||
Channel width in VHT mode refers HT capability when
|
||||
the width goes down to below 80MHz, hence add checking
|
||||
HT channel width to its max operation channel width.
|
||||
So that mesh has capable to select bandwidth below 80Mhz.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
wpa_supplicant/config.c | 1 +
|
||||
wpa_supplicant/config_ssid.h | 1 +
|
||||
wpa_supplicant/wpa_supplicant.c | 3 +++
|
||||
3 files changed, 5 insertions(+)
|
||||
|
||||
--- a/wpa_supplicant/config.c
|
||||
+++ b/wpa_supplicant/config.c
|
||||
@@ -2802,6 +2802,7 @@ void wpa_config_set_network_defaults(str
|
||||
ssid->mka_priority = DEFAULT_PRIO_NOT_KEY_SERVER;
|
||||
#endif /* CONFIG_MACSEC */
|
||||
ssid->mac_addr = -1;
|
||||
+ ssid->max_oper_chwidth = (u8)DEFAULT_MAX_OPER_CHWIDTH;
|
||||
}
|
||||
|
||||
|
||||
--- a/wpa_supplicant/config_ssid.h
|
||||
+++ b/wpa_supplicant/config_ssid.h
|
||||
@@ -37,6 +37,7 @@
|
||||
#define DEFAULT_AMPDU_FACTOR -1 /* no change */
|
||||
#define DEFAULT_AMPDU_DENSITY -1 /* no change */
|
||||
#define DEFAULT_USER_SELECTED_SIM 1
|
||||
+#define DEFAULT_MAX_OPER_CHWIDTH -1
|
||||
|
||||
struct psk_list_entry {
|
||||
struct dl_list list;
|
||||
--- a/wpa_supplicant/wpa_supplicant.c
|
||||
+++ b/wpa_supplicant/wpa_supplicant.c
|
||||
@@ -2312,6 +2312,9 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
vht_caps |= VHT_CAP_SUPP_CHAN_WIDTH_160MHZ;
|
||||
seg0 = 114;
|
||||
}
|
||||
+ } else if (ssid->max_oper_chwidth == VHT_CHANWIDTH_USE_HT) {
|
||||
+ chwidth = VHT_CHANWIDTH_USE_HT;
|
||||
+ seg0 = vht80[j] + 2;
|
||||
}
|
||||
|
||||
if (hostapd_set_freq_params(&vht_freq, mode->mode, freq->freq,
|
||||
@@ -0,0 +1,82 @@
|
||||
From 24fc73b2470ff79cd8c92e029ca785c8e95a204c Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Wed, 18 Apr 2018 14:14:19 -0700
|
||||
Subject: [PATCH 2/2] mesh: implement use of VHT20 config in mesh mode
|
||||
|
||||
mesh in VHT mode is supposed to be able to use any bandwidth
|
||||
that 11ac supports, but we don't have a way to set VHT20
|
||||
although there are parameters that are supposed to be used.
|
||||
This patch along with the patch of
|
||||
"mesh: add VHT_CHANWIDTH_USE_HT to max_oper_chwidth" makes mesh
|
||||
available to use of any bandwidth using combination of
|
||||
existing parameters like below shown.
|
||||
|
||||
VHT80:
|
||||
default
|
||||
do not set any parameters
|
||||
VHT40:
|
||||
max_oper_chwidth = 0
|
||||
VHT20:
|
||||
max_oper_chwidth=0
|
||||
disable_ht40=1
|
||||
HT40:
|
||||
disable_vht = 1
|
||||
HT20:
|
||||
disable_ht40 = 1
|
||||
disable HT:
|
||||
disable_ht = 1
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
wpa_supplicant/wpa_supplicant.c | 18 +++++++++++++-----
|
||||
1 file changed, 13 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/wpa_supplicant/wpa_supplicant.c
|
||||
+++ b/wpa_supplicant/wpa_supplicant.c
|
||||
@@ -2144,9 +2144,15 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
if (!dfs_enabled)
|
||||
return;
|
||||
|
||||
+ freq->channel = pri_chan->chan;
|
||||
+
|
||||
#ifdef CONFIG_HT_OVERRIDES
|
||||
- if (ssid->disable_ht40)
|
||||
- return;
|
||||
+ if (ssid->disable_ht40) {
|
||||
+ if (ssid->disable_vht)
|
||||
+ return;
|
||||
+ else
|
||||
+ goto skip_ht40;
|
||||
+ }
|
||||
#endif /* CONFIG_HT_OVERRIDES */
|
||||
|
||||
/* Check/setup HT40+/HT40- */
|
||||
@@ -2174,8 +2180,6 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
if (!dfs_enabled)
|
||||
return;
|
||||
|
||||
- freq->channel = pri_chan->chan;
|
||||
-
|
||||
if (ht40 == -1) {
|
||||
if (!(pri_chan->flag & HOSTAPD_CHAN_HT40MINUS))
|
||||
return;
|
||||
@@ -2219,6 +2223,7 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
wpa_scan_results_free(scan_res);
|
||||
}
|
||||
|
||||
+skip_ht40:
|
||||
wpa_printf(MSG_DEBUG,
|
||||
"IBSS/mesh: setup freq channel %d, sec_channel_offset %d",
|
||||
freq->channel, freq->sec_channel_offset);
|
||||
@@ -2314,7 +2319,10 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
}
|
||||
} else if (ssid->max_oper_chwidth == VHT_CHANWIDTH_USE_HT) {
|
||||
chwidth = VHT_CHANWIDTH_USE_HT;
|
||||
- seg0 = vht80[j] + 2;
|
||||
+ if (ssid->disable_ht40)
|
||||
+ seg0 = 0;
|
||||
+ else
|
||||
+ seg0 = vht80[j] + 2;
|
||||
}
|
||||
|
||||
if (hostapd_set_freq_params(&vht_freq, mode->mode, freq->freq,
|
||||
@@ -0,0 +1,45 @@
|
||||
From 444adf78eeb129e415d53fcb2fa2f05b6a69abdc Mon Sep 17 00:00:00 2001
|
||||
From: Sven Eckelmann <sven.eckelmann@openmesh.com>
|
||||
Date: Mon, 7 May 2018 15:24:29 +0200
|
||||
Subject: wpa_supplicant: Fix parsing of max_oper_chwidth
|
||||
|
||||
The max_oper_chwidth is parsed in wpa_config_set as INT_RANGE (see
|
||||
ssid_fields). The actual parsing for INT_RANGE is done by
|
||||
wpa_config_parse_int which can only store the result as full integer.
|
||||
|
||||
max_oper_chwidth is stored as u8 (a single byte) in wpa_ssid. This means
|
||||
that on little endian systems, the least significant byte of the parsed
|
||||
value are really stored in the max_oper_chwidth. But on big endian system,
|
||||
the only most significant byte is stored as max_oper_chwidth. This means
|
||||
that 0 is always stored because the provided range doesn't allow any other
|
||||
value for systems with multi-byte-wide integers.
|
||||
|
||||
This also means that for common systems with 4-byte-wide integers, the
|
||||
remaining 3 bytes were written after the actual member of the struct. This
|
||||
should not have influenced the behavior of succeeding members because these
|
||||
bytes would have been part of the padding between the members on most
|
||||
systems.
|
||||
|
||||
Increasing its size to a full int fixes the write operations outside of the
|
||||
member and allows to use the max_oper_chwidth setting on big endian
|
||||
systems.
|
||||
|
||||
Fixes: 0f29bc68d18e ("IBSS/mesh: Add support for VHT80P80 configuration")
|
||||
Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
|
||||
|
||||
Forwarded: https://patchwork.ozlabs.org/patch/909751/
|
||||
---
|
||||
wpa_supplicant/config_ssid.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/wpa_supplicant/config_ssid.h
|
||||
+++ b/wpa_supplicant/config_ssid.h
|
||||
@@ -511,7 +511,7 @@ struct wpa_ssid {
|
||||
|
||||
int vht;
|
||||
|
||||
- u8 max_oper_chwidth;
|
||||
+ int max_oper_chwidth;
|
||||
|
||||
unsigned int vht_center_freq1;
|
||||
unsigned int vht_center_freq2;
|
||||
@@ -0,0 +1,104 @@
|
||||
From 2a5c291881fa819325d0287d0763776edfcb1943 Mon Sep 17 00:00:00 2001
|
||||
From: Dan Harkins <dharkins@lounge.org>
|
||||
Date: Fri, 25 May 2018 21:40:04 +0300
|
||||
Subject: [PATCH] EAP-pwd: Move EC group initialization to earlier step
|
||||
|
||||
This is needed for adding support for salted passwords.
|
||||
|
||||
Signed-off-by: Dan Harkins <dharkins@lounge.org>
|
||||
---
|
||||
src/eap_common/eap_pwd_common.c | 32 +++++++++++++++++++++++---------
|
||||
src/eap_common/eap_pwd_common.h | 1 +
|
||||
src/eap_peer/eap_pwd.c | 2 +-
|
||||
src/eap_server/eap_server_pwd.c | 2 +-
|
||||
4 files changed, 26 insertions(+), 11 deletions(-)
|
||||
|
||||
--- a/src/eap_common/eap_pwd_common.c
|
||||
+++ b/src/eap_common/eap_pwd_common.c
|
||||
@@ -81,6 +81,27 @@ static int eap_pwd_kdf(const u8 *key, si
|
||||
}
|
||||
|
||||
|
||||
+EAP_PWD_group * get_eap_pwd_group(u16 num)
|
||||
+{
|
||||
+ EAP_PWD_group *grp;
|
||||
+
|
||||
+ grp = os_zalloc(sizeof(EAP_PWD_group));
|
||||
+ if (!grp)
|
||||
+ return NULL;
|
||||
+ grp->group = crypto_ec_init(num);
|
||||
+ if (!grp->group) {
|
||||
+ wpa_printf(MSG_INFO, "EAP-pwd: unable to create EC group");
|
||||
+ os_free(grp);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ grp->group_num = num;
|
||||
+ wpa_printf(MSG_INFO, "EAP-pwd: provisioned group %d", num);
|
||||
+
|
||||
+ return grp;
|
||||
+}
|
||||
+
|
||||
+
|
||||
/*
|
||||
* compute a "random" secret point on an elliptic curve based
|
||||
* on the password and identities.
|
||||
@@ -97,12 +118,8 @@ int compute_password_element(EAP_PWD_gro
|
||||
size_t primebytelen, primebitlen;
|
||||
struct crypto_bignum *x_candidate = NULL, *rnd = NULL, *cofactor = NULL;
|
||||
|
||||
- grp->pwe = NULL;
|
||||
- grp->group = crypto_ec_init(num);
|
||||
- if (!grp->group) {
|
||||
- wpa_printf(MSG_INFO, "EAP-pwd: unable to create EC group");
|
||||
- goto fail;
|
||||
- }
|
||||
+ if (grp->pwe)
|
||||
+ return -1;
|
||||
|
||||
cofactor = crypto_bignum_init();
|
||||
grp->pwe = crypto_ec_point_init(grp->group);
|
||||
@@ -234,11 +251,8 @@ int compute_password_element(EAP_PWD_gro
|
||||
break;
|
||||
}
|
||||
wpa_printf(MSG_DEBUG, "EAP-pwd: found a PWE in %d tries", ctr);
|
||||
- grp->group_num = num;
|
||||
if (0) {
|
||||
fail:
|
||||
- crypto_ec_deinit(grp->group);
|
||||
- grp->group = NULL;
|
||||
crypto_ec_point_deinit(grp->pwe, 1);
|
||||
grp->pwe = NULL;
|
||||
ret = 1;
|
||||
--- a/src/eap_common/eap_pwd_common.h
|
||||
+++ b/src/eap_common/eap_pwd_common.h
|
||||
@@ -50,6 +50,7 @@ struct eap_pwd_id {
|
||||
} STRUCT_PACKED;
|
||||
|
||||
/* common routines */
|
||||
+EAP_PWD_group * get_eap_pwd_group(u16 num);
|
||||
int compute_password_element(EAP_PWD_group *grp, u16 num,
|
||||
const u8 *password, size_t password_len,
|
||||
const u8 *id_server, size_t id_server_len,
|
||||
--- a/src/eap_peer/eap_pwd.c
|
||||
+++ b/src/eap_peer/eap_pwd.c
|
||||
@@ -265,7 +265,7 @@ eap_pwd_perform_id_exchange(struct eap_s
|
||||
wpa_hexdump_ascii(MSG_INFO, "EAP-PWD (peer): server sent id of",
|
||||
data->id_server, data->id_server_len);
|
||||
|
||||
- data->grp = os_zalloc(sizeof(EAP_PWD_group));
|
||||
+ data->grp = get_eap_pwd_group(data->group_num);
|
||||
if (data->grp == NULL) {
|
||||
wpa_printf(MSG_INFO, "EAP-PWD: failed to allocate memory for "
|
||||
"group");
|
||||
--- a/src/eap_server/eap_server_pwd.c
|
||||
+++ b/src/eap_server/eap_server_pwd.c
|
||||
@@ -562,7 +562,7 @@ static void eap_pwd_process_id_resp(stru
|
||||
wpa_hexdump_ascii(MSG_DEBUG, "EAP-PWD (server): peer sent id of",
|
||||
data->id_peer, data->id_peer_len);
|
||||
|
||||
- data->grp = os_zalloc(sizeof(EAP_PWD_group));
|
||||
+ data->grp = get_eap_pwd_group(data->group_num);
|
||||
if (data->grp == NULL) {
|
||||
wpa_printf(MSG_INFO, "EAP-PWD: failed to allocate memory for "
|
||||
"group");
|
||||
@@ -0,0 +1,247 @@
|
||||
From 22ac3dfebf7b25a3aae02f9b4f69025bb4173137 Mon Sep 17 00:00:00 2001
|
||||
From: Dan Harkins <dharkins@lounge.org>
|
||||
Date: Fri, 25 May 2018 21:40:04 +0300
|
||||
Subject: [PATCH] EAP-pwd: Mask timing of PWE derivation
|
||||
|
||||
Run through the hunting-and-pecking loop 40 times to mask the time
|
||||
necessary to find PWE. The odds of PWE not being found in 40 loops is
|
||||
roughly 1 in 1 trillion.
|
||||
|
||||
Signed-off-by: Dan Harkins <dharkins@lounge.org>
|
||||
---
|
||||
src/eap_common/eap_pwd_common.c | 171 ++++++++++++++++++++++++--------
|
||||
1 file changed, 130 insertions(+), 41 deletions(-)
|
||||
|
||||
--- a/src/eap_common/eap_pwd_common.c
|
||||
+++ b/src/eap_common/eap_pwd_common.c
|
||||
@@ -112,18 +112,25 @@ int compute_password_element(EAP_PWD_gro
|
||||
const u8 *id_peer, size_t id_peer_len,
|
||||
const u8 *token)
|
||||
{
|
||||
+ struct crypto_bignum *qr = NULL, *qnr = NULL, *one = NULL;
|
||||
+ struct crypto_bignum *tmp1 = NULL, *tmp2 = NULL, *pm1 = NULL;
|
||||
struct crypto_hash *hash;
|
||||
unsigned char pwe_digest[SHA256_MAC_LEN], *prfbuf = NULL, ctr;
|
||||
- int is_odd, ret = 0;
|
||||
+ int is_odd, ret = 0, check, found = 0;
|
||||
size_t primebytelen, primebitlen;
|
||||
struct crypto_bignum *x_candidate = NULL, *rnd = NULL, *cofactor = NULL;
|
||||
+ const struct crypto_bignum *prime;
|
||||
|
||||
if (grp->pwe)
|
||||
return -1;
|
||||
|
||||
+ prime = crypto_ec_get_prime(grp->group);
|
||||
cofactor = crypto_bignum_init();
|
||||
grp->pwe = crypto_ec_point_init(grp->group);
|
||||
- if (!cofactor || !grp->pwe) {
|
||||
+ tmp1 = crypto_bignum_init();
|
||||
+ pm1 = crypto_bignum_init();
|
||||
+ one = crypto_bignum_init_set((const u8 *) "\x01", 1);
|
||||
+ if (!cofactor || !grp->pwe || !tmp1 || !pm1 || !one) {
|
||||
wpa_printf(MSG_INFO, "EAP-pwd: unable to create bignums");
|
||||
goto fail;
|
||||
}
|
||||
@@ -140,15 +147,36 @@ int compute_password_element(EAP_PWD_gro
|
||||
"buffer");
|
||||
goto fail;
|
||||
}
|
||||
+ if (crypto_bignum_sub(prime, one, pm1) < 0)
|
||||
+ goto fail;
|
||||
+
|
||||
+ /* get a random quadratic residue and nonresidue */
|
||||
+ while (!qr || !qnr) {
|
||||
+ int res;
|
||||
+
|
||||
+ if (crypto_bignum_rand(tmp1, prime) < 0)
|
||||
+ goto fail;
|
||||
+ res = crypto_bignum_legendre(tmp1, prime);
|
||||
+ if (!qr && res == 1) {
|
||||
+ qr = tmp1;
|
||||
+ tmp1 = crypto_bignum_init();
|
||||
+ } else if (!qnr && res == -1) {
|
||||
+ qnr = tmp1;
|
||||
+ tmp1 = crypto_bignum_init();
|
||||
+ }
|
||||
+ if (!tmp1)
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
os_memset(prfbuf, 0, primebytelen);
|
||||
ctr = 0;
|
||||
- while (1) {
|
||||
- if (ctr > 30) {
|
||||
- wpa_printf(MSG_INFO, "EAP-pwd: unable to find random "
|
||||
- "point on curve for group %d, something's "
|
||||
- "fishy", num);
|
||||
- goto fail;
|
||||
- }
|
||||
+
|
||||
+ /*
|
||||
+ * Run through the hunting-and-pecking loop 40 times to mask the time
|
||||
+ * necessary to find PWE. The odds of PWE not being found in 40 loops is
|
||||
+ * roughly 1 in 1 trillion.
|
||||
+ */
|
||||
+ while (ctr < 40) {
|
||||
ctr++;
|
||||
|
||||
/*
|
||||
@@ -199,58 +227,113 @@ int compute_password_element(EAP_PWD_gro
|
||||
x_candidate) < 0)
|
||||
goto fail;
|
||||
|
||||
- if (crypto_bignum_cmp(x_candidate,
|
||||
- crypto_ec_get_prime(grp->group)) >= 0)
|
||||
+ if (crypto_bignum_cmp(x_candidate, prime) >= 0)
|
||||
continue;
|
||||
|
||||
wpa_hexdump(MSG_DEBUG, "EAP-pwd: x_candidate",
|
||||
prfbuf, primebytelen);
|
||||
|
||||
/*
|
||||
- * need to unambiguously identify the solution, if there is
|
||||
- * one...
|
||||
+ * compute y^2 using the equation of the curve
|
||||
+ *
|
||||
+ * y^2 = x^3 + ax + b
|
||||
*/
|
||||
- is_odd = crypto_bignum_is_odd(rnd);
|
||||
+ tmp2 = crypto_ec_point_compute_y_sqr(grp->group, x_candidate);
|
||||
+ if (!tmp2)
|
||||
+ goto fail;
|
||||
|
||||
/*
|
||||
- * solve the quadratic equation, if it's not solvable then we
|
||||
- * don't have a point
|
||||
+ * mask tmp2 so doing legendre won't leak timing info
|
||||
+ *
|
||||
+ * tmp1 is a random number between 1 and p-1
|
||||
*/
|
||||
- if (crypto_ec_point_solve_y_coord(grp->group, grp->pwe,
|
||||
- x_candidate, is_odd) != 0) {
|
||||
- wpa_printf(MSG_INFO, "EAP-pwd: Could not solve for y");
|
||||
- continue;
|
||||
- }
|
||||
+ if (crypto_bignum_rand(tmp1, pm1) < 0 ||
|
||||
+ crypto_bignum_mulmod(tmp2, tmp1, prime, tmp2) < 0 ||
|
||||
+ crypto_bignum_mulmod(tmp2, tmp1, prime, tmp2) < 0)
|
||||
+ goto fail;
|
||||
+
|
||||
/*
|
||||
- * If there's a solution to the equation then the point must be
|
||||
- * on the curve so why check again explicitly? OpenSSL code
|
||||
- * says this is required by X9.62. We're not X9.62 but it can't
|
||||
- * hurt just to be sure.
|
||||
+ * Now tmp2 (y^2) is masked, all values between 1 and p-1
|
||||
+ * are equally probable. Multiplying by r^2 does not change
|
||||
+ * whether or not tmp2 is a quadratic residue, just masks it.
|
||||
+ *
|
||||
+ * Flip a coin, multiply by the random quadratic residue or the
|
||||
+ * random quadratic nonresidue and record heads or tails.
|
||||
*/
|
||||
- if (!crypto_ec_point_is_on_curve(grp->group, grp->pwe)) {
|
||||
- wpa_printf(MSG_INFO, "EAP-pwd: point is not on curve");
|
||||
- continue;
|
||||
+ if (crypto_bignum_is_odd(tmp1)) {
|
||||
+ crypto_bignum_mulmod(tmp2, qr, prime, tmp2);
|
||||
+ check = 1;
|
||||
+ } else {
|
||||
+ crypto_bignum_mulmod(tmp2, qnr, prime, tmp2);
|
||||
+ check = -1;
|
||||
}
|
||||
|
||||
- if (!crypto_bignum_is_one(cofactor)) {
|
||||
- /* make sure the point is not in a small sub-group */
|
||||
- if (crypto_ec_point_mul(grp->group, grp->pwe,
|
||||
- cofactor, grp->pwe) != 0) {
|
||||
- wpa_printf(MSG_INFO, "EAP-pwd: cannot "
|
||||
- "multiply generator by order");
|
||||
+ /*
|
||||
+ * Now it's safe to do legendre, if check is 1 then it's
|
||||
+ * a straightforward test (multiplying by qr does not
|
||||
+ * change result), if check is -1 then it's the opposite test
|
||||
+ * (multiplying a qr by qnr would make a qnr).
|
||||
+ */
|
||||
+ if (crypto_bignum_legendre(tmp2, prime) == check) {
|
||||
+ if (found == 1)
|
||||
+ continue;
|
||||
+
|
||||
+ /* need to unambiguously identify the solution */
|
||||
+ is_odd = crypto_bignum_is_odd(rnd);
|
||||
+
|
||||
+ /*
|
||||
+ * We know x_candidate is a quadratic residue so set
|
||||
+ * it here.
|
||||
+ */
|
||||
+ if (crypto_ec_point_solve_y_coord(grp->group, grp->pwe,
|
||||
+ x_candidate,
|
||||
+ is_odd) != 0) {
|
||||
+ wpa_printf(MSG_INFO,
|
||||
+ "EAP-pwd: Could not solve for y");
|
||||
continue;
|
||||
}
|
||||
- if (crypto_ec_point_is_at_infinity(grp->group,
|
||||
- grp->pwe)) {
|
||||
- wpa_printf(MSG_INFO, "EAP-pwd: point is at "
|
||||
- "infinity");
|
||||
+
|
||||
+ /*
|
||||
+ * If there's a solution to the equation then the point
|
||||
+ * must be on the curve so why check again explicitly?
|
||||
+ * OpenSSL code says this is required by X9.62. We're
|
||||
+ * not X9.62 but it can't hurt just to be sure.
|
||||
+ */
|
||||
+ if (!crypto_ec_point_is_on_curve(grp->group,
|
||||
+ grp->pwe)) {
|
||||
+ wpa_printf(MSG_INFO,
|
||||
+ "EAP-pwd: point is not on curve");
|
||||
continue;
|
||||
}
|
||||
+
|
||||
+ if (!crypto_bignum_is_one(cofactor)) {
|
||||
+ /* make sure the point is not in a small
|
||||
+ * sub-group */
|
||||
+ if (crypto_ec_point_mul(grp->group, grp->pwe,
|
||||
+ cofactor,
|
||||
+ grp->pwe) != 0) {
|
||||
+ wpa_printf(MSG_INFO,
|
||||
+ "EAP-pwd: cannot multiply generator by order");
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (crypto_ec_point_is_at_infinity(grp->group,
|
||||
+ grp->pwe)) {
|
||||
+ wpa_printf(MSG_INFO,
|
||||
+ "EAP-pwd: point is at infinity");
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+ wpa_printf(MSG_DEBUG,
|
||||
+ "EAP-pwd: found a PWE in %d tries", ctr);
|
||||
+ found = 1;
|
||||
}
|
||||
- /* if we got here then we have a new generator. */
|
||||
- break;
|
||||
}
|
||||
- wpa_printf(MSG_DEBUG, "EAP-pwd: found a PWE in %d tries", ctr);
|
||||
+ if (found == 0) {
|
||||
+ wpa_printf(MSG_INFO,
|
||||
+ "EAP-pwd: unable to find random point on curve for group %d, something's fishy",
|
||||
+ num);
|
||||
+ goto fail;
|
||||
+ }
|
||||
if (0) {
|
||||
fail:
|
||||
crypto_ec_point_deinit(grp->pwe, 1);
|
||||
@@ -261,6 +344,12 @@ int compute_password_element(EAP_PWD_gro
|
||||
crypto_bignum_deinit(cofactor, 1);
|
||||
crypto_bignum_deinit(x_candidate, 1);
|
||||
crypto_bignum_deinit(rnd, 1);
|
||||
+ crypto_bignum_deinit(pm1, 0);
|
||||
+ crypto_bignum_deinit(tmp1, 1);
|
||||
+ crypto_bignum_deinit(tmp2, 1);
|
||||
+ crypto_bignum_deinit(qr, 1);
|
||||
+ crypto_bignum_deinit(qnr, 1);
|
||||
+ crypto_bignum_deinit(one, 0);
|
||||
os_free(prfbuf);
|
||||
|
||||
return ret;
|
||||
@@ -0,0 +1,88 @@
|
||||
From d42c477cc794163a3757956bbffca5cea000923c Mon Sep 17 00:00:00 2001
|
||||
From: Jouni Malinen <jouni@codeaurora.org>
|
||||
Date: Tue, 26 Feb 2019 11:43:03 +0200
|
||||
Subject: [PATCH 01/14] OpenSSL: Use constant time operations for private
|
||||
bignums
|
||||
|
||||
This helps in reducing measurable timing differences in operations
|
||||
involving private information. BoringSSL has removed BN_FLG_CONSTTIME
|
||||
and expects specific constant time functions to be called instead, so a
|
||||
bit different approach is needed depending on which library is used.
|
||||
|
||||
The main operation that needs protection against side channel attacks is
|
||||
BN_mod_exp() that depends on private keys (the public key validation
|
||||
step in crypto_dh_derive_secret() is an exception that can use the
|
||||
faster version since it does not depend on private keys).
|
||||
|
||||
crypto_bignum_div() is currently used only in SAE FFC case with not
|
||||
safe-prime groups and only with values that do not depend on private
|
||||
keys, so it is not critical to protect it.
|
||||
|
||||
crypto_bignum_inverse() is currently used only in SAE FFC PWE
|
||||
derivation. The additional protection here is targeting only OpenSSL.
|
||||
BoringSSL may need conversion to using BN_mod_inverse_blinded().
|
||||
|
||||
This is related to CVE-2019-9494 and CVE-2019-9495.
|
||||
|
||||
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
|
||||
---
|
||||
src/crypto/crypto_openssl.c | 20 +++++++++++++++-----
|
||||
1 file changed, 15 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/src/crypto/crypto_openssl.c
|
||||
+++ b/src/crypto/crypto_openssl.c
|
||||
@@ -548,7 +548,8 @@ int crypto_mod_exp(const u8 *base, size_
|
||||
bn_result == NULL)
|
||||
goto error;
|
||||
|
||||
- if (BN_mod_exp(bn_result, bn_base, bn_exp, bn_modulus, ctx) != 1)
|
||||
+ if (BN_mod_exp_mont_consttime(bn_result, bn_base, bn_exp, bn_modulus,
|
||||
+ ctx, NULL) != 1)
|
||||
goto error;
|
||||
|
||||
*result_len = BN_bn2bin(bn_result, result);
|
||||
@@ -1294,8 +1295,9 @@ int crypto_bignum_exptmod(const struct c
|
||||
bnctx = BN_CTX_new();
|
||||
if (bnctx == NULL)
|
||||
return -1;
|
||||
- res = BN_mod_exp((BIGNUM *) d, (const BIGNUM *) a, (const BIGNUM *) b,
|
||||
- (const BIGNUM *) c, bnctx);
|
||||
+ res = BN_mod_exp_mont_consttime((BIGNUM *) d, (const BIGNUM *) a,
|
||||
+ (const BIGNUM *) b, (const BIGNUM *) c,
|
||||
+ bnctx, NULL);
|
||||
BN_CTX_free(bnctx);
|
||||
|
||||
return res ? 0 : -1;
|
||||
@@ -1314,6 +1316,11 @@ int crypto_bignum_inverse(const struct c
|
||||
bnctx = BN_CTX_new();
|
||||
if (bnctx == NULL)
|
||||
return -1;
|
||||
+#ifdef OPENSSL_IS_BORINGSSL
|
||||
+ /* TODO: use BN_mod_inverse_blinded() ? */
|
||||
+#else /* OPENSSL_IS_BORINGSSL */
|
||||
+ BN_set_flags((BIGNUM *) a, BN_FLG_CONSTTIME);
|
||||
+#endif /* OPENSSL_IS_BORINGSSL */
|
||||
res = BN_mod_inverse((BIGNUM *) c, (const BIGNUM *) a,
|
||||
(const BIGNUM *) b, bnctx);
|
||||
BN_CTX_free(bnctx);
|
||||
@@ -1347,6 +1354,9 @@ int crypto_bignum_div(const struct crypt
|
||||
bnctx = BN_CTX_new();
|
||||
if (bnctx == NULL)
|
||||
return -1;
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
+ BN_set_flags((BIGNUM *) a, BN_FLG_CONSTTIME);
|
||||
+#endif /* OPENSSL_IS_BORINGSSL */
|
||||
res = BN_div((BIGNUM *) c, NULL, (const BIGNUM *) a,
|
||||
(const BIGNUM *) b, bnctx);
|
||||
BN_CTX_free(bnctx);
|
||||
@@ -1438,8 +1448,8 @@ int crypto_bignum_legendre(const struct
|
||||
/* exp = (p-1) / 2 */
|
||||
!BN_sub(exp, (const BIGNUM *) p, BN_value_one()) ||
|
||||
!BN_rshift1(exp, exp) ||
|
||||
- !BN_mod_exp(tmp, (const BIGNUM *) a, exp, (const BIGNUM *) p,
|
||||
- bnctx))
|
||||
+ !BN_mod_exp_mont_consttime(tmp, (const BIGNUM *) a, exp,
|
||||
+ (const BIGNUM *) p, bnctx, NULL))
|
||||
goto fail;
|
||||
|
||||
if (BN_is_word(tmp, 1))
|
||||
@@ -0,0 +1,212 @@
|
||||
From 6e34f618d37ddbb5854c42e2ad4fca83492fa7b7 Mon Sep 17 00:00:00 2001
|
||||
From: Jouni Malinen <jouni@codeaurora.org>
|
||||
Date: Wed, 27 Feb 2019 18:38:30 +0200
|
||||
Subject: [PATCH 02/14] Add helper functions for constant time operations
|
||||
|
||||
These functions can be used to help implement constant time operations
|
||||
for various cryptographic operations that must minimize externally
|
||||
observable differences in processing (both in timing and also in
|
||||
internal cache use, etc.).
|
||||
|
||||
This is related to CVE-2019-9494 and CVE-2019-9495.
|
||||
|
||||
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
|
||||
---
|
||||
src/utils/const_time.h | 191 +++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 191 insertions(+)
|
||||
create mode 100644 src/utils/const_time.h
|
||||
|
||||
--- /dev/null
|
||||
+++ b/src/utils/const_time.h
|
||||
@@ -0,0 +1,191 @@
|
||||
+/*
|
||||
+ * Helper functions for constant time operations
|
||||
+ * Copyright (c) 2019, The Linux Foundation
|
||||
+ *
|
||||
+ * This software may be distributed under the terms of the BSD license.
|
||||
+ * See README for more details.
|
||||
+ *
|
||||
+ * These helper functions can be used to implement logic that needs to minimize
|
||||
+ * externally visible differences in execution path by avoiding use of branches,
|
||||
+ * avoiding early termination or other time differences, and forcing same memory
|
||||
+ * access pattern regardless of values.
|
||||
+ */
|
||||
+
|
||||
+#ifndef CONST_TIME_H
|
||||
+#define CONST_TIME_H
|
||||
+
|
||||
+
|
||||
+#if defined(__clang__)
|
||||
+#define NO_UBSAN_UINT_OVERFLOW \
|
||||
+ __attribute__((no_sanitize("unsigned-integer-overflow")))
|
||||
+#else
|
||||
+#define NO_UBSAN_UINT_OVERFLOW
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
+/**
|
||||
+ * const_time_fill_msb - Fill all bits with MSB value
|
||||
+ * @val: Input value
|
||||
+ * Returns: Value with all the bits set to the MSB of the input val
|
||||
+ */
|
||||
+static inline unsigned int const_time_fill_msb(unsigned int val)
|
||||
+{
|
||||
+ /* Move the MSB to LSB and multiple by -1 to fill in all bits. */
|
||||
+ return (val >> (sizeof(val) * 8 - 1)) * ~0U;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/* Returns: -1 if val is zero; 0 if val is not zero */
|
||||
+static inline unsigned int const_time_is_zero(unsigned int val)
|
||||
+ NO_UBSAN_UINT_OVERFLOW
|
||||
+{
|
||||
+ /* Set MSB to 1 for 0 and fill rest of bits with the MSB value */
|
||||
+ return const_time_fill_msb(~val & (val - 1));
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/* Returns: -1 if a == b; 0 if a != b */
|
||||
+static inline unsigned int const_time_eq(unsigned int a, unsigned int b)
|
||||
+{
|
||||
+ return const_time_is_zero(a ^ b);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/* Returns: -1 if a == b; 0 if a != b */
|
||||
+static inline u8 const_time_eq_u8(unsigned int a, unsigned int b)
|
||||
+{
|
||||
+ return (u8) const_time_eq(a, b);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/**
|
||||
+ * const_time_eq_bin - Constant time memory comparison
|
||||
+ * @a: First buffer to compare
|
||||
+ * @b: Second buffer to compare
|
||||
+ * @len: Number of octets to compare
|
||||
+ * Returns: -1 if buffers are equal, 0 if not
|
||||
+ *
|
||||
+ * This function is meant for comparing passwords or hash values where
|
||||
+ * difference in execution time or memory access pattern could provide external
|
||||
+ * observer information about the location of the difference in the memory
|
||||
+ * buffers. The return value does not behave like memcmp(), i.e.,
|
||||
+ * const_time_eq_bin() cannot be used to sort items into a defined order. Unlike
|
||||
+ * memcmp(), the execution time of const_time_eq_bin() does not depend on the
|
||||
+ * contents of the compared memory buffers, but only on the total compared
|
||||
+ * length.
|
||||
+ */
|
||||
+static inline unsigned int const_time_eq_bin(const void *a, const void *b,
|
||||
+ size_t len)
|
||||
+{
|
||||
+ const u8 *aa = a;
|
||||
+ const u8 *bb = b;
|
||||
+ size_t i;
|
||||
+ u8 res = 0;
|
||||
+
|
||||
+ for (i = 0; i < len; i++)
|
||||
+ res |= aa[i] ^ bb[i];
|
||||
+
|
||||
+ return const_time_is_zero(res);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/**
|
||||
+ * const_time_select - Constant time unsigned int selection
|
||||
+ * @mask: 0 (false) or -1 (true) to identify which value to select
|
||||
+ * @true_val: Value to select for the true case
|
||||
+ * @false_val: Value to select for the false case
|
||||
+ * Returns: true_val if mask == -1, false_val if mask == 0
|
||||
+ */
|
||||
+static inline unsigned int const_time_select(unsigned int mask,
|
||||
+ unsigned int true_val,
|
||||
+ unsigned int false_val)
|
||||
+{
|
||||
+ return (mask & true_val) | (~mask & false_val);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/**
|
||||
+ * const_time_select_int - Constant time int selection
|
||||
+ * @mask: 0 (false) or -1 (true) to identify which value to select
|
||||
+ * @true_val: Value to select for the true case
|
||||
+ * @false_val: Value to select for the false case
|
||||
+ * Returns: true_val if mask == -1, false_val if mask == 0
|
||||
+ */
|
||||
+static inline int const_time_select_int(unsigned int mask, int true_val,
|
||||
+ int false_val)
|
||||
+{
|
||||
+ return (int) const_time_select(mask, (unsigned int) true_val,
|
||||
+ (unsigned int) false_val);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/**
|
||||
+ * const_time_select_u8 - Constant time u8 selection
|
||||
+ * @mask: 0 (false) or -1 (true) to identify which value to select
|
||||
+ * @true_val: Value to select for the true case
|
||||
+ * @false_val: Value to select for the false case
|
||||
+ * Returns: true_val if mask == -1, false_val if mask == 0
|
||||
+ */
|
||||
+static inline u8 const_time_select_u8(u8 mask, u8 true_val, u8 false_val)
|
||||
+{
|
||||
+ return (u8) const_time_select(mask, true_val, false_val);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/**
|
||||
+ * const_time_select_s8 - Constant time s8 selection
|
||||
+ * @mask: 0 (false) or -1 (true) to identify which value to select
|
||||
+ * @true_val: Value to select for the true case
|
||||
+ * @false_val: Value to select for the false case
|
||||
+ * Returns: true_val if mask == -1, false_val if mask == 0
|
||||
+ */
|
||||
+static inline s8 const_time_select_s8(u8 mask, s8 true_val, s8 false_val)
|
||||
+{
|
||||
+ return (s8) const_time_select(mask, (unsigned int) true_val,
|
||||
+ (unsigned int) false_val);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/**
|
||||
+ * const_time_select_bin - Constant time binary buffer selection copy
|
||||
+ * @mask: 0 (false) or -1 (true) to identify which value to copy
|
||||
+ * @true_val: Buffer to copy for the true case
|
||||
+ * @false_val: Buffer to copy for the false case
|
||||
+ * @len: Number of octets to copy
|
||||
+ * @dst: Destination buffer for the copy
|
||||
+ *
|
||||
+ * This function copies the specified buffer into the destination buffer using
|
||||
+ * operations with identical memory access pattern regardless of which buffer
|
||||
+ * is being copied.
|
||||
+ */
|
||||
+static inline void const_time_select_bin(u8 mask, const u8 *true_val,
|
||||
+ const u8 *false_val, size_t len,
|
||||
+ u8 *dst)
|
||||
+{
|
||||
+ size_t i;
|
||||
+
|
||||
+ for (i = 0; i < len; i++)
|
||||
+ dst[i] = const_time_select_u8(mask, true_val[i], false_val[i]);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static inline int const_time_memcmp(const void *a, const void *b, size_t len)
|
||||
+{
|
||||
+ const u8 *aa = a;
|
||||
+ const u8 *bb = b;
|
||||
+ int diff, res = 0;
|
||||
+ unsigned int mask;
|
||||
+
|
||||
+ if (len == 0)
|
||||
+ return 0;
|
||||
+ do {
|
||||
+ len--;
|
||||
+ diff = (int) aa[len] - (int) bb[len];
|
||||
+ mask = const_time_is_zero((unsigned int) diff);
|
||||
+ res = const_time_select_int(mask, res, diff);
|
||||
+ } while (len);
|
||||
+
|
||||
+ return res;
|
||||
+}
|
||||
+
|
||||
+#endif /* CONST_TIME_H */
|
||||
@@ -0,0 +1,55 @@
|
||||
From c93461c1d98f52681717a088776ab32fd97872b0 Mon Sep 17 00:00:00 2001
|
||||
From: Jouni Malinen <jouni@codeaurora.org>
|
||||
Date: Fri, 8 Mar 2019 00:24:12 +0200
|
||||
Subject: [PATCH 03/14] OpenSSL: Use constant time selection for
|
||||
crypto_bignum_legendre()
|
||||
|
||||
Get rid of the branches that depend on the result of the Legendre
|
||||
operation. This is needed to avoid leaking information about different
|
||||
temporary results in blinding mechanisms.
|
||||
|
||||
This is related to CVE-2019-9494 and CVE-2019-9495.
|
||||
|
||||
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
|
||||
---
|
||||
src/crypto/crypto_openssl.c | 15 +++++++++------
|
||||
1 file changed, 9 insertions(+), 6 deletions(-)
|
||||
|
||||
--- a/src/crypto/crypto_openssl.c
|
||||
+++ b/src/crypto/crypto_openssl.c
|
||||
@@ -24,6 +24,7 @@
|
||||
#endif /* CONFIG_ECC */
|
||||
|
||||
#include "common.h"
|
||||
+#include "utils/const_time.h"
|
||||
#include "wpabuf.h"
|
||||
#include "dh_group5.h"
|
||||
#include "sha1.h"
|
||||
@@ -1434,6 +1435,7 @@ int crypto_bignum_legendre(const struct
|
||||
BN_CTX *bnctx;
|
||||
BIGNUM *exp = NULL, *tmp = NULL;
|
||||
int res = -2;
|
||||
+ unsigned int mask;
|
||||
|
||||
if (TEST_FAIL())
|
||||
return -2;
|
||||
@@ -1452,12 +1454,13 @@ int crypto_bignum_legendre(const struct
|
||||
(const BIGNUM *) p, bnctx, NULL))
|
||||
goto fail;
|
||||
|
||||
- if (BN_is_word(tmp, 1))
|
||||
- res = 1;
|
||||
- else if (BN_is_zero(tmp))
|
||||
- res = 0;
|
||||
- else
|
||||
- res = -1;
|
||||
+ /* Return 1 if tmp == 1, 0 if tmp == 0, or -1 otherwise. Need to use
|
||||
+ * constant time selection to avoid branches here. */
|
||||
+ res = -1;
|
||||
+ mask = const_time_eq(BN_is_word(tmp, 1), 1);
|
||||
+ res = const_time_select_int(mask, 1, res);
|
||||
+ mask = const_time_eq(BN_is_zero(tmp), 1);
|
||||
+ res = const_time_select_int(mask, 0, res);
|
||||
|
||||
fail:
|
||||
BN_clear_free(tmp);
|
||||
@@ -0,0 +1,242 @@
|
||||
From 6513db3e96c43c2e36805cf5ead349765d18eaf7 Mon Sep 17 00:00:00 2001
|
||||
From: Jouni Malinen <jouni@codeaurora.org>
|
||||
Date: Tue, 26 Feb 2019 13:05:09 +0200
|
||||
Subject: [PATCH 05/14] SAE: Minimize timing differences in PWE derivation
|
||||
|
||||
The QR test result can provide information about the password to an
|
||||
attacker, so try to minimize differences in how the
|
||||
sae_test_pwd_seed_ecc() result is used. (CVE-2019-9494)
|
||||
|
||||
Use heap memory for the dummy password to allow the same password length
|
||||
to be used even with long passwords.
|
||||
|
||||
Use constant time selection functions to track the real vs. dummy
|
||||
variables so that the exact same operations can be performed for both QR
|
||||
test results.
|
||||
|
||||
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
|
||||
---
|
||||
src/common/sae.c | 106 ++++++++++++++++++++++++++++++-------------------------
|
||||
1 file changed, 57 insertions(+), 49 deletions(-)
|
||||
|
||||
--- a/src/common/sae.c
|
||||
+++ b/src/common/sae.c
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "includes.h"
|
||||
|
||||
#include "common.h"
|
||||
+#include "utils/const_time.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "crypto/sha256.h"
|
||||
#include "crypto/random.h"
|
||||
@@ -269,15 +270,12 @@ static int sae_test_pwd_seed_ecc(struct
|
||||
const u8 *prime,
|
||||
const struct crypto_bignum *qr,
|
||||
const struct crypto_bignum *qnr,
|
||||
- struct crypto_bignum **ret_x_cand)
|
||||
+ u8 *pwd_value)
|
||||
{
|
||||
- u8 pwd_value[SAE_MAX_ECC_PRIME_LEN];
|
||||
struct crypto_bignum *y_sqr, *x_cand;
|
||||
int res;
|
||||
size_t bits;
|
||||
|
||||
- *ret_x_cand = NULL;
|
||||
-
|
||||
wpa_hexdump_key(MSG_DEBUG, "SAE: pwd-seed", pwd_seed, SHA256_MAC_LEN);
|
||||
|
||||
/* pwd-value = KDF-z(pwd-seed, "SAE Hunting and Pecking", p) */
|
||||
@@ -286,7 +284,7 @@ static int sae_test_pwd_seed_ecc(struct
|
||||
prime, sae->tmp->prime_len, pwd_value, bits) < 0)
|
||||
return -1;
|
||||
if (bits % 8)
|
||||
- buf_shift_right(pwd_value, sizeof(pwd_value), 8 - bits % 8);
|
||||
+ buf_shift_right(pwd_value, sae->tmp->prime_len, 8 - bits % 8);
|
||||
wpa_hexdump_key(MSG_DEBUG, "SAE: pwd-value",
|
||||
pwd_value, sae->tmp->prime_len);
|
||||
|
||||
@@ -297,20 +295,13 @@ static int sae_test_pwd_seed_ecc(struct
|
||||
if (!x_cand)
|
||||
return -1;
|
||||
y_sqr = crypto_ec_point_compute_y_sqr(sae->tmp->ec, x_cand);
|
||||
- if (!y_sqr) {
|
||||
- crypto_bignum_deinit(x_cand, 1);
|
||||
+ crypto_bignum_deinit(x_cand, 1);
|
||||
+ if (!y_sqr)
|
||||
return -1;
|
||||
- }
|
||||
|
||||
res = is_quadratic_residue_blind(sae, prime, bits, qr, qnr, y_sqr);
|
||||
crypto_bignum_deinit(y_sqr, 1);
|
||||
- if (res <= 0) {
|
||||
- crypto_bignum_deinit(x_cand, 1);
|
||||
- return res;
|
||||
- }
|
||||
-
|
||||
- *ret_x_cand = x_cand;
|
||||
- return 1;
|
||||
+ return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -431,25 +422,30 @@ static int sae_derive_pwe_ecc(struct sae
|
||||
const u8 *addr[3];
|
||||
size_t len[3];
|
||||
size_t num_elem;
|
||||
- u8 dummy_password[32];
|
||||
- size_t dummy_password_len;
|
||||
+ u8 *dummy_password, *tmp_password;
|
||||
int pwd_seed_odd = 0;
|
||||
u8 prime[SAE_MAX_ECC_PRIME_LEN];
|
||||
size_t prime_len;
|
||||
- struct crypto_bignum *x = NULL, *qr, *qnr;
|
||||
+ struct crypto_bignum *x = NULL, *qr = NULL, *qnr = NULL;
|
||||
+ u8 x_bin[SAE_MAX_ECC_PRIME_LEN];
|
||||
+ u8 x_cand_bin[SAE_MAX_ECC_PRIME_LEN];
|
||||
size_t bits;
|
||||
- int res;
|
||||
-
|
||||
- dummy_password_len = password_len;
|
||||
- if (dummy_password_len > sizeof(dummy_password))
|
||||
- dummy_password_len = sizeof(dummy_password);
|
||||
- if (random_get_bytes(dummy_password, dummy_password_len) < 0)
|
||||
- return -1;
|
||||
+ int res = -1;
|
||||
+ u8 found = 0; /* 0 (false) or 0xff (true) to be used as const_time_*
|
||||
+ * mask */
|
||||
+
|
||||
+ os_memset(x_bin, 0, sizeof(x_bin));
|
||||
+
|
||||
+ dummy_password = os_malloc(password_len);
|
||||
+ tmp_password = os_malloc(password_len);
|
||||
+ if (!dummy_password || !tmp_password ||
|
||||
+ random_get_bytes(dummy_password, password_len) < 0)
|
||||
+ goto fail;
|
||||
|
||||
prime_len = sae->tmp->prime_len;
|
||||
if (crypto_bignum_to_bin(sae->tmp->prime, prime, sizeof(prime),
|
||||
prime_len) < 0)
|
||||
- return -1;
|
||||
+ goto fail;
|
||||
bits = crypto_ec_prime_len_bits(sae->tmp->ec);
|
||||
|
||||
/*
|
||||
@@ -458,7 +454,7 @@ static int sae_derive_pwe_ecc(struct sae
|
||||
*/
|
||||
if (get_random_qr_qnr(prime, prime_len, sae->tmp->prime, bits,
|
||||
&qr, &qnr) < 0)
|
||||
- return -1;
|
||||
+ goto fail;
|
||||
|
||||
wpa_hexdump_ascii_key(MSG_DEBUG, "SAE: password",
|
||||
password, password_len);
|
||||
@@ -474,7 +470,7 @@ static int sae_derive_pwe_ecc(struct sae
|
||||
*/
|
||||
sae_pwd_seed_key(addr1, addr2, addrs);
|
||||
|
||||
- addr[0] = password;
|
||||
+ addr[0] = tmp_password;
|
||||
len[0] = password_len;
|
||||
num_elem = 1;
|
||||
if (identifier) {
|
||||
@@ -491,9 +487,8 @@ static int sae_derive_pwe_ecc(struct sae
|
||||
* attacks that attempt to determine the number of iterations required
|
||||
* in the loop.
|
||||
*/
|
||||
- for (counter = 1; counter <= k || !x; counter++) {
|
||||
+ for (counter = 1; counter <= k || !found; counter++) {
|
||||
u8 pwd_seed[SHA256_MAC_LEN];
|
||||
- struct crypto_bignum *x_cand;
|
||||
|
||||
if (counter > 200) {
|
||||
/* This should not happen in practice */
|
||||
@@ -501,40 +496,49 @@ static int sae_derive_pwe_ecc(struct sae
|
||||
break;
|
||||
}
|
||||
|
||||
- wpa_printf(MSG_DEBUG, "SAE: counter = %u", counter);
|
||||
+ wpa_printf(MSG_DEBUG, "SAE: counter = %03u", counter);
|
||||
+ const_time_select_bin(found, dummy_password, password,
|
||||
+ password_len, tmp_password);
|
||||
if (hmac_sha256_vector(addrs, sizeof(addrs), num_elem,
|
||||
addr, len, pwd_seed) < 0)
|
||||
break;
|
||||
|
||||
res = sae_test_pwd_seed_ecc(sae, pwd_seed,
|
||||
- prime, qr, qnr, &x_cand);
|
||||
+ prime, qr, qnr, x_cand_bin);
|
||||
+ const_time_select_bin(found, x_bin, x_cand_bin, prime_len,
|
||||
+ x_bin);
|
||||
+ pwd_seed_odd = const_time_select_u8(
|
||||
+ found, pwd_seed_odd,
|
||||
+ pwd_seed[SHA256_MAC_LEN - 1] & 0x01);
|
||||
+ os_memset(pwd_seed, 0, sizeof(pwd_seed));
|
||||
if (res < 0)
|
||||
goto fail;
|
||||
- if (res > 0 && !x) {
|
||||
- wpa_printf(MSG_DEBUG,
|
||||
- "SAE: Selected pwd-seed with counter %u",
|
||||
- counter);
|
||||
- x = x_cand;
|
||||
- pwd_seed_odd = pwd_seed[SHA256_MAC_LEN - 1] & 0x01;
|
||||
- os_memset(pwd_seed, 0, sizeof(pwd_seed));
|
||||
-
|
||||
- /*
|
||||
- * Use a dummy password for the following rounds, if
|
||||
- * any.
|
||||
- */
|
||||
- addr[0] = dummy_password;
|
||||
- len[0] = dummy_password_len;
|
||||
- } else if (res > 0) {
|
||||
- crypto_bignum_deinit(x_cand, 1);
|
||||
- }
|
||||
+ /* Need to minimize differences in handling res == 0 and 1 here
|
||||
+ * to avoid differences in timing and instruction cache access,
|
||||
+ * so use const_time_select_*() to make local copies of the
|
||||
+ * values based on whether this loop iteration was the one that
|
||||
+ * found the pwd-seed/x. */
|
||||
+
|
||||
+ /* found is 0 or 0xff here and res is 0 or 1. Bitwise OR of them
|
||||
+ * (with res converted to 0/0xff) handles this in constant time.
|
||||
+ */
|
||||
+ found |= res * 0xff;
|
||||
+ wpa_printf(MSG_DEBUG, "SAE: pwd-seed result %d found=0x%02x",
|
||||
+ res, found);
|
||||
}
|
||||
|
||||
- if (!x) {
|
||||
+ if (!found) {
|
||||
wpa_printf(MSG_DEBUG, "SAE: Could not generate PWE");
|
||||
res = -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
+ x = crypto_bignum_init_set(x_bin, prime_len);
|
||||
+ if (!x) {
|
||||
+ res = -1;
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
if (!sae->tmp->pwe_ecc)
|
||||
sae->tmp->pwe_ecc = crypto_ec_point_init(sae->tmp->ec);
|
||||
if (!sae->tmp->pwe_ecc)
|
||||
@@ -543,7 +547,6 @@ static int sae_derive_pwe_ecc(struct sae
|
||||
res = crypto_ec_point_solve_y_coord(sae->tmp->ec,
|
||||
sae->tmp->pwe_ecc, x,
|
||||
pwd_seed_odd);
|
||||
- crypto_bignum_deinit(x, 1);
|
||||
if (res < 0) {
|
||||
/*
|
||||
* This should not happen since we already checked that there
|
||||
@@ -555,6 +558,11 @@ static int sae_derive_pwe_ecc(struct sae
|
||||
fail:
|
||||
crypto_bignum_deinit(qr, 0);
|
||||
crypto_bignum_deinit(qnr, 0);
|
||||
+ os_free(dummy_password);
|
||||
+ bin_clear_free(tmp_password, password_len);
|
||||
+ crypto_bignum_deinit(x, 1);
|
||||
+ os_memset(x_bin, 0, sizeof(x_bin));
|
||||
+ os_memset(x_cand_bin, 0, sizeof(x_cand_bin));
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
From 362704dda04507e7ebb8035122e83d9f0ae7c320 Mon Sep 17 00:00:00 2001
|
||||
From: Jouni Malinen <jouni@codeaurora.org>
|
||||
Date: Tue, 26 Feb 2019 19:34:38 +0200
|
||||
Subject: [PATCH 06/14] SAE: Avoid branches in is_quadratic_residue_blind()
|
||||
|
||||
Make the non-failure path in the function proceed without branches based
|
||||
on r_odd and in constant time to minimize risk of observable differences
|
||||
in timing or cache use. (CVE-2019-9494)
|
||||
|
||||
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
|
||||
---
|
||||
src/common/sae.c | 64 ++++++++++++++++++++++++++++++++------------------------
|
||||
1 file changed, 37 insertions(+), 27 deletions(-)
|
||||
|
||||
--- a/src/common/sae.c
|
||||
+++ b/src/common/sae.c
|
||||
@@ -209,12 +209,14 @@ get_rand_1_to_p_1(const u8 *prime, size_
|
||||
|
||||
static int is_quadratic_residue_blind(struct sae_data *sae,
|
||||
const u8 *prime, size_t bits,
|
||||
- const struct crypto_bignum *qr,
|
||||
- const struct crypto_bignum *qnr,
|
||||
+ const u8 *qr, const u8 *qnr,
|
||||
const struct crypto_bignum *y_sqr)
|
||||
{
|
||||
- struct crypto_bignum *r, *num;
|
||||
+ struct crypto_bignum *r, *num, *qr_or_qnr = NULL;
|
||||
int r_odd, check, res = -1;
|
||||
+ u8 qr_or_qnr_bin[SAE_MAX_ECC_PRIME_LEN];
|
||||
+ size_t prime_len = sae->tmp->prime_len;
|
||||
+ unsigned int mask;
|
||||
|
||||
/*
|
||||
* Use the blinding technique to mask y_sqr while determining
|
||||
@@ -225,7 +227,7 @@ static int is_quadratic_residue_blind(st
|
||||
* r = a random number between 1 and p-1, inclusive
|
||||
* num = (v * r * r) modulo p
|
||||
*/
|
||||
- r = get_rand_1_to_p_1(prime, sae->tmp->prime_len, bits, &r_odd);
|
||||
+ r = get_rand_1_to_p_1(prime, prime_len, bits, &r_odd);
|
||||
if (!r)
|
||||
return -1;
|
||||
|
||||
@@ -235,41 +237,45 @@ static int is_quadratic_residue_blind(st
|
||||
crypto_bignum_mulmod(num, r, sae->tmp->prime, num) < 0)
|
||||
goto fail;
|
||||
|
||||
- if (r_odd) {
|
||||
- /*
|
||||
- * num = (num * qr) module p
|
||||
- * LGR(num, p) = 1 ==> quadratic residue
|
||||
- */
|
||||
- if (crypto_bignum_mulmod(num, qr, sae->tmp->prime, num) < 0)
|
||||
- goto fail;
|
||||
- check = 1;
|
||||
- } else {
|
||||
- /*
|
||||
- * num = (num * qnr) module p
|
||||
- * LGR(num, p) = -1 ==> quadratic residue
|
||||
- */
|
||||
- if (crypto_bignum_mulmod(num, qnr, sae->tmp->prime, num) < 0)
|
||||
- goto fail;
|
||||
- check = -1;
|
||||
- }
|
||||
+ /*
|
||||
+ * Need to minimize differences in handling different cases, so try to
|
||||
+ * avoid branches and timing differences.
|
||||
+ *
|
||||
+ * If r_odd:
|
||||
+ * num = (num * qr) module p
|
||||
+ * LGR(num, p) = 1 ==> quadratic residue
|
||||
+ * else:
|
||||
+ * num = (num * qnr) module p
|
||||
+ * LGR(num, p) = -1 ==> quadratic residue
|
||||
+ */
|
||||
+ mask = const_time_is_zero(r_odd);
|
||||
+ const_time_select_bin(mask, qnr, qr, prime_len, qr_or_qnr_bin);
|
||||
+ qr_or_qnr = crypto_bignum_init_set(qr_or_qnr_bin, prime_len);
|
||||
+ if (!qr_or_qnr ||
|
||||
+ crypto_bignum_mulmod(num, qr_or_qnr, sae->tmp->prime, num) < 0)
|
||||
+ goto fail;
|
||||
+ /* r_odd is 0 or 1; branchless version of check = r_odd ? 1 : -1, */
|
||||
+ check = const_time_select_int(mask, -1, 1);
|
||||
|
||||
res = crypto_bignum_legendre(num, sae->tmp->prime);
|
||||
if (res == -2) {
|
||||
res = -1;
|
||||
goto fail;
|
||||
}
|
||||
- res = res == check;
|
||||
+ /* branchless version of res = res == check
|
||||
+ * (res is -1, 0, or 1; check is -1 or 1) */
|
||||
+ mask = const_time_eq(res, check);
|
||||
+ res = const_time_select_int(mask, 1, 0);
|
||||
fail:
|
||||
crypto_bignum_deinit(num, 1);
|
||||
crypto_bignum_deinit(r, 1);
|
||||
+ crypto_bignum_deinit(qr_or_qnr, 1);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
static int sae_test_pwd_seed_ecc(struct sae_data *sae, const u8 *pwd_seed,
|
||||
- const u8 *prime,
|
||||
- const struct crypto_bignum *qr,
|
||||
- const struct crypto_bignum *qnr,
|
||||
+ const u8 *prime, const u8 *qr, const u8 *qnr,
|
||||
u8 *pwd_value)
|
||||
{
|
||||
struct crypto_bignum *y_sqr, *x_cand;
|
||||
@@ -429,6 +435,8 @@ static int sae_derive_pwe_ecc(struct sae
|
||||
struct crypto_bignum *x = NULL, *qr = NULL, *qnr = NULL;
|
||||
u8 x_bin[SAE_MAX_ECC_PRIME_LEN];
|
||||
u8 x_cand_bin[SAE_MAX_ECC_PRIME_LEN];
|
||||
+ u8 qr_bin[SAE_MAX_ECC_PRIME_LEN];
|
||||
+ u8 qnr_bin[SAE_MAX_ECC_PRIME_LEN];
|
||||
size_t bits;
|
||||
int res = -1;
|
||||
u8 found = 0; /* 0 (false) or 0xff (true) to be used as const_time_*
|
||||
@@ -453,7 +461,9 @@ static int sae_derive_pwe_ecc(struct sae
|
||||
* (qnr) modulo p for blinding purposes during the loop.
|
||||
*/
|
||||
if (get_random_qr_qnr(prime, prime_len, sae->tmp->prime, bits,
|
||||
- &qr, &qnr) < 0)
|
||||
+ &qr, &qnr) < 0 ||
|
||||
+ crypto_bignum_to_bin(qr, qr_bin, sizeof(qr_bin), prime_len) < 0 ||
|
||||
+ crypto_bignum_to_bin(qnr, qnr_bin, sizeof(qnr_bin), prime_len) < 0)
|
||||
goto fail;
|
||||
|
||||
wpa_hexdump_ascii_key(MSG_DEBUG, "SAE: password",
|
||||
@@ -504,7 +514,7 @@ static int sae_derive_pwe_ecc(struct sae
|
||||
break;
|
||||
|
||||
res = sae_test_pwd_seed_ecc(sae, pwd_seed,
|
||||
- prime, qr, qnr, x_cand_bin);
|
||||
+ prime, qr_bin, qnr_bin, x_cand_bin);
|
||||
const_time_select_bin(found, x_bin, x_cand_bin, prime_len,
|
||||
x_bin);
|
||||
pwd_seed_odd = const_time_select_u8(
|
||||
@@ -0,0 +1,113 @@
|
||||
From 90839597cc4016b33f00055b12d59174c62770a3 Mon Sep 17 00:00:00 2001
|
||||
From: Jouni Malinen <jouni@codeaurora.org>
|
||||
Date: Sat, 2 Mar 2019 12:24:09 +0200
|
||||
Subject: [PATCH 07/14] SAE: Mask timing of MODP groups 22, 23, 24
|
||||
|
||||
These groups have significant probability of coming up with pwd-value
|
||||
that is equal or greater than the prime and as such, need for going
|
||||
through the PWE derivation loop multiple times. This can result in
|
||||
sufficient timing different to allow an external observer to determine
|
||||
how many rounds are needed and that can leak information about the used
|
||||
password.
|
||||
|
||||
Force at least 40 loop rounds for these MODP groups similarly to the ECC
|
||||
group design to mask timing. This behavior is not described in IEEE Std
|
||||
802.11-2016 for SAE, but it does not result in different values (i.e.,
|
||||
only different timing), so such implementation specific countermeasures
|
||||
can be done without breaking interoperability with other implementation.
|
||||
|
||||
Note: These MODP groups 22, 23, and 24 are not considered sufficiently
|
||||
strong to be used with SAE (or more or less anything else). As such,
|
||||
they should never be enabled in runtime configuration for any production
|
||||
use cases. These changes to introduce additional protection to mask
|
||||
timing is only for completeness of implementation and not an indication
|
||||
that these groups should be used.
|
||||
|
||||
This is related to CVE-2019-9494.
|
||||
|
||||
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
|
||||
---
|
||||
src/common/sae.c | 38 ++++++++++++++++++++++++++++----------
|
||||
1 file changed, 28 insertions(+), 10 deletions(-)
|
||||
|
||||
--- a/src/common/sae.c
|
||||
+++ b/src/common/sae.c
|
||||
@@ -578,22 +578,27 @@ fail:
|
||||
}
|
||||
|
||||
|
||||
+static int sae_modp_group_require_masking(int group)
|
||||
+{
|
||||
+ /* Groups for which pwd-value is likely to be >= p frequently */
|
||||
+ return group == 22 || group == 23 || group == 24;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static int sae_derive_pwe_ffc(struct sae_data *sae, const u8 *addr1,
|
||||
const u8 *addr2, const u8 *password,
|
||||
size_t password_len, const char *identifier)
|
||||
{
|
||||
- u8 counter;
|
||||
+ u8 counter, k;
|
||||
u8 addrs[2 * ETH_ALEN];
|
||||
const u8 *addr[3];
|
||||
size_t len[3];
|
||||
size_t num_elem;
|
||||
int found = 0;
|
||||
+ struct crypto_bignum *pwe = NULL;
|
||||
|
||||
- if (sae->tmp->pwe_ffc == NULL) {
|
||||
- sae->tmp->pwe_ffc = crypto_bignum_init();
|
||||
- if (sae->tmp->pwe_ffc == NULL)
|
||||
- return -1;
|
||||
- }
|
||||
+ crypto_bignum_deinit(sae->tmp->pwe_ffc, 1);
|
||||
+ sae->tmp->pwe_ffc = NULL;
|
||||
|
||||
wpa_hexdump_ascii_key(MSG_DEBUG, "SAE: password",
|
||||
password, password_len);
|
||||
@@ -617,7 +622,9 @@ static int sae_derive_pwe_ffc(struct sae
|
||||
len[num_elem] = sizeof(counter);
|
||||
num_elem++;
|
||||
|
||||
- for (counter = 1; !found; counter++) {
|
||||
+ k = sae_modp_group_require_masking(sae->group) ? 40 : 1;
|
||||
+
|
||||
+ for (counter = 1; counter <= k || !found; counter++) {
|
||||
u8 pwd_seed[SHA256_MAC_LEN];
|
||||
int res;
|
||||
|
||||
@@ -627,19 +634,30 @@ static int sae_derive_pwe_ffc(struct sae
|
||||
break;
|
||||
}
|
||||
|
||||
- wpa_printf(MSG_DEBUG, "SAE: counter = %u", counter);
|
||||
+ wpa_printf(MSG_DEBUG, "SAE: counter = %02u", counter);
|
||||
if (hmac_sha256_vector(addrs, sizeof(addrs), num_elem,
|
||||
addr, len, pwd_seed) < 0)
|
||||
break;
|
||||
- res = sae_test_pwd_seed_ffc(sae, pwd_seed, sae->tmp->pwe_ffc);
|
||||
+ if (!pwe) {
|
||||
+ pwe = crypto_bignum_init();
|
||||
+ if (!pwe)
|
||||
+ break;
|
||||
+ }
|
||||
+ res = sae_test_pwd_seed_ffc(sae, pwd_seed, pwe);
|
||||
if (res < 0)
|
||||
break;
|
||||
if (res > 0) {
|
||||
- wpa_printf(MSG_DEBUG, "SAE: Use this PWE");
|
||||
found = 1;
|
||||
+ if (!sae->tmp->pwe_ffc) {
|
||||
+ wpa_printf(MSG_DEBUG, "SAE: Use this PWE");
|
||||
+ sae->tmp->pwe_ffc = pwe;
|
||||
+ pwe = NULL;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
+ crypto_bignum_deinit(pwe, 1);
|
||||
+
|
||||
return found ? 0 : -1;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
From f8f20717f87eff1f025f48ed585c7684debacf72 Mon Sep 17 00:00:00 2001
|
||||
From: Jouni Malinen <jouni@codeaurora.org>
|
||||
Date: Sat, 2 Mar 2019 12:45:33 +0200
|
||||
Subject: [PATCH 08/14] SAE: Use const_time selection for PWE in FFC
|
||||
|
||||
This is an initial step towards making the FFC case use strictly
|
||||
constant time operations similarly to the ECC case.
|
||||
sae_test_pwd_seed_ffc() does not yet have constant time behavior,
|
||||
though.
|
||||
|
||||
This is related to CVE-2019-9494.
|
||||
|
||||
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
|
||||
---
|
||||
src/common/sae.c | 53 +++++++++++++++++++++++++++++++++++------------------
|
||||
1 file changed, 35 insertions(+), 18 deletions(-)
|
||||
|
||||
--- a/src/common/sae.c
|
||||
+++ b/src/common/sae.c
|
||||
@@ -589,17 +589,28 @@ static int sae_derive_pwe_ffc(struct sae
|
||||
const u8 *addr2, const u8 *password,
|
||||
size_t password_len, const char *identifier)
|
||||
{
|
||||
- u8 counter, k;
|
||||
+ u8 counter, k, sel_counter = 0;
|
||||
u8 addrs[2 * ETH_ALEN];
|
||||
const u8 *addr[3];
|
||||
size_t len[3];
|
||||
size_t num_elem;
|
||||
- int found = 0;
|
||||
- struct crypto_bignum *pwe = NULL;
|
||||
+ u8 found = 0; /* 0 (false) or 0xff (true) to be used as const_time_*
|
||||
+ * mask */
|
||||
+ u8 mask;
|
||||
+ struct crypto_bignum *pwe;
|
||||
+ size_t prime_len = sae->tmp->prime_len * 8;
|
||||
+ u8 *pwe_buf;
|
||||
|
||||
crypto_bignum_deinit(sae->tmp->pwe_ffc, 1);
|
||||
sae->tmp->pwe_ffc = NULL;
|
||||
|
||||
+ /* Allocate a buffer to maintain selected and candidate PWE for constant
|
||||
+ * time selection. */
|
||||
+ pwe_buf = os_zalloc(prime_len * 2);
|
||||
+ pwe = crypto_bignum_init();
|
||||
+ if (!pwe_buf || !pwe)
|
||||
+ goto fail;
|
||||
+
|
||||
wpa_hexdump_ascii_key(MSG_DEBUG, "SAE: password",
|
||||
password, password_len);
|
||||
|
||||
@@ -638,27 +649,33 @@ static int sae_derive_pwe_ffc(struct sae
|
||||
if (hmac_sha256_vector(addrs, sizeof(addrs), num_elem,
|
||||
addr, len, pwd_seed) < 0)
|
||||
break;
|
||||
- if (!pwe) {
|
||||
- pwe = crypto_bignum_init();
|
||||
- if (!pwe)
|
||||
- break;
|
||||
- }
|
||||
res = sae_test_pwd_seed_ffc(sae, pwd_seed, pwe);
|
||||
+ /* res is -1 for fatal failure, 0 if a valid PWE was not found,
|
||||
+ * or 1 if a valid PWE was found. */
|
||||
if (res < 0)
|
||||
break;
|
||||
- if (res > 0) {
|
||||
- found = 1;
|
||||
- if (!sae->tmp->pwe_ffc) {
|
||||
- wpa_printf(MSG_DEBUG, "SAE: Use this PWE");
|
||||
- sae->tmp->pwe_ffc = pwe;
|
||||
- pwe = NULL;
|
||||
- }
|
||||
- }
|
||||
+ /* Store the candidate PWE into the second half of pwe_buf and
|
||||
+ * the selected PWE in the beginning of pwe_buf using constant
|
||||
+ * time selection. */
|
||||
+ if (crypto_bignum_to_bin(pwe, pwe_buf + prime_len, prime_len,
|
||||
+ prime_len) < 0)
|
||||
+ break;
|
||||
+ const_time_select_bin(found, pwe_buf, pwe_buf + prime_len,
|
||||
+ prime_len, pwe_buf);
|
||||
+ sel_counter = const_time_select_u8(found, sel_counter, counter);
|
||||
+ mask = const_time_eq_u8(res, 1);
|
||||
+ found = const_time_select_u8(found, found, mask);
|
||||
}
|
||||
|
||||
- crypto_bignum_deinit(pwe, 1);
|
||||
+ if (!found)
|
||||
+ goto fail;
|
||||
|
||||
- return found ? 0 : -1;
|
||||
+ wpa_printf(MSG_DEBUG, "SAE: Use PWE from counter = %02u", sel_counter);
|
||||
+ sae->tmp->pwe_ffc = crypto_bignum_init_set(pwe_buf, prime_len);
|
||||
+fail:
|
||||
+ crypto_bignum_deinit(pwe, 1);
|
||||
+ bin_clear_free(pwe_buf, prime_len * 2);
|
||||
+ return sae->tmp->pwe_ffc ? 0 : -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
From cff138b0747fa39765cbc641b66cfa5d7f1735d1 Mon Sep 17 00:00:00 2001
|
||||
From: Jouni Malinen <jouni@codeaurora.org>
|
||||
Date: Sat, 2 Mar 2019 16:05:56 +0200
|
||||
Subject: [PATCH 09/14] SAE: Use constant time operations in
|
||||
sae_test_pwd_seed_ffc()
|
||||
|
||||
Try to avoid showing externally visible timing or memory access
|
||||
differences regardless of whether the derived pwd-value is smaller than
|
||||
the group prime.
|
||||
|
||||
This is related to CVE-2019-9494.
|
||||
|
||||
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
|
||||
---
|
||||
src/common/sae.c | 75 ++++++++++++++++++++++++++++++++++----------------------
|
||||
1 file changed, 46 insertions(+), 29 deletions(-)
|
||||
|
||||
--- a/src/common/sae.c
|
||||
+++ b/src/common/sae.c
|
||||
@@ -311,14 +311,17 @@ static int sae_test_pwd_seed_ecc(struct
|
||||
}
|
||||
|
||||
|
||||
+/* Returns -1 on fatal failure, 0 if PWE cannot be derived from the provided
|
||||
+ * pwd-seed, or 1 if a valid PWE was derived from pwd-seed. */
|
||||
static int sae_test_pwd_seed_ffc(struct sae_data *sae, const u8 *pwd_seed,
|
||||
struct crypto_bignum *pwe)
|
||||
{
|
||||
u8 pwd_value[SAE_MAX_PRIME_LEN];
|
||||
size_t bits = sae->tmp->prime_len * 8;
|
||||
u8 exp[1];
|
||||
- struct crypto_bignum *a, *b;
|
||||
- int res;
|
||||
+ struct crypto_bignum *a, *b = NULL;
|
||||
+ int res, is_val;
|
||||
+ u8 pwd_value_valid;
|
||||
|
||||
wpa_hexdump_key(MSG_DEBUG, "SAE: pwd-seed", pwd_seed, SHA256_MAC_LEN);
|
||||
|
||||
@@ -330,16 +333,29 @@ static int sae_test_pwd_seed_ffc(struct
|
||||
wpa_hexdump_key(MSG_DEBUG, "SAE: pwd-value", pwd_value,
|
||||
sae->tmp->prime_len);
|
||||
|
||||
- if (os_memcmp(pwd_value, sae->tmp->dh->prime, sae->tmp->prime_len) >= 0)
|
||||
- {
|
||||
- wpa_printf(MSG_DEBUG, "SAE: pwd-value >= p");
|
||||
- return 0;
|
||||
- }
|
||||
+ /* Check whether pwd-value < p */
|
||||
+ res = const_time_memcmp(pwd_value, sae->tmp->dh->prime,
|
||||
+ sae->tmp->prime_len);
|
||||
+ /* pwd-value >= p is invalid, so res is < 0 for the valid cases and
|
||||
+ * the negative sign can be used to fill the mask for constant time
|
||||
+ * selection */
|
||||
+ pwd_value_valid = const_time_fill_msb(res);
|
||||
+
|
||||
+ /* If pwd-value >= p, force pwd-value to be < p and perform the
|
||||
+ * calculations anyway to hide timing difference. The derived PWE will
|
||||
+ * be ignored in that case. */
|
||||
+ pwd_value[0] = const_time_select_u8(pwd_value_valid, pwd_value[0], 0);
|
||||
|
||||
/* PWE = pwd-value^((p-1)/r) modulo p */
|
||||
|
||||
+ res = -1;
|
||||
a = crypto_bignum_init_set(pwd_value, sae->tmp->prime_len);
|
||||
+ if (!a)
|
||||
+ goto fail;
|
||||
|
||||
+ /* This is an optimization based on the used group that does not depend
|
||||
+ * on the password in any way, so it is fine to use separate branches
|
||||
+ * for this step without constant time operations. */
|
||||
if (sae->tmp->dh->safe_prime) {
|
||||
/*
|
||||
* r = (p-1)/2 for the group used here, so this becomes:
|
||||
@@ -353,33 +369,34 @@ static int sae_test_pwd_seed_ffc(struct
|
||||
b = crypto_bignum_init_set(exp, sizeof(exp));
|
||||
if (b == NULL ||
|
||||
crypto_bignum_sub(sae->tmp->prime, b, b) < 0 ||
|
||||
- crypto_bignum_div(b, sae->tmp->order, b) < 0) {
|
||||
- crypto_bignum_deinit(b, 0);
|
||||
- b = NULL;
|
||||
- }
|
||||
+ crypto_bignum_div(b, sae->tmp->order, b) < 0)
|
||||
+ goto fail;
|
||||
}
|
||||
|
||||
- if (a == NULL || b == NULL)
|
||||
- res = -1;
|
||||
- else
|
||||
- res = crypto_bignum_exptmod(a, b, sae->tmp->prime, pwe);
|
||||
-
|
||||
- crypto_bignum_deinit(a, 0);
|
||||
- crypto_bignum_deinit(b, 0);
|
||||
-
|
||||
- if (res < 0) {
|
||||
- wpa_printf(MSG_DEBUG, "SAE: Failed to calculate PWE");
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- /* if (PWE > 1) --> found */
|
||||
- if (crypto_bignum_is_zero(pwe) || crypto_bignum_is_one(pwe)) {
|
||||
- wpa_printf(MSG_DEBUG, "SAE: PWE <= 1");
|
||||
- return 0;
|
||||
- }
|
||||
+ if (!b)
|
||||
+ goto fail;
|
||||
|
||||
- wpa_printf(MSG_DEBUG, "SAE: PWE found");
|
||||
- return 1;
|
||||
+ res = crypto_bignum_exptmod(a, b, sae->tmp->prime, pwe);
|
||||
+ if (res < 0)
|
||||
+ goto fail;
|
||||
+
|
||||
+ /* There were no fatal errors in calculations, so determine the return
|
||||
+ * value using constant time operations. We get here for number of
|
||||
+ * invalid cases which are cleared here after having performed all the
|
||||
+ * computation. PWE is valid if pwd-value was less than prime and
|
||||
+ * PWE > 1. Start with pwd-value check first and then use constant time
|
||||
+ * operations to clear res to 0 if PWE is 0 or 1.
|
||||
+ */
|
||||
+ res = const_time_select_u8(pwd_value_valid, 1, 0);
|
||||
+ is_val = crypto_bignum_is_zero(pwe);
|
||||
+ res = const_time_select_u8(const_time_is_zero(is_val), res, 0);
|
||||
+ is_val = crypto_bignum_is_one(pwe);
|
||||
+ res = const_time_select_u8(const_time_is_zero(is_val), res, 0);
|
||||
+
|
||||
+fail:
|
||||
+ crypto_bignum_deinit(a, 1);
|
||||
+ crypto_bignum_deinit(b, 1);
|
||||
+ return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,319 @@
|
||||
From aaf65feac67c3993935634eefe5bc76b9fce03aa Mon Sep 17 00:00:00 2001
|
||||
From: Jouni Malinen <jouni@codeaurora.org>
|
||||
Date: Tue, 26 Feb 2019 11:59:45 +0200
|
||||
Subject: [PATCH 04/14] EAP-pwd: Use constant time and memory access for
|
||||
finding the PWE
|
||||
|
||||
This algorithm could leak information to external observers in form of
|
||||
timing differences or memory access patterns (cache use). While the
|
||||
previous implementation had protection against the most visible timing
|
||||
differences (looping 40 rounds and masking the legendre operation), it
|
||||
did not protect against memory access patterns between the two possible
|
||||
code paths in the masking operations. That might be sufficient to allow
|
||||
an unprivileged process running on the same device to be able to
|
||||
determine which path is being executed through a cache attack and based
|
||||
on that, determine information about the used password.
|
||||
|
||||
Convert the PWE finding loop to use constant time functions and
|
||||
identical memory access path without different branches for the QR/QNR
|
||||
cases to minimize possible side-channel information similarly to the
|
||||
changes done for SAE authentication. (CVE-2019-9495)
|
||||
|
||||
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
|
||||
---
|
||||
src/eap_common/eap_pwd_common.c | 187 +++++++++++++++++++++-------------------
|
||||
1 file changed, 99 insertions(+), 88 deletions(-)
|
||||
|
||||
--- a/src/eap_common/eap_pwd_common.c
|
||||
+++ b/src/eap_common/eap_pwd_common.c
|
||||
@@ -8,11 +8,15 @@
|
||||
|
||||
#include "includes.h"
|
||||
#include "common.h"
|
||||
+#include "utils/const_time.h"
|
||||
#include "crypto/sha256.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "eap_defs.h"
|
||||
#include "eap_pwd_common.h"
|
||||
|
||||
+#define MAX_ECC_PRIME_LEN 66
|
||||
+
|
||||
+
|
||||
/* The random function H(x) = HMAC-SHA256(0^32, x) */
|
||||
struct crypto_hash * eap_pwd_h_init(void)
|
||||
{
|
||||
@@ -102,6 +106,15 @@ EAP_PWD_group * get_eap_pwd_group(u16 nu
|
||||
}
|
||||
|
||||
|
||||
+static void buf_shift_right(u8 *buf, size_t len, size_t bits)
|
||||
+{
|
||||
+ size_t i;
|
||||
+ for (i = len - 1; i > 0; i--)
|
||||
+ buf[i] = (buf[i - 1] << (8 - bits)) | (buf[i] >> bits);
|
||||
+ buf[0] >>= bits;
|
||||
+}
|
||||
+
|
||||
+
|
||||
/*
|
||||
* compute a "random" secret point on an elliptic curve based
|
||||
* on the password and identities.
|
||||
@@ -113,17 +126,27 @@ int compute_password_element(EAP_PWD_gro
|
||||
const u8 *token)
|
||||
{
|
||||
struct crypto_bignum *qr = NULL, *qnr = NULL, *one = NULL;
|
||||
+ struct crypto_bignum *qr_or_qnr = NULL;
|
||||
+ u8 qr_bin[MAX_ECC_PRIME_LEN];
|
||||
+ u8 qnr_bin[MAX_ECC_PRIME_LEN];
|
||||
+ u8 qr_or_qnr_bin[MAX_ECC_PRIME_LEN];
|
||||
+ u8 x_bin[MAX_ECC_PRIME_LEN];
|
||||
struct crypto_bignum *tmp1 = NULL, *tmp2 = NULL, *pm1 = NULL;
|
||||
struct crypto_hash *hash;
|
||||
unsigned char pwe_digest[SHA256_MAC_LEN], *prfbuf = NULL, ctr;
|
||||
- int is_odd, ret = 0, check, found = 0;
|
||||
- size_t primebytelen, primebitlen;
|
||||
- struct crypto_bignum *x_candidate = NULL, *rnd = NULL, *cofactor = NULL;
|
||||
+ int ret = 0, check, res;
|
||||
+ u8 found = 0; /* 0 (false) or 0xff (true) to be used as const_time_*
|
||||
+ * mask */
|
||||
+ size_t primebytelen = 0, primebitlen;
|
||||
+ struct crypto_bignum *x_candidate = NULL, *cofactor = NULL;
|
||||
const struct crypto_bignum *prime;
|
||||
+ u8 mask, found_ctr = 0, is_odd = 0;
|
||||
|
||||
if (grp->pwe)
|
||||
return -1;
|
||||
|
||||
+ os_memset(x_bin, 0, sizeof(x_bin));
|
||||
+
|
||||
prime = crypto_ec_get_prime(grp->group);
|
||||
cofactor = crypto_bignum_init();
|
||||
grp->pwe = crypto_ec_point_init(grp->group);
|
||||
@@ -152,8 +175,6 @@ int compute_password_element(EAP_PWD_gro
|
||||
|
||||
/* get a random quadratic residue and nonresidue */
|
||||
while (!qr || !qnr) {
|
||||
- int res;
|
||||
-
|
||||
if (crypto_bignum_rand(tmp1, prime) < 0)
|
||||
goto fail;
|
||||
res = crypto_bignum_legendre(tmp1, prime);
|
||||
@@ -167,6 +188,11 @@ int compute_password_element(EAP_PWD_gro
|
||||
if (!tmp1)
|
||||
goto fail;
|
||||
}
|
||||
+ if (crypto_bignum_to_bin(qr, qr_bin, sizeof(qr_bin),
|
||||
+ primebytelen) < 0 ||
|
||||
+ crypto_bignum_to_bin(qnr, qnr_bin, sizeof(qnr_bin),
|
||||
+ primebytelen) < 0)
|
||||
+ goto fail;
|
||||
|
||||
os_memset(prfbuf, 0, primebytelen);
|
||||
ctr = 0;
|
||||
@@ -194,17 +220,16 @@ int compute_password_element(EAP_PWD_gro
|
||||
eap_pwd_h_update(hash, &ctr, sizeof(ctr));
|
||||
eap_pwd_h_final(hash, pwe_digest);
|
||||
|
||||
- crypto_bignum_deinit(rnd, 1);
|
||||
- rnd = crypto_bignum_init_set(pwe_digest, SHA256_MAC_LEN);
|
||||
- if (!rnd) {
|
||||
- wpa_printf(MSG_INFO, "EAP-pwd: unable to create rnd");
|
||||
- goto fail;
|
||||
- }
|
||||
+ is_odd = const_time_select_u8(
|
||||
+ found, is_odd, pwe_digest[SHA256_MAC_LEN - 1] & 0x01);
|
||||
if (eap_pwd_kdf(pwe_digest, SHA256_MAC_LEN,
|
||||
(u8 *) "EAP-pwd Hunting And Pecking",
|
||||
os_strlen("EAP-pwd Hunting And Pecking"),
|
||||
prfbuf, primebitlen) < 0)
|
||||
goto fail;
|
||||
+ if (primebitlen % 8)
|
||||
+ buf_shift_right(prfbuf, primebytelen,
|
||||
+ 8 - primebitlen % 8);
|
||||
|
||||
crypto_bignum_deinit(x_candidate, 1);
|
||||
x_candidate = crypto_bignum_init_set(prfbuf, primebytelen);
|
||||
@@ -214,24 +239,13 @@ int compute_password_element(EAP_PWD_gro
|
||||
goto fail;
|
||||
}
|
||||
|
||||
- /*
|
||||
- * eap_pwd_kdf() returns a string of bits 0..primebitlen but
|
||||
- * BN_bin2bn will treat that string of bits as a big endian
|
||||
- * number. If the primebitlen is not an even multiple of 8
|
||||
- * then excessive bits-- those _after_ primebitlen-- so now
|
||||
- * we have to shift right the amount we masked off.
|
||||
- */
|
||||
- if ((primebitlen % 8) &&
|
||||
- crypto_bignum_rshift(x_candidate,
|
||||
- (8 - (primebitlen % 8)),
|
||||
- x_candidate) < 0)
|
||||
- goto fail;
|
||||
-
|
||||
if (crypto_bignum_cmp(x_candidate, prime) >= 0)
|
||||
continue;
|
||||
|
||||
- wpa_hexdump(MSG_DEBUG, "EAP-pwd: x_candidate",
|
||||
- prfbuf, primebytelen);
|
||||
+ wpa_hexdump_key(MSG_DEBUG, "EAP-pwd: x_candidate",
|
||||
+ prfbuf, primebytelen);
|
||||
+ const_time_select_bin(found, x_bin, prfbuf, primebytelen,
|
||||
+ x_bin);
|
||||
|
||||
/*
|
||||
* compute y^2 using the equation of the curve
|
||||
@@ -260,13 +274,15 @@ int compute_password_element(EAP_PWD_gro
|
||||
* Flip a coin, multiply by the random quadratic residue or the
|
||||
* random quadratic nonresidue and record heads or tails.
|
||||
*/
|
||||
- if (crypto_bignum_is_odd(tmp1)) {
|
||||
- crypto_bignum_mulmod(tmp2, qr, prime, tmp2);
|
||||
- check = 1;
|
||||
- } else {
|
||||
- crypto_bignum_mulmod(tmp2, qnr, prime, tmp2);
|
||||
- check = -1;
|
||||
- }
|
||||
+ mask = const_time_eq_u8(crypto_bignum_is_odd(tmp1), 1);
|
||||
+ check = const_time_select_s8(mask, 1, -1);
|
||||
+ const_time_select_bin(mask, qr_bin, qnr_bin, primebytelen,
|
||||
+ qr_or_qnr_bin);
|
||||
+ crypto_bignum_deinit(qr_or_qnr, 1);
|
||||
+ qr_or_qnr = crypto_bignum_init_set(qr_or_qnr_bin, primebytelen);
|
||||
+ if (!qr_or_qnr ||
|
||||
+ crypto_bignum_mulmod(tmp2, qr_or_qnr, prime, tmp2) < 0)
|
||||
+ goto fail;
|
||||
|
||||
/*
|
||||
* Now it's safe to do legendre, if check is 1 then it's
|
||||
@@ -274,59 +290,12 @@ int compute_password_element(EAP_PWD_gro
|
||||
* change result), if check is -1 then it's the opposite test
|
||||
* (multiplying a qr by qnr would make a qnr).
|
||||
*/
|
||||
- if (crypto_bignum_legendre(tmp2, prime) == check) {
|
||||
- if (found == 1)
|
||||
- continue;
|
||||
-
|
||||
- /* need to unambiguously identify the solution */
|
||||
- is_odd = crypto_bignum_is_odd(rnd);
|
||||
-
|
||||
- /*
|
||||
- * We know x_candidate is a quadratic residue so set
|
||||
- * it here.
|
||||
- */
|
||||
- if (crypto_ec_point_solve_y_coord(grp->group, grp->pwe,
|
||||
- x_candidate,
|
||||
- is_odd) != 0) {
|
||||
- wpa_printf(MSG_INFO,
|
||||
- "EAP-pwd: Could not solve for y");
|
||||
- continue;
|
||||
- }
|
||||
-
|
||||
- /*
|
||||
- * If there's a solution to the equation then the point
|
||||
- * must be on the curve so why check again explicitly?
|
||||
- * OpenSSL code says this is required by X9.62. We're
|
||||
- * not X9.62 but it can't hurt just to be sure.
|
||||
- */
|
||||
- if (!crypto_ec_point_is_on_curve(grp->group,
|
||||
- grp->pwe)) {
|
||||
- wpa_printf(MSG_INFO,
|
||||
- "EAP-pwd: point is not on curve");
|
||||
- continue;
|
||||
- }
|
||||
-
|
||||
- if (!crypto_bignum_is_one(cofactor)) {
|
||||
- /* make sure the point is not in a small
|
||||
- * sub-group */
|
||||
- if (crypto_ec_point_mul(grp->group, grp->pwe,
|
||||
- cofactor,
|
||||
- grp->pwe) != 0) {
|
||||
- wpa_printf(MSG_INFO,
|
||||
- "EAP-pwd: cannot multiply generator by order");
|
||||
- continue;
|
||||
- }
|
||||
- if (crypto_ec_point_is_at_infinity(grp->group,
|
||||
- grp->pwe)) {
|
||||
- wpa_printf(MSG_INFO,
|
||||
- "EAP-pwd: point is at infinity");
|
||||
- continue;
|
||||
- }
|
||||
- }
|
||||
- wpa_printf(MSG_DEBUG,
|
||||
- "EAP-pwd: found a PWE in %d tries", ctr);
|
||||
- found = 1;
|
||||
- }
|
||||
+ res = crypto_bignum_legendre(tmp2, prime);
|
||||
+ if (res == -2)
|
||||
+ goto fail;
|
||||
+ mask = const_time_eq(res, check);
|
||||
+ found_ctr = const_time_select_u8(found, found_ctr, ctr);
|
||||
+ found |= mask;
|
||||
}
|
||||
if (found == 0) {
|
||||
wpa_printf(MSG_INFO,
|
||||
@@ -334,6 +303,44 @@ int compute_password_element(EAP_PWD_gro
|
||||
num);
|
||||
goto fail;
|
||||
}
|
||||
+
|
||||
+ /*
|
||||
+ * We know x_candidate is a quadratic residue so set it here.
|
||||
+ */
|
||||
+ crypto_bignum_deinit(x_candidate, 1);
|
||||
+ x_candidate = crypto_bignum_init_set(x_bin, primebytelen);
|
||||
+ if (!x_candidate ||
|
||||
+ crypto_ec_point_solve_y_coord(grp->group, grp->pwe, x_candidate,
|
||||
+ is_odd) != 0) {
|
||||
+ wpa_printf(MSG_INFO, "EAP-pwd: Could not solve for y");
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * If there's a solution to the equation then the point must be on the
|
||||
+ * curve so why check again explicitly? OpenSSL code says this is
|
||||
+ * required by X9.62. We're not X9.62 but it can't hurt just to be sure.
|
||||
+ */
|
||||
+ if (!crypto_ec_point_is_on_curve(grp->group, grp->pwe)) {
|
||||
+ wpa_printf(MSG_INFO, "EAP-pwd: point is not on curve");
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ if (!crypto_bignum_is_one(cofactor)) {
|
||||
+ /* make sure the point is not in a small sub-group */
|
||||
+ if (crypto_ec_point_mul(grp->group, grp->pwe, cofactor,
|
||||
+ grp->pwe) != 0) {
|
||||
+ wpa_printf(MSG_INFO,
|
||||
+ "EAP-pwd: cannot multiply generator by order");
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ if (crypto_ec_point_is_at_infinity(grp->group, grp->pwe)) {
|
||||
+ wpa_printf(MSG_INFO, "EAP-pwd: point is at infinity");
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ }
|
||||
+ wpa_printf(MSG_DEBUG, "EAP-pwd: found a PWE in %02d tries", found_ctr);
|
||||
+
|
||||
if (0) {
|
||||
fail:
|
||||
crypto_ec_point_deinit(grp->pwe, 1);
|
||||
@@ -343,14 +350,18 @@ int compute_password_element(EAP_PWD_gro
|
||||
/* cleanliness and order.... */
|
||||
crypto_bignum_deinit(cofactor, 1);
|
||||
crypto_bignum_deinit(x_candidate, 1);
|
||||
- crypto_bignum_deinit(rnd, 1);
|
||||
crypto_bignum_deinit(pm1, 0);
|
||||
crypto_bignum_deinit(tmp1, 1);
|
||||
crypto_bignum_deinit(tmp2, 1);
|
||||
crypto_bignum_deinit(qr, 1);
|
||||
crypto_bignum_deinit(qnr, 1);
|
||||
+ crypto_bignum_deinit(qr_or_qnr, 1);
|
||||
crypto_bignum_deinit(one, 0);
|
||||
- os_free(prfbuf);
|
||||
+ bin_clear_free(prfbuf, primebytelen);
|
||||
+ os_memset(qr_bin, 0, sizeof(qr_bin));
|
||||
+ os_memset(qnr_bin, 0, sizeof(qnr_bin));
|
||||
+ os_memset(qr_or_qnr_bin, 0, sizeof(qr_or_qnr_bin));
|
||||
+ os_memset(pwe_digest, 0, sizeof(pwe_digest));
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
From ac8fa9ef198640086cf2ce7c94673be2b6a018a0 Mon Sep 17 00:00:00 2001
|
||||
From: Jouni Malinen <jouni@codeaurora.org>
|
||||
Date: Tue, 5 Mar 2019 23:43:25 +0200
|
||||
Subject: [PATCH 10/14] SAE: Fix confirm message validation in error cases
|
||||
|
||||
Explicitly verify that own and peer commit scalar/element are available
|
||||
when trying to check SAE confirm message. It could have been possible to
|
||||
hit a NULL pointer dereference if the peer element could not have been
|
||||
parsed. (CVE-2019-9496)
|
||||
|
||||
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
|
||||
---
|
||||
src/common/sae.c | 14 +++++++++++---
|
||||
1 file changed, 11 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/src/common/sae.c
|
||||
+++ b/src/common/sae.c
|
||||
@@ -1464,23 +1464,31 @@ int sae_check_confirm(struct sae_data *s
|
||||
|
||||
wpa_printf(MSG_DEBUG, "SAE: peer-send-confirm %u", WPA_GET_LE16(data));
|
||||
|
||||
- if (sae->tmp == NULL) {
|
||||
+ if (!sae->tmp || !sae->peer_commit_scalar ||
|
||||
+ !sae->tmp->own_commit_scalar) {
|
||||
wpa_printf(MSG_DEBUG, "SAE: Temporary data not yet available");
|
||||
return -1;
|
||||
}
|
||||
|
||||
- if (sae->tmp->ec)
|
||||
+ if (sae->tmp->ec) {
|
||||
+ if (!sae->tmp->peer_commit_element_ecc ||
|
||||
+ !sae->tmp->own_commit_element_ecc)
|
||||
+ return -1;
|
||||
sae_cn_confirm_ecc(sae, data, sae->peer_commit_scalar,
|
||||
sae->tmp->peer_commit_element_ecc,
|
||||
sae->tmp->own_commit_scalar,
|
||||
sae->tmp->own_commit_element_ecc,
|
||||
verifier);
|
||||
- else
|
||||
+ } else {
|
||||
+ if (!sae->tmp->peer_commit_element_ffc ||
|
||||
+ !sae->tmp->own_commit_element_ffc)
|
||||
+ return -1;
|
||||
sae_cn_confirm_ffc(sae, data, sae->peer_commit_scalar,
|
||||
sae->tmp->peer_commit_element_ffc,
|
||||
sae->tmp->own_commit_scalar,
|
||||
sae->tmp->own_commit_element_ffc,
|
||||
verifier);
|
||||
+ }
|
||||
|
||||
if (os_memcmp_const(verifier, data + 2, SHA256_MAC_LEN) != 0) {
|
||||
wpa_printf(MSG_DEBUG, "SAE: Confirm mismatch");
|
||||
@@ -0,0 +1,53 @@
|
||||
From 70ff850e89fbc8bc7da515321b4d15b5eef70581 Mon Sep 17 00:00:00 2001
|
||||
From: Mathy Vanhoef <mathy.vanhoef@nyu.edu>
|
||||
Date: Sun, 31 Mar 2019 17:13:06 +0200
|
||||
Subject: [PATCH 11/14] EAP-pwd server: Verify received scalar and element
|
||||
|
||||
When processing an EAP-pwd Commit frame, the peer's scalar and element
|
||||
(elliptic curve point) were not validated. This allowed an adversary to
|
||||
bypass authentication, and impersonate any user if the crypto
|
||||
implementation did not verify the validity of the EC point.
|
||||
|
||||
Fix this vulnerability by assuring the received scalar lies within the
|
||||
valid range, and by checking that the received element is not the point
|
||||
at infinity and lies on the elliptic curve being used. (CVE-2019-9498)
|
||||
|
||||
The vulnerability is only exploitable if OpenSSL version 1.0.2 or lower
|
||||
is used, or if LibreSSL or wolfssl is used. Newer versions of OpenSSL
|
||||
(and also BoringSSL) implicitly validate the elliptic curve point in
|
||||
EC_POINT_set_affine_coordinates_GFp(), preventing the attack.
|
||||
|
||||
Signed-off-by: Mathy Vanhoef <mathy.vanhoef@nyu.edu>
|
||||
---
|
||||
src/eap_server/eap_server_pwd.c | 20 ++++++++++++++++++++
|
||||
1 file changed, 20 insertions(+)
|
||||
|
||||
--- a/src/eap_server/eap_server_pwd.c
|
||||
+++ b/src/eap_server/eap_server_pwd.c
|
||||
@@ -653,6 +653,26 @@ eap_pwd_process_commit_resp(struct eap_s
|
||||
goto fin;
|
||||
}
|
||||
|
||||
+ /* verify received scalar */
|
||||
+ if (crypto_bignum_is_zero(data->peer_scalar) ||
|
||||
+ crypto_bignum_is_one(data->peer_scalar) ||
|
||||
+ crypto_bignum_cmp(data->peer_scalar,
|
||||
+ crypto_ec_get_order(data->grp->group)) >= 0) {
|
||||
+ wpa_printf(MSG_INFO,
|
||||
+ "EAP-PWD (server): received scalar is invalid");
|
||||
+ goto fin;
|
||||
+ }
|
||||
+
|
||||
+ /* verify received element */
|
||||
+ if (!crypto_ec_point_is_on_curve(data->grp->group,
|
||||
+ data->peer_element) ||
|
||||
+ crypto_ec_point_is_at_infinity(data->grp->group,
|
||||
+ data->peer_element)) {
|
||||
+ wpa_printf(MSG_INFO,
|
||||
+ "EAP-PWD (server): received element is invalid");
|
||||
+ goto fin;
|
||||
+ }
|
||||
+
|
||||
/* check to ensure peer's element is not in a small sub-group */
|
||||
if (!crypto_bignum_is_one(cofactor)) {
|
||||
if (crypto_ec_point_mul(data->grp->group, data->peer_element,
|
||||
@@ -0,0 +1,40 @@
|
||||
From d63edfa90243e9a7de6ae5c275032f2cc79fef95 Mon Sep 17 00:00:00 2001
|
||||
From: Mathy Vanhoef <mathy.vanhoef@nyu.edu>
|
||||
Date: Sun, 31 Mar 2019 17:26:01 +0200
|
||||
Subject: [PATCH 12/14] EAP-pwd server: Detect reflection attacks
|
||||
|
||||
When processing an EAP-pwd Commit frame, verify that the peer's scalar
|
||||
and elliptic curve element differ from the one sent by the server. This
|
||||
prevents reflection attacks where the adversary reflects the scalar and
|
||||
element sent by the server. (CVE-2019-9497)
|
||||
|
||||
The vulnerability allows an adversary to complete the EAP-pwd handshake
|
||||
as any user. However, the adversary does not learn the negotiated
|
||||
session key, meaning the subsequent 4-way handshake would fail. As a
|
||||
result, this cannot be abused to bypass authentication unless EAP-pwd is
|
||||
used in non-WLAN cases without any following key exchange that would
|
||||
require the attacker to learn the MSK.
|
||||
|
||||
Signed-off-by: Mathy Vanhoef <mathy.vanhoef@nyu.edu>
|
||||
---
|
||||
src/eap_server/eap_server_pwd.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
--- a/src/eap_server/eap_server_pwd.c
|
||||
+++ b/src/eap_server/eap_server_pwd.c
|
||||
@@ -688,6 +688,15 @@ eap_pwd_process_commit_resp(struct eap_s
|
||||
}
|
||||
}
|
||||
|
||||
+ /* detect reflection attacks */
|
||||
+ if (crypto_bignum_cmp(data->my_scalar, data->peer_scalar) == 0 ||
|
||||
+ crypto_ec_point_cmp(data->grp->group, data->my_element,
|
||||
+ data->peer_element) == 0) {
|
||||
+ wpa_printf(MSG_INFO,
|
||||
+ "EAP-PWD (server): detected reflection attack!");
|
||||
+ goto fin;
|
||||
+ }
|
||||
+
|
||||
/* compute the shared key, k */
|
||||
if ((crypto_ec_point_mul(data->grp->group, data->grp->pwe,
|
||||
data->peer_scalar, K) < 0) ||
|
||||
@@ -0,0 +1,53 @@
|
||||
From 8ad8585f91823ddcc3728155e288e0f9f872e31a Mon Sep 17 00:00:00 2001
|
||||
From: Mathy Vanhoef <mathy.vanhoef@nyu.edu>
|
||||
Date: Sun, 31 Mar 2019 17:43:44 +0200
|
||||
Subject: [PATCH 13/14] EAP-pwd client: Verify received scalar and element
|
||||
|
||||
When processing an EAP-pwd Commit frame, the server's scalar and element
|
||||
(elliptic curve point) were not validated. This allowed an adversary to
|
||||
bypass authentication, and act as a rogue Access Point (AP) if the
|
||||
crypto implementation did not verify the validity of the EC point.
|
||||
|
||||
Fix this vulnerability by assuring the received scalar lies within the
|
||||
valid range, and by checking that the received element is not the point
|
||||
at infinity and lies on the elliptic curve being used. (CVE-2019-9499)
|
||||
|
||||
The vulnerability is only exploitable if OpenSSL version 1.0.2 or lower
|
||||
is used, or if LibreSSL or wolfssl is used. Newer versions of OpenSSL
|
||||
(and also BoringSSL) implicitly validate the elliptic curve point in
|
||||
EC_POINT_set_affine_coordinates_GFp(), preventing the attack.
|
||||
|
||||
Signed-off-by: Mathy Vanhoef <mathy.vanhoef@nyu.edu>
|
||||
---
|
||||
src/eap_peer/eap_pwd.c | 20 ++++++++++++++++++++
|
||||
1 file changed, 20 insertions(+)
|
||||
|
||||
--- a/src/eap_peer/eap_pwd.c
|
||||
+++ b/src/eap_peer/eap_pwd.c
|
||||
@@ -436,6 +436,26 @@ eap_pwd_perform_commit_exchange(struct e
|
||||
goto fin;
|
||||
}
|
||||
|
||||
+ /* verify received scalar */
|
||||
+ if (crypto_bignum_is_zero(data->server_scalar) ||
|
||||
+ crypto_bignum_is_one(data->server_scalar) ||
|
||||
+ crypto_bignum_cmp(data->server_scalar,
|
||||
+ crypto_ec_get_order(data->grp->group)) >= 0) {
|
||||
+ wpa_printf(MSG_INFO,
|
||||
+ "EAP-PWD (peer): received scalar is invalid");
|
||||
+ goto fin;
|
||||
+ }
|
||||
+
|
||||
+ /* verify received element */
|
||||
+ if (!crypto_ec_point_is_on_curve(data->grp->group,
|
||||
+ data->server_element) ||
|
||||
+ crypto_ec_point_is_at_infinity(data->grp->group,
|
||||
+ data->server_element)) {
|
||||
+ wpa_printf(MSG_INFO,
|
||||
+ "EAP-PWD (peer): received element is invalid");
|
||||
+ goto fin;
|
||||
+ }
|
||||
+
|
||||
/* check to ensure server's element is not in a small sub-group */
|
||||
if (!crypto_bignum_is_one(cofactor)) {
|
||||
if (crypto_ec_point_mul(data->grp->group, data->server_element,
|
||||
@@ -0,0 +1,321 @@
|
||||
From 16d4f1069118aa19bfce013493e1ac5783f92f1d Mon Sep 17 00:00:00 2001
|
||||
From: Jouni Malinen <jouni@codeaurora.org>
|
||||
Date: Fri, 5 Apr 2019 02:12:50 +0300
|
||||
Subject: [PATCH 14/14] EAP-pwd: Check element x,y coordinates explicitly
|
||||
|
||||
This adds an explicit check for 0 < x,y < prime based on RFC 5931,
|
||||
2.8.5.2.2 requirement. The earlier checks might have covered this
|
||||
implicitly, but it is safer to avoid any dependency on implicit checks
|
||||
and specific crypto library behavior. (CVE-2019-9498 and CVE-2019-9499)
|
||||
|
||||
Furthermore, this moves the EAP-pwd element and scalar parsing and
|
||||
validation steps into shared helper functions so that there is no need
|
||||
to maintain two separate copies of this common functionality between the
|
||||
server and peer implementations.
|
||||
|
||||
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
|
||||
---
|
||||
src/eap_common/eap_pwd_common.c | 106 ++++++++++++++++++++++++++++++++++++++++
|
||||
src/eap_common/eap_pwd_common.h | 3 ++
|
||||
src/eap_peer/eap_pwd.c | 45 ++---------------
|
||||
src/eap_server/eap_server_pwd.c | 45 ++---------------
|
||||
4 files changed, 117 insertions(+), 82 deletions(-)
|
||||
|
||||
--- a/src/eap_common/eap_pwd_common.c
|
||||
+++ b/src/eap_common/eap_pwd_common.c
|
||||
@@ -427,3 +427,109 @@ int compute_keys(EAP_PWD_group *grp, con
|
||||
|
||||
return 1;
|
||||
}
|
||||
+
|
||||
+
|
||||
+static int eap_pwd_element_coord_ok(const struct crypto_bignum *prime,
|
||||
+ const u8 *buf, size_t len)
|
||||
+{
|
||||
+ struct crypto_bignum *val;
|
||||
+ int ok = 1;
|
||||
+
|
||||
+ val = crypto_bignum_init_set(buf, len);
|
||||
+ if (!val || crypto_bignum_is_zero(val) ||
|
||||
+ crypto_bignum_cmp(val, prime) >= 0)
|
||||
+ ok = 0;
|
||||
+ crypto_bignum_deinit(val, 0);
|
||||
+ return ok;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+struct crypto_ec_point * eap_pwd_get_element(EAP_PWD_group *group,
|
||||
+ const u8 *buf)
|
||||
+{
|
||||
+ struct crypto_ec_point *element;
|
||||
+ const struct crypto_bignum *prime;
|
||||
+ size_t prime_len;
|
||||
+ struct crypto_bignum *cofactor = NULL;
|
||||
+
|
||||
+ prime = crypto_ec_get_prime(group->group);
|
||||
+ prime_len = crypto_ec_prime_len(group->group);
|
||||
+
|
||||
+ /* RFC 5931, 2.8.5.2.2: 0 < x,y < p */
|
||||
+ if (!eap_pwd_element_coord_ok(prime, buf, prime_len) ||
|
||||
+ !eap_pwd_element_coord_ok(prime, buf + prime_len, prime_len)) {
|
||||
+ wpa_printf(MSG_INFO, "EAP-pwd: Invalid coordinate in element");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ element = crypto_ec_point_from_bin(group->group, buf);
|
||||
+ if (!element) {
|
||||
+ wpa_printf(MSG_INFO, "EAP-pwd: EC point from element failed");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ /* RFC 5931, 2.8.5.2.2: on curve and not the point at infinity */
|
||||
+ if (!crypto_ec_point_is_on_curve(group->group, element) ||
|
||||
+ crypto_ec_point_is_at_infinity(group->group, element)) {
|
||||
+ wpa_printf(MSG_INFO, "EAP-pwd: Invalid element");
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ cofactor = crypto_bignum_init();
|
||||
+ if (!cofactor || crypto_ec_cofactor(group->group, cofactor) < 0) {
|
||||
+ wpa_printf(MSG_INFO,
|
||||
+ "EAP-pwd: Unable to get cofactor for curve");
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ if (!crypto_bignum_is_one(cofactor)) {
|
||||
+ struct crypto_ec_point *point;
|
||||
+ int ok = 1;
|
||||
+
|
||||
+ /* check to ensure peer's element is not in a small sub-group */
|
||||
+ point = crypto_ec_point_init(group->group);
|
||||
+ if (!point ||
|
||||
+ crypto_ec_point_mul(group->group, element,
|
||||
+ cofactor, point) != 0 ||
|
||||
+ crypto_ec_point_is_at_infinity(group->group, point))
|
||||
+ ok = 0;
|
||||
+ crypto_ec_point_deinit(point, 0);
|
||||
+
|
||||
+ if (!ok) {
|
||||
+ wpa_printf(MSG_INFO,
|
||||
+ "EAP-pwd: Small sub-group check on peer element failed");
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+out:
|
||||
+ crypto_bignum_deinit(cofactor, 0);
|
||||
+ return element;
|
||||
+fail:
|
||||
+ crypto_ec_point_deinit(element, 0);
|
||||
+ element = NULL;
|
||||
+ goto out;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+struct crypto_bignum * eap_pwd_get_scalar(EAP_PWD_group *group, const u8 *buf)
|
||||
+{
|
||||
+ struct crypto_bignum *scalar;
|
||||
+ const struct crypto_bignum *order;
|
||||
+ size_t order_len;
|
||||
+
|
||||
+ order = crypto_ec_get_order(group->group);
|
||||
+ order_len = crypto_ec_order_len(group->group);
|
||||
+
|
||||
+ /* RFC 5931, 2.8.5.2: 1 < scalar < r */
|
||||
+ scalar = crypto_bignum_init_set(buf, order_len);
|
||||
+ if (!scalar || crypto_bignum_is_zero(scalar) ||
|
||||
+ crypto_bignum_is_one(scalar) ||
|
||||
+ crypto_bignum_cmp(scalar, order) >= 0) {
|
||||
+ wpa_printf(MSG_INFO, "EAP-pwd: received scalar is invalid");
|
||||
+ crypto_bignum_deinit(scalar, 0);
|
||||
+ scalar = NULL;
|
||||
+ }
|
||||
+
|
||||
+ return scalar;
|
||||
+}
|
||||
--- a/src/eap_common/eap_pwd_common.h
|
||||
+++ b/src/eap_common/eap_pwd_common.h
|
||||
@@ -64,5 +64,8 @@ int compute_keys(EAP_PWD_group *grp, con
|
||||
struct crypto_hash * eap_pwd_h_init(void);
|
||||
void eap_pwd_h_update(struct crypto_hash *hash, const u8 *data, size_t len);
|
||||
void eap_pwd_h_final(struct crypto_hash *hash, u8 *digest);
|
||||
+struct crypto_ec_point * eap_pwd_get_element(EAP_PWD_group *group,
|
||||
+ const u8 *buf);
|
||||
+struct crypto_bignum * eap_pwd_get_scalar(EAP_PWD_group *group, const u8 *buf);
|
||||
|
||||
#endif /* EAP_PWD_COMMON_H */
|
||||
--- a/src/eap_peer/eap_pwd.c
|
||||
+++ b/src/eap_peer/eap_pwd.c
|
||||
@@ -344,7 +344,7 @@ eap_pwd_perform_commit_exchange(struct e
|
||||
const struct wpabuf *reqData,
|
||||
const u8 *payload, size_t payload_len)
|
||||
{
|
||||
- struct crypto_ec_point *K = NULL, *point = NULL;
|
||||
+ struct crypto_ec_point *K = NULL;
|
||||
struct crypto_bignum *mask = NULL, *cofactor = NULL;
|
||||
const u8 *ptr;
|
||||
u8 *scalar = NULL, *element = NULL;
|
||||
@@ -413,8 +413,7 @@ eap_pwd_perform_commit_exchange(struct e
|
||||
/* process the request */
|
||||
data->k = crypto_bignum_init();
|
||||
K = crypto_ec_point_init(data->grp->group);
|
||||
- point = crypto_ec_point_init(data->grp->group);
|
||||
- if (!data->k || !K || !point) {
|
||||
+ if (!data->k || !K) {
|
||||
wpa_printf(MSG_INFO, "EAP-PWD (peer): peer data allocation "
|
||||
"fail");
|
||||
goto fin;
|
||||
@@ -422,55 +421,20 @@ eap_pwd_perform_commit_exchange(struct e
|
||||
|
||||
/* element, x then y, followed by scalar */
|
||||
ptr = payload;
|
||||
- data->server_element = crypto_ec_point_from_bin(data->grp->group, ptr);
|
||||
+ data->server_element = eap_pwd_get_element(data->grp, ptr);
|
||||
if (!data->server_element) {
|
||||
wpa_printf(MSG_INFO, "EAP-PWD (peer): setting peer element "
|
||||
"fail");
|
||||
goto fin;
|
||||
}
|
||||
ptr += prime_len * 2;
|
||||
- data->server_scalar = crypto_bignum_init_set(ptr, order_len);
|
||||
+ data->server_scalar = eap_pwd_get_scalar(data->grp, ptr);
|
||||
if (!data->server_scalar) {
|
||||
wpa_printf(MSG_INFO,
|
||||
"EAP-PWD (peer): setting peer scalar fail");
|
||||
goto fin;
|
||||
}
|
||||
|
||||
- /* verify received scalar */
|
||||
- if (crypto_bignum_is_zero(data->server_scalar) ||
|
||||
- crypto_bignum_is_one(data->server_scalar) ||
|
||||
- crypto_bignum_cmp(data->server_scalar,
|
||||
- crypto_ec_get_order(data->grp->group)) >= 0) {
|
||||
- wpa_printf(MSG_INFO,
|
||||
- "EAP-PWD (peer): received scalar is invalid");
|
||||
- goto fin;
|
||||
- }
|
||||
-
|
||||
- /* verify received element */
|
||||
- if (!crypto_ec_point_is_on_curve(data->grp->group,
|
||||
- data->server_element) ||
|
||||
- crypto_ec_point_is_at_infinity(data->grp->group,
|
||||
- data->server_element)) {
|
||||
- wpa_printf(MSG_INFO,
|
||||
- "EAP-PWD (peer): received element is invalid");
|
||||
- goto fin;
|
||||
- }
|
||||
-
|
||||
- /* check to ensure server's element is not in a small sub-group */
|
||||
- if (!crypto_bignum_is_one(cofactor)) {
|
||||
- if (crypto_ec_point_mul(data->grp->group, data->server_element,
|
||||
- cofactor, point) < 0) {
|
||||
- wpa_printf(MSG_INFO, "EAP-PWD (peer): cannot multiply "
|
||||
- "server element by order!\n");
|
||||
- goto fin;
|
||||
- }
|
||||
- if (crypto_ec_point_is_at_infinity(data->grp->group, point)) {
|
||||
- wpa_printf(MSG_INFO, "EAP-PWD (peer): server element "
|
||||
- "is at infinity!\n");
|
||||
- goto fin;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
/* compute the shared key, k */
|
||||
if (crypto_ec_point_mul(data->grp->group, data->grp->pwe,
|
||||
data->server_scalar, K) < 0 ||
|
||||
@@ -544,7 +508,6 @@ fin:
|
||||
crypto_bignum_deinit(mask, 1);
|
||||
crypto_bignum_deinit(cofactor, 1);
|
||||
crypto_ec_point_deinit(K, 1);
|
||||
- crypto_ec_point_deinit(point, 1);
|
||||
if (data->outbuf == NULL)
|
||||
eap_pwd_state(data, FAILURE);
|
||||
else
|
||||
--- a/src/eap_server/eap_server_pwd.c
|
||||
+++ b/src/eap_server/eap_server_pwd.c
|
||||
@@ -604,7 +604,7 @@ eap_pwd_process_commit_resp(struct eap_s
|
||||
{
|
||||
const u8 *ptr;
|
||||
struct crypto_bignum *cofactor = NULL;
|
||||
- struct crypto_ec_point *K = NULL, *point = NULL;
|
||||
+ struct crypto_ec_point *K = NULL;
|
||||
int res = 0;
|
||||
size_t prime_len, order_len;
|
||||
|
||||
@@ -623,9 +623,8 @@ eap_pwd_process_commit_resp(struct eap_s
|
||||
|
||||
data->k = crypto_bignum_init();
|
||||
cofactor = crypto_bignum_init();
|
||||
- point = crypto_ec_point_init(data->grp->group);
|
||||
K = crypto_ec_point_init(data->grp->group);
|
||||
- if (!data->k || !cofactor || !point || !K) {
|
||||
+ if (!data->k || !cofactor || !K) {
|
||||
wpa_printf(MSG_INFO, "EAP-PWD (server): peer data allocation "
|
||||
"fail");
|
||||
goto fin;
|
||||
@@ -639,55 +638,20 @@ eap_pwd_process_commit_resp(struct eap_s
|
||||
|
||||
/* element, x then y, followed by scalar */
|
||||
ptr = payload;
|
||||
- data->peer_element = crypto_ec_point_from_bin(data->grp->group, ptr);
|
||||
+ data->peer_element = eap_pwd_get_element(data->grp, ptr);
|
||||
if (!data->peer_element) {
|
||||
wpa_printf(MSG_INFO, "EAP-PWD (server): setting peer element "
|
||||
"fail");
|
||||
goto fin;
|
||||
}
|
||||
ptr += prime_len * 2;
|
||||
- data->peer_scalar = crypto_bignum_init_set(ptr, order_len);
|
||||
+ data->peer_scalar = eap_pwd_get_scalar(data->grp, ptr);
|
||||
if (!data->peer_scalar) {
|
||||
wpa_printf(MSG_INFO, "EAP-PWD (server): peer data allocation "
|
||||
"fail");
|
||||
goto fin;
|
||||
}
|
||||
|
||||
- /* verify received scalar */
|
||||
- if (crypto_bignum_is_zero(data->peer_scalar) ||
|
||||
- crypto_bignum_is_one(data->peer_scalar) ||
|
||||
- crypto_bignum_cmp(data->peer_scalar,
|
||||
- crypto_ec_get_order(data->grp->group)) >= 0) {
|
||||
- wpa_printf(MSG_INFO,
|
||||
- "EAP-PWD (server): received scalar is invalid");
|
||||
- goto fin;
|
||||
- }
|
||||
-
|
||||
- /* verify received element */
|
||||
- if (!crypto_ec_point_is_on_curve(data->grp->group,
|
||||
- data->peer_element) ||
|
||||
- crypto_ec_point_is_at_infinity(data->grp->group,
|
||||
- data->peer_element)) {
|
||||
- wpa_printf(MSG_INFO,
|
||||
- "EAP-PWD (server): received element is invalid");
|
||||
- goto fin;
|
||||
- }
|
||||
-
|
||||
- /* check to ensure peer's element is not in a small sub-group */
|
||||
- if (!crypto_bignum_is_one(cofactor)) {
|
||||
- if (crypto_ec_point_mul(data->grp->group, data->peer_element,
|
||||
- cofactor, point) != 0) {
|
||||
- wpa_printf(MSG_INFO, "EAP-PWD (server): cannot "
|
||||
- "multiply peer element by order");
|
||||
- goto fin;
|
||||
- }
|
||||
- if (crypto_ec_point_is_at_infinity(data->grp->group, point)) {
|
||||
- wpa_printf(MSG_INFO, "EAP-PWD (server): peer element "
|
||||
- "is at infinity!\n");
|
||||
- goto fin;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
/* detect reflection attacks */
|
||||
if (crypto_bignum_cmp(data->my_scalar, data->peer_scalar) == 0 ||
|
||||
crypto_ec_point_cmp(data->grp->group, data->my_element,
|
||||
@@ -739,7 +703,6 @@ eap_pwd_process_commit_resp(struct eap_s
|
||||
|
||||
fin:
|
||||
crypto_ec_point_deinit(K, 1);
|
||||
- crypto_ec_point_deinit(point, 1);
|
||||
crypto_bignum_deinit(cofactor, 1);
|
||||
|
||||
if (res)
|
||||
@@ -0,0 +1,40 @@
|
||||
From fe76f487e28bdc61940f304f153a954cf36935ea Mon Sep 17 00:00:00 2001
|
||||
From: Jouni Malinen <jouni@codeaurora.org>
|
||||
Date: Wed, 17 Apr 2019 01:55:32 +0300
|
||||
Subject: [PATCH 1/3] EAP-pwd server: Fix reassembly buffer handling
|
||||
|
||||
data->inbuf allocation might fail and if that were to happen, the next
|
||||
fragment in the exchange could have resulted in NULL pointer
|
||||
dereference. Unexpected fragment with more bit might also be able to
|
||||
trigger this. Fix that by explicitly checking for data->inbuf to be
|
||||
available before using it.
|
||||
|
||||
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
|
||||
---
|
||||
src/eap_server/eap_server_pwd.c | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/src/eap_server/eap_server_pwd.c
|
||||
+++ b/src/eap_server/eap_server_pwd.c
|
||||
@@ -882,6 +882,12 @@ static void eap_pwd_process(struct eap_s
|
||||
* the first and all intermediate fragments have the M bit set
|
||||
*/
|
||||
if (EAP_PWD_GET_MORE_BIT(lm_exch) || data->in_frag_pos) {
|
||||
+ if (!data->inbuf) {
|
||||
+ wpa_printf(MSG_DEBUG,
|
||||
+ "EAP-pwd: No buffer for reassembly");
|
||||
+ eap_pwd_state(data, FAILURE);
|
||||
+ return;
|
||||
+ }
|
||||
if ((data->in_frag_pos + len) > wpabuf_size(data->inbuf)) {
|
||||
wpa_printf(MSG_DEBUG, "EAP-pwd: Buffer overflow "
|
||||
"attack detected! (%d+%d > %d)",
|
||||
@@ -902,7 +908,7 @@ static void eap_pwd_process(struct eap_s
|
||||
* last fragment won't have the M bit set (but we're obviously
|
||||
* buffering fragments so that's how we know it's the last)
|
||||
*/
|
||||
- if (data->in_frag_pos) {
|
||||
+ if (data->in_frag_pos && data->inbuf) {
|
||||
pos = wpabuf_head_u8(data->inbuf);
|
||||
len = data->in_frag_pos;
|
||||
wpa_printf(MSG_DEBUG, "EAP-pwd: Last fragment, %d bytes",
|
||||
@@ -0,0 +1,40 @@
|
||||
From d2d1a324ce937628e4d9d9999fe113819b7d4478 Mon Sep 17 00:00:00 2001
|
||||
From: Jouni Malinen <jouni@codeaurora.org>
|
||||
Date: Wed, 17 Apr 2019 02:21:20 +0300
|
||||
Subject: [PATCH 3/3] EAP-pwd peer: Fix reassembly buffer handling
|
||||
|
||||
Unexpected fragment might result in data->inbuf not being allocated
|
||||
before processing and that could have resulted in NULL pointer
|
||||
dereference. Fix that by explicitly checking for data->inbuf to be
|
||||
available before using it.
|
||||
|
||||
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
|
||||
---
|
||||
src/eap_peer/eap_pwd.c | 9 ++++++++-
|
||||
1 file changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/src/eap_peer/eap_pwd.c
|
||||
+++ b/src/eap_peer/eap_pwd.c
|
||||
@@ -805,6 +805,13 @@ eap_pwd_process(struct eap_sm *sm, void
|
||||
* buffer and ACK the fragment
|
||||
*/
|
||||
if (EAP_PWD_GET_MORE_BIT(lm_exch) || data->in_frag_pos) {
|
||||
+ if (!data->inbuf) {
|
||||
+ wpa_printf(MSG_DEBUG,
|
||||
+ "EAP-pwd: No buffer for reassembly");
|
||||
+ ret->methodState = METHOD_DONE;
|
||||
+ ret->decision = DECISION_FAIL;
|
||||
+ return NULL;
|
||||
+ }
|
||||
data->in_frag_pos += len;
|
||||
if (data->in_frag_pos > wpabuf_size(data->inbuf)) {
|
||||
wpa_printf(MSG_INFO, "EAP-pwd: Buffer overflow attack "
|
||||
@@ -831,7 +838,7 @@ eap_pwd_process(struct eap_sm *sm, void
|
||||
/*
|
||||
* we're buffering and this is the last fragment
|
||||
*/
|
||||
- if (data->in_frag_pos) {
|
||||
+ if (data->in_frag_pos && data->inbuf) {
|
||||
wpa_printf(MSG_DEBUG, "EAP-pwd: Last fragment, %d bytes",
|
||||
(int) len);
|
||||
pos = wpabuf_head_u8(data->inbuf);
|
||||
@@ -0,0 +1,40 @@
|
||||
From 92e1b96c26a84e503847bdd22ebadf697c4031ad Mon Sep 17 00:00:00 2001
|
||||
From: Jouni Malinen <j@w1.fi>
|
||||
Date: Sat, 13 Apr 2019 17:20:57 +0300
|
||||
Subject: EAP-pwd: Disallow ECC groups with a prime under 256 bits
|
||||
|
||||
Based on the SAE implementation guidance update to not allow ECC groups
|
||||
with a prime that is under 256 bits, reject groups 25, 26, and 27 in
|
||||
EAP-pwd.
|
||||
|
||||
Signed-off-by: Jouni Malinen <j@w1.fi>
|
||||
---
|
||||
src/eap_common/eap_pwd_common.c | 13 +++++++++++++
|
||||
1 file changed, 13 insertions(+)
|
||||
|
||||
--- a/src/eap_common/eap_pwd_common.c
|
||||
+++ b/src/eap_common/eap_pwd_common.c
|
||||
@@ -85,10 +85,23 @@ static int eap_pwd_kdf(const u8 *key, si
|
||||
}
|
||||
|
||||
|
||||
+static int eap_pwd_suitable_group(u16 num)
|
||||
+{
|
||||
+ /* Do not allow ECC groups with prime under 256 bits based on guidance
|
||||
+ * for the similar design in SAE. */
|
||||
+ return num == 19 || num == 20 || num == 21 ||
|
||||
+ num == 28 || num == 29 || num == 30;
|
||||
+}
|
||||
+
|
||||
+
|
||||
EAP_PWD_group * get_eap_pwd_group(u16 num)
|
||||
{
|
||||
EAP_PWD_group *grp;
|
||||
|
||||
+ if (!eap_pwd_suitable_group(num)) {
|
||||
+ wpa_printf(MSG_INFO, "EAP-pwd: unsuitable group %u", num);
|
||||
+ return NULL;
|
||||
+ }
|
||||
grp = os_zalloc(sizeof(EAP_PWD_group));
|
||||
if (!grp)
|
||||
return NULL;
|
||||
@@ -0,0 +1,54 @@
|
||||
From db54db11aec763b6fc74715c36e0f9de0d65e206 Mon Sep 17 00:00:00 2001
|
||||
From: Jouni Malinen <jouni@codeaurora.org>
|
||||
Date: Mon, 8 Apr 2019 18:01:07 +0300
|
||||
Subject: SAE: Reject unsuitable groups based on REVmd changes
|
||||
|
||||
The rules defining which DH groups are suitable for SAE use were
|
||||
accepted into IEEE 802.11 REVmd based on this document:
|
||||
https://mentor.ieee.org/802.11/dcn/19/11-19-0387-02-000m-addressing-some-sae-comments.docx
|
||||
|
||||
Enforce those rules in production builds of wpa_supplicant and hostapd.
|
||||
CONFIG_TESTING_OPTIONS=y builds can still be used to select any o the
|
||||
implemented groups to maintain testing coverage.
|
||||
|
||||
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
|
||||
---
|
||||
src/common/sae.c | 23 +++++++++++++++++++++++
|
||||
1 file changed, 23 insertions(+)
|
||||
|
||||
--- a/src/common/sae.c
|
||||
+++ b/src/common/sae.c
|
||||
@@ -18,10 +18,33 @@
|
||||
#include "sae.h"
|
||||
|
||||
|
||||
+static int sae_suitable_group(int group)
|
||||
+{
|
||||
+#ifdef CONFIG_TESTING_OPTIONS
|
||||
+ /* Allow all groups for testing purposes in non-production builds. */
|
||||
+ return 1;
|
||||
+#else /* CONFIG_TESTING_OPTIONS */
|
||||
+ /* Enforce REVmd rules on which SAE groups are suitable for production
|
||||
+ * purposes: FFC groups whose prime is >= 3072 bits and ECC groups
|
||||
+ * defined over a prime field whose prime is >= 256 bits. Furthermore,
|
||||
+ * ECC groups defined over a characteristic 2 finite field and ECC
|
||||
+ * groups with a co-factor greater than 1 are not suitable. */
|
||||
+ return group == 19 || group == 20 || group == 21 ||
|
||||
+ group == 28 || group == 29 || group == 30 ||
|
||||
+ group == 15 || group == 16 || group == 17 || group == 18;
|
||||
+#endif /* CONFIG_TESTING_OPTIONS */
|
||||
+}
|
||||
+
|
||||
+
|
||||
int sae_set_group(struct sae_data *sae, int group)
|
||||
{
|
||||
struct sae_temporary_data *tmp;
|
||||
|
||||
+ if (!sae_suitable_group(group)) {
|
||||
+ wpa_printf(MSG_DEBUG, "SAE: Reject unsuitable group %d", group);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
sae_clear_data(sae);
|
||||
tmp = sae->tmp = os_zalloc(sizeof(*tmp));
|
||||
if (tmp == NULL)
|
||||
@@ -0,0 +1,26 @@
|
||||
From e43f08991f00820c1f711ca254021d5f83b5cd7d Mon Sep 17 00:00:00 2001
|
||||
From: Jouni Malinen <jouni@codeaurora.org>
|
||||
Date: Thu, 25 Apr 2019 18:52:34 +0300
|
||||
Subject: [PATCH 1/6] SAE: Use const_time_memcmp() for pwd_value >= prime
|
||||
comparison
|
||||
|
||||
This reduces timing and memory access pattern differences for an
|
||||
operation that could depend on the used password.
|
||||
|
||||
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
|
||||
(cherry picked from commit 8e14b030e558d23f65d761895c07089404e61cf1)
|
||||
---
|
||||
src/common/sae.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/src/common/sae.c
|
||||
+++ b/src/common/sae.c
|
||||
@@ -317,7 +317,7 @@ static int sae_test_pwd_seed_ecc(struct
|
||||
wpa_hexdump_key(MSG_DEBUG, "SAE: pwd-value",
|
||||
pwd_value, sae->tmp->prime_len);
|
||||
|
||||
- if (os_memcmp(pwd_value, prime, sae->tmp->prime_len) >= 0)
|
||||
+ if (const_time_memcmp(pwd_value, prime, sae->tmp->prime_len) >= 0)
|
||||
return 0;
|
||||
|
||||
x_cand = crypto_bignum_init_set(pwd_value, sae->tmp->prime_len);
|
||||
@@ -0,0 +1,65 @@
|
||||
From 20d7bd83c43fb24c4cf84d3045254d3ee1957166 Mon Sep 17 00:00:00 2001
|
||||
From: Jouni Malinen <jouni@codeaurora.org>
|
||||
Date: Thu, 25 Apr 2019 19:07:05 +0300
|
||||
Subject: [PATCH 2/6] EAP-pwd: Use const_time_memcmp() for pwd_value >= prime
|
||||
comparison
|
||||
|
||||
This reduces timing and memory access pattern differences for an
|
||||
operation that could depend on the used password.
|
||||
|
||||
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
|
||||
(cherry picked from commit 7958223fdcfe82479e6ed71019a84f6d4cbf799c)
|
||||
---
|
||||
src/eap_common/eap_pwd_common.c | 13 ++++++++-----
|
||||
1 file changed, 8 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/src/eap_common/eap_pwd_common.c
|
||||
+++ b/src/eap_common/eap_pwd_common.c
|
||||
@@ -144,6 +144,7 @@ int compute_password_element(EAP_PWD_gro
|
||||
u8 qnr_bin[MAX_ECC_PRIME_LEN];
|
||||
u8 qr_or_qnr_bin[MAX_ECC_PRIME_LEN];
|
||||
u8 x_bin[MAX_ECC_PRIME_LEN];
|
||||
+ u8 prime_bin[MAX_ECC_PRIME_LEN];
|
||||
struct crypto_bignum *tmp1 = NULL, *tmp2 = NULL, *pm1 = NULL;
|
||||
struct crypto_hash *hash;
|
||||
unsigned char pwe_digest[SHA256_MAC_LEN], *prfbuf = NULL, ctr;
|
||||
@@ -161,6 +162,11 @@ int compute_password_element(EAP_PWD_gro
|
||||
os_memset(x_bin, 0, sizeof(x_bin));
|
||||
|
||||
prime = crypto_ec_get_prime(grp->group);
|
||||
+ primebitlen = crypto_ec_prime_len_bits(grp->group);
|
||||
+ primebytelen = crypto_ec_prime_len(grp->group);
|
||||
+ if (crypto_bignum_to_bin(prime, prime_bin, sizeof(prime_bin),
|
||||
+ primebytelen) < 0)
|
||||
+ return -1;
|
||||
cofactor = crypto_bignum_init();
|
||||
grp->pwe = crypto_ec_point_init(grp->group);
|
||||
tmp1 = crypto_bignum_init();
|
||||
@@ -176,8 +182,6 @@ int compute_password_element(EAP_PWD_gro
|
||||
"curve");
|
||||
goto fail;
|
||||
}
|
||||
- primebitlen = crypto_ec_prime_len_bits(grp->group);
|
||||
- primebytelen = crypto_ec_prime_len(grp->group);
|
||||
if ((prfbuf = os_malloc(primebytelen)) == NULL) {
|
||||
wpa_printf(MSG_INFO, "EAP-pwd: unable to malloc space for prf "
|
||||
"buffer");
|
||||
@@ -243,6 +247,8 @@ int compute_password_element(EAP_PWD_gro
|
||||
if (primebitlen % 8)
|
||||
buf_shift_right(prfbuf, primebytelen,
|
||||
8 - primebitlen % 8);
|
||||
+ if (const_time_memcmp(prfbuf, prime_bin, primebytelen) >= 0)
|
||||
+ continue;
|
||||
|
||||
crypto_bignum_deinit(x_candidate, 1);
|
||||
x_candidate = crypto_bignum_init_set(prfbuf, primebytelen);
|
||||
@@ -252,9 +258,6 @@ int compute_password_element(EAP_PWD_gro
|
||||
goto fail;
|
||||
}
|
||||
|
||||
- if (crypto_bignum_cmp(x_candidate, prime) >= 0)
|
||||
- continue;
|
||||
-
|
||||
wpa_hexdump_key(MSG_DEBUG, "EAP-pwd: x_candidate",
|
||||
prfbuf, primebytelen);
|
||||
const_time_select_bin(found, x_bin, prfbuf, primebytelen,
|
||||
@@ -0,0 +1,61 @@
|
||||
From ee34d8cfbd0fbf7ba7429531d4bee1c43b074d8b Mon Sep 17 00:00:00 2001
|
||||
From: Jouni Malinen <jouni@codeaurora.org>
|
||||
Date: Thu, 25 Apr 2019 19:23:05 +0300
|
||||
Subject: [PATCH 3/6] OpenSSL: Use BN_bn2binpad() or BN_bn2bin_padded() if
|
||||
available
|
||||
|
||||
This converts crypto_bignum_to_bin() to use the OpenSSL/BoringSSL
|
||||
functions BN_bn2binpad()/BN_bn2bin_padded(), when available, to avoid
|
||||
differences in runtime and memory access patterns depending on the
|
||||
leading bytes of the BIGNUM value.
|
||||
|
||||
OpenSSL 1.0.2 and LibreSSL do not include such functions, so those cases
|
||||
are still using the previous implementation where the BN_num_bytes()
|
||||
call may result in different memory access pattern.
|
||||
|
||||
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
|
||||
(cherry picked from commit 1e237903f5b5d3117342daf006c5878cdb45e3d3)
|
||||
---
|
||||
src/crypto/crypto_openssl.c | 16 ++++++++++++++++
|
||||
1 file changed, 16 insertions(+)
|
||||
|
||||
--- a/src/crypto/crypto_openssl.c
|
||||
+++ b/src/crypto/crypto_openssl.c
|
||||
@@ -1226,7 +1226,13 @@ void crypto_bignum_deinit(struct crypto_
|
||||
int crypto_bignum_to_bin(const struct crypto_bignum *a,
|
||||
u8 *buf, size_t buflen, size_t padlen)
|
||||
{
|
||||
+#ifdef OPENSSL_IS_BORINGSSL
|
||||
+#else /* OPENSSL_IS_BORINGSSL */
|
||||
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
|
||||
+#else
|
||||
int num_bytes, offset;
|
||||
+#endif
|
||||
+#endif /* OPENSSL_IS_BORINGSSL */
|
||||
|
||||
if (TEST_FAIL())
|
||||
return -1;
|
||||
@@ -1234,6 +1240,14 @@ int crypto_bignum_to_bin(const struct cr
|
||||
if (padlen > buflen)
|
||||
return -1;
|
||||
|
||||
+#ifdef OPENSSL_IS_BORINGSSL
|
||||
+ if (BN_bn2bin_padded(buf, padlen, (const BIGNUM *) a) == 0)
|
||||
+ return -1;
|
||||
+ return padlen;
|
||||
+#else /* OPENSSL_IS_BORINGSSL */
|
||||
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
|
||||
+ return BN_bn2binpad((const BIGNUM *) a, buf, padlen);
|
||||
+#else
|
||||
num_bytes = BN_num_bytes((const BIGNUM *) a);
|
||||
if ((size_t) num_bytes > buflen)
|
||||
return -1;
|
||||
@@ -1246,6 +1260,8 @@ int crypto_bignum_to_bin(const struct cr
|
||||
BN_bn2bin((const BIGNUM *) a, buf + offset);
|
||||
|
||||
return num_bytes + offset;
|
||||
+#endif
|
||||
+#endif /* OPENSSL_IS_BORINGSSL */
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
From a25b48118d75f3c2d7cb1b2c3b4cffb13091a34c Mon Sep 17 00:00:00 2001
|
||||
From: Jouni Malinen <j@w1.fi>
|
||||
Date: Mon, 24 Jun 2019 23:01:06 +0300
|
||||
Subject: [PATCH 4/6] SAE: Run through prf result processing even if it >=
|
||||
prime
|
||||
|
||||
This reduces differences in timing and memory access within the
|
||||
hunting-and-pecking loop for ECC groups that have a prime that is not
|
||||
close to a power of two (e.g., Brainpool curves).
|
||||
|
||||
Signed-off-by: Jouni Malinen <j@w1.fi>
|
||||
(cherry picked from commit 147bf7b88a9c231322b5b574263071ca6dbb0503)
|
||||
---
|
||||
src/common/sae.c | 15 ++++++++++++---
|
||||
1 file changed, 12 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/src/common/sae.c
|
||||
+++ b/src/common/sae.c
|
||||
@@ -304,6 +304,8 @@ static int sae_test_pwd_seed_ecc(struct
|
||||
struct crypto_bignum *y_sqr, *x_cand;
|
||||
int res;
|
||||
size_t bits;
|
||||
+ int cmp_prime;
|
||||
+ unsigned int in_range;
|
||||
|
||||
wpa_hexdump_key(MSG_DEBUG, "SAE: pwd-seed", pwd_seed, SHA256_MAC_LEN);
|
||||
|
||||
@@ -317,8 +319,13 @@ static int sae_test_pwd_seed_ecc(struct
|
||||
wpa_hexdump_key(MSG_DEBUG, "SAE: pwd-value",
|
||||
pwd_value, sae->tmp->prime_len);
|
||||
|
||||
- if (const_time_memcmp(pwd_value, prime, sae->tmp->prime_len) >= 0)
|
||||
- return 0;
|
||||
+ cmp_prime = const_time_memcmp(pwd_value, prime, sae->tmp->prime_len);
|
||||
+ /* Create a const_time mask for selection based on prf result
|
||||
+ * being smaller than prime. */
|
||||
+ in_range = const_time_fill_msb((unsigned int) cmp_prime);
|
||||
+ /* The algorithm description would skip the next steps if
|
||||
+ * cmp_prime >= 0 (reutnr 0 here), but go through them regardless to
|
||||
+ * minimize externally observable differences in behavior. */
|
||||
|
||||
x_cand = crypto_bignum_init_set(pwd_value, sae->tmp->prime_len);
|
||||
if (!x_cand)
|
||||
@@ -330,7 +337,9 @@ static int sae_test_pwd_seed_ecc(struct
|
||||
|
||||
res = is_quadratic_residue_blind(sae, prime, bits, qr, qnr, y_sqr);
|
||||
crypto_bignum_deinit(y_sqr, 1);
|
||||
- return res;
|
||||
+ if (res < 0)
|
||||
+ return res;
|
||||
+ return const_time_select_int(in_range, res, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
From 00a6cc73da61b03c146b6c341d0d1e572bcef432 Mon Sep 17 00:00:00 2001
|
||||
From: Jouni Malinen <j@w1.fi>
|
||||
Date: Mon, 24 Jun 2019 23:02:51 +0300
|
||||
Subject: [PATCH 5/6] EAP-pwd: Run through prf result processing even if it >=
|
||||
prime
|
||||
|
||||
This reduces differences in timing and memory access within the
|
||||
hunting-and-pecking loop for ECC groups that have a prime that is not
|
||||
close to a power of two (e.g., Brainpool curves).
|
||||
|
||||
Signed-off-by: Jouni Malinen <j@w1.fi>
|
||||
(cherry picked from commit cd803299ca485eb857e37c88f973fccfbb8600e5)
|
||||
---
|
||||
src/eap_common/eap_pwd_common.c | 13 ++++++++++---
|
||||
1 file changed, 10 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/src/eap_common/eap_pwd_common.c
|
||||
+++ b/src/eap_common/eap_pwd_common.c
|
||||
@@ -155,6 +155,8 @@ int compute_password_element(EAP_PWD_gro
|
||||
struct crypto_bignum *x_candidate = NULL, *cofactor = NULL;
|
||||
const struct crypto_bignum *prime;
|
||||
u8 mask, found_ctr = 0, is_odd = 0;
|
||||
+ int cmp_prime;
|
||||
+ unsigned int in_range;
|
||||
|
||||
if (grp->pwe)
|
||||
return -1;
|
||||
@@ -247,8 +249,13 @@ int compute_password_element(EAP_PWD_gro
|
||||
if (primebitlen % 8)
|
||||
buf_shift_right(prfbuf, primebytelen,
|
||||
8 - primebitlen % 8);
|
||||
- if (const_time_memcmp(prfbuf, prime_bin, primebytelen) >= 0)
|
||||
- continue;
|
||||
+ cmp_prime = const_time_memcmp(prfbuf, prime_bin, primebytelen);
|
||||
+ /* Create a const_time mask for selection based on prf result
|
||||
+ * being smaller than prime. */
|
||||
+ in_range = const_time_fill_msb((unsigned int) cmp_prime);
|
||||
+ /* The algorithm description would skip the next steps if
|
||||
+ * cmp_prime >= 0, but go through them regardless to minimize
|
||||
+ * externally observable differences in behavior. */
|
||||
|
||||
crypto_bignum_deinit(x_candidate, 1);
|
||||
x_candidate = crypto_bignum_init_set(prfbuf, primebytelen);
|
||||
@@ -311,7 +318,7 @@ int compute_password_element(EAP_PWD_gro
|
||||
goto fail;
|
||||
mask = const_time_eq(res, check);
|
||||
found_ctr = const_time_select_u8(found, found_ctr, ctr);
|
||||
- found |= mask;
|
||||
+ found |= mask & in_range;
|
||||
}
|
||||
if (found == 0) {
|
||||
wpa_printf(MSG_INFO,
|
||||
@@ -0,0 +1,44 @@
|
||||
From 558518ed63202e5358116ab7e0afd5e85490f2ef Mon Sep 17 00:00:00 2001
|
||||
From: Jouni Malinen <j@w1.fi>
|
||||
Date: Sat, 27 Jul 2019 23:19:17 +0300
|
||||
Subject: [PATCH 6/6] dragonfly: Disable use of groups using Brainpool curves
|
||||
|
||||
Disable groups that use Brainpool curves for now since they leak more
|
||||
timing information due to the prime not being close to a power of two.
|
||||
This removes use of groups 28, 29, and 30 from SAE and EAP-pwd.
|
||||
|
||||
Signed-off-by: Jouni Malinen <j@w1.fi>
|
||||
(cherry picked from commit 876c5eaa6dae1a87a17603fc489a44c29eedc2e3)
|
||||
---
|
||||
src/common/sae.c | 6 ++++--
|
||||
src/eap_common/eap_pwd_common.c | 3 +--
|
||||
2 files changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/src/common/sae.c
|
||||
+++ b/src/common/sae.c
|
||||
@@ -28,9 +28,11 @@ static int sae_suitable_group(int group)
|
||||
* purposes: FFC groups whose prime is >= 3072 bits and ECC groups
|
||||
* defined over a prime field whose prime is >= 256 bits. Furthermore,
|
||||
* ECC groups defined over a characteristic 2 finite field and ECC
|
||||
- * groups with a co-factor greater than 1 are not suitable. */
|
||||
+ * groups with a co-factor greater than 1 are not suitable. Disable
|
||||
+ * groups that use Brainpool curves as well for now since they leak more
|
||||
+ * timing information due to the prime not being close to a power of
|
||||
+ * two. */
|
||||
return group == 19 || group == 20 || group == 21 ||
|
||||
- group == 28 || group == 29 || group == 30 ||
|
||||
group == 15 || group == 16 || group == 17 || group == 18;
|
||||
#endif /* CONFIG_TESTING_OPTIONS */
|
||||
}
|
||||
--- a/src/eap_common/eap_pwd_common.c
|
||||
+++ b/src/eap_common/eap_pwd_common.c
|
||||
@@ -89,8 +89,7 @@ static int eap_pwd_suitable_group(u16 nu
|
||||
{
|
||||
/* Do not allow ECC groups with prime under 256 bits based on guidance
|
||||
* for the similar design in SAE. */
|
||||
- return num == 19 || num == 20 || num == 21 ||
|
||||
- num == 28 || num == 29 || num == 30;
|
||||
+ return num == 19 || num == 20 || num == 21;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
From 8c07fa9eda13e835f3f968b2e1c9a8be3a851ff9 Mon Sep 17 00:00:00 2001
|
||||
From: Jouni Malinen <j@w1.fi>
|
||||
Date: Thu, 29 Aug 2019 11:52:04 +0300
|
||||
Subject: [PATCH] AP: Silently ignore management frame from unexpected source
|
||||
address
|
||||
|
||||
Do not process any received Management frames with unexpected/invalid SA
|
||||
so that we do not add any state for unexpected STA addresses or end up
|
||||
sending out frames to unexpected destination. This prevents unexpected
|
||||
sequences where an unprotected frame might end up causing the AP to send
|
||||
out a response to another device and that other device processing the
|
||||
unexpected response.
|
||||
|
||||
In particular, this prevents some potential denial of service cases
|
||||
where the unexpected response frame from the AP might result in a
|
||||
connected station dropping its association.
|
||||
|
||||
Signed-off-by: Jouni Malinen <j@w1.fi>
|
||||
---
|
||||
src/ap/drv_callbacks.c | 13 +++++++++++++
|
||||
src/ap/ieee802_11.c | 12 ++++++++++++
|
||||
2 files changed, 25 insertions(+)
|
||||
|
||||
--- a/src/ap/drv_callbacks.c
|
||||
+++ b/src/ap/drv_callbacks.c
|
||||
@@ -129,6 +129,19 @@ int hostapd_notif_assoc(struct hostapd_d
|
||||
"hostapd_notif_assoc: Skip event with no address");
|
||||
return -1;
|
||||
}
|
||||
+
|
||||
+ if (is_multicast_ether_addr(addr) ||
|
||||
+ is_zero_ether_addr(addr) ||
|
||||
+ os_memcmp(addr, hapd->own_addr, ETH_ALEN) == 0) {
|
||||
+ /* Do not process any frames with unexpected/invalid SA so that
|
||||
+ * we do not add any state for unexpected STA addresses or end
|
||||
+ * up sending out frames to unexpected destination. */
|
||||
+ wpa_printf(MSG_DEBUG, "%s: Invalid SA=" MACSTR
|
||||
+ " in received indication - ignore this indication silently",
|
||||
+ __func__, MAC2STR(addr));
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
random_add_randomness(addr, ETH_ALEN);
|
||||
|
||||
hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
|
||||
--- a/src/ap/ieee802_11.c
|
||||
+++ b/src/ap/ieee802_11.c
|
||||
@@ -3929,6 +3929,18 @@ int ieee802_11_mgmt(struct hostapd_data
|
||||
fc = le_to_host16(mgmt->frame_control);
|
||||
stype = WLAN_FC_GET_STYPE(fc);
|
||||
|
||||
+ if (is_multicast_ether_addr(mgmt->sa) ||
|
||||
+ is_zero_ether_addr(mgmt->sa) ||
|
||||
+ os_memcmp(mgmt->sa, hapd->own_addr, ETH_ALEN) == 0) {
|
||||
+ /* Do not process any frames with unexpected/invalid SA so that
|
||||
+ * we do not add any state for unexpected STA addresses or end
|
||||
+ * up sending out frames to unexpected destination. */
|
||||
+ wpa_printf(MSG_DEBUG, "MGMT: Invalid SA=" MACSTR
|
||||
+ " in received frame - ignore this frame silently",
|
||||
+ MAC2STR(mgmt->sa));
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
if (stype == WLAN_FC_STYPE_BEACON) {
|
||||
handle_beacon(hapd, mgmt, len, fi);
|
||||
return 1;
|
||||
@@ -0,0 +1,97 @@
|
||||
--- a/src/utils/os_unix.c
|
||||
+++ b/src/utils/os_unix.c
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <time.h>
|
||||
#include <sys/wait.h>
|
||||
+#include <fcntl.h>
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <sys/capability.h>
|
||||
@@ -182,59 +183,46 @@ int os_gmtime(os_time_t t, struct os_tm
|
||||
return 0;
|
||||
}
|
||||
|
||||
-
|
||||
-#ifdef __APPLE__
|
||||
-#include <fcntl.h>
|
||||
-static int os_daemon(int nochdir, int noclose)
|
||||
+int os_daemonize(const char *pid_file)
|
||||
{
|
||||
- int devnull;
|
||||
+ int pid = 0, i, devnull;
|
||||
|
||||
- if (chdir("/") < 0)
|
||||
- return -1;
|
||||
+#if defined(__uClinux__) || defined(__sun__)
|
||||
+ return -1;
|
||||
+#else /* defined(__uClinux__) || defined(__sun__) */
|
||||
|
||||
- devnull = open("/dev/null", O_RDWR);
|
||||
- if (devnull < 0)
|
||||
+#ifndef __APPLE__
|
||||
+ pid = fork();
|
||||
+ if (pid < 0)
|
||||
return -1;
|
||||
+#endif
|
||||
|
||||
- if (dup2(devnull, STDIN_FILENO) < 0) {
|
||||
- close(devnull);
|
||||
- return -1;
|
||||
+ if (pid > 0) {
|
||||
+ if (pid_file) {
|
||||
+ FILE *f = fopen(pid_file, "w");
|
||||
+ if (f) {
|
||||
+ fprintf(f, "%u\n", pid);
|
||||
+ fclose(f);
|
||||
+ }
|
||||
+ }
|
||||
+ _exit(0);
|
||||
}
|
||||
|
||||
- if (dup2(devnull, STDOUT_FILENO) < 0) {
|
||||
- close(devnull);
|
||||
+ if (setsid() < 0)
|
||||
return -1;
|
||||
- }
|
||||
|
||||
- if (dup2(devnull, STDERR_FILENO) < 0) {
|
||||
- close(devnull);
|
||||
+ if (chdir("/") < 0)
|
||||
return -1;
|
||||
- }
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-#else /* __APPLE__ */
|
||||
-#define os_daemon daemon
|
||||
-#endif /* __APPLE__ */
|
||||
|
||||
-
|
||||
-int os_daemonize(const char *pid_file)
|
||||
-{
|
||||
-#if defined(__uClinux__) || defined(__sun__)
|
||||
- return -1;
|
||||
-#else /* defined(__uClinux__) || defined(__sun__) */
|
||||
- if (os_daemon(0, 0)) {
|
||||
- perror("daemon");
|
||||
+ devnull = open("/dev/null", O_RDWR);
|
||||
+ if (devnull < 0)
|
||||
return -1;
|
||||
- }
|
||||
|
||||
- if (pid_file) {
|
||||
- FILE *f = fopen(pid_file, "w");
|
||||
- if (f) {
|
||||
- fprintf(f, "%u\n", getpid());
|
||||
- fclose(f);
|
||||
- }
|
||||
- }
|
||||
+ for (i = 0; i <= STDERR_FILENO; i++)
|
||||
+ dup2(devnull, i);
|
||||
+
|
||||
+ if (devnull > 2)
|
||||
+ close(devnull);
|
||||
|
||||
return -0;
|
||||
#endif /* defined(__uClinux__) || defined(__sun__) */
|
||||
@@ -0,0 +1,14 @@
|
||||
--- a/wpa_supplicant/wpa_supplicant.c
|
||||
+++ b/wpa_supplicant/wpa_supplicant.c
|
||||
@@ -292,9 +292,10 @@ void wpa_supplicant_cancel_auth_timeout(
|
||||
*/
|
||||
void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
+ struct wpa_ssid *ssid = wpa_s->current_ssid;
|
||||
+
|
||||
#ifdef IEEE8021X_EAPOL
|
||||
struct eapol_config eapol_conf;
|
||||
- struct wpa_ssid *ssid = wpa_s->current_ssid;
|
||||
|
||||
#ifdef CONFIG_IBSS_RSN
|
||||
if (ssid->mode == WPAS_MODE_IBSS &&
|
||||
@@ -0,0 +1,12 @@
|
||||
--- a/src/l2_packet/l2_packet_linux.c
|
||||
+++ b/src/l2_packet/l2_packet_linux.c
|
||||
@@ -360,8 +360,7 @@ struct l2_packet_data * l2_packet_init_b
|
||||
|
||||
l2 = l2_packet_init(br_ifname, own_addr, protocol, rx_callback,
|
||||
rx_callback_ctx, l2_hdr);
|
||||
- if (!l2)
|
||||
- return NULL;
|
||||
+ return l2;
|
||||
|
||||
#ifndef CONFIG_NO_LINUX_PACKET_SOCKET_WAR
|
||||
/*
|
||||
355
package/network/services/hostapd/patches/200-multicall.patch
Normal file
355
package/network/services/hostapd/patches/200-multicall.patch
Normal file
@@ -0,0 +1,355 @@
|
||||
--- a/hostapd/Makefile
|
||||
+++ b/hostapd/Makefile
|
||||
@@ -28,6 +28,7 @@ CFLAGS += -I$(abspath ../src/utils)
|
||||
export BINDIR ?= /usr/local/bin/
|
||||
|
||||
-include .config
|
||||
+-include $(if $(MULTICALL), ../wpa_supplicant/.config)
|
||||
|
||||
ifndef CONFIG_NO_GITVER
|
||||
# Add VERSION_STR postfix for builds from a git repository
|
||||
@@ -198,7 +199,8 @@ endif
|
||||
|
||||
ifdef CONFIG_NO_VLAN
|
||||
CFLAGS += -DCONFIG_NO_VLAN
|
||||
-else
|
||||
+endif
|
||||
+ifneq ($(findstring CONFIG_NO_VLAN,$(CFLAGS)), CONFIG_NO_VLAN)
|
||||
OBJS += ../src/ap/vlan_init.o
|
||||
OBJS += ../src/ap/vlan_ifconfig.o
|
||||
OBJS += ../src/ap/vlan.o
|
||||
@@ -354,10 +356,14 @@ CFLAGS += -DCONFIG_MBO
|
||||
OBJS += ../src/ap/mbo_ap.o
|
||||
endif
|
||||
|
||||
+ifndef MULTICALL
|
||||
+CFLAGS += -DNO_SUPPLICANT
|
||||
+endif
|
||||
+
|
||||
include ../src/drivers/drivers.mak
|
||||
-OBJS += $(DRV_AP_OBJS)
|
||||
-CFLAGS += $(DRV_AP_CFLAGS)
|
||||
-LDFLAGS += $(DRV_AP_LDFLAGS)
|
||||
+OBJS += $(sort $(DRV_AP_OBJS) $(if $(MULTICALL),$(DRV_WPA_OBJS)))
|
||||
+CFLAGS += $(DRV_AP_CFLAGS) $(if $(MULTICALL),$(DRV_WPA_CFLAGS))
|
||||
+LDFLAGS += $(DRV_AP_LDFLAGS) $(if $(MULTICALL),$(DRV_WPA_LDFLAGS))
|
||||
LIBS += $(DRV_AP_LIBS)
|
||||
|
||||
ifdef CONFIG_L2_PACKET
|
||||
@@ -1274,6 +1280,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR)
|
||||
|
||||
BCHECK=../src/drivers/build.hostapd
|
||||
|
||||
+hostapd_multi.a: $(BCHECK) $(OBJS)
|
||||
+ $(Q)$(CC) -c -o hostapd_multi.o -Dmain=hostapd_main $(CFLAGS) main.c
|
||||
+ @$(E) " CC " $<
|
||||
+ @rm -f $@
|
||||
+ @$(AR) cr $@ hostapd_multi.o $(OBJS)
|
||||
+
|
||||
hostapd: $(BCHECK) $(OBJS)
|
||||
$(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
|
||||
@$(E) " LD " $@
|
||||
@@ -1316,6 +1328,12 @@ ifeq ($(CONFIG_TLS), linux)
|
||||
HOBJS += ../src/crypto/crypto_linux.o
|
||||
endif
|
||||
|
||||
+dump_cflags:
|
||||
+ @printf "%s " "$(CFLAGS)"
|
||||
+
|
||||
+dump_ldflags:
|
||||
+ @printf "%s " "$(LDFLAGS) $(LIBS) $(EXTRALIBS)"
|
||||
+
|
||||
nt_password_hash: $(NOBJS)
|
||||
$(Q)$(CC) $(LDFLAGS) -o nt_password_hash $(NOBJS) $(LIBS_n)
|
||||
@$(E) " LD " $@
|
||||
--- a/wpa_supplicant/Makefile
|
||||
+++ b/wpa_supplicant/Makefile
|
||||
@@ -27,6 +27,7 @@ CFLAGS += -I$(abspath ../src)
|
||||
CFLAGS += -I$(abspath ../src/utils)
|
||||
|
||||
-include .config
|
||||
+-include $(if $(MULTICALL),../hostapd/.config)
|
||||
|
||||
ifndef CONFIG_NO_GITVER
|
||||
# Add VERSION_STR postfix for builds from a git repository
|
||||
@@ -354,7 +355,9 @@ endif
|
||||
ifdef CONFIG_IBSS_RSN
|
||||
NEED_RSN_AUTHENTICATOR=y
|
||||
CFLAGS += -DCONFIG_IBSS_RSN
|
||||
+ifndef MULTICALL
|
||||
CFLAGS += -DCONFIG_NO_VLAN
|
||||
+endif
|
||||
OBJS += ibss_rsn.o
|
||||
endif
|
||||
|
||||
@@ -862,6 +865,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS
|
||||
CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS
|
||||
LIBS += -ldl -rdynamic
|
||||
endif
|
||||
+else
|
||||
+ ifdef MULTICALL
|
||||
+ OBJS += ../src/eap_common/eap_common.o
|
||||
+ endif
|
||||
endif
|
||||
|
||||
ifdef CONFIG_AP
|
||||
@@ -869,9 +876,11 @@ NEED_EAP_COMMON=y
|
||||
NEED_RSN_AUTHENTICATOR=y
|
||||
CFLAGS += -DCONFIG_AP
|
||||
OBJS += ap.o
|
||||
+ifndef MULTICALL
|
||||
CFLAGS += -DCONFIG_NO_RADIUS
|
||||
CFLAGS += -DCONFIG_NO_ACCOUNTING
|
||||
CFLAGS += -DCONFIG_NO_VLAN
|
||||
+endif
|
||||
OBJS += ../src/ap/hostapd.o
|
||||
OBJS += ../src/ap/wpa_auth_glue.o
|
||||
OBJS += ../src/ap/utils.o
|
||||
@@ -953,6 +962,12 @@ endif
|
||||
ifdef CONFIG_HS20
|
||||
OBJS += ../src/ap/hs20.o
|
||||
endif
|
||||
+else
|
||||
+ ifdef MULTICALL
|
||||
+ OBJS += ../src/eap_server/eap_server.o
|
||||
+ OBJS += ../src/eap_server/eap_server_identity.o
|
||||
+ OBJS += ../src/eap_server/eap_server_methods.o
|
||||
+ endif
|
||||
endif
|
||||
|
||||
ifdef CONFIG_MBO
|
||||
@@ -961,7 +976,9 @@ CFLAGS += -DCONFIG_MBO
|
||||
endif
|
||||
|
||||
ifdef NEED_RSN_AUTHENTICATOR
|
||||
+ifndef MULTICALL
|
||||
CFLAGS += -DCONFIG_NO_RADIUS
|
||||
+endif
|
||||
NEED_AES_WRAP=y
|
||||
OBJS += ../src/ap/wpa_auth.o
|
||||
OBJS += ../src/ap/wpa_auth_ie.o
|
||||
@@ -1888,6 +1905,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv)
|
||||
|
||||
$(OBJS_c) $(OBJS_t) $(OBJS_t2) $(OBJS) $(BCHECK) $(EXTRA_progs): .config
|
||||
|
||||
+wpa_supplicant_multi.a: .config $(BCHECK) $(OBJS) $(EXTRA_progs)
|
||||
+ $(Q)$(CC) -c -o wpa_supplicant_multi.o -Dmain=wpa_supplicant_main $(CFLAGS) main.c
|
||||
+ @$(E) " CC " $<
|
||||
+ @rm -f $@
|
||||
+ @$(AR) cr $@ wpa_supplicant_multi.o $(OBJS)
|
||||
+
|
||||
wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs)
|
||||
$(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS)
|
||||
@$(E) " LD " $@
|
||||
@@ -1990,6 +2013,12 @@ endif
|
||||
-e 's|\@DBUS_INTERFACE\@|$(DBUS_INTERFACE)|g' $< >$@
|
||||
@$(E) " sed" $<
|
||||
|
||||
+dump_cflags:
|
||||
+ @printf "%s " "$(CFLAGS)"
|
||||
+
|
||||
+dump_ldflags:
|
||||
+ @printf "%s " "$(LDFLAGS) $(LIBS) $(EXTRALIBS)"
|
||||
+
|
||||
wpa_supplicant.exe: wpa_supplicant
|
||||
mv -f $< $@
|
||||
wpa_cli.exe: wpa_cli
|
||||
--- a/src/drivers/driver.h
|
||||
+++ b/src/drivers/driver.h
|
||||
@@ -5449,8 +5449,8 @@ union wpa_event_data {
|
||||
* Driver wrapper code should call this function whenever an event is received
|
||||
* from the driver.
|
||||
*/
|
||||
-void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
|
||||
- union wpa_event_data *data);
|
||||
+extern void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data);
|
||||
|
||||
/**
|
||||
* wpa_supplicant_event_global - Report a driver event for wpa_supplicant
|
||||
@@ -5462,7 +5462,7 @@ void wpa_supplicant_event(void *ctx, enu
|
||||
* Same as wpa_supplicant_event(), but we search for the interface in
|
||||
* wpa_global.
|
||||
*/
|
||||
-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
|
||||
+extern void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
|
||||
union wpa_event_data *data);
|
||||
|
||||
/*
|
||||
--- a/src/ap/drv_callbacks.c
|
||||
+++ b/src/ap/drv_callbacks.c
|
||||
@@ -1528,8 +1528,8 @@ static void hostapd_event_wds_sta_interf
|
||||
}
|
||||
|
||||
|
||||
-void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
|
||||
- union wpa_event_data *data)
|
||||
+void hostapd_wpa_event(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data)
|
||||
{
|
||||
struct hostapd_data *hapd = ctx;
|
||||
#ifndef CONFIG_NO_STDOUT_DEBUG
|
||||
@@ -1755,7 +1755,7 @@ void wpa_supplicant_event(void *ctx, enu
|
||||
}
|
||||
|
||||
|
||||
-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
|
||||
+void hostapd_wpa_event_global(void *ctx, enum wpa_event_type event,
|
||||
union wpa_event_data *data)
|
||||
{
|
||||
struct hapd_interfaces *interfaces = ctx;
|
||||
--- a/wpa_supplicant/wpa_priv.c
|
||||
+++ b/wpa_supplicant/wpa_priv.c
|
||||
@@ -1031,8 +1031,8 @@ static void wpa_priv_send_ft_response(st
|
||||
}
|
||||
|
||||
|
||||
-void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
|
||||
- union wpa_event_data *data)
|
||||
+static void supplicant_event(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data)
|
||||
{
|
||||
struct wpa_priv_interface *iface = ctx;
|
||||
|
||||
@@ -1095,7 +1095,7 @@ void wpa_supplicant_event(void *ctx, enu
|
||||
}
|
||||
|
||||
|
||||
-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
|
||||
+void supplicant_event_global(void *ctx, enum wpa_event_type event,
|
||||
union wpa_event_data *data)
|
||||
{
|
||||
struct wpa_priv_global *global = ctx;
|
||||
@@ -1207,6 +1207,8 @@ int main(int argc, char *argv[])
|
||||
if (os_program_init())
|
||||
return -1;
|
||||
|
||||
+ wpa_supplicant_event = supplicant_event;
|
||||
+ wpa_supplicant_event_global = supplicant_event_global;
|
||||
wpa_priv_fd_workaround();
|
||||
|
||||
os_memset(&global, 0, sizeof(global));
|
||||
--- a/wpa_supplicant/events.c
|
||||
+++ b/wpa_supplicant/events.c
|
||||
@@ -3976,8 +3976,8 @@ static void wpas_event_assoc_reject(stru
|
||||
}
|
||||
|
||||
|
||||
-void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
|
||||
- union wpa_event_data *data)
|
||||
+void supplicant_event(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data)
|
||||
{
|
||||
struct wpa_supplicant *wpa_s = ctx;
|
||||
int resched;
|
||||
@@ -4745,7 +4745,7 @@ void wpa_supplicant_event(void *ctx, enu
|
||||
}
|
||||
|
||||
|
||||
-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
|
||||
+void supplicant_event_global(void *ctx, enum wpa_event_type event,
|
||||
union wpa_event_data *data)
|
||||
{
|
||||
struct wpa_supplicant *wpa_s;
|
||||
--- a/wpa_supplicant/wpa_supplicant.c
|
||||
+++ b/wpa_supplicant/wpa_supplicant.c
|
||||
@@ -5797,7 +5797,6 @@ struct wpa_interface * wpa_supplicant_ma
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-
|
||||
/**
|
||||
* wpa_supplicant_match_existing - Match existing interfaces
|
||||
* @global: Pointer to global data from wpa_supplicant_init()
|
||||
@@ -5834,6 +5833,11 @@ static int wpa_supplicant_match_existing
|
||||
|
||||
#endif /* CONFIG_MATCH_IFACE */
|
||||
|
||||
+extern void supplicant_event(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data);
|
||||
+
|
||||
+extern void supplicant_event_global(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data);
|
||||
|
||||
/**
|
||||
* wpa_supplicant_add_iface - Add a new network interface
|
||||
@@ -6090,6 +6094,8 @@ struct wpa_global * wpa_supplicant_init(
|
||||
#ifndef CONFIG_NO_WPA_MSG
|
||||
wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb);
|
||||
#endif /* CONFIG_NO_WPA_MSG */
|
||||
+ wpa_supplicant_event = supplicant_event;
|
||||
+ wpa_supplicant_event_global = supplicant_event_global;
|
||||
|
||||
if (params->wpa_debug_file_path)
|
||||
wpa_debug_open_file(params->wpa_debug_file_path);
|
||||
--- a/hostapd/main.c
|
||||
+++ b/hostapd/main.c
|
||||
@@ -591,6 +591,11 @@ fail:
|
||||
return -1;
|
||||
}
|
||||
|
||||
+void hostapd_wpa_event(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data);
|
||||
+
|
||||
+void hostapd_wpa_event_global(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data);
|
||||
|
||||
#ifdef CONFIG_WPS
|
||||
static int gen_uuid(const char *txt_addr)
|
||||
@@ -674,6 +679,8 @@ int main(int argc, char *argv[])
|
||||
hostapd_dpp_init_global(&interfaces);
|
||||
#endif /* CONFIG_DPP */
|
||||
|
||||
+ wpa_supplicant_event = hostapd_wpa_event;
|
||||
+ wpa_supplicant_event_global = hostapd_wpa_event_global;
|
||||
for (;;) {
|
||||
c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:vg:G:");
|
||||
if (c < 0)
|
||||
--- a/src/drivers/drivers.c
|
||||
+++ b/src/drivers/drivers.c
|
||||
@@ -10,6 +10,10 @@
|
||||
#include "utils/common.h"
|
||||
#include "driver.h"
|
||||
|
||||
+void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data);
|
||||
+void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data);
|
||||
|
||||
const struct wpa_driver_ops *const wpa_drivers[] =
|
||||
{
|
||||
--- a/wpa_supplicant/eapol_test.c
|
||||
+++ b/wpa_supplicant/eapol_test.c
|
||||
@@ -29,7 +29,12 @@
|
||||
#include "ctrl_iface.h"
|
||||
#include "pcsc_funcs.h"
|
||||
#include "wpas_glue.h"
|
||||
+#include "drivers/driver.h"
|
||||
|
||||
+void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data);
|
||||
+void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data);
|
||||
|
||||
const struct wpa_driver_ops *const wpa_drivers[] = { NULL };
|
||||
|
||||
@@ -1295,6 +1300,10 @@ static void usage(void)
|
||||
"option several times.\n");
|
||||
}
|
||||
|
||||
+extern void supplicant_event(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data);
|
||||
+extern void supplicant_event_global(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -1315,6 +1324,8 @@ int main(int argc, char *argv[])
|
||||
if (os_program_init())
|
||||
return -1;
|
||||
|
||||
+ wpa_supplicant_event = supplicant_event;
|
||||
+ wpa_supplicant_event_global = supplicant_event_global;
|
||||
hostapd_logger_register_cb(hostapd_logger_cb);
|
||||
|
||||
os_memset(&eapol_test, 0, sizeof(eapol_test));
|
||||
58
package/network/services/hostapd/patches/300-noscan.patch
Normal file
58
package/network/services/hostapd/patches/300-noscan.patch
Normal file
@@ -0,0 +1,58 @@
|
||||
--- a/hostapd/config_file.c
|
||||
+++ b/hostapd/config_file.c
|
||||
@@ -3214,6 +3214,10 @@ static int hostapd_config_fill(struct ho
|
||||
}
|
||||
#endif /* CONFIG_IEEE80211W */
|
||||
#ifdef CONFIG_IEEE80211N
|
||||
+ } else if (os_strcmp(buf, "noscan") == 0) {
|
||||
+ conf->noscan = atoi(pos);
|
||||
+ } else if (os_strcmp(buf, "ht_coex") == 0) {
|
||||
+ conf->no_ht_coex = !atoi(pos);
|
||||
} else if (os_strcmp(buf, "ieee80211n") == 0) {
|
||||
conf->ieee80211n = atoi(pos);
|
||||
} else if (os_strcmp(buf, "ht_capab") == 0) {
|
||||
--- a/src/ap/ap_config.h
|
||||
+++ b/src/ap/ap_config.h
|
||||
@@ -775,6 +775,8 @@ struct hostapd_config {
|
||||
|
||||
int ht_op_mode_fixed;
|
||||
u16 ht_capab;
|
||||
+ int noscan;
|
||||
+ int no_ht_coex;
|
||||
int ieee80211n;
|
||||
int secondary_channel;
|
||||
int no_pri_sec_switch;
|
||||
--- a/src/ap/hw_features.c
|
||||
+++ b/src/ap/hw_features.c
|
||||
@@ -480,7 +480,8 @@ static int ieee80211n_check_40mhz(struct
|
||||
int ret;
|
||||
|
||||
/* Check that HT40 is used and PRI / SEC switch is allowed */
|
||||
- if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch)
|
||||
+ if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch ||
|
||||
+ iface->conf->noscan)
|
||||
return 0;
|
||||
|
||||
hostapd_set_state(iface, HAPD_IFACE_HT_SCAN);
|
||||
--- a/src/ap/ieee802_11_ht.c
|
||||
+++ b/src/ap/ieee802_11_ht.c
|
||||
@@ -252,6 +252,9 @@ void hostapd_2040_coex_action(struct hos
|
||||
return;
|
||||
}
|
||||
|
||||
+ if (iface->conf->noscan || iface->conf->no_ht_coex)
|
||||
+ return;
|
||||
+
|
||||
if (len < IEEE80211_HDRLEN + 2 + sizeof(*bc_ie)) {
|
||||
wpa_printf(MSG_DEBUG,
|
||||
"Ignore too short 20/40 BSS Coexistence Management frame");
|
||||
@@ -412,6 +415,9 @@ void ht40_intolerant_add(struct hostapd_
|
||||
if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G)
|
||||
return;
|
||||
|
||||
+ if (iface->conf->noscan || iface->conf->no_ht_coex)
|
||||
+ return;
|
||||
+
|
||||
wpa_printf(MSG_INFO, "HT: Forty MHz Intolerant is set by STA " MACSTR
|
||||
" in Association Request", MAC2STR(sta->addr));
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
--- a/wpa_supplicant/config.c
|
||||
+++ b/wpa_supplicant/config.c
|
||||
@@ -2217,6 +2217,7 @@ static const struct parse_data ssid_fiel
|
||||
#else /* CONFIG_MESH */
|
||||
{ INT_RANGE(mode, 0, 4) },
|
||||
#endif /* CONFIG_MESH */
|
||||
+ { INT_RANGE(noscan, 0, 1) },
|
||||
{ INT_RANGE(proactive_key_caching, 0, 1) },
|
||||
{ INT_RANGE(disabled, 0, 2) },
|
||||
{ STR(id_str) },
|
||||
--- a/wpa_supplicant/config_file.c
|
||||
+++ b/wpa_supplicant/config_file.c
|
||||
@@ -818,6 +818,7 @@ static void wpa_config_write_network(FIL
|
||||
#endif /* IEEE8021X_EAPOL */
|
||||
INT(mode);
|
||||
INT(no_auto_peer);
|
||||
+ INT(noscan);
|
||||
INT(mesh_fwding);
|
||||
INT(frequency);
|
||||
INT(fixed_freq);
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -288,6 +288,8 @@ static int wpa_supplicant_mesh_init(stru
|
||||
frequency);
|
||||
goto out_free;
|
||||
}
|
||||
+ if (ssid->noscan)
|
||||
+ conf->noscan = 1;
|
||||
if (ssid->ht40)
|
||||
conf->secondary_channel = ssid->ht40;
|
||||
if (conf->hw_mode == HOSTAPD_MODE_IEEE80211A && ssid->vht) {
|
||||
--- a/wpa_supplicant/wpa_supplicant.c
|
||||
+++ b/wpa_supplicant/wpa_supplicant.c
|
||||
@@ -2051,12 +2051,12 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
{
|
||||
enum hostapd_hw_mode hw_mode;
|
||||
struct hostapd_hw_modes *mode = NULL;
|
||||
- int ht40plus[] = { 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157,
|
||||
+ int ht40plus[] = { 1, 2, 3, 4, 5, 6, 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157,
|
||||
184, 192 };
|
||||
int vht80[] = { 36, 52, 100, 116, 132, 149 };
|
||||
struct hostapd_channel_data *pri_chan = NULL, *sec_chan = NULL;
|
||||
u8 channel;
|
||||
- int i, chan_idx, ht40 = -1, res, obss_scan = 1;
|
||||
+ int i, chan_idx, ht40 = -1, res, obss_scan = !(ssid->noscan);
|
||||
unsigned int j, k;
|
||||
struct hostapd_freq_params vht_freq;
|
||||
int chwidth, seg0, seg1;
|
||||
@@ -2126,7 +2126,7 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
return;
|
||||
|
||||
/* Setup higher BW only for 5 GHz */
|
||||
- if (mode->mode != HOSTAPD_MODE_IEEE80211A)
|
||||
+ if (mode->mode != HOSTAPD_MODE_IEEE80211A && !(ssid->noscan))
|
||||
return;
|
||||
|
||||
for (chan_idx = 0; chan_idx < mode->num_channels; chan_idx++) {
|
||||
--- a/wpa_supplicant/config_ssid.h
|
||||
+++ b/wpa_supplicant/config_ssid.h
|
||||
@@ -856,6 +856,8 @@ struct wpa_ssid {
|
||||
*/
|
||||
int no_auto_peer;
|
||||
|
||||
+ int noscan;
|
||||
+
|
||||
/**
|
||||
* mesh_rssi_threshold - Set mesh parameter mesh_rssi_threshold (dBm)
|
||||
*
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/wpa_supplicant/wpa_supplicant.c
|
||||
+++ b/wpa_supplicant/wpa_supplicant.c
|
||||
@@ -4248,7 +4248,7 @@ wpa_supplicant_alloc(struct wpa_supplica
|
||||
if (wpa_s == NULL)
|
||||
return NULL;
|
||||
wpa_s->scan_req = INITIAL_SCAN_REQ;
|
||||
- wpa_s->scan_interval = 5;
|
||||
+ wpa_s->scan_interval = 1;
|
||||
wpa_s->new_connection = 1;
|
||||
wpa_s->parent = parent ? parent : wpa_s;
|
||||
wpa_s->p2pdev = wpa_s->parent;
|
||||
@@ -0,0 +1,61 @@
|
||||
--- a/src/drivers/drivers.mak
|
||||
+++ b/src/drivers/drivers.mak
|
||||
@@ -49,7 +49,6 @@ NEED_SME=y
|
||||
NEED_AP_MLME=y
|
||||
NEED_NETLINK=y
|
||||
NEED_LINUX_IOCTL=y
|
||||
-NEED_RFKILL=y
|
||||
NEED_RADIOTAP=y
|
||||
|
||||
ifdef CONFIG_LIBNL32
|
||||
@@ -136,7 +135,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
|
||||
CONFIG_WIRELESS_EXTENSION=y
|
||||
NEED_NETLINK=y
|
||||
NEED_LINUX_IOCTL=y
|
||||
-NEED_RFKILL=y
|
||||
endif
|
||||
|
||||
ifdef CONFIG_DRIVER_NDIS
|
||||
@@ -162,7 +160,6 @@ endif
|
||||
ifdef CONFIG_WIRELESS_EXTENSION
|
||||
DRV_WPA_CFLAGS += -DCONFIG_WIRELESS_EXTENSION
|
||||
DRV_WPA_OBJS += ../src/drivers/driver_wext.o
|
||||
-NEED_RFKILL=y
|
||||
endif
|
||||
|
||||
ifdef NEED_NETLINK
|
||||
@@ -175,6 +172,7 @@ endif
|
||||
|
||||
ifdef NEED_RFKILL
|
||||
DRV_OBJS += ../src/drivers/rfkill.o
|
||||
+DRV_WPA_CFLAGS += -DCONFIG_RFKILL
|
||||
endif
|
||||
|
||||
ifdef NEED_RADIOTAP
|
||||
--- a/src/drivers/rfkill.h
|
||||
+++ b/src/drivers/rfkill.h
|
||||
@@ -18,8 +18,24 @@ struct rfkill_config {
|
||||
void (*unblocked_cb)(void *ctx);
|
||||
};
|
||||
|
||||
+#ifdef CONFIG_RFKILL
|
||||
struct rfkill_data * rfkill_init(struct rfkill_config *cfg);
|
||||
void rfkill_deinit(struct rfkill_data *rfkill);
|
||||
int rfkill_is_blocked(struct rfkill_data *rfkill);
|
||||
+#else
|
||||
+static inline struct rfkill_data * rfkill_init(struct rfkill_config *cfg)
|
||||
+{
|
||||
+ return (void *) 1;
|
||||
+}
|
||||
+
|
||||
+static inline void rfkill_deinit(struct rfkill_data *rfkill)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+static inline int rfkill_is_blocked(struct rfkill_data *rfkill)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+#endif
|
||||
|
||||
#endif /* RFKILL_H */
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/src/drivers/driver_nl80211.c
|
||||
+++ b/src/drivers/driver_nl80211.c
|
||||
@@ -4234,7 +4234,7 @@ static int nl80211_set_channel(struct i8
|
||||
freq->freq, freq->ht_enabled, freq->vht_enabled,
|
||||
freq->bandwidth, freq->center_freq1, freq->center_freq2);
|
||||
|
||||
- msg = nl80211_drv_msg(drv, 0, set_chan ? NL80211_CMD_SET_CHANNEL :
|
||||
+ msg = nl80211_bss_msg(bss, 0, set_chan ? NL80211_CMD_SET_CHANNEL :
|
||||
NL80211_CMD_SET_WIPHY);
|
||||
if (!msg || nl80211_put_freq_params(msg, freq) < 0) {
|
||||
nlmsg_free(msg);
|
||||
@@ -0,0 +1,69 @@
|
||||
--- a/src/ap/hostapd.c
|
||||
+++ b/src/ap/hostapd.c
|
||||
@@ -93,6 +93,25 @@ static void hostapd_reload_bss(struct ho
|
||||
#endif /* CONFIG_NO_RADIUS */
|
||||
|
||||
ssid = &hapd->conf->ssid;
|
||||
+
|
||||
+ hostapd_set_freq(hapd, hapd->iconf->hw_mode, hapd->iface->freq,
|
||||
+ hapd->iconf->channel,
|
||||
+ hapd->iconf->ieee80211n,
|
||||
+ hapd->iconf->ieee80211ac,
|
||||
+ hapd->iconf->secondary_channel,
|
||||
+ hapd->iconf->vht_oper_chwidth,
|
||||
+ hapd->iconf->vht_oper_centr_freq_seg0_idx,
|
||||
+ hapd->iconf->vht_oper_centr_freq_seg1_idx);
|
||||
+
|
||||
+ if (hapd->iface->current_mode) {
|
||||
+ if (hostapd_prepare_rates(hapd->iface, hapd->iface->current_mode)) {
|
||||
+ wpa_printf(MSG_ERROR, "Failed to prepare rates table.");
|
||||
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
|
||||
+ HOSTAPD_LEVEL_WARNING,
|
||||
+ "Failed to prepare rates table.");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (!ssid->wpa_psk_set && ssid->wpa_psk && !ssid->wpa_psk->next &&
|
||||
ssid->wpa_passphrase_set && ssid->wpa_passphrase) {
|
||||
/*
|
||||
@@ -171,6 +190,7 @@ int hostapd_reload_config(struct hostapd
|
||||
struct hostapd_data *hapd = iface->bss[0];
|
||||
struct hostapd_config *newconf, *oldconf;
|
||||
size_t j;
|
||||
+ int i;
|
||||
|
||||
if (iface->config_fname == NULL) {
|
||||
/* Only in-memory config in use - assume it has been updated */
|
||||
@@ -192,21 +212,20 @@ int hostapd_reload_config(struct hostapd
|
||||
oldconf = hapd->iconf;
|
||||
iface->conf = newconf;
|
||||
|
||||
+ for (i = 0; i < iface->num_hw_features; i++) {
|
||||
+ struct hostapd_hw_modes *mode = &iface->hw_features[i];
|
||||
+ if (mode->mode == iface->conf->hw_mode) {
|
||||
+ iface->current_mode = mode;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (iface->conf->channel)
|
||||
+ iface->freq = hostapd_hw_get_freq(hapd, iface->conf->channel);
|
||||
+
|
||||
for (j = 0; j < iface->num_bss; j++) {
|
||||
hapd = iface->bss[j];
|
||||
hapd->iconf = newconf;
|
||||
- hapd->iconf->channel = oldconf->channel;
|
||||
- hapd->iconf->acs = oldconf->acs;
|
||||
- hapd->iconf->secondary_channel = oldconf->secondary_channel;
|
||||
- hapd->iconf->ieee80211n = oldconf->ieee80211n;
|
||||
- hapd->iconf->ieee80211ac = oldconf->ieee80211ac;
|
||||
- hapd->iconf->ht_capab = oldconf->ht_capab;
|
||||
- hapd->iconf->vht_capab = oldconf->vht_capab;
|
||||
- hapd->iconf->vht_oper_chwidth = oldconf->vht_oper_chwidth;
|
||||
- hapd->iconf->vht_oper_centr_freq_seg0_idx =
|
||||
- oldconf->vht_oper_centr_freq_seg0_idx;
|
||||
- hapd->iconf->vht_oper_centr_freq_seg1_idx =
|
||||
- oldconf->vht_oper_centr_freq_seg1_idx;
|
||||
hapd->conf = newconf->bss[j];
|
||||
hostapd_reload_bss(hapd);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
--- a/src/drivers/driver_nl80211.c
|
||||
+++ b/src/drivers/driver_nl80211.c
|
||||
@@ -2566,10 +2566,15 @@ static int wpa_driver_nl80211_del_beacon
|
||||
struct nl_msg *msg;
|
||||
struct wpa_driver_nl80211_data *drv = bss->drv;
|
||||
|
||||
+ if (!bss->beacon_set)
|
||||
+ return 0;
|
||||
+
|
||||
+ bss->beacon_set = 0;
|
||||
+
|
||||
wpa_printf(MSG_DEBUG, "nl80211: Remove beacon (ifindex=%d)",
|
||||
- drv->ifindex);
|
||||
+ bss->ifindex);
|
||||
nl80211_put_wiphy_data_ap(bss);
|
||||
- msg = nl80211_drv_msg(drv, 0, NL80211_CMD_DEL_BEACON);
|
||||
+ msg = nl80211_bss_msg(bss, 0, NL80211_CMD_DEL_BEACON);
|
||||
return send_and_recv_msgs(drv, msg, NULL, NULL);
|
||||
}
|
||||
|
||||
@@ -4835,7 +4840,7 @@ static void nl80211_teardown_ap(struct i
|
||||
nl80211_mgmt_unsubscribe(bss, "AP teardown");
|
||||
|
||||
nl80211_put_wiphy_data_ap(bss);
|
||||
- bss->beacon_set = 0;
|
||||
+ wpa_driver_nl80211_del_beacon(bss);
|
||||
}
|
||||
|
||||
|
||||
@@ -7057,8 +7062,6 @@ static int wpa_driver_nl80211_if_remove(
|
||||
} else {
|
||||
wpa_printf(MSG_DEBUG, "nl80211: First BSS - reassign context");
|
||||
nl80211_teardown_ap(bss);
|
||||
- if (!bss->added_if && !drv->first_bss->next)
|
||||
- wpa_driver_nl80211_del_beacon(bss);
|
||||
nl80211_destroy_bss(bss);
|
||||
if (!bss->added_if)
|
||||
i802_set_iface_flags(bss, 0);
|
||||
@@ -7437,7 +7440,6 @@ static int wpa_driver_nl80211_deinit_ap(
|
||||
if (!is_ap_interface(drv->nlmode))
|
||||
return -1;
|
||||
wpa_driver_nl80211_del_beacon(bss);
|
||||
- bss->beacon_set = 0;
|
||||
|
||||
/*
|
||||
* If the P2P GO interface was dynamically added, then it is
|
||||
@@ -7457,7 +7459,6 @@ static int wpa_driver_nl80211_stop_ap(vo
|
||||
if (!is_ap_interface(drv->nlmode))
|
||||
return -1;
|
||||
wpa_driver_nl80211_del_beacon(bss);
|
||||
- bss->beacon_set = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
--- a/hostapd/ctrl_iface.c
|
||||
+++ b/hostapd/ctrl_iface.c
|
||||
@@ -60,6 +60,7 @@
|
||||
#include "fst/fst_ctrl_iface.h"
|
||||
#include "config_file.h"
|
||||
#include "ctrl_iface.h"
|
||||
+#include "config_file.h"
|
||||
|
||||
|
||||
#define HOSTAPD_CLI_DUP_VALUE_MAX_LEN 256
|
||||
@@ -78,6 +79,7 @@ static void hostapd_ctrl_iface_send(stru
|
||||
enum wpa_msg_type type,
|
||||
const char *buf, size_t len);
|
||||
|
||||
+static char *reload_opts = NULL;
|
||||
|
||||
static int hostapd_ctrl_iface_attach(struct hostapd_data *hapd,
|
||||
struct sockaddr_storage *from,
|
||||
@@ -129,6 +131,61 @@ static int hostapd_ctrl_iface_new_sta(st
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static char *get_option(char *opt, char *str)
|
||||
+{
|
||||
+ int len = strlen(str);
|
||||
+
|
||||
+ if (!strncmp(opt, str, len))
|
||||
+ return opt + len;
|
||||
+ else
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static struct hostapd_config *hostapd_ctrl_iface_config_read(const char *fname)
|
||||
+{
|
||||
+ struct hostapd_config *conf;
|
||||
+ char *opt, *val;
|
||||
+
|
||||
+ conf = hostapd_config_read(fname);
|
||||
+ if (!conf)
|
||||
+ return NULL;
|
||||
+
|
||||
+ for (opt = strtok(reload_opts, " ");
|
||||
+ opt;
|
||||
+ opt = strtok(NULL, " ")) {
|
||||
+
|
||||
+ if ((val = get_option(opt, "channel=")))
|
||||
+ conf->channel = atoi(val);
|
||||
+ else if ((val = get_option(opt, "ht_capab=")))
|
||||
+ conf->ht_capab = atoi(val);
|
||||
+ else if ((val = get_option(opt, "ht_capab_mask=")))
|
||||
+ conf->ht_capab &= atoi(val);
|
||||
+ else if ((val = get_option(opt, "sec_chan=")))
|
||||
+ conf->secondary_channel = atoi(val);
|
||||
+ else if ((val = get_option(opt, "hw_mode=")))
|
||||
+ conf->hw_mode = atoi(val);
|
||||
+ else if ((val = get_option(opt, "ieee80211n=")))
|
||||
+ conf->ieee80211n = atoi(val);
|
||||
+ else
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return conf;
|
||||
+}
|
||||
+
|
||||
+static int hostapd_ctrl_iface_update(struct hostapd_data *hapd, char *txt)
|
||||
+{
|
||||
+ struct hostapd_config * (*config_read_cb)(const char *config_fname);
|
||||
+ struct hostapd_iface *iface = hapd->iface;
|
||||
+
|
||||
+ config_read_cb = iface->interfaces->config_read_cb;
|
||||
+ iface->interfaces->config_read_cb = hostapd_ctrl_iface_config_read;
|
||||
+ reload_opts = txt;
|
||||
+
|
||||
+ hostapd_reload_config(iface);
|
||||
+
|
||||
+ iface->interfaces->config_read_cb = config_read_cb;
|
||||
+}
|
||||
|
||||
#ifdef CONFIG_IEEE80211W
|
||||
#ifdef NEED_AP_MLME
|
||||
@@ -3031,6 +3088,8 @@ static int hostapd_ctrl_iface_receive_pr
|
||||
} else if (os_strncmp(buf, "VENDOR ", 7) == 0) {
|
||||
reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply,
|
||||
reply_size);
|
||||
+ } else if (os_strncmp(buf, "UPDATE ", 7) == 0) {
|
||||
+ hostapd_ctrl_iface_update(hapd, buf + 7);
|
||||
} else if (os_strcmp(buf, "ERP_FLUSH") == 0) {
|
||||
ieee802_1x_erp_flush(hapd);
|
||||
#ifdef RADIUS_SERVER
|
||||
--- a/src/ap/ctrl_iface_ap.c
|
||||
+++ b/src/ap/ctrl_iface_ap.c
|
||||
@@ -864,7 +864,13 @@ int hostapd_parse_csa_settings(const cha
|
||||
|
||||
int hostapd_ctrl_iface_stop_ap(struct hostapd_data *hapd)
|
||||
{
|
||||
- return hostapd_drv_stop_ap(hapd);
|
||||
+ struct hostapd_iface *iface = hapd->iface;
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < iface->num_bss; i++)
|
||||
+ hostapd_drv_stop_ap(iface->bss[i]);
|
||||
+
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,246 @@
|
||||
--- a/wpa_supplicant/Makefile
|
||||
+++ b/wpa_supplicant/Makefile
|
||||
@@ -26,6 +26,10 @@ CFLAGS += $(EXTRA_CFLAGS)
|
||||
CFLAGS += -I$(abspath ../src)
|
||||
CFLAGS += -I$(abspath ../src/utils)
|
||||
|
||||
+ifdef MULTICALL
|
||||
+CFLAGS += -DMULTICALL
|
||||
+endif
|
||||
+
|
||||
-include .config
|
||||
-include $(if $(MULTICALL),../hostapd/.config)
|
||||
|
||||
@@ -117,6 +121,8 @@ OBJS_c += ../src/utils/common.o
|
||||
OBJS_c += ../src/common/cli.o
|
||||
OBJS += wmm_ac.o
|
||||
|
||||
+OBJS += ../src/common/wpa_ctrl.o
|
||||
+
|
||||
ifndef CONFIG_OS
|
||||
ifdef CONFIG_NATIVE_WINDOWS
|
||||
CONFIG_OS=win32
|
||||
--- a/wpa_supplicant/bss.c
|
||||
+++ b/wpa_supplicant/bss.c
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "utils/common.h"
|
||||
#include "utils/eloop.h"
|
||||
#include "common/ieee802_11_defs.h"
|
||||
+#include "common/ieee802_11_common.h"
|
||||
#include "drivers/driver.h"
|
||||
#include "eap_peer/eap.h"
|
||||
#include "wpa_supplicant_i.h"
|
||||
@@ -292,6 +293,10 @@ void calculate_update_time(const struct
|
||||
static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src,
|
||||
struct os_reltime *fetch_time)
|
||||
{
|
||||
+ struct ieee80211_ht_capabilities *capab;
|
||||
+ struct ieee80211_ht_operation *oper;
|
||||
+ struct ieee802_11_elems elems;
|
||||
+
|
||||
dst->flags = src->flags;
|
||||
os_memcpy(dst->bssid, src->bssid, ETH_ALEN);
|
||||
dst->freq = src->freq;
|
||||
@@ -304,6 +309,15 @@ static void wpa_bss_copy_res(struct wpa_
|
||||
dst->est_throughput = src->est_throughput;
|
||||
dst->snr = src->snr;
|
||||
|
||||
+ memset(&elems, 0, sizeof(elems));
|
||||
+ ieee802_11_parse_elems((u8 *) (src + 1), src->ie_len, &elems, 0);
|
||||
+ capab = (struct ieee80211_ht_capabilities *) elems.ht_capabilities;
|
||||
+ oper = (struct ieee80211_ht_operation *) elems.ht_operation;
|
||||
+ if (capab)
|
||||
+ dst->ht_capab = le_to_host16(capab->ht_capabilities_info);
|
||||
+ if (oper)
|
||||
+ dst->ht_param = oper->ht_param;
|
||||
+
|
||||
calculate_update_time(fetch_time, src->age, &dst->last_update);
|
||||
}
|
||||
|
||||
--- a/wpa_supplicant/bss.h
|
||||
+++ b/wpa_supplicant/bss.h
|
||||
@@ -81,6 +81,10 @@ struct wpa_bss {
|
||||
u8 ssid[SSID_MAX_LEN];
|
||||
/** Length of SSID */
|
||||
size_t ssid_len;
|
||||
+ /** HT capabilities */
|
||||
+ u16 ht_capab;
|
||||
+ /* Five octets of HT Operation Information */
|
||||
+ u8 ht_param;
|
||||
/** Frequency of the channel in MHz (e.g., 2412 = channel 1) */
|
||||
int freq;
|
||||
/** Beacon interval in TUs (host byte order) */
|
||||
--- a/wpa_supplicant/main.c
|
||||
+++ b/wpa_supplicant/main.c
|
||||
@@ -34,7 +34,7 @@ static void usage(void)
|
||||
"vW] [-P<pid file>] "
|
||||
"[-g<global ctrl>] \\\n"
|
||||
" [-G<group>] \\\n"
|
||||
- " -i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] "
|
||||
+ " -i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] [-H<hostapd path>] "
|
||||
"[-p<driver_param>] \\\n"
|
||||
" [-b<br_ifname>] [-e<entropy file>]"
|
||||
#ifdef CONFIG_DEBUG_FILE
|
||||
@@ -74,6 +74,7 @@ static void usage(void)
|
||||
" -g = global ctrl_interface\n"
|
||||
" -G = global ctrl_interface group\n"
|
||||
" -h = show this help text\n"
|
||||
+ " -H = connect to a hostapd instance to manage state changes\n"
|
||||
" -i = interface name\n"
|
||||
" -I = additional configuration file\n"
|
||||
" -K = include keys (passwords, etc.) in debug output\n"
|
||||
@@ -201,7 +202,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (;;) {
|
||||
c = getopt(argc, argv,
|
||||
- "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuvW");
|
||||
+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuvW");
|
||||
if (c < 0)
|
||||
break;
|
||||
switch (c) {
|
||||
@@ -248,6 +249,9 @@ int main(int argc, char *argv[])
|
||||
usage();
|
||||
exitcode = 0;
|
||||
goto out;
|
||||
+ case 'H':
|
||||
+ iface->hostapd_ctrl = optarg;
|
||||
+ break;
|
||||
case 'i':
|
||||
iface->ifname = optarg;
|
||||
break;
|
||||
--- a/wpa_supplicant/wpa_supplicant.c
|
||||
+++ b/wpa_supplicant/wpa_supplicant.c
|
||||
@@ -125,6 +125,55 @@ static void wpas_update_fils_connect_par
|
||||
#endif /* CONFIG_FILS && IEEE8021X_EAPOL */
|
||||
|
||||
|
||||
+static int hostapd_stop(struct wpa_supplicant *wpa_s)
|
||||
+{
|
||||
+ const char *cmd = "STOP_AP";
|
||||
+ char buf[256];
|
||||
+ size_t len = sizeof(buf);
|
||||
+
|
||||
+ if (wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL) < 0) {
|
||||
+ wpa_printf(MSG_ERROR, "\nFailed to stop hostapd AP interfaces\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int hostapd_reload(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
|
||||
+{
|
||||
+ char *cmd = NULL;
|
||||
+ char buf[256];
|
||||
+ size_t len = sizeof(buf);
|
||||
+ enum hostapd_hw_mode hw_mode;
|
||||
+ u8 channel;
|
||||
+ int sec_chan = 0;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (!bss)
|
||||
+ return -1;
|
||||
+
|
||||
+ if (bss->ht_param & HT_INFO_HT_PARAM_STA_CHNL_WIDTH) {
|
||||
+ int sec = bss->ht_param & HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK;
|
||||
+ if (sec == HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE)
|
||||
+ sec_chan = 1;
|
||||
+ else if (sec == HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW)
|
||||
+ sec_chan = -1;
|
||||
+ }
|
||||
+
|
||||
+ hw_mode = ieee80211_freq_to_chan(bss->freq, &channel);
|
||||
+ if (asprintf(&cmd, "UPDATE channel=%d sec_chan=%d hw_mode=%d",
|
||||
+ channel, sec_chan, hw_mode) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ ret = wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL);
|
||||
+ free(cmd);
|
||||
+
|
||||
+ if (ret < 0) {
|
||||
+ wpa_printf(MSG_ERROR, "\nFailed to reload hostapd AP interfaces\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/* Configure default/group WEP keys for static WEP */
|
||||
int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
|
||||
{
|
||||
@@ -913,12 +962,16 @@ void wpa_supplicant_set_state(struct wpa
|
||||
|
||||
sme_sched_obss_scan(wpa_s, 1);
|
||||
|
||||
+ if (wpa_s->hostapd)
|
||||
+ hostapd_reload(wpa_s, wpa_s->current_bss);
|
||||
#if defined(CONFIG_FILS) && defined(IEEE8021X_EAPOL)
|
||||
if (!fils_hlp_sent && ssid && ssid->eap.erp)
|
||||
wpas_update_fils_connect_params(wpa_s);
|
||||
#endif /* CONFIG_FILS && IEEE8021X_EAPOL */
|
||||
} else if (state == WPA_DISCONNECTED || state == WPA_ASSOCIATING ||
|
||||
state == WPA_ASSOCIATED) {
|
||||
+ if (wpa_s->hostapd)
|
||||
+ hostapd_stop(wpa_s);
|
||||
wpa_s->new_connection = 1;
|
||||
wpa_drv_set_operstate(wpa_s, 0);
|
||||
#ifndef IEEE8021X_EAPOL
|
||||
@@ -1947,6 +2000,8 @@ void wpa_supplicant_associate(struct wpa
|
||||
wpa_ssid_txt(ssid->ssid, ssid->ssid_len),
|
||||
ssid->id);
|
||||
wpas_notify_mesh_group_started(wpa_s, ssid);
|
||||
+ if (wpa_s->hostapd)
|
||||
+ hostapd_reload(wpa_s, wpa_s->current_bss);
|
||||
#else /* CONFIG_MESH */
|
||||
wpa_msg(wpa_s, MSG_ERROR,
|
||||
"mesh mode support not included in the build");
|
||||
@@ -5423,6 +5478,16 @@ static int wpa_supplicant_init_iface(str
|
||||
sizeof(wpa_s->bridge_ifname));
|
||||
}
|
||||
|
||||
+ if (iface->hostapd_ctrl) {
|
||||
+ wpa_s->hostapd = wpa_ctrl_open(iface->hostapd_ctrl);
|
||||
+ if (!wpa_s->hostapd) {
|
||||
+ wpa_printf(MSG_ERROR, "\nFailed to connect to hostapd\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (hostapd_stop(wpa_s) < 0)
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
/* RSNA Supplicant Key Management - INITIALIZE */
|
||||
eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);
|
||||
eapol_sm_notify_portValid(wpa_s->eapol, FALSE);
|
||||
@@ -5744,6 +5809,11 @@ static void wpa_supplicant_deinit_iface(
|
||||
if (terminate)
|
||||
wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING);
|
||||
|
||||
+ if (wpa_s->hostapd) {
|
||||
+ wpa_ctrl_close(wpa_s->hostapd);
|
||||
+ wpa_s->hostapd = NULL;
|
||||
+ }
|
||||
+
|
||||
if (wpa_s->ctrl_iface) {
|
||||
wpa_supplicant_ctrl_iface_deinit(wpa_s->ctrl_iface);
|
||||
wpa_s->ctrl_iface = NULL;
|
||||
--- a/wpa_supplicant/wpa_supplicant_i.h
|
||||
+++ b/wpa_supplicant/wpa_supplicant_i.h
|
||||
@@ -101,6 +101,11 @@ struct wpa_interface {
|
||||
const char *ifname;
|
||||
|
||||
/**
|
||||
+ * hostapd_ctrl - path to hostapd control socket for notification
|
||||
+ */
|
||||
+ const char *hostapd_ctrl;
|
||||
+
|
||||
+ /**
|
||||
* bridge_ifname - Optional bridge interface name
|
||||
*
|
||||
* If the driver interface (ifname) is included in a Linux bridge
|
||||
@@ -513,6 +518,8 @@ struct wpa_supplicant {
|
||||
#endif /* CONFIG_CTRL_IFACE_BINDER */
|
||||
char bridge_ifname[16];
|
||||
|
||||
+ struct wpa_ctrl *hostapd;
|
||||
+
|
||||
char *confname;
|
||||
char *confanother;
|
||||
|
||||
@@ -0,0 +1,193 @@
|
||||
--- a/hostapd/Makefile
|
||||
+++ b/hostapd/Makefile
|
||||
@@ -220,6 +220,9 @@ endif
|
||||
ifdef CONFIG_NO_CTRL_IFACE
|
||||
CFLAGS += -DCONFIG_NO_CTRL_IFACE
|
||||
else
|
||||
+ifdef CONFIG_CTRL_IFACE_MIB
|
||||
+CFLAGS += -DCONFIG_CTRL_IFACE_MIB
|
||||
+endif
|
||||
ifeq ($(CONFIG_CTRL_IFACE), udp)
|
||||
CFLAGS += -DCONFIG_CTRL_IFACE_UDP
|
||||
else
|
||||
--- a/hostapd/ctrl_iface.c
|
||||
+++ b/hostapd/ctrl_iface.c
|
||||
@@ -2857,6 +2857,7 @@ static int hostapd_ctrl_iface_receive_pr
|
||||
reply_size);
|
||||
} else if (os_strcmp(buf, "STATUS-DRIVER") == 0) {
|
||||
reply_len = hostapd_drv_status(hapd, reply, reply_size);
|
||||
+#ifdef CONFIG_CTRL_IFACE_MIB
|
||||
} else if (os_strcmp(buf, "MIB") == 0) {
|
||||
reply_len = ieee802_11_get_mib(hapd, reply, reply_size);
|
||||
if (reply_len >= 0) {
|
||||
@@ -2898,6 +2899,7 @@ static int hostapd_ctrl_iface_receive_pr
|
||||
} else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
|
||||
reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply,
|
||||
reply_size);
|
||||
+#endif
|
||||
} else if (os_strcmp(buf, "ATTACH") == 0) {
|
||||
if (hostapd_ctrl_iface_attach(hapd, from, fromlen, NULL))
|
||||
reply_len = -1;
|
||||
--- a/wpa_supplicant/Makefile
|
||||
+++ b/wpa_supplicant/Makefile
|
||||
@@ -927,6 +927,9 @@ ifdef CONFIG_FILS
|
||||
OBJS += ../src/ap/fils_hlp.o
|
||||
endif
|
||||
ifdef CONFIG_CTRL_IFACE
|
||||
+ifdef CONFIG_CTRL_IFACE_MIB
|
||||
+CFLAGS += -DCONFIG_CTRL_IFACE_MIB
|
||||
+endif
|
||||
OBJS += ../src/ap/ctrl_iface_ap.o
|
||||
endif
|
||||
|
||||
--- a/wpa_supplicant/ctrl_iface.c
|
||||
+++ b/wpa_supplicant/ctrl_iface.c
|
||||
@@ -2108,7 +2108,7 @@ static int wpa_supplicant_ctrl_iface_sta
|
||||
pos += ret;
|
||||
}
|
||||
|
||||
-#ifdef CONFIG_AP
|
||||
+#if defined(CONFIG_AP) && defined(CONFIG_CTRL_IFACE_MIB)
|
||||
if (wpa_s->ap_iface) {
|
||||
pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos,
|
||||
end - pos,
|
||||
@@ -9825,6 +9825,7 @@ char * wpa_supplicant_ctrl_iface_process
|
||||
reply_len = -1;
|
||||
} else if (os_strncmp(buf, "NOTE ", 5) == 0) {
|
||||
wpa_printf(MSG_INFO, "NOTE: %s", buf + 5);
|
||||
+#ifdef CONFIG_CTRL_IFACE_MIB
|
||||
} else if (os_strcmp(buf, "MIB") == 0) {
|
||||
reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size);
|
||||
if (reply_len >= 0) {
|
||||
@@ -9832,6 +9833,7 @@ char * wpa_supplicant_ctrl_iface_process
|
||||
reply + reply_len,
|
||||
reply_size - reply_len);
|
||||
}
|
||||
+#endif
|
||||
} else if (os_strncmp(buf, "STATUS", 6) == 0) {
|
||||
reply_len = wpa_supplicant_ctrl_iface_status(
|
||||
wpa_s, buf + 6, reply, reply_size);
|
||||
@@ -10313,6 +10315,7 @@ char * wpa_supplicant_ctrl_iface_process
|
||||
reply_len = wpa_supplicant_ctrl_iface_bss(
|
||||
wpa_s, buf + 4, reply, reply_size);
|
||||
#ifdef CONFIG_AP
|
||||
+#ifdef CONFIG_CTRL_IFACE_MIB
|
||||
} else if (os_strcmp(buf, "STA-FIRST") == 0) {
|
||||
reply_len = ap_ctrl_iface_sta_first(wpa_s, reply, reply_size);
|
||||
} else if (os_strncmp(buf, "STA ", 4) == 0) {
|
||||
@@ -10321,12 +10324,15 @@ char * wpa_supplicant_ctrl_iface_process
|
||||
} else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
|
||||
reply_len = ap_ctrl_iface_sta_next(wpa_s, buf + 9, reply,
|
||||
reply_size);
|
||||
+#endif
|
||||
+#ifdef CONFIG_CTRL_IFACE_MIB
|
||||
} else if (os_strncmp(buf, "DEAUTHENTICATE ", 15) == 0) {
|
||||
if (ap_ctrl_iface_sta_deauthenticate(wpa_s, buf + 15))
|
||||
reply_len = -1;
|
||||
} else if (os_strncmp(buf, "DISASSOCIATE ", 13) == 0) {
|
||||
if (ap_ctrl_iface_sta_disassociate(wpa_s, buf + 13))
|
||||
reply_len = -1;
|
||||
+#endif
|
||||
} else if (os_strncmp(buf, "CHAN_SWITCH ", 12) == 0) {
|
||||
if (ap_ctrl_iface_chanswitch(wpa_s, buf + 12))
|
||||
reply_len = -1;
|
||||
--- a/src/ap/ctrl_iface_ap.c
|
||||
+++ b/src/ap/ctrl_iface_ap.c
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "mbo_ap.h"
|
||||
#include "taxonomy.h"
|
||||
|
||||
+#ifdef CONFIG_CTRL_IFACE_MIB
|
||||
|
||||
static size_t hostapd_write_ht_mcs_bitmask(char *buf, size_t buflen,
|
||||
size_t curr_len, const u8 *mcs_set)
|
||||
@@ -415,6 +416,7 @@ int hostapd_ctrl_iface_sta_next(struct h
|
||||
return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen);
|
||||
}
|
||||
|
||||
+#endif
|
||||
|
||||
#ifdef CONFIG_P2P_MANAGER
|
||||
static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype,
|
||||
@@ -753,12 +755,12 @@ int hostapd_ctrl_iface_status(struct hos
|
||||
return len;
|
||||
len += ret;
|
||||
}
|
||||
-
|
||||
+#ifdef CONFIG_CTRL_IFACE_MIB
|
||||
if (iface->conf->ieee80211n && !hapd->conf->disable_11n && mode) {
|
||||
len = hostapd_write_ht_mcs_bitmask(buf, buflen, len,
|
||||
mode->mcs_set);
|
||||
}
|
||||
-
|
||||
+#endif /* CONFIG_CTRL_IFACE_MIB */
|
||||
if (iface->current_rates && iface->num_rates) {
|
||||
ret = os_snprintf(buf + len, buflen - len, "supported_rates=");
|
||||
if (os_snprintf_error(buflen - len, ret))
|
||||
--- a/src/ap/ieee802_1x.c
|
||||
+++ b/src/ap/ieee802_1x.c
|
||||
@@ -2555,6 +2555,7 @@ static const char * bool_txt(Boolean val
|
||||
return val ? "TRUE" : "FALSE";
|
||||
}
|
||||
|
||||
+#ifdef CONFIG_CTRL_IFACE_MIB
|
||||
|
||||
int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen)
|
||||
{
|
||||
@@ -2730,6 +2731,7 @@ int ieee802_1x_get_mib_sta(struct hostap
|
||||
return len;
|
||||
}
|
||||
|
||||
+#endif
|
||||
|
||||
#ifdef CONFIG_HS20
|
||||
static void ieee802_1x_wnm_notif_send(void *eloop_ctx, void *timeout_ctx)
|
||||
--- a/src/ap/wpa_auth.c
|
||||
+++ b/src/ap/wpa_auth.c
|
||||
@@ -3772,6 +3772,7 @@ static const char * wpa_bool_txt(int val
|
||||
return val ? "TRUE" : "FALSE";
|
||||
}
|
||||
|
||||
+#ifdef CONFIG_CTRL_IFACE_MIB
|
||||
|
||||
#define RSN_SUITE "%02x-%02x-%02x-%d"
|
||||
#define RSN_SUITE_ARG(s) \
|
||||
@@ -3916,7 +3917,7 @@ int wpa_get_mib_sta(struct wpa_state_mac
|
||||
|
||||
return len;
|
||||
}
|
||||
-
|
||||
+#endif
|
||||
|
||||
void wpa_auth_countermeasures_start(struct wpa_authenticator *wpa_auth)
|
||||
{
|
||||
--- a/src/rsn_supp/wpa.c
|
||||
+++ b/src/rsn_supp/wpa.c
|
||||
@@ -2306,6 +2306,8 @@ static u32 wpa_key_mgmt_suite(struct wpa
|
||||
}
|
||||
|
||||
|
||||
+#ifdef CONFIG_CTRL_IFACE_MIB
|
||||
+
|
||||
#define RSN_SUITE "%02x-%02x-%02x-%d"
|
||||
#define RSN_SUITE_ARG(s) \
|
||||
((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff
|
||||
@@ -2389,6 +2391,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch
|
||||
|
||||
return (int) len;
|
||||
}
|
||||
+#endif
|
||||
#endif /* CONFIG_CTRL_IFACE */
|
||||
|
||||
|
||||
--- a/wpa_supplicant/ap.c
|
||||
+++ b/wpa_supplicant/ap.c
|
||||
@@ -1179,7 +1179,7 @@ int wpas_ap_wps_nfc_report_handover(stru
|
||||
#endif /* CONFIG_WPS */
|
||||
|
||||
|
||||
-#ifdef CONFIG_CTRL_IFACE
|
||||
+#if defined(CONFIG_CTRL_IFACE) && defined(CONFIG_CTRL_IFACE_MIB)
|
||||
|
||||
int ap_ctrl_iface_sta_first(struct wpa_supplicant *wpa_s,
|
||||
char *buf, size_t buflen)
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/hostapd/hostapd_cli.c
|
||||
+++ b/hostapd/hostapd_cli.c
|
||||
@@ -743,7 +743,7 @@ static int wpa_ctrl_command_sta(struct w
|
||||
}
|
||||
|
||||
buf[len] = '\0';
|
||||
- if (memcmp(buf, "FAIL", 4) == 0)
|
||||
+ if (memcmp(buf, "FAIL", 4) == 0 || memcmp(buf, "UNKNOWN COMMAND", 15) == 0)
|
||||
return -1;
|
||||
if (print)
|
||||
printf("%s", buf);
|
||||
@@ -0,0 +1,56 @@
|
||||
--- a/src/common/wpa_common.c
|
||||
+++ b/src/common/wpa_common.c
|
||||
@@ -1849,6 +1849,31 @@ u32 wpa_akm_to_suite(int akm)
|
||||
}
|
||||
|
||||
|
||||
+static void wpa_fixup_wpa_ie_rsn(u8 *assoc_ie, const u8 *wpa_msg_ie,
|
||||
+ size_t rsn_ie_len)
|
||||
+{
|
||||
+ int pos, count;
|
||||
+
|
||||
+ pos = sizeof(struct rsn_ie_hdr) + RSN_SELECTOR_LEN;
|
||||
+ if (rsn_ie_len < pos + 2)
|
||||
+ return;
|
||||
+
|
||||
+ count = WPA_GET_LE16(wpa_msg_ie + pos);
|
||||
+ pos += 2 + count * RSN_SELECTOR_LEN;
|
||||
+ if (rsn_ie_len < pos + 2)
|
||||
+ return;
|
||||
+
|
||||
+ count = WPA_GET_LE16(wpa_msg_ie + pos);
|
||||
+ pos += 2 + count * RSN_SELECTOR_LEN;
|
||||
+ if (rsn_ie_len < pos + 2)
|
||||
+ return;
|
||||
+
|
||||
+ if (!assoc_ie[pos] && !assoc_ie[pos + 1] &&
|
||||
+ (wpa_msg_ie[pos] || wpa_msg_ie[pos + 1]))
|
||||
+ memcpy(&assoc_ie[pos], &wpa_msg_ie[pos], 2);
|
||||
+}
|
||||
+
|
||||
+
|
||||
int wpa_compare_rsn_ie(int ft_initial_assoc,
|
||||
const u8 *ie1, size_t ie1len,
|
||||
const u8 *ie2, size_t ie2len)
|
||||
@@ -1856,8 +1881,19 @@ int wpa_compare_rsn_ie(int ft_initial_as
|
||||
if (ie1 == NULL || ie2 == NULL)
|
||||
return -1;
|
||||
|
||||
- if (ie1len == ie2len && os_memcmp(ie1, ie2, ie1len) == 0)
|
||||
- return 0; /* identical IEs */
|
||||
+ if (ie1len == ie2len) {
|
||||
+ u8 *ie_tmp;
|
||||
+
|
||||
+ if (os_memcmp(ie1, ie2, ie1len) == 0)
|
||||
+ return 0; /* identical IEs */
|
||||
+
|
||||
+ ie_tmp = alloca(ie1len);
|
||||
+ memcpy(ie_tmp, ie1, ie1len);
|
||||
+ wpa_fixup_wpa_ie_rsn(ie_tmp, ie2, ie1len);
|
||||
+
|
||||
+ if (os_memcmp(ie_tmp, ie2, ie1len) == 0)
|
||||
+ return 0; /* only mismatch in RSN capabilties */
|
||||
+ }
|
||||
|
||||
#ifdef CONFIG_IEEE80211R
|
||||
if (ft_initial_assoc) {
|
||||
@@ -0,0 +1,22 @@
|
||||
--- a/src/ap/wps_hostapd.c
|
||||
+++ b/src/ap/wps_hostapd.c
|
||||
@@ -346,8 +346,7 @@ static int hapd_wps_reconfig_in_memory(s
|
||||
bss->wpa_pairwise |= WPA_CIPHER_GCMP;
|
||||
else
|
||||
bss->wpa_pairwise |= WPA_CIPHER_CCMP;
|
||||
- }
|
||||
- if (cred->encr_type & WPS_ENCR_TKIP)
|
||||
+ } else if (cred->encr_type & WPS_ENCR_TKIP)
|
||||
bss->wpa_pairwise |= WPA_CIPHER_TKIP;
|
||||
bss->rsn_pairwise = bss->wpa_pairwise;
|
||||
bss->wpa_group = wpa_select_ap_group_cipher(bss->wpa,
|
||||
@@ -1069,8 +1068,7 @@ int hostapd_init_wps(struct hostapd_data
|
||||
WPA_CIPHER_GCMP_256)) {
|
||||
wps->encr_types |= WPS_ENCR_AES;
|
||||
wps->encr_types_rsn |= WPS_ENCR_AES;
|
||||
- }
|
||||
- if (conf->rsn_pairwise & WPA_CIPHER_TKIP) {
|
||||
+ } else if (conf->rsn_pairwise & WPA_CIPHER_TKIP) {
|
||||
wps->encr_types |= WPS_ENCR_TKIP;
|
||||
wps->encr_types_rsn |= WPS_ENCR_TKIP;
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
--- a/src/utils/wpa_debug.c
|
||||
+++ b/src/utils/wpa_debug.c
|
||||
@@ -201,7 +201,7 @@ void wpa_debug_close_linux_tracing(void)
|
||||
*
|
||||
* Note: New line '\n' is added to the end of the text when printing to stdout.
|
||||
*/
|
||||
-void wpa_printf(int level, const char *fmt, ...)
|
||||
+void _wpa_printf(int level, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@@ -248,8 +248,8 @@ void wpa_printf(int level, const char *f
|
||||
}
|
||||
|
||||
|
||||
-static void _wpa_hexdump(int level, const char *title, const u8 *buf,
|
||||
- size_t len, int show)
|
||||
+void _wpa_hexdump(int level, const char *title, const u8 *buf,
|
||||
+ size_t len, int show)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
@@ -375,20 +375,8 @@ static void _wpa_hexdump(int level, cons
|
||||
#endif /* CONFIG_ANDROID_LOG */
|
||||
}
|
||||
|
||||
-void wpa_hexdump(int level, const char *title, const void *buf, size_t len)
|
||||
-{
|
||||
- _wpa_hexdump(level, title, buf, len, 1);
|
||||
-}
|
||||
-
|
||||
-
|
||||
-void wpa_hexdump_key(int level, const char *title, const void *buf, size_t len)
|
||||
-{
|
||||
- _wpa_hexdump(level, title, buf, len, wpa_debug_show_keys);
|
||||
-}
|
||||
-
|
||||
-
|
||||
-static void _wpa_hexdump_ascii(int level, const char *title, const void *buf,
|
||||
- size_t len, int show)
|
||||
+void _wpa_hexdump_ascii(int level, const char *title, const void *buf,
|
||||
+ size_t len, int show)
|
||||
{
|
||||
size_t i, llen;
|
||||
const u8 *pos = buf;
|
||||
@@ -495,20 +483,6 @@ static void _wpa_hexdump_ascii(int level
|
||||
}
|
||||
|
||||
|
||||
-void wpa_hexdump_ascii(int level, const char *title, const void *buf,
|
||||
- size_t len)
|
||||
-{
|
||||
- _wpa_hexdump_ascii(level, title, buf, len, 1);
|
||||
-}
|
||||
-
|
||||
-
|
||||
-void wpa_hexdump_ascii_key(int level, const char *title, const void *buf,
|
||||
- size_t len)
|
||||
-{
|
||||
- _wpa_hexdump_ascii(level, title, buf, len, wpa_debug_show_keys);
|
||||
-}
|
||||
-
|
||||
-
|
||||
#ifdef CONFIG_DEBUG_FILE
|
||||
static char *last_path = NULL;
|
||||
#endif /* CONFIG_DEBUG_FILE */
|
||||
@@ -604,7 +578,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_
|
||||
}
|
||||
|
||||
|
||||
-void wpa_msg(void *ctx, int level, const char *fmt, ...)
|
||||
+void _wpa_msg(void *ctx, int level, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *buf;
|
||||
@@ -642,7 +616,7 @@ void wpa_msg(void *ctx, int level, const
|
||||
}
|
||||
|
||||
|
||||
-void wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...)
|
||||
+void _wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *buf;
|
||||
--- a/src/utils/wpa_debug.h
|
||||
+++ b/src/utils/wpa_debug.h
|
||||
@@ -52,6 +52,17 @@ int wpa_debug_reopen_file(void);
|
||||
void wpa_debug_close_file(void);
|
||||
void wpa_debug_setup_stdout(void);
|
||||
|
||||
+/* internal */
|
||||
+void _wpa_hexdump(int level, const char *title, const u8 *buf,
|
||||
+ size_t len, int show);
|
||||
+void _wpa_hexdump_ascii(int level, const char *title, const void *buf,
|
||||
+ size_t len, int show);
|
||||
+extern int wpa_debug_show_keys;
|
||||
+
|
||||
+#ifndef CONFIG_MSG_MIN_PRIORITY
|
||||
+#define CONFIG_MSG_MIN_PRIORITY 0
|
||||
+#endif
|
||||
+
|
||||
/**
|
||||
* wpa_debug_printf_timestamp - Print timestamp for debug output
|
||||
*
|
||||
@@ -72,9 +83,15 @@ void wpa_debug_print_timestamp(void);
|
||||
*
|
||||
* Note: New line '\n' is added to the end of the text when printing to stdout.
|
||||
*/
|
||||
-void wpa_printf(int level, const char *fmt, ...)
|
||||
+void _wpa_printf(int level, const char *fmt, ...)
|
||||
PRINTF_FORMAT(2, 3);
|
||||
|
||||
+#define wpa_printf(level, ...) \
|
||||
+ do { \
|
||||
+ if (level >= CONFIG_MSG_MIN_PRIORITY) \
|
||||
+ _wpa_printf(level, __VA_ARGS__); \
|
||||
+ } while(0)
|
||||
+
|
||||
/**
|
||||
* wpa_hexdump - conditional hex dump
|
||||
* @level: priority level (MSG_*) of the message
|
||||
@@ -86,7 +103,13 @@ PRINTF_FORMAT(2, 3);
|
||||
* output may be directed to stdout, stderr, and/or syslog based on
|
||||
* configuration. The contents of buf is printed out has hex dump.
|
||||
*/
|
||||
-void wpa_hexdump(int level, const char *title, const void *buf, size_t len);
|
||||
+static inline void wpa_hexdump(int level, const char *title, const u8 *buf, size_t len)
|
||||
+{
|
||||
+ if (level < CONFIG_MSG_MIN_PRIORITY)
|
||||
+ return;
|
||||
+
|
||||
+ _wpa_hexdump(level, title, buf, len, 1);
|
||||
+}
|
||||
|
||||
static inline void wpa_hexdump_buf(int level, const char *title,
|
||||
const struct wpabuf *buf)
|
||||
@@ -108,7 +131,13 @@ static inline void wpa_hexdump_buf(int l
|
||||
* like wpa_hexdump(), but by default, does not include secret keys (passwords,
|
||||
* etc.) in debug output.
|
||||
*/
|
||||
-void wpa_hexdump_key(int level, const char *title, const void *buf, size_t len);
|
||||
+static inline void wpa_hexdump_key(int level, const char *title, const u8 *buf, size_t len)
|
||||
+{
|
||||
+ if (level < CONFIG_MSG_MIN_PRIORITY)
|
||||
+ return;
|
||||
+
|
||||
+ _wpa_hexdump(level, title, buf, len, wpa_debug_show_keys);
|
||||
+}
|
||||
|
||||
static inline void wpa_hexdump_buf_key(int level, const char *title,
|
||||
const struct wpabuf *buf)
|
||||
@@ -130,8 +159,14 @@ static inline void wpa_hexdump_buf_key(i
|
||||
* the hex numbers and ASCII characters (for printable range) are shown. 16
|
||||
* bytes per line will be shown.
|
||||
*/
|
||||
-void wpa_hexdump_ascii(int level, const char *title, const void *buf,
|
||||
- size_t len);
|
||||
+static inline void wpa_hexdump_ascii(int level, const char *title,
|
||||
+ const u8 *buf, size_t len)
|
||||
+{
|
||||
+ if (level < CONFIG_MSG_MIN_PRIORITY)
|
||||
+ return;
|
||||
+
|
||||
+ _wpa_hexdump_ascii(level, title, buf, len, 1);
|
||||
+}
|
||||
|
||||
/**
|
||||
* wpa_hexdump_ascii_key - conditional hex dump, hide keys
|
||||
@@ -147,8 +182,14 @@ void wpa_hexdump_ascii(int level, const
|
||||
* bytes per line will be shown. This works like wpa_hexdump_ascii(), but by
|
||||
* default, does not include secret keys (passwords, etc.) in debug output.
|
||||
*/
|
||||
-void wpa_hexdump_ascii_key(int level, const char *title, const void *buf,
|
||||
- size_t len);
|
||||
+static inline void wpa_hexdump_ascii_key(int level, const char *title,
|
||||
+ const u8 *buf, size_t len)
|
||||
+{
|
||||
+ if (level < CONFIG_MSG_MIN_PRIORITY)
|
||||
+ return;
|
||||
+
|
||||
+ _wpa_hexdump_ascii(level, title, buf, len, wpa_debug_show_keys);
|
||||
+}
|
||||
|
||||
/*
|
||||
* wpa_dbg() behaves like wpa_msg(), but it can be removed from build to reduce
|
||||
@@ -185,7 +226,12 @@ void wpa_hexdump_ascii_key(int level, co
|
||||
*
|
||||
* Note: New line '\n' is added to the end of the text when printing to stdout.
|
||||
*/
|
||||
-void wpa_msg(void *ctx, int level, const char *fmt, ...) PRINTF_FORMAT(3, 4);
|
||||
+void _wpa_msg(void *ctx, int level, const char *fmt, ...) PRINTF_FORMAT(3, 4);
|
||||
+#define wpa_msg(ctx, level, ...) \
|
||||
+ do { \
|
||||
+ if (level >= CONFIG_MSG_MIN_PRIORITY) \
|
||||
+ _wpa_msg(ctx, level, __VA_ARGS__); \
|
||||
+ } while(0)
|
||||
|
||||
/**
|
||||
* wpa_msg_ctrl - Conditional printf for ctrl_iface monitors
|
||||
@@ -199,8 +245,13 @@ void wpa_msg(void *ctx, int level, const
|
||||
* attached ctrl_iface monitors. In other words, it can be used for frequent
|
||||
* events that do not need to be sent to syslog.
|
||||
*/
|
||||
-void wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...)
|
||||
+void _wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...)
|
||||
PRINTF_FORMAT(3, 4);
|
||||
+#define wpa_msg_ctrl(ctx, level, ...) \
|
||||
+ do { \
|
||||
+ if (level >= CONFIG_MSG_MIN_PRIORITY) \
|
||||
+ _wpa_msg_ctrl(ctx, level, __VA_ARGS__); \
|
||||
+ } while(0)
|
||||
|
||||
/**
|
||||
* wpa_msg_global - Global printf for ctrl_iface monitors
|
||||
@@ -0,0 +1,62 @@
|
||||
--- a/hostapd/main.c
|
||||
+++ b/hostapd/main.c
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "utils/common.h"
|
||||
#include "utils/eloop.h"
|
||||
#include "utils/uuid.h"
|
||||
+#include "utils/build_features.h"
|
||||
#include "crypto/random.h"
|
||||
#include "crypto/tls.h"
|
||||
#include "common/version.h"
|
||||
@@ -682,7 +683,7 @@ int main(int argc, char *argv[])
|
||||
wpa_supplicant_event = hostapd_wpa_event;
|
||||
wpa_supplicant_event_global = hostapd_wpa_event_global;
|
||||
for (;;) {
|
||||
- c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:vg:G:");
|
||||
+ c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:g:G:v::");
|
||||
if (c < 0)
|
||||
break;
|
||||
switch (c) {
|
||||
@@ -719,6 +720,8 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
#endif /* CONFIG_DEBUG_LINUX_TRACING */
|
||||
case 'v':
|
||||
+ if (optarg)
|
||||
+ exit(!has_feature(optarg));
|
||||
show_version();
|
||||
exit(1);
|
||||
break;
|
||||
--- a/wpa_supplicant/main.c
|
||||
+++ b/wpa_supplicant/main.c
|
||||
@@ -12,6 +12,7 @@
|
||||
#endif /* __linux__ */
|
||||
|
||||
#include "common.h"
|
||||
+#include "build_features.h"
|
||||
#include "fst/fst.h"
|
||||
#include "wpa_supplicant_i.h"
|
||||
#include "driver_i.h"
|
||||
@@ -202,7 +203,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (;;) {
|
||||
c = getopt(argc, argv,
|
||||
- "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuvW");
|
||||
+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuv::W");
|
||||
if (c < 0)
|
||||
break;
|
||||
switch (c) {
|
||||
@@ -305,8 +306,12 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
#endif /* CONFIG_DBUS */
|
||||
case 'v':
|
||||
- printf("%s\n", wpa_supplicant_version);
|
||||
- exitcode = 0;
|
||||
+ if (optarg) {
|
||||
+ exitcode = !has_feature(optarg);
|
||||
+ } else {
|
||||
+ printf("%s\n", wpa_supplicant_version);
|
||||
+ exitcode = 0;
|
||||
+ }
|
||||
goto out;
|
||||
case 'W':
|
||||
params.wait_for_monitor++;
|
||||
@@ -0,0 +1,58 @@
|
||||
--- a/hostapd/hostapd_cli.c
|
||||
+++ b/hostapd/hostapd_cli.c
|
||||
@@ -385,7 +385,6 @@ static int hostapd_cli_cmd_disassociate(
|
||||
}
|
||||
|
||||
|
||||
-#ifdef CONFIG_TAXONOMY
|
||||
static int hostapd_cli_cmd_signature(struct wpa_ctrl *ctrl, int argc,
|
||||
char *argv[])
|
||||
{
|
||||
@@ -398,7 +397,6 @@ static int hostapd_cli_cmd_signature(str
|
||||
os_snprintf(buf, sizeof(buf), "SIGNATURE %s", argv[0]);
|
||||
return wpa_ctrl_command(ctrl, buf);
|
||||
}
|
||||
-#endif /* CONFIG_TAXONOMY */
|
||||
|
||||
|
||||
#ifdef CONFIG_IEEE80211W
|
||||
@@ -417,7 +415,6 @@ static int hostapd_cli_cmd_sa_query(stru
|
||||
#endif /* CONFIG_IEEE80211W */
|
||||
|
||||
|
||||
-#ifdef CONFIG_WPS
|
||||
static int hostapd_cli_cmd_wps_pin(struct wpa_ctrl *ctrl, int argc,
|
||||
char *argv[])
|
||||
{
|
||||
@@ -643,7 +640,6 @@ static int hostapd_cli_cmd_wps_config(st
|
||||
ssid_hex, argv[1]);
|
||||
return wpa_ctrl_command(ctrl, buf);
|
||||
}
|
||||
-#endif /* CONFIG_WPS */
|
||||
|
||||
|
||||
static int hostapd_cli_cmd_disassoc_imminent(struct wpa_ctrl *ctrl, int argc,
|
||||
@@ -1510,15 +1506,12 @@ static const struct hostapd_cli_cmd host
|
||||
{ "disassociate", hostapd_cli_cmd_disassociate,
|
||||
hostapd_complete_stations,
|
||||
"<addr> = disassociate a station" },
|
||||
-#ifdef CONFIG_TAXONOMY
|
||||
{ "signature", hostapd_cli_cmd_signature, hostapd_complete_stations,
|
||||
"<addr> = get taxonomy signature for a station" },
|
||||
-#endif /* CONFIG_TAXONOMY */
|
||||
#ifdef CONFIG_IEEE80211W
|
||||
{ "sa_query", hostapd_cli_cmd_sa_query, hostapd_complete_stations,
|
||||
"<addr> = send SA Query to a station" },
|
||||
#endif /* CONFIG_IEEE80211W */
|
||||
-#ifdef CONFIG_WPS
|
||||
{ "wps_pin", hostapd_cli_cmd_wps_pin, NULL,
|
||||
"<uuid> <pin> [timeout] [addr] = add WPS Enrollee PIN" },
|
||||
{ "wps_check_pin", hostapd_cli_cmd_wps_check_pin, NULL,
|
||||
@@ -1543,7 +1536,6 @@ static const struct hostapd_cli_cmd host
|
||||
"<SSID> <auth> <encr> <key> = configure AP" },
|
||||
{ "wps_get_status", hostapd_cli_cmd_wps_get_status, NULL,
|
||||
"= show current WPS status" },
|
||||
-#endif /* CONFIG_WPS */
|
||||
{ "disassoc_imminent", hostapd_cli_cmd_disassoc_imminent, NULL,
|
||||
"= send Disassociation Imminent notification" },
|
||||
{ "ess_disassoc", hostapd_cli_cmd_ess_disassoc, NULL,
|
||||
@@ -0,0 +1,12 @@
|
||||
--- a/wpa_supplicant/wpa_cli.c
|
||||
+++ b/wpa_supplicant/wpa_cli.c
|
||||
@@ -26,6 +26,9 @@
|
||||
#include <cutils/properties.h>
|
||||
#endif /* ANDROID */
|
||||
|
||||
+#ifndef CONFIG_P2P
|
||||
+#define CONFIG_P2P
|
||||
+#endif
|
||||
|
||||
static const char *const wpa_cli_version =
|
||||
"wpa_cli v" VERSION_STR "\n"
|
||||
@@ -0,0 +1,10 @@
|
||||
--- a/src/drivers/linux_wext.h
|
||||
+++ b/src/drivers/linux_wext.h
|
||||
@@ -26,6 +26,7 @@ typedef int32_t __s32;
|
||||
typedef uint16_t __u16;
|
||||
typedef int16_t __s16;
|
||||
typedef uint8_t __u8;
|
||||
+typedef int8_t __s8;
|
||||
#ifndef __user
|
||||
#define __user
|
||||
#endif /* __user */
|
||||
73
package/network/services/hostapd/patches/450-scan_wait.patch
Normal file
73
package/network/services/hostapd/patches/450-scan_wait.patch
Normal file
@@ -0,0 +1,73 @@
|
||||
--- a/hostapd/main.c
|
||||
+++ b/hostapd/main.c
|
||||
@@ -38,6 +38,8 @@ struct hapd_global {
|
||||
};
|
||||
|
||||
static struct hapd_global global;
|
||||
+static int daemonize = 0;
|
||||
+static char *pid_file = NULL;
|
||||
|
||||
|
||||
#ifndef CONFIG_NO_HOSTAPD_LOGGER
|
||||
@@ -148,6 +150,14 @@ static void hostapd_logger_cb(void *ctx,
|
||||
}
|
||||
#endif /* CONFIG_NO_HOSTAPD_LOGGER */
|
||||
|
||||
+static void hostapd_setup_complete_cb(void *ctx)
|
||||
+{
|
||||
+ if (daemonize && os_daemonize(pid_file)) {
|
||||
+ perror("daemon");
|
||||
+ return;
|
||||
+ }
|
||||
+ daemonize = 0;
|
||||
+}
|
||||
|
||||
/**
|
||||
* hostapd_driver_init - Preparate driver interface
|
||||
@@ -166,6 +176,8 @@ static int hostapd_driver_init(struct ho
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ hapd->setup_complete_cb = hostapd_setup_complete_cb;
|
||||
+
|
||||
/* Initialize the driver interface */
|
||||
if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5]))
|
||||
b = NULL;
|
||||
@@ -406,8 +418,6 @@ static void hostapd_global_deinit(const
|
||||
#endif /* CONFIG_NATIVE_WINDOWS */
|
||||
|
||||
eap_server_unregister_methods();
|
||||
-
|
||||
- os_daemonize_terminate(pid_file);
|
||||
}
|
||||
|
||||
|
||||
@@ -433,18 +443,6 @@ static int hostapd_global_run(struct hap
|
||||
}
|
||||
#endif /* EAP_SERVER_TNC */
|
||||
|
||||
- if (daemonize) {
|
||||
- if (os_daemonize(pid_file)) {
|
||||
- wpa_printf(MSG_ERROR, "daemon: %s", strerror(errno));
|
||||
- return -1;
|
||||
- }
|
||||
- if (eloop_sock_requeue()) {
|
||||
- wpa_printf(MSG_ERROR, "eloop_sock_requeue: %s",
|
||||
- strerror(errno));
|
||||
- return -1;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
eloop_run();
|
||||
|
||||
return 0;
|
||||
@@ -646,8 +644,7 @@ int main(int argc, char *argv[])
|
||||
struct hapd_interfaces interfaces;
|
||||
int ret = 1;
|
||||
size_t i, j;
|
||||
- int c, debug = 0, daemonize = 0;
|
||||
- char *pid_file = NULL;
|
||||
+ int c, debug = 0;
|
||||
const char *log_file = NULL;
|
||||
const char *entropy_file = NULL;
|
||||
char **bss_config = NULL, **tmp_bss;
|
||||
@@ -0,0 +1,189 @@
|
||||
From 4bb69d15477e0f2b00e166845341dc933de47c58 Mon Sep 17 00:00:00 2001
|
||||
From: Antonio Quartulli <ordex@autistici.org>
|
||||
Date: Sun, 3 Jun 2012 18:22:56 +0200
|
||||
Subject: [PATCHv2 601/602] wpa_supplicant: add new config params to be used
|
||||
with the ibss join command
|
||||
|
||||
Signed-hostap: Antonio Quartulli <ordex@autistici.org>
|
||||
---
|
||||
src/drivers/driver.h | 6 +++
|
||||
wpa_supplicant/config.c | 96 +++++++++++++++++++++++++++++++++++++++
|
||||
wpa_supplicant/config_ssid.h | 6 +++
|
||||
wpa_supplicant/wpa_supplicant.c | 23 +++++++---
|
||||
4 files changed, 124 insertions(+), 7 deletions(-)
|
||||
|
||||
--- a/src/drivers/driver.h
|
||||
+++ b/src/drivers/driver.h
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#define WPA_SUPPLICANT_DRIVER_VERSION 4
|
||||
|
||||
+#include "ap/sta_info.h"
|
||||
#include "common/defs.h"
|
||||
#include "common/ieee802_11_defs.h"
|
||||
#include "common/wpa_common.h"
|
||||
@@ -762,6 +763,9 @@ struct wpa_driver_associate_params {
|
||||
* responsible for selecting with which BSS to associate. */
|
||||
const u8 *bssid;
|
||||
|
||||
+ unsigned char rates[WLAN_SUPP_RATES_MAX];
|
||||
+ int mcast_rate;
|
||||
+
|
||||
/**
|
||||
* bssid_hint - BSSID of a proposed AP
|
||||
*
|
||||
--- a/wpa_supplicant/config.c
|
||||
+++ b/wpa_supplicant/config.c
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "eap_peer/eap.h"
|
||||
#include "p2p/p2p.h"
|
||||
#include "fst/fst.h"
|
||||
+#include "ap/sta_info.h"
|
||||
#include "config.h"
|
||||
|
||||
|
||||
@@ -2037,6 +2038,97 @@ static char * wpa_config_write_peerkey(c
|
||||
#endif /* NO_CONFIG_WRITE */
|
||||
|
||||
|
||||
+static int wpa_config_parse_mcast_rate(const struct parse_data *data,
|
||||
+ struct wpa_ssid *ssid, int line,
|
||||
+ const char *value)
|
||||
+{
|
||||
+ ssid->mcast_rate = (int)(strtod(value, NULL) * 10);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#ifndef NO_CONFIG_WRITE
|
||||
+static char * wpa_config_write_mcast_rate(const struct parse_data *data,
|
||||
+ struct wpa_ssid *ssid)
|
||||
+{
|
||||
+ char *value;
|
||||
+ int res;
|
||||
+
|
||||
+ if (!ssid->mcast_rate == 0)
|
||||
+ return NULL;
|
||||
+
|
||||
+ value = os_malloc(6); /* longest: 300.0 */
|
||||
+ if (value == NULL)
|
||||
+ return NULL;
|
||||
+ res = os_snprintf(value, 5, "%.1f", (double)ssid->mcast_rate / 10);
|
||||
+ if (res < 0) {
|
||||
+ os_free(value);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ return value;
|
||||
+}
|
||||
+#endif /* NO_CONFIG_WRITE */
|
||||
+
|
||||
+static int wpa_config_parse_rates(const struct parse_data *data,
|
||||
+ struct wpa_ssid *ssid, int line,
|
||||
+ const char *value)
|
||||
+{
|
||||
+ int i;
|
||||
+ char *pos, *r, *sptr, *end;
|
||||
+ double rate;
|
||||
+
|
||||
+ pos = (char *)value;
|
||||
+ r = strtok_r(pos, ",", &sptr);
|
||||
+ i = 0;
|
||||
+ while (pos && i < WLAN_SUPP_RATES_MAX) {
|
||||
+ rate = 0.0;
|
||||
+ if (r)
|
||||
+ rate = strtod(r, &end);
|
||||
+ ssid->rates[i] = rate * 2;
|
||||
+ if (*end != '\0' || rate * 2 != ssid->rates[i])
|
||||
+ return 1;
|
||||
+
|
||||
+ i++;
|
||||
+ r = strtok_r(NULL, ",", &sptr);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#ifndef NO_CONFIG_WRITE
|
||||
+static char * wpa_config_write_rates(const struct parse_data *data,
|
||||
+ struct wpa_ssid *ssid)
|
||||
+{
|
||||
+ char *value, *pos;
|
||||
+ int res, i;
|
||||
+
|
||||
+ if (ssid->rates[0] <= 0)
|
||||
+ return NULL;
|
||||
+
|
||||
+ value = os_malloc(6 * WLAN_SUPP_RATES_MAX + 1);
|
||||
+ if (value == NULL)
|
||||
+ return NULL;
|
||||
+ pos = value;
|
||||
+ for (i = 0; i < WLAN_SUPP_RATES_MAX - 1; i++) {
|
||||
+ res = os_snprintf(pos, 6, "%.1f,", (double)ssid->rates[i] / 2);
|
||||
+ if (res < 0) {
|
||||
+ os_free(value);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ pos += res;
|
||||
+ }
|
||||
+ res = os_snprintf(pos, 6, "%.1f",
|
||||
+ (double)ssid->rates[WLAN_SUPP_RATES_MAX - 1] / 2);
|
||||
+ if (res < 0) {
|
||||
+ os_free(value);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ value[6 * WLAN_SUPP_RATES_MAX] = '\0';
|
||||
+ return value;
|
||||
+}
|
||||
+#endif /* NO_CONFIG_WRITE */
|
||||
+
|
||||
/* Helper macros for network block parser */
|
||||
|
||||
#ifdef OFFSET
|
||||
@@ -2282,6 +2374,8 @@ static const struct parse_data ssid_fiel
|
||||
{ INT(ap_max_inactivity) },
|
||||
{ INT(dtim_period) },
|
||||
{ INT(beacon_int) },
|
||||
+ { FUNC(rates) },
|
||||
+ { FUNC(mcast_rate) },
|
||||
#ifdef CONFIG_MACSEC
|
||||
{ INT_RANGE(macsec_policy, 0, 1) },
|
||||
{ INT_RANGE(macsec_integ_only, 0, 1) },
|
||||
--- a/wpa_supplicant/config_ssid.h
|
||||
+++ b/wpa_supplicant/config_ssid.h
|
||||
@@ -10,8 +10,10 @@
|
||||
#define CONFIG_SSID_H
|
||||
|
||||
#include "common/defs.h"
|
||||
+#include "ap/sta_info.h"
|
||||
#include "utils/list.h"
|
||||
#include "eap_peer/eap_config.h"
|
||||
+#include "drivers/nl80211_copy.h"
|
||||
|
||||
|
||||
#define DEFAULT_EAP_WORKAROUND ((unsigned int) -1)
|
||||
@@ -757,6 +759,9 @@ struct wpa_ssid {
|
||||
*/
|
||||
void *parent_cred;
|
||||
|
||||
+ unsigned char rates[WLAN_SUPP_RATES_MAX];
|
||||
+ double mcast_rate;
|
||||
+
|
||||
#ifdef CONFIG_MACSEC
|
||||
/**
|
||||
* macsec_policy - Determines the policy for MACsec secure session
|
||||
--- a/wpa_supplicant/wpa_supplicant.c
|
||||
+++ b/wpa_supplicant/wpa_supplicant.c
|
||||
@@ -3061,6 +3061,12 @@ static void wpas_start_assoc_cb(struct w
|
||||
params.beacon_int = ssid->beacon_int;
|
||||
else
|
||||
params.beacon_int = wpa_s->conf->beacon_int;
|
||||
+ i = 0;
|
||||
+ while (i < WLAN_SUPP_RATES_MAX) {
|
||||
+ params.rates[i] = ssid->rates[i];
|
||||
+ i++;
|
||||
+ }
|
||||
+ params.mcast_rate = ssid->mcast_rate;
|
||||
}
|
||||
|
||||
params.pairwise_suite = cipher_pairwise;
|
||||
@@ -0,0 +1,59 @@
|
||||
From ffc4445958a3ed4064f2e1bf73fa478a61c5cf7b Mon Sep 17 00:00:00 2001
|
||||
From: Antonio Quartulli <ordex@autistici.org>
|
||||
Date: Sun, 3 Jun 2012 18:42:25 +0200
|
||||
Subject: [PATCHv2 602/602] driver_nl80211: use new parameters during ibss join
|
||||
|
||||
Signed-hostap: Antonio Quartulli <ordex@autistici.org>
|
||||
---
|
||||
src/drivers/driver_nl80211.c | 33 ++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 32 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/src/drivers/driver_nl80211.c
|
||||
+++ b/src/drivers/driver_nl80211.c
|
||||
@@ -5094,7 +5094,7 @@ static int wpa_driver_nl80211_ibss(struc
|
||||
struct wpa_driver_associate_params *params)
|
||||
{
|
||||
struct nl_msg *msg;
|
||||
- int ret = -1;
|
||||
+ int ret = -1, i;
|
||||
int count = 0;
|
||||
|
||||
wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex);
|
||||
@@ -5121,6 +5121,37 @@ retry:
|
||||
nl80211_put_beacon_int(msg, params->beacon_int))
|
||||
goto fail;
|
||||
|
||||
+ if (params->fixed_freq) {
|
||||
+ wpa_printf(MSG_DEBUG, " * fixed_freq");
|
||||
+ nla_put_flag(msg, NL80211_ATTR_FREQ_FIXED);
|
||||
+ }
|
||||
+
|
||||
+ if (params->beacon_int > 0) {
|
||||
+ wpa_printf(MSG_DEBUG, " * beacon_int=%d",
|
||||
+ params->beacon_int);
|
||||
+ nla_put_u32(msg, NL80211_ATTR_BEACON_INTERVAL,
|
||||
+ params->beacon_int);
|
||||
+ }
|
||||
+
|
||||
+ if (params->rates[0] > 0) {
|
||||
+ wpa_printf(MSG_DEBUG, " * basic_rates:");
|
||||
+ i = 0;
|
||||
+ while (i < NL80211_MAX_SUPP_RATES &&
|
||||
+ params->rates[i] > 0) {
|
||||
+ wpa_printf(MSG_DEBUG, " %.1f",
|
||||
+ (double)params->rates[i] / 2);
|
||||
+ i++;
|
||||
+ }
|
||||
+ nla_put(msg, NL80211_ATTR_BSS_BASIC_RATES, i,
|
||||
+ params->rates);
|
||||
+ }
|
||||
+
|
||||
+ if (params->mcast_rate > 0) {
|
||||
+ wpa_printf(MSG_DEBUG, " * mcast_rate=%.1f",
|
||||
+ (double)params->mcast_rate / 10);
|
||||
+ nla_put_u32(msg, NL80211_ATTR_MCAST_RATE, params->mcast_rate);
|
||||
+ }
|
||||
+
|
||||
ret = nl80211_set_conn_keys(params, msg);
|
||||
if (ret)
|
||||
goto fail;
|
||||
@@ -0,0 +1,68 @@
|
||||
From: Sven Eckelmann <sven.eckelmann@openmesh.com>
|
||||
Date: Thu, 11 May 2017 08:21:45 +0200
|
||||
Subject: [PATCH] set mcast_rate in mesh mode
|
||||
|
||||
The wpa_supplicant code for IBSS allows to set the mcast rate. It is
|
||||
recommended to increase this value from 1 or 6 Mbit/s to something higher
|
||||
when using a mesh protocol on top which uses the multicast packet loss as
|
||||
indicator for the link quality.
|
||||
|
||||
This setting was unfortunately not applied for mesh mode. But it would be
|
||||
beneficial when wpa_supplicant would behave similar to IBSS mode and set
|
||||
this argument during mesh join like authsae already does. At least it is
|
||||
helpful for companies/projects which are currently switching to 802.11s
|
||||
(without mesh_fwding and with mesh_ttl set to 1) as replacement for IBSS
|
||||
because newer drivers seem to support 802.11s but not IBSS anymore.
|
||||
|
||||
Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
|
||||
Tested-by: Simon Wunderlich <simon.wunderlich@openmesh.com>
|
||||
|
||||
--- a/src/drivers/driver.h
|
||||
+++ b/src/drivers/driver.h
|
||||
@@ -1397,6 +1397,7 @@ struct wpa_driver_mesh_join_params {
|
||||
#define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008
|
||||
unsigned int flags;
|
||||
u8 handle_dfs;
|
||||
+ int mcast_rate;
|
||||
};
|
||||
|
||||
/**
|
||||
--- a/src/drivers/driver_nl80211.c
|
||||
+++ b/src/drivers/driver_nl80211.c
|
||||
@@ -9248,6 +9248,18 @@ static int nl80211_put_mesh_id(struct nl
|
||||
}
|
||||
|
||||
|
||||
+static int nl80211_put_mcast_rate(struct nl_msg *msg, int mcast_rate)
|
||||
+{
|
||||
+ if (mcast_rate > 0) {
|
||||
+ wpa_printf(MSG_DEBUG, " * mcast_rate=%.1f",
|
||||
+ (double)mcast_rate / 10);
|
||||
+ return nla_put_u32(msg, NL80211_ATTR_MCAST_RATE, mcast_rate);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static int nl80211_put_mesh_config(struct nl_msg *msg,
|
||||
struct wpa_driver_mesh_bss_params *params)
|
||||
{
|
||||
@@ -9309,6 +9321,7 @@ static int nl80211_join_mesh(struct i802
|
||||
nl80211_put_basic_rates(msg, params->basic_rates) ||
|
||||
nl80211_put_mesh_id(msg, params->meshid, params->meshid_len) ||
|
||||
nl80211_put_beacon_int(msg, params->beacon_int) ||
|
||||
+ nl80211_put_mcast_rate(msg, params->mcast_rate) ||
|
||||
nl80211_put_dtim_period(msg, params->dtim_period))
|
||||
goto fail;
|
||||
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -482,6 +482,7 @@ int wpa_supplicant_join_mesh(struct wpa_
|
||||
|
||||
params->meshid = ssid->ssid;
|
||||
params->meshid_len = ssid->ssid_len;
|
||||
+ params->mcast_rate = ssid->mcast_rate;
|
||||
ibss_mesh_setup_freq(wpa_s, ssid, ¶ms->freq);
|
||||
wpa_s->mesh_ht_enabled = !!params->freq.ht_enabled;
|
||||
wpa_s->mesh_vht_enabled = !!params->freq.vht_enabled;
|
||||
@@ -0,0 +1,19 @@
|
||||
--- a/wpa_supplicant/wpa_supplicant.c
|
||||
+++ b/wpa_supplicant/wpa_supplicant.c
|
||||
@@ -2124,11 +2124,13 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
for (j = 0; j < wpa_s->last_scan_res_used; j++) {
|
||||
struct wpa_bss *bss = wpa_s->last_scan_res[j];
|
||||
|
||||
- if (ssid->mode != WPAS_MODE_IBSS)
|
||||
+ /* Don't adjust control freq in case of fixed_freq */
|
||||
+ if (ssid->fixed_freq) {
|
||||
+ obss_scan = 0;
|
||||
break;
|
||||
+ }
|
||||
|
||||
- /* Don't adjust control freq in case of fixed_freq */
|
||||
- if (ssid->fixed_freq)
|
||||
+ if (ssid->mode != WPAS_MODE_IBSS)
|
||||
break;
|
||||
|
||||
if (!bss_is_ibss(bss))
|
||||
@@ -0,0 +1,45 @@
|
||||
--- a/src/ap/acs.c
|
||||
+++ b/src/ap/acs.c
|
||||
@@ -292,18 +292,12 @@ static void acs_fail(struct hostapd_ifac
|
||||
static long double
|
||||
acs_survey_interference_factor(struct freq_survey *survey, s8 min_nf)
|
||||
{
|
||||
- long double factor, busy, total;
|
||||
+ long double factor, busy = 0, total;
|
||||
|
||||
if (survey->filled & SURVEY_HAS_CHAN_TIME_BUSY)
|
||||
busy = survey->channel_time_busy;
|
||||
else if (survey->filled & SURVEY_HAS_CHAN_TIME_RX)
|
||||
busy = survey->channel_time_rx;
|
||||
- else {
|
||||
- /* This shouldn't really happen as survey data is checked in
|
||||
- * acs_sanity_check() */
|
||||
- wpa_printf(MSG_ERROR, "ACS: Survey data missing");
|
||||
- return 0;
|
||||
- }
|
||||
|
||||
total = survey->channel_time;
|
||||
|
||||
@@ -392,20 +386,19 @@ static int acs_usable_vht80_chan(struct
|
||||
static int acs_survey_is_sufficient(struct freq_survey *survey)
|
||||
{
|
||||
if (!(survey->filled & SURVEY_HAS_NF)) {
|
||||
+ survey->nf = -95;
|
||||
wpa_printf(MSG_INFO, "ACS: Survey is missing noise floor");
|
||||
- return 0;
|
||||
}
|
||||
|
||||
if (!(survey->filled & SURVEY_HAS_CHAN_TIME)) {
|
||||
+ survey->channel_time = 0;
|
||||
wpa_printf(MSG_INFO, "ACS: Survey is missing channel time");
|
||||
- return 0;
|
||||
}
|
||||
|
||||
if (!(survey->filled & SURVEY_HAS_CHAN_TIME_BUSY) &&
|
||||
!(survey->filled & SURVEY_HAS_CHAN_TIME_RX)) {
|
||||
wpa_printf(MSG_INFO,
|
||||
"ACS: Survey is missing RX and busy time (at least one is required)");
|
||||
- return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
342
package/network/services/hostapd/patches/600-ubus_support.patch
Normal file
342
package/network/services/hostapd/patches/600-ubus_support.patch
Normal file
@@ -0,0 +1,342 @@
|
||||
--- a/hostapd/Makefile
|
||||
+++ b/hostapd/Makefile
|
||||
@@ -165,6 +165,11 @@ OBJS += ../src/common/hw_features_common
|
||||
|
||||
OBJS += ../src/eapol_auth/eapol_auth_sm.o
|
||||
|
||||
+ifdef CONFIG_UBUS
|
||||
+CFLAGS += -DUBUS_SUPPORT
|
||||
+OBJS += ../src/ap/ubus.o
|
||||
+LIBS += -lubox -lubus
|
||||
+endif
|
||||
|
||||
ifdef CONFIG_CODE_COVERAGE
|
||||
CFLAGS += -O0 -fprofile-arcs -ftest-coverage
|
||||
--- a/src/ap/hostapd.h
|
||||
+++ b/src/ap/hostapd.h
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "utils/list.h"
|
||||
#include "ap_config.h"
|
||||
#include "drivers/driver.h"
|
||||
+#include "ubus.h"
|
||||
|
||||
struct wpa_ctrl_dst;
|
||||
struct radius_server_data;
|
||||
@@ -129,6 +130,7 @@ struct hostapd_data {
|
||||
struct hostapd_iface *iface;
|
||||
struct hostapd_config *iconf;
|
||||
struct hostapd_bss_config *conf;
|
||||
+ struct hostapd_ubus_bss ubus;
|
||||
int interface_added; /* virtual interface added for this BSS */
|
||||
unsigned int started:1;
|
||||
unsigned int disabled:1;
|
||||
@@ -544,6 +546,7 @@ hostapd_alloc_bss_data(struct hostapd_if
|
||||
struct hostapd_bss_config *bss);
|
||||
int hostapd_setup_interface(struct hostapd_iface *iface);
|
||||
int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err);
|
||||
+void hostapd_set_own_neighbor_report(struct hostapd_data *hapd);
|
||||
void hostapd_interface_deinit(struct hostapd_iface *iface);
|
||||
void hostapd_interface_free(struct hostapd_iface *iface);
|
||||
struct hostapd_iface * hostapd_alloc_iface(void);
|
||||
--- a/src/ap/hostapd.c
|
||||
+++ b/src/ap/hostapd.c
|
||||
@@ -315,6 +315,7 @@ static void hostapd_free_hapd_data(struc
|
||||
hapd->started = 0;
|
||||
|
||||
wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface);
|
||||
+ hostapd_ubus_free_bss(hapd);
|
||||
iapp_deinit(hapd->iapp);
|
||||
hapd->iapp = NULL;
|
||||
accounting_deinit(hapd);
|
||||
@@ -1237,6 +1238,8 @@ static int hostapd_setup_bss(struct host
|
||||
if (hapd->driver && hapd->driver->set_operstate)
|
||||
hapd->driver->set_operstate(hapd->drv_priv, 1);
|
||||
|
||||
+ hostapd_ubus_add_bss(hapd);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1651,7 +1654,7 @@ static enum nr_chan_width hostapd_get_nr
|
||||
#endif /* NEED_AP_MLME */
|
||||
|
||||
|
||||
-static void hostapd_set_own_neighbor_report(struct hostapd_data *hapd)
|
||||
+void hostapd_set_own_neighbor_report(struct hostapd_data *hapd)
|
||||
{
|
||||
#ifdef NEED_AP_MLME
|
||||
u16 capab = hostapd_own_capab_info(hapd);
|
||||
@@ -1872,6 +1875,7 @@ static int hostapd_setup_interface_compl
|
||||
if (err)
|
||||
goto fail;
|
||||
|
||||
+ hostapd_ubus_add_iface(iface);
|
||||
wpa_printf(MSG_DEBUG, "Completing interface initialization");
|
||||
if (iface->conf->channel) {
|
||||
#ifdef NEED_AP_MLME
|
||||
@@ -2052,6 +2056,7 @@ dfs_offload:
|
||||
|
||||
fail:
|
||||
wpa_printf(MSG_ERROR, "Interface initialization failed");
|
||||
+ hostapd_ubus_free_iface(iface);
|
||||
hostapd_set_state(iface, HAPD_IFACE_DISABLED);
|
||||
wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED);
|
||||
#ifdef CONFIG_FST
|
||||
@@ -2517,6 +2522,7 @@ void hostapd_interface_deinit_free(struc
|
||||
(unsigned int) iface->conf->num_bss);
|
||||
driver = iface->bss[0]->driver;
|
||||
drv_priv = iface->bss[0]->drv_priv;
|
||||
+ hostapd_ubus_free_iface(iface);
|
||||
hostapd_interface_deinit(iface);
|
||||
wpa_printf(MSG_DEBUG, "%s: driver=%p drv_priv=%p -> hapd_deinit",
|
||||
__func__, driver, drv_priv);
|
||||
--- a/src/ap/ieee802_11.c
|
||||
+++ b/src/ap/ieee802_11.c
|
||||
@@ -1714,12 +1714,13 @@ ieee802_11_set_radius_info(struct hostap
|
||||
|
||||
|
||||
static void handle_auth(struct hostapd_data *hapd,
|
||||
- const struct ieee80211_mgmt *mgmt, size_t len)
|
||||
+ const struct ieee80211_mgmt *mgmt, size_t len,
|
||||
+ struct hostapd_frame_info *fi)
|
||||
{
|
||||
u16 auth_alg, auth_transaction, status_code;
|
||||
u16 resp = WLAN_STATUS_SUCCESS;
|
||||
struct sta_info *sta = NULL;
|
||||
- int res, reply_res;
|
||||
+ int res, reply_res, ubus_resp;
|
||||
u16 fc;
|
||||
const u8 *challenge = NULL;
|
||||
u32 session_timeout, acct_interim_interval;
|
||||
@@ -1730,6 +1731,11 @@ static void handle_auth(struct hostapd_d
|
||||
char *identity = NULL;
|
||||
char *radius_cui = NULL;
|
||||
u16 seq_ctrl;
|
||||
+ struct hostapd_ubus_request req = {
|
||||
+ .type = HOSTAPD_UBUS_AUTH_REQ,
|
||||
+ .mgmt_frame = mgmt,
|
||||
+ .frame_info = fi,
|
||||
+ };
|
||||
|
||||
if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.auth)) {
|
||||
wpa_printf(MSG_INFO, "handle_auth - too short payload (len=%lu)",
|
||||
@@ -1890,6 +1896,13 @@ static void handle_auth(struct hostapd_d
|
||||
resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
|
||||
goto fail;
|
||||
}
|
||||
+ ubus_resp = hostapd_ubus_handle_event(hapd, &req);
|
||||
+ if (ubus_resp) {
|
||||
+ wpa_printf(MSG_DEBUG, "Station " MACSTR " rejected by ubus handler.\n",
|
||||
+ MAC2STR(mgmt->sa));
|
||||
+ resp = ubus_resp > 0 ? (u16) ubus_resp : WLAN_STATUS_UNSPECIFIED_FAILURE;
|
||||
+ goto fail;
|
||||
+ }
|
||||
if (res == HOSTAPD_ACL_PENDING)
|
||||
return;
|
||||
|
||||
@@ -3169,12 +3182,12 @@ void fils_hlp_timeout(void *eloop_ctx, v
|
||||
|
||||
static void handle_assoc(struct hostapd_data *hapd,
|
||||
const struct ieee80211_mgmt *mgmt, size_t len,
|
||||
- int reassoc)
|
||||
+ int reassoc, struct hostapd_frame_info *fi)
|
||||
{
|
||||
u16 capab_info, listen_interval, seq_ctrl, fc;
|
||||
u16 resp = WLAN_STATUS_SUCCESS, reply_res;
|
||||
const u8 *pos;
|
||||
- int left, i;
|
||||
+ int left, i, ubus_resp;
|
||||
struct sta_info *sta;
|
||||
u8 *tmp = NULL;
|
||||
struct hostapd_sta_wpa_psk_short *psk = NULL;
|
||||
@@ -3183,6 +3196,11 @@ static void handle_assoc(struct hostapd_
|
||||
#ifdef CONFIG_FILS
|
||||
int delay_assoc = 0;
|
||||
#endif /* CONFIG_FILS */
|
||||
+ struct hostapd_ubus_request req = {
|
||||
+ .type = HOSTAPD_UBUS_ASSOC_REQ,
|
||||
+ .mgmt_frame = mgmt,
|
||||
+ .frame_info = fi,
|
||||
+ };
|
||||
|
||||
if (len < IEEE80211_HDRLEN + (reassoc ? sizeof(mgmt->u.reassoc_req) :
|
||||
sizeof(mgmt->u.assoc_req))) {
|
||||
@@ -3354,6 +3372,14 @@ static void handle_assoc(struct hostapd_
|
||||
}
|
||||
#endif /* CONFIG_MBO */
|
||||
|
||||
+ ubus_resp = hostapd_ubus_handle_event(hapd, &req);
|
||||
+ if (ubus_resp) {
|
||||
+ wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n",
|
||||
+ MAC2STR(mgmt->sa));
|
||||
+ resp = ubus_resp > 0 ? (u16) ubus_resp : WLAN_STATUS_UNSPECIFIED_FAILURE;
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
/*
|
||||
* sta->capability is used in check_assoc_ies() for RRM enabled
|
||||
* capability element.
|
||||
@@ -3567,6 +3593,7 @@ static void handle_disassoc(struct hosta
|
||||
wpa_printf(MSG_DEBUG, "disassocation: STA=" MACSTR " reason_code=%d",
|
||||
MAC2STR(mgmt->sa),
|
||||
le_to_host16(mgmt->u.disassoc.reason_code));
|
||||
+ hostapd_ubus_notify(hapd, "disassoc", mgmt->sa);
|
||||
|
||||
sta = ap_get_sta(hapd, mgmt->sa);
|
||||
if (sta == NULL) {
|
||||
@@ -3632,6 +3659,8 @@ static void handle_deauth(struct hostapd
|
||||
" reason_code=%d",
|
||||
MAC2STR(mgmt->sa), le_to_host16(mgmt->u.deauth.reason_code));
|
||||
|
||||
+ hostapd_ubus_notify(hapd, "deauth", mgmt->sa);
|
||||
+
|
||||
sta = ap_get_sta(hapd, mgmt->sa);
|
||||
if (sta == NULL) {
|
||||
wpa_msg(hapd->msg_ctx, MSG_DEBUG, "Station " MACSTR " trying "
|
||||
@@ -3963,7 +3992,7 @@ int ieee802_11_mgmt(struct hostapd_data
|
||||
|
||||
|
||||
if (stype == WLAN_FC_STYPE_PROBE_REQ) {
|
||||
- handle_probe_req(hapd, mgmt, len, ssi_signal);
|
||||
+ handle_probe_req(hapd, mgmt, len, fi);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -3983,17 +4012,17 @@ int ieee802_11_mgmt(struct hostapd_data
|
||||
switch (stype) {
|
||||
case WLAN_FC_STYPE_AUTH:
|
||||
wpa_printf(MSG_DEBUG, "mgmt::auth");
|
||||
- handle_auth(hapd, mgmt, len);
|
||||
+ handle_auth(hapd, mgmt, len, fi);
|
||||
ret = 1;
|
||||
break;
|
||||
case WLAN_FC_STYPE_ASSOC_REQ:
|
||||
wpa_printf(MSG_DEBUG, "mgmt::assoc_req");
|
||||
- handle_assoc(hapd, mgmt, len, 0);
|
||||
+ handle_assoc(hapd, mgmt, len, 0, fi);
|
||||
ret = 1;
|
||||
break;
|
||||
case WLAN_FC_STYPE_REASSOC_REQ:
|
||||
wpa_printf(MSG_DEBUG, "mgmt::reassoc_req");
|
||||
- handle_assoc(hapd, mgmt, len, 1);
|
||||
+ handle_assoc(hapd, mgmt, len, 1, fi);
|
||||
ret = 1;
|
||||
break;
|
||||
case WLAN_FC_STYPE_DISASSOC:
|
||||
--- a/src/ap/beacon.c
|
||||
+++ b/src/ap/beacon.c
|
||||
@@ -720,7 +720,7 @@ void sta_track_claim_taxonomy_info(struc
|
||||
|
||||
void handle_probe_req(struct hostapd_data *hapd,
|
||||
const struct ieee80211_mgmt *mgmt, size_t len,
|
||||
- int ssi_signal)
|
||||
+ struct hostapd_frame_info *fi)
|
||||
{
|
||||
u8 *resp;
|
||||
struct ieee802_11_elems elems;
|
||||
@@ -729,6 +729,7 @@ void handle_probe_req(struct hostapd_dat
|
||||
size_t i, resp_len;
|
||||
int noack;
|
||||
enum ssid_match_result res;
|
||||
+ int ssi_signal = fi->ssi_signal;
|
||||
int ret;
|
||||
u16 csa_offs[2];
|
||||
size_t csa_offs_len;
|
||||
@@ -737,6 +738,11 @@ void handle_probe_req(struct hostapd_dat
|
||||
struct hostapd_sta_wpa_psk_short *psk = NULL;
|
||||
char *identity = NULL;
|
||||
char *radius_cui = NULL;
|
||||
+ struct hostapd_ubus_request req = {
|
||||
+ .type = HOSTAPD_UBUS_PROBE_REQ,
|
||||
+ .mgmt_frame = mgmt,
|
||||
+ .frame_info = fi,
|
||||
+ };
|
||||
|
||||
if (len < IEEE80211_HDRLEN)
|
||||
return;
|
||||
@@ -914,6 +920,12 @@ void handle_probe_req(struct hostapd_dat
|
||||
}
|
||||
#endif /* CONFIG_P2P */
|
||||
|
||||
+ if (hostapd_ubus_handle_event(hapd, &req)) {
|
||||
+ wpa_printf(MSG_DEBUG, "Probe request for " MACSTR " rejected by ubus handler.\n",
|
||||
+ MAC2STR(mgmt->sa));
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
/* TODO: verify that supp_rates contains at least one matching rate
|
||||
* with AP configuration */
|
||||
|
||||
--- a/src/ap/beacon.h
|
||||
+++ b/src/ap/beacon.h
|
||||
@@ -14,7 +14,7 @@ struct ieee80211_mgmt;
|
||||
|
||||
void handle_probe_req(struct hostapd_data *hapd,
|
||||
const struct ieee80211_mgmt *mgmt, size_t len,
|
||||
- int ssi_signal);
|
||||
+ struct hostapd_frame_info *fi);
|
||||
int ieee802_11_set_beacon(struct hostapd_data *hapd);
|
||||
int ieee802_11_set_beacons(struct hostapd_iface *iface);
|
||||
int ieee802_11_update_beacons(struct hostapd_iface *iface);
|
||||
--- a/src/ap/drv_callbacks.c
|
||||
+++ b/src/ap/drv_callbacks.c
|
||||
@@ -116,6 +116,10 @@ int hostapd_notif_assoc(struct hostapd_d
|
||||
u16 reason = WLAN_REASON_UNSPECIFIED;
|
||||
u16 status = WLAN_STATUS_SUCCESS;
|
||||
const u8 *p2p_dev_addr = NULL;
|
||||
+ struct hostapd_ubus_request req = {
|
||||
+ .type = HOSTAPD_UBUS_ASSOC_REQ,
|
||||
+ .addr = addr,
|
||||
+ };
|
||||
|
||||
if (addr == NULL) {
|
||||
/*
|
||||
@@ -208,6 +212,12 @@ int hostapd_notif_assoc(struct hostapd_d
|
||||
goto fail;
|
||||
}
|
||||
|
||||
+ if (hostapd_ubus_handle_event(hapd, &req)) {
|
||||
+ wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n",
|
||||
+ MAC2STR(req.addr));
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
#ifdef CONFIG_P2P
|
||||
if (elems.p2p) {
|
||||
wpabuf_free(sta->p2p_ie);
|
||||
--- a/src/ap/sta_info.c
|
||||
+++ b/src/ap/sta_info.c
|
||||
@@ -415,6 +415,7 @@ void ap_handle_timer(void *eloop_ctx, vo
|
||||
HOSTAPD_LEVEL_INFO, "deauthenticated due to "
|
||||
"local deauth request");
|
||||
ap_free_sta(hapd, sta);
|
||||
+ hostapd_ubus_notify(hapd, "local-deauth", sta->addr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -562,6 +563,7 @@ skip_poll:
|
||||
hapd, sta,
|
||||
WLAN_REASON_PREV_AUTH_NOT_VALID);
|
||||
ap_free_sta(hapd, sta);
|
||||
+ hostapd_ubus_notify(hapd, "inactive-deauth", sta->addr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1223,6 +1225,7 @@ void ap_sta_set_authorized(struct hostap
|
||||
buf, ip_addr);
|
||||
} else {
|
||||
wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED "%s", buf);
|
||||
+ hostapd_ubus_notify(hapd, "disassoc", sta->addr);
|
||||
|
||||
if (hapd->msg_ctx_parent &&
|
||||
hapd->msg_ctx_parent != hapd->msg_ctx)
|
||||
--- a/src/ap/wpa_auth_glue.c
|
||||
+++ b/src/ap/wpa_auth_glue.c
|
||||
@@ -177,6 +177,7 @@ static void hostapd_wpa_auth_psk_failure
|
||||
struct hostapd_data *hapd = ctx;
|
||||
wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_POSSIBLE_PSK_MISMATCH MACSTR,
|
||||
MAC2STR(addr));
|
||||
+ hostapd_ubus_notify(hapd, "key-mismatch", addr);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
From 672540d4ddbd24782b5c65b35d636bdfe8a90d0f Mon Sep 17 00:00:00 2001
|
||||
From: Rosen Penev <rosenp@gmail.com>
|
||||
Date: Fri, 15 Jun 2018 18:35:30 -0700
|
||||
Subject: [PATCH] Fix compile with OpenSSL 1.1.0 and deprecated APIs
|
||||
|
||||
SSL_session_reused is the same as SSL_cache_hit. The engine load stuff is
|
||||
now handled by OPENSSL_init.
|
||||
|
||||
Signed-off-by: Rosen Penev <rosenp@gmail.com>
|
||||
---
|
||||
src/crypto/tls_openssl.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/src/crypto/tls_openssl.c
|
||||
+++ b/src/crypto/tls_openssl.c
|
||||
@@ -1024,8 +1024,10 @@ void * tls_init(const struct tls_config
|
||||
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
wpa_printf(MSG_DEBUG, "ENGINE: Loading dynamic engine");
|
||||
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
ERR_load_ENGINE_strings();
|
||||
ENGINE_load_dynamic();
|
||||
+#endif /* OPENSSL_VERSION_NUMBER */
|
||||
|
||||
if (conf &&
|
||||
(conf->opensc_engine_path || conf->pkcs11_engine_path ||
|
||||
@@ -3874,7 +3876,7 @@ struct wpabuf * tls_connection_decrypt(v
|
||||
|
||||
int tls_connection_resumed(void *ssl_ctx, struct tls_connection *conn)
|
||||
{
|
||||
- return conn ? SSL_cache_hit(conn->ssl) : 0;
|
||||
+ return conn ? SSL_session_reused(conn->ssl) : 0;
|
||||
}
|
||||
|
||||
|
||||
1060
package/network/services/hostapd/src/src/ap/ubus.c
Normal file
1060
package/network/services/hostapd/src/src/ap/ubus.c
Normal file
File diff suppressed because it is too large
Load Diff
77
package/network/services/hostapd/src/src/ap/ubus.h
Normal file
77
package/network/services/hostapd/src/src/ap/ubus.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* hostapd / ubus support
|
||||
* Copyright (c) 2013, Felix Fietkau <nbd@nbd.name>
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
#ifndef __HOSTAPD_UBUS_H
|
||||
#define __HOSTAPD_UBUS_H
|
||||
|
||||
enum hostapd_ubus_event_type {
|
||||
HOSTAPD_UBUS_PROBE_REQ,
|
||||
HOSTAPD_UBUS_AUTH_REQ,
|
||||
HOSTAPD_UBUS_ASSOC_REQ,
|
||||
HOSTAPD_UBUS_TYPE_MAX
|
||||
};
|
||||
|
||||
struct hostapd_ubus_request {
|
||||
enum hostapd_ubus_event_type type;
|
||||
const struct ieee80211_mgmt *mgmt_frame;
|
||||
const struct hostapd_frame_info *frame_info;
|
||||
const u8 *addr;
|
||||
};
|
||||
|
||||
struct hostapd_iface;
|
||||
struct hostapd_data;
|
||||
|
||||
#ifdef UBUS_SUPPORT
|
||||
|
||||
#include <libubox/avl.h>
|
||||
#include <libubus.h>
|
||||
|
||||
struct hostapd_ubus_bss {
|
||||
struct ubus_object obj;
|
||||
struct avl_tree banned;
|
||||
int notify_response;
|
||||
};
|
||||
|
||||
void hostapd_ubus_add_iface(struct hostapd_iface *iface);
|
||||
void hostapd_ubus_free_iface(struct hostapd_iface *iface);
|
||||
void hostapd_ubus_add_bss(struct hostapd_data *hapd);
|
||||
void hostapd_ubus_free_bss(struct hostapd_data *hapd);
|
||||
|
||||
int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req);
|
||||
void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac);
|
||||
|
||||
#else
|
||||
|
||||
struct hostapd_ubus_bss {};
|
||||
|
||||
static inline void hostapd_ubus_add_iface(struct hostapd_iface *iface)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void hostapd_ubus_free_iface(struct hostapd_iface *iface)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void hostapd_ubus_add_bss(struct hostapd_data *hapd)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void hostapd_ubus_free_bss(struct hostapd_data *hapd)
|
||||
{
|
||||
}
|
||||
|
||||
static inline int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef BUILD_FEATURES_H
|
||||
#define BUILD_FEATURES_H
|
||||
|
||||
static inline int has_feature(const char *feat)
|
||||
{
|
||||
#if defined(IEEE8021X_EAPOL) || (defined(HOSTAPD) && !defined(CONFIG_NO_RADIUS))
|
||||
if (!strcmp(feat, "eap"))
|
||||
return 1;
|
||||
#endif
|
||||
#ifdef CONFIG_IEEE80211N
|
||||
if (!strcmp(feat, "11n"))
|
||||
return 1;
|
||||
#endif
|
||||
#ifdef CONFIG_IEEE80211AC
|
||||
if (!strcmp(feat, "11ac"))
|
||||
return 1;
|
||||
#endif
|
||||
#ifdef CONFIG_IEEE80211R
|
||||
if (!strcmp(feat, "11r"))
|
||||
return 1;
|
||||
#endif
|
||||
#ifdef CONFIG_IEEE80211W
|
||||
if (!strcmp(feat, "11w"))
|
||||
return 1;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* BUILD_FEATURES_H */
|
||||
Reference in New Issue
Block a user