1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

add qca feed

This commit is contained in:
suyuan 2022-09-10 05:47:47 +08:00
parent d43ffd8720
commit 26ac03f3f6
451 changed files with 111139 additions and 12069 deletions

View file

@ -0,0 +1,321 @@
include $(TOPDIR)/rules.mk
PKG:=qca-hostap
PKG_NAME:=$(PKG)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=ssh://qca-git01.qualcomm.com:29418/wifi/$(PKG_NAME).git
PKG_BRANCH:=master
PKG_RELEASE:=1
PATCH_DIR:=$(TOPDIR)/qca/src/$(PKG_NAME)/qca-patches
include $(INCLUDE_DIR)/local-development.mk
ifeq ($(DUMP)$(PKG_VERSION),)
PKG_REV:=$(shell git ls-remote $(PKG_SOURCE_URL) $(PKG_BRANCH) | cut -b -7)
PKG_VERSION:=g$(PKG_REV)
endif
LOCAL_TYPE=$(strip \
$(if $(findstring supplicant,$(BUILD_VARIANT)),supplicant, \
hostap \
))
LOCAL_VARIANT=$(patsubst supplicant-%,%,$(BUILD_VARIANT))
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG)-$(PKG_VERSION)
PKG_BUILD_DEPENDS:=qca-wifi
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)/Default
SECTION:=QCA
CATEGORY:=$(QTI_SOFTWARE_CATEGORY)
URL:=http://www.qca.qualcomm.com
MAINTAINER:=Qualcomm Atheros
endef
define Package/$(PKG_NAME)
$(call Package/$(PKG_NAME)/Default)
TITLE:=Hostap authenticator
DEPENDS:=@$(WIFI_PKGS) @(!(PACKAGE_hostapd)) +libnl +libopenssl
VARIANT:=default
endef
define Package/$(PKG_NAME)-lite
$(call Package/$(PKG_NAME)/Default)
TITLE:=Hostap authenticator for lite profile
DEPENDS:=@$(WIFI_PKGS) @(!(PACKAGE_hostapd)) +libnl +libopenssl
VARIANT:=lite
endef
define Package/$(PKG_NAME)/description
This package contains the IEEE 802.1x/WPA/EAP/RADIUS Authenticator.
endef
define Package/$(PKG_NAME)-lite/description
This package contains the IEEE 802.1x/WPA/EAP/RADIUS Authenticator.
endef
define Package/$(PKG_NAME)-macsec
$(call Package/$(PKG_NAME))
TITLE:=Hostap authenticator (MACSEC)
DEPENDS+= @TARGET_ipq806x||TARGET_ipq||TARGET_ipq807x||TARGET_ipq60xx||TARGET_ipq50xx +kmod-qca-nss-macsec
VARIANT:=macsec
endef
define Package/$(PKG_NAME)-macsec/Description
Hostap authenticator with MACSEC support for IPQ807x.
endef
define Package/qca-hostapd-cli
$(call Package/$(PKG_NAME)/Default)
DEPENDS:=@(PACKAGE_qca-hostap||PACKAGE_qca-hostap-macsec||PACKAGE_qca-hostap-lite) +librt +libnl +libopenssl
DEPENDS+= PACKAGE_kmod-qca-nss-macsec:kmod-qca-nss-macsec
TITLE:=Hostap authenticator command line interface
endef
define Package/qca-hostapd-cli/description
This package contains a command line utility to control the
IEEE 802.1x/WPA/EAP/RADIUS Authenticator.
endef
define Package/qca-wpa-supplicant
$(call Package/$(PKG_NAME)/Default)
TITLE:=WPA Supplicant
DEPENDS:=@$(WIFI_PKGS) @(!(PACKAGE_wpa-supplicant)) +libopenssl +libnl
VARIANT:=supplicant-default
endef
define Package/qca-wpa-supplicant-lite
$(call Package/$(PKG_NAME)/Default)
TITLE:=WPA Supplicant for lite profile
DEPENDS:=@$(WIFI_PKGS) @(!(PACKAGE_wpa-supplicant)) +libopenssl +libnl
VARIANT:=supplicant-lite
endef
define Package/qca-wpa-supplicant/Description
WPA Supplicant
endef
define Package/qca-wpa-supplicant-lite/Description
WPA Supplicant for lite profile
endef
define Package/qca-wpa-supplicant-macsec
$(call Package/qca-wpa-supplicant)
TITLE:=WPA Supplicant (MACSEC)
DEPENDS+= @TARGET_ipq806x||TARGET_ipq||TARGET_ipq807x||TARGET_ipq60xx||TARGET_ipq50xx +kmod-qca-nss-macsec
VARIANT:=supplicant-macsec
endef
define Package/qca-wpa-supplicant-macsec/Description
WPA Supplicant with MACSEC support for IPQ8066.
endef
define Package/qca-wpa-cli
$(call Package/$(PKG_NAME)/Default)
DEPENDS:=@(PACKAGE_qca-wpa-supplicant||PACKAGE_qca-wpa-supplicant-macsec||PACKAGE_qca-wpa-supplicant-lite) +librt +libopenssl +libnl
TITLE:=WPA Supplicant command line interface
endef
define Package/qca-wpa-cli/Description
WPA Supplicant control utility
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-$(LOCAL_VARIANT).config), \
$(CP) ./files/hostapd-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config \
)
$(CP) ./files/wpa_supplicant-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
endef
TARGET_CPPFLAGS += \
-I$(STAGING_DIR)/usr/include \
-I$(STAGING_DIR)/usr/include/qca-nss-macsec
TARGET_LDFLAGS += \
-lnl-3 -lnl-genl-3 -lm -lssl -lcrypto -lpthread -ldl -pie
TARGET_CFLAGS += -fpie -Werror
ifneq ($(LOCAL_TYPE),hostap)
TARGET_LDFLAGS += \
-lssl -lcrypto
endif
ifeq ($(LOCAL_VARIANT),macsec)
TARGET_LDFLAGS += -lfal -L$(STAGING_DIR)/usr/lib
endif
define Build/RunMake
CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
$(MAKE) -C $(PKG_BUILD_DIR)/$(1) \
$(TARGET_CONFIGURE_OPTS) \
LIBS="$(TARGET_LDFLAGS)" \
$(2)
endef
define Build/Compile/qca-hostap
$(call Build/RunMake,hostapd, \
hostapd hostapd_cli \
)
endef
define Build/Compile/qca-supplicant
$(call Build/RunMake,wpa_supplicant, \
wpa_supplicant wpa_cli \
)
endef
define Build/Compile
$(Build/Compile/qca-$(LOCAL_TYPE))
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/src/common/wpa_ctrl.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/common/qca-vendor.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/common/ieee802_11_defs.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/utils/includes.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/utils/build_config.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/utils/eloop.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/utils/os.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/utils/common.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/utils/wpa_debug.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/utils/wpabuf.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/drivers/linux_ioctl.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/drivers/linux_wext.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/drivers/netlink.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/drivers/priv_netlink.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/drivers/nl80211_copy.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/common/wpa_ctrl.o $(1)/usr/lib/
$(CP) $(PKG_BUILD_DIR)/src/drivers/netlink.o $(1)/usr/lib/
$(CP) $(PKG_BUILD_DIR)/src/utils/eloop.o $(1)/usr/lib/
$(CP) $(PKG_BUILD_DIR)/src/utils/wpa_debug.o $(1)/usr/lib/
$(CP) $(PKG_BUILD_DIR)/src/utils/common.o $(1)/usr/lib/
$(CP) $(PKG_BUILD_DIR)/src/utils/os_unix.o $(1)/usr/lib/
endef
define Install/$(PKG_NAME)
$(INSTALL_DIR) $(1)/lib/wifi
$(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/wifi/hostapd.sh
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/qca-hostapd.init $(1)/etc/init.d/qca-hostapd
$(INSTALL_DIR) $(1)/usr/sbin
endef
define Install/qca-wpa-supplicant
$(INSTALL_DIR) $(1)/lib/wifi
$(INSTALL_DATA) ./files/wpa_supplicant.sh $(1)/lib/wifi/wpa_supplicant.sh
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/qca-wpa-supplicant.init $(1)/etc/init.d/qca-wpa-supplicant
$(INSTALL_DIR) $(1)/usr/sbin
endef
define Package/$(PKG_NAME)/install
$(call Install/$(PKG_NAME),$(1))
$(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/
endef
define Package/$(PKG_NAME)-lite/install
$(call Install/$(PKG_NAME),$(1))
$(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/
endef
define Package/$(PKG_NAME)-macsec/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/hostapd-macsec
endef
ifneq ($(LOCAL_TYPE),supplicant)
ifneq ($(LOCAL_VARIANT),macsec)
define Package/qca-hostapd-cli/install
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/hotplug.d/button
$(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd_cli $(1)/usr/sbin/
$(INSTALL_DATA) ./files/wps-hotplug.sh $(1)/etc/hotplug.d/button/50-wps
$(INSTALL_DATA) ./files/wps-extender-hotplug.sh \
$(1)/etc/hotplug.d/button/54-wps-extender
$(INSTALL_DATA) ./files/wps-reset-hotplug.sh $(1)/etc/hotplug.d/button/51-wps-reset
$(INSTALL_DIR) $(1)/lib/wifi
$(INSTALL_BIN) ./files/wps-hostapd-update-uci.sh \
$(1)/lib/wifi/wps-hostapd-update-uci
$(INSTALL_DIR) $(1)/lib/wifi
$(INSTALL_BIN) ./files/dpp-supplicant-update-uci.sh \
$(1)/lib/wifi/dpp-supplicant-update-uci
$(INSTALL_BIN) ./files/wps-hostapd-nbh-update.sh \
$(1)/lib/wifi/wps-hostapd-nbh-update
$(INSTALL_BIN) ./files/dpp-hostapd-update-uci.sh \
$(1)/lib/wifi/dpp-hostapd-update-uci
$(INSTALL_BIN) ./files/dpp-operating-class-update.sh \
$(1)/lib/wifi/dpp-operating-class-update.sh
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) ./files/hapd.sh \
$(1)/usr/sbin/hapd
$(INSTALL_BIN) ./files/wpsd.sh \
$(1)/usr/sbin/wpsd
endef
endif
endif
define Package/qca-wpa-supplicant/install
$(call Install/qca-wpa-supplicant,$(1))
$(INSTALL_BIN) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant $(1)/usr/sbin/
endef
define Package/qca-wpa-supplicant-lite/install
$(call Install/qca-wpa-supplicant,$(1))
$(INSTALL_BIN) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant $(1)/usr/sbin/
endef
define Package/qca-wpa-supplicant-macsec/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant $(1)/usr/sbin/wpa_supplicant-macsec
$(INSTALL_DIR) $(1)/etc/init.d $(1)/etc/config
$(INSTALL_BIN) ./files/macsec.init $(1)/etc/init.d/macsec
$(INSTALL_BIN) ./files/macsec.config $(1)/etc/config/macsec
endef
ifneq ($(LOCAL_TYPE),hostap)
ifneq ($(LOCAL_VARIANT),macsec)
define Package/qca-wpa-cli/install
$(INSTALL_DIR) $(1)/usr/sbin
$(CP) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_cli $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/hotplug.d/button
$(INSTALL_DATA) ./files/wps-supplicant-hotplug.sh \
$(1)/etc/hotplug.d/button/52-wps-supplicant
$(INSTALL_DIR) $(1)/lib/wifi
$(INSTALL_BIN) ./files/wps-supplicant-update-uci.sh \
$(1)/lib/wifi/wps-supplicant-update-uci
endef
endif
endif
$(eval $(call BuildPackage,$(PKG_NAME)))
$(eval $(call BuildPackage,qca-wpa-supplicant))
$(eval $(call BuildPackage,$(PKG_NAME)-lite))
$(eval $(call BuildPackage,$(PKG_NAME)-macsec))
$(eval $(call BuildPackage,qca-wpa-supplicant-lite))
$(eval $(call BuildPackage,qca-wpa-supplicant-macsec))
$(eval $(call BuildPackage,qca-hostapd-cli))
$(eval $(call BuildPackage,qca-wpa-cli))

View file

@ -0,0 +1,230 @@
#!/bin/sh
#
# Copyright (c) 2018 Qualcomm Technologies, Inc.
#
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
[ -e /lib/functions.sh ] && . /lib/functions.sh
IFNAME=$1
CMD=$2
CONFIG=$3
shift
shift
SSID=$@
PASS=$@
parent=$(cat /sys/class/net/${IFNAME}/parent)
is_section_ifname() {
local config=$1
local ifname
config_get ifname "$config" ifname
[ "${ifname}" = "$2" ] && eval "$3=$config"
}
hex2string()
{
I=0
while [ $I -lt ${#1} ];
do
echo -en "\x"${1:$I:2}
let "I += 2"
done
}
case "$CMD" in
DPP-CONF-RECEIVED)
rsn_pairwise=
hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent set wpa 2
hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent set wpa_key_mgmt DPP
hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent set ieee80211w 1
if [ -f /sys/class/net/$parent/ciphercaps ]
then
cat /sys/class/net/$parent/ciphercaps | grep -i "gcmp"
if [ $? -eq 0 ]
then
rsn_pairwise="CCMP CCMP-256 GCMP GCMP-256"
else
rsn_pairwise="CCMP"
fi
fi
hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent set rsn_pairwise "$rsn_pairwise"
;;
DPP-CONFOBJ-AKM)
encryption=
sae=
dpp=
case "$CONFIG" in
dpp)
hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent set wpa_key_mgmt "DPP"
encryption="dpp"
ieee80211w=1
dpp=1
sae=0
;;
sae)
hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent set wpa_key_mgmt "DPP SAE"
encryption="ccmp"
sae=1
ieee80211w=2
dpp=0
;;
psk+sae)
hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent set wpa_key_mgmt "DPP WPA-PSK SAE"
encryption="psk2+ccmp"
sae=1
ieee80211w=1
dpp=0
;;
psk)
hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent set wpa_key_mgmt "DPP WPA-PSK"
encryption="psk2"
ieee80211w=1
dpp=0
sae=0
;;
dpp+sae)
hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent set wpa_key_mgmt "DPP SAE"
encryption="ccmp"
ieee80211w=2
dpp=1
sae=1
;;
dpp+psk+sae)
hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent set wpa_key_mgmt "DPP WPA-PSK SAE"
encryption="psk2+ccmp"
sae=1
ieee80211w=1
dpp=1
;;
esac
ker_ver=`uname -r |cut -d. -f1`
if [ $ker_ver == 5 ]; then
. /sbin/wifi config
else
. /sbin/wifi detect
fi
sect=
config_foreach is_section_ifname wifi-iface $IFNAME sect
uci set wireless.${sect}.encryption=$encryption
uci set wireless.${sect}.sae=$sae
uci set wireless.${sect}.dpp=$dpp
uci set wireless.${sect}.ieee80211w=$ieee80211w
uci commit wireless
;;
DPP-CONFOBJ-SSID)
hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent set ssid "$SSID"
ker_ver=`uname -r |cut -d. -f1`
if [ $ker_ver == 5 ]; then
. /sbin/wifi config
else
. /sbin/wifi detect
fi
sect=
config_foreach is_section_ifname wifi-iface $IFNAME sect
uci set wireless.${sect}.ssid="$SSID"
uci commit wireless
;;
DPP-CONNECTOR)
hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent set dpp_connector $CONFIG
ker_ver=`uname -r |cut -d. -f1`
if [ $ker_ver == 5 ]; then
. /sbin/wifi config
else
. /sbin/wifi detect
fi
sect=
config_foreach is_section_ifname wifi-iface $IFNAME sect
uci set wireless.${sect}.dpp_connector=$CONFIG
uci commit wireless
;;
DPP-1905-CONNECTOR)
hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent set dpp_1905_connector $CONFIG
ker_ver=`uname -r |cut -d. -f1`
if [ $ker_ver == 5 ]; then
. /sbin/wifi config
else
. /sbin/wifi detect
fi
sect=
config_foreach is_section_ifname wifi-iface $IFNAME sect
uci set wireless.${sect}.dpp_1905_connector=$CONFIG
uci commit wireless
;;
DPP-CONFOBJ-PASS)
PASS_STR=$(hex2string $PASS)
hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent set wpa_passphrase "$PASS_STR"
ker_ver=`uname -r |cut -d. -f1`
if [ $ker_ver == 5 ]; then
. /sbin/wifi config
else
. /sbin/wifi detect
fi
sect=
config_foreach is_section_ifname wifi-iface $IFNAME sect
uci set wireless.${sect}.key="$PASS_STR"
uci commit wireless
hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent dpp_bootstrap_remove \*
hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent disable
hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent enable
;;
DPP-CONFOBJ-PSK)
PASS_STR=$(hex2string "$CONFIG")
hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent set wpa_psk $PASS_STR
ker_ver=`uname -r |cut -d. -f1`
if [ $ker_ver == 5 ]; then
. /sbin/wifi config
else
. /sbin/wifi detect
fi
sect=
config_foreach is_section_ifname wifi-iface $IFNAME sect
uci set wireless.${sect}.key=$PASS_STR
uci commit wireless
hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent dpp_bootstrap_remove \*
hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent disable
hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent enable
;;
DPP-C-SIGN-KEY)
hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent set dpp_csign $CONFIG
ker_ver=`uname -r |cut -d. -f1`
if [ $ker_ver == 5 ]; then
. /sbin/wifi config
else
. /sbin/wifi detect
fi
sect=
config_foreach is_section_ifname wifi-iface $IFNAME sect
uci set wireless.${sect}.dpp_csign=$CONFIG
uci commit wireless
;;
DPP-NET-ACCESS-KEY)
hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent set dpp_netaccesskey $CONFIG
ker_ver=`uname -r |cut -d. -f1`
if [ $ker_ver == 5 ]; then
. /sbin/wifi config
else
. /sbin/wifi detect
fi
sect=
config_foreach is_section_ifname wifi-iface $IFNAME sect
uci set wireless.${sect}.dpp_netaccesskey=$CONFIG
uci commit wireless
hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent disable
hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent enable
;;
esac

View file

@ -0,0 +1,151 @@
#!/bin/bash
#
# Copyright (c) 2019 Qualcomm Technologies, Inc.
#
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
dpp_operating_class_setup()
{
htmode=$1
channel=$2
# select the operating class for 2.4GHz channels
if [ $channel -ge 1 -a $channel -le 14 ]
then
case "$htmode" in
HT40+)
if [ $channel -lt 1 -a $channel -gt 9 ]
then
echo "Invalid HTMODE to the configured channel" > /dev/console
return 0
fi
return 83
;;
HT40-)
if [ $channel -lt 5 -a $channel -gt 13 ]
then
echo "Invalid HTMODE to the configured channel" > /dev/console
return 0
fi
return 84
;;
HT40)
if [ $channel -ge 1 -a $channel -le 9 ]
then
return 83
elif [ $channel -ne 14 ]
then
return 84
else
echo "Invalid HTMODE to the configured channel" > /dev/console
return 0
fi
;;
*)
if [ $channel -eq 14 ]
then
return 82
else
return 81
fi
;;
esac
# select the operating class for 5GHz channels
elif [ $channel -ge 36 -a $channel -le 169 ]
then
case "$htmode" in
*HT40+)
if [ $channel -eq 36 -o $channel -eq 44 ]
then
return 116
elif [ $channel -eq 52 -o $channel -eq 60 ]
then
return 119
elif [ $channel -eq 100 -o $channel -eq 108 -o $channel -eq 116 -o $channel -eq 124 -o $channel -eq 132 -o $channel -eq 140 ]
then
return 122
elif [ $channel -eq 149 -o $channel -eq 157 ]
then
return 126
else
echo "Invalid HTMODE to the configured channel" > /dev/console
return 0
fi
;;
*HT40-)
if [ $channel -eq 40 -o $channel -eq 48 ]
then
return 117
elif [ $channel -eq 56 -o $channel -eq 64 ]
then
return 120
elif [ $channel -eq 104 -o $channel -eq 112 -o $channel -eq 120 -o $channel -eq 128 -o $channel -eq 136 -o $channel -eq 144 ]
then
return 123
elif [ $channel -eq 153 -o $channel -eq 161 ]
then
return 127
else
echo "Invalid HTMODE to the configured channel" > /dev/console
return 0
fi
;;
*HT40)
if [ $channel -eq 36 -o $channel -eq 44 ]
then
return 116
elif [ $channel -eq 40 -o $channel -eq 48 ]
then
return 117
elif [ $channel -eq 52 -o $channel -eq 60 ]
then
return 119
elif [ $channel -eq 56 -o $channel -eq 64 ]
then
return 120
elif [ $channel -eq 100 -o $channel -eq 108 -o $channel -eq 116 -o $channel -eq 124 -o $channel -eq 132 -o $channel -eq 140 ]
then
return 122
elif [ $channel -eq 104 -o $channel -eq 112 -o $channel -eq 120 -o $channel -eq 128 -o $channel -eq 136 -o $channel -eq 144 ]
then
return 123
elif [ $channel -eq 149 -o $channel -eq 157 ]
then
return 126
elif [ $channel -eq 153 -o $channel -eq 161 ]
then
return 127
else
echo "Invalid HTMODE to the configured channel" > /dev/console
return 0
fi
;;
*HT80) return 128;;
*HT80_80) return 130;;
*HT160) return 129;;
*)
if [ $channel -eq 36 -o $channel -eq 40 -o $channel -eq 44 -o $channel -eq 48 ]
then
return 115
elif [ $channel -eq 52 -o $channel -eq 56 -o $channel -eq 60 -o $channel -eq 64 ]
then
return 118
elif [ $channel -eq 100 -o $channel -eq 104 -o $channel -eq 108 -o $channel -eq 112 -o $channel -eq 116 -o $channel -eq 120 -o $channel -eq 124 -o $channel -eq 128 -o $channel -eq 132 -o $channel -eq 136 -o $channel -eq 140 -o $channel -eq 144 ]
then
return 121
elif [ $channel -eq 149 -o $channel -eq 153 -o $channel -eq 157 -o $channel -eq 161 ]
then
return 124
elif [ $channel -eq 149 -o $channel -eq 153 -o $channel -eq 157 -o $channel -eq 161 -o $channel -eq 165 -o $channel -eq 169 ]
then
return 125
else
echo "Invalid HTMODE to the configured channel" > /dev/console
return 0
fi
;;
esac
fi
}

View file

@ -0,0 +1,323 @@
#!/bin/sh
#
# Copyright (c) 2019 Qualcomm Technologies, Inc.
#
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
[ -e /lib/functions.sh ] && . /lib/functions.sh
IFNAME=$1
CMD=$2
CONFIG=$3
shift
shift
SSID=$@
PASS=$@
parent=$(cat /sys/class/net/${IFNAME}/parent)
pairwise=
map=
is_section_ifname() {
local config=$1
local ifname
config_get ifname "$config" ifname
[ "${ifname}" = "$2" ] && eval "$3=$config"
}
hex2string()
{
I=0
while [ $I -lt ${#1} ];
do
echo -en "\x"${1:$I:2}
let "I += 2"
done
}
get_map_config() {
local config="$1"
local ifname
config_get ifname "$config" ifname
[ "${ifname}" = "$2" ] && config_get map "$config" map 0
}
is_map_config() {
config_load wireless
config_foreach get_map_config wifi-iface $1
}
get_pairwise() {
if [ -f /sys/class/net/$parent/ciphercaps ]
then
cat /sys/class/net/$parent/ciphercaps | grep -i "gcmp"
if [ $? -eq 0 ]
then
pairwise="CCMP CCMP-256 GCMP GCMP-256"
else
pairwise="CCMP"
fi
fi
}
case "$CMD" in
DPP-CONF-RECEIVED)
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME remove_network all
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME add_network
get_pairwise
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME set_network 0 pairwise $pairwise
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME set_network 0 group "CCMP"
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME set_network 0 proto "RSN"
;;
DPP-CONFOBJ-AKM)
encryption=
sae=
dpp=
sae_require_mfp=
ieee80211w=
key_mgmt=
is_map_config $IFNAME
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME set_network 0 multi_ap_profile $map
if [ $map -gt 0 ]
then
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME set_network 0 multi_ap_backhaul_sta 1
fi
case "$CONFIG" in
dpp+psk+sae)
key_mgmt="DPP SAE WPA-PSK"
encryption="psk2+ccmp"
sae=1
dpp=1
ieee80211w=1
sae_require_mfp=1
;;
dpp+sae)
key_mgmt="DPP SAE"
encryption="ccmp"
sae=1
ieee80211w=2
dpp=1
;;
dpp)
key_mgmt="DPP"
encryption="dpp"
ieee80211w=1
dpp=1
sae=0
;;
sae)
key_mgmt="SAE"
encryption="ccmp"
sae=1
ieee80211w=2
dpp=0
;;
psk+sae)
key_mgmt="SAE WPA-PSK"
encryption="psk2+ccmp"
sae=1
ieee80211w=1
sae_require_mfp=1
dpp=0
;;
psk)
key_mgmt="WPA-PSK"
encryption="psk2"
ieee80211w=1
dpp=0
sae=0
;;
esac
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME set_network 0 ieee80211w $ieee80211w
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME set_network 0 key_mgmt $key_mgmt
ker_ver=`uname -r |cut -d. -f1`
if [ $ker_ver == 5 ]; then
. /sbin/wifi config
else
. /sbin/wifi detect
fi
sect=
config_foreach is_section_ifname wifi-iface $IFNAME sect
uci set wireless.${sect}.encryption=$encryption
uci set wireless.${sect}.sae=$sae
uci set wireless.${sect}.sae_require_mfp=$sae_require_mfp
uci set wireless.${sect}.dpp=$dpp
uci set wireless.${sect}.ieee80211w=$ieee80211w
uci commit wireless
;;
DPP-CONFOBJ-SSID)
network_ids=
i=0
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME list_network | wc -l > /tmp/count_network_list.txt
read network_ids < /tmp/count_network_list.txt
while [ $i -lt $network_ids ]
do
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME set_network $i ssid \""$SSID"\"
i=$(expr $i + 1)
done
ker_ver=`uname -r |cut -d. -f1`
if [ $ker_ver == 5 ]; then
. /sbin/wifi config
else
. /sbin/wifi detect
fi
sect=
config_foreach is_section_ifname wifi-iface $IFNAME sect
uci set wireless.${sect}.ssid="$SSID"
uci commit wireless
;;
DPP-CONNECTOR)
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME set dpp_connector $CONFIG
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME set_network 0 dpp_connector \"${CONFIG}\"
ker_ver=`uname -r |cut -d. -f1`
if [ $ker_ver == 5 ]; then
. /sbin/wifi config
else
. /sbin/wifi detect
fi
sect=
config_foreach is_section_ifname wifi-iface $IFNAME sect
uci set wireless.${sect}.dpp_connector=$CONFIG
uci commit wireless
;;
DPP-1905-CONNECTOR)
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME set dpp_1905_connector $CONFIG
ker_ver=`uname -r |cut -d. -f1`
if [ $ker_ver == 5 ]; then
. /sbin/wifi config
else
. /sbin/wifi detect
fi
sect=
config_foreach is_section_ifname wifi-iface $IFNAME sect
uci set wireless.${sect}.dpp_1905_connector=$CONFIG
uci commit wireless
;;
DPP-CONFOBJ-PASS)
network_ids=
i=0
PASS_STR=$(hex2string $PASS)
get_pairwise
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME list_network | wc -l > /tmp/count_network_list.txt
read network_ids < /tmp/count_network_list.txt
while [ $i -lt $network_ids ]
do
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME set_network $i psk \"${PASS_STR}\"
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME set_network $i pairwise $pairwise
i=$(expr $i + 1)
done
ker_ver=`uname -r |cut -d. -f1`
if [ $ker_ver == 5 ]; then
. /sbin/wifi config
else
. /sbin/wifi detect
fi
sect=
config_foreach is_section_ifname wifi-iface $IFNAME sect
uci set wireless.${sect}.key="$PASS_STR"
uci commit wireless
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME dpp_bootstrap_remove \*
i=0
while [ $i -lt $network_ids ]
do
wpa_cli -i$IFNAME -p /var/run/wpa_supplicant-$IFNAME enable_network $i
wpa_cli -i$IFNAME -p /var/run/wpa_supplicant-$IFNAME save_config
i=$(expr $i + 1)
done
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME disable
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME enable
;;
DPP-CONFOBJ-PSK)
network_ids=
i=0
PASS_STR=$(hex2string "$CONFIG")
get_pairwise
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME list_network | wc -l > /tmp/count_network_list.txt
read network_ids < /tmp/count_network_list.txt
while [ $i -lt $network_ids ]
do
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME set_network $i psk $PASS_STR
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME set_network $i pairwise $pairwise
i=$(expr $i + 1)
done
ker_ver=`uname -r |cut -d. -f1`
if [ $ker_ver == 5 ]; then
. /sbin/wifi config
else
. /sbin/wifi detect
fi
sect=
config_foreach is_section_ifname wifi-iface $IFNAME sect
uci set wireless.${sect}.key=$PASS_STR
uci commit wireless
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME dpp_bootstrap_remove \*
i=0
while [ $i -lt $network_ids ]
do
wpa_cli -i$IFNAME -p /var/run/wpa_supplicant-$IFNAME enable_network $i
wpa_cli -i$IFNAME -p /var/run/wpa_supplicant-$IFNAME save_config
i=$(expr $i + 1)
done
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME disable
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME enable
;;
DPP-C-SIGN-KEY)
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME set dpp_csign $CONFIG
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME set_network 0 dpp_csign $CONFIG
ker_ver=`uname -r |cut -d. -f1`
if [ $ker_ver == 5 ]; then
. /sbin/wifi config
else
. /sbin/wifi detect
fi
sect=
config_foreach is_section_ifname wifi-iface $IFNAME sect
uci set wireless.${sect}.dpp_csign=$CONFIG
uci commit wireless
;;
DPP-NET-ACCESS-KEY)
network_ids=
i=0
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME list_network | wc -l > /tmp/count_network_list.txt
read network_ids < /tmp/count_network_list.txt
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME set dpp_netaccesskey $CONFIG
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME set_network 0 dpp_netaccesskey $CONFIG
ker_ver=`uname -r |cut -d. -f1`
if [ $ker_ver == 5 ]; then
. /sbin/wifi config
else
. /sbin/wifi detect
fi
sect=
config_foreach is_section_ifname wifi-iface $IFNAME sect
uci set wireless.${sect}.dpp_netaccesskey=$CONFIG
uci commit wireless
while [ $i -lt $network_ids ]
do
wpa_cli -i$IFNAME -p /var/run/wpa_supplicant-$IFNAME enable_network $i
wpa_cli -i$IFNAME -p /var/run/wpa_supplicant-$IFNAME save_config
i=$(expr $i + 1)
done
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME disable
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME enable
;;
esac

View file

@ -0,0 +1,30 @@
#!/bin/sh
#
# Copyright (c) 2019 Qualcomm Technologies, Inc.
#
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
hostap_enable() {
hostapd_cli -i $1 -p /var/run/hostapd-$2 enable
}
hostap_disable() {
hostapd_cli -i $1 -p /var/run/hostapd-$2 disable
}
hostap_reconfig() {
wpa_cli -g /var/run/hostapd/global raw REMOVE $1
wpa_cli -g /var/run/hostapd/global raw ADD bss_config=$1:/var/run/hostapd-$1.conf
}
IFNAME=$1
PARENT=$(cat /sys/class/net/${IFNAME}/parent)
case "$2" in
enable) hostap_enable $IFNAME $PARENT;;
disable) hostap_disable $IFNAME $PARENT;;
reconfig) hostap_reconfig $IFNAME;;
*) echo "Invalid arguments. USAGE: hapd <ifname> <enable/disable/reconfig>";;
esac

View file

@ -0,0 +1,99 @@
# Driver interface for atheros driver
CONFIG_DRIVER_ATHEROS=y
CFLAGS += -I$(ATHEROSPATH)
CFLAGS += -DCONFIG_ATHEROS_AP
CFLAGS += -DCONFIG_ATHEROS_QOS_MAP
CFLAGS += -DCONFIG_ATHEROS_OSEN
CONFIG_TLS=openssl
CONFIG_INTERNAL_LIBTOMMATH=y
CONFIG_INTERNAL_LIBTOMMATH_FAST=y
# WPA2/IEEE 802.11i RSN pre-authentication
CONFIG_RSN_PREAUTH=y
# IEEE 802.11w (management frame protection)
# This version is an experimental implementation based on IEEE 802.11w/D1.0
# draft and is subject to change since the standard has not yet been finalized.
# Driver support is also needed for IEEE 802.11w.
CONFIG_IEEE80211W=y
# Integrated EAP server
CONFIG_EAP=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
# Wi-Fi Protected Setup (WPS)
CONFIG_WPS=y
# Enable UPnP support for external WPS Registrars
CONFIG_WPS_UPNP=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., madwifi or FreeBSD/net80211)
#CONFIG_DRIVER_RADIUS_ACL=y
# Add support for writing debug log to a file: -f /tmp/hostapd.log
# Disabled by default.
CONFIG_DEBUG_FILE=y
CONFIG_NO_DUMP_STATE=y
CONFIG_WPS2=y
CONFIG_HS20=y
NEED_AP_MLME=y
CONFIG_P2P_MANAGER=y
CONFIG_INTERWORKING=y
ATH_GCM_SUPPORT=y
CONFIG_WNM=y
CONFIG_DRIVER_NL80211=y
CONFIG_DRIVER_NL80211_QCA=y
CONFIG_IAPP=y
CONFIG_IEEE80211N=y
CONFIG_LIBNL32=y
CONFIG_PEERKEY=y
CONFIG_PKCS12=y
CONFIG_ACS=y
CONFIG_FST=y
CONFIG_MBO=y
ifdef CONFIG_MBO
CONFIG_IEEE80211W=y
endif
CONFIG_IEEE80211AC=1
CONFIG_IEEE80211AX=1
CONFIG_FILS=y
CONFIG_IEEE80211R_AP=y
CONFIG_OWE=y
CONFIG_SAE=y
CONFIG_DPP=y
CONFIG_DPP2=y
CONFIG_SUITEB=y
CONFIG_SUITEB192=y
CONFIG_ERP=y
CONFIG_TESTING_OPTIONS=y
CONFIG_OCV=y
CONFIG_SAE_PK=y
CONFIG_WEP=y

View file

@ -0,0 +1,88 @@
# Driver interface for atheros driver
CONFIG_DRIVER_ATHEROS=y
CFLAGS += -I$(ATHEROSPATH)
CFLAGS += -DCONFIG_ATHEROS_AP
CFLAGS += -DCONFIG_ATHEROS_QOS_MAP
CFLAGS += -DCONFIG_ATHEROS_OSEN
CONFIG_TLS=internal
CONFIG_INTERNAL_LIBTOMMATH=y
CONFIG_INTERNAL_LIBTOMMATH_FAST=y
# WPA2/IEEE 802.11i RSN pre-authentication
CONFIG_RSN_PREAUTH=y
# IEEE 802.11w (management frame protection)
# This version is an experimental implementation based on IEEE 802.11w/D1.0
# draft and is subject to change since the standard has not yet been finalized.
# Driver support is also needed for IEEE 802.11w.
CONFIG_IEEE80211W=y
# QCA vendor extensions to nl80211
CONFIG_DRIVER_NL80211_QCA=y
# Integrated EAP server
CONFIG_EAP=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
# Wi-Fi Protected Setup (WPS)
CONFIG_WPS=y
# Enable UPnP support for external WPS Registrars
CONFIG_WPS_UPNP=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., madwifi or FreeBSD/net80211)
#CONFIG_DRIVER_RADIUS_ACL=y
# Add support for writing debug log to a file: -f /tmp/hostapd.log
# Disabled by default.
CONFIG_DEBUG_FILE=y
CONFIG_NO_VLAN=y
CONFIG_NO_DUMP_STATE=y
CONFIG_WPS2=y
CONFIG_HS20=y
NEED_AP_MLME=y
CONFIG_P2P_MANAGER=y
CONFIG_INTERWORKING=y
ATH_GCM_SUPPORT=y
CONFIG_WNM=y
CONFIG_DRIVER_NL80211=y
CONFIG_DRIVER_NL80211_QCA=y
CONFIG_IAPP=y
CONFIG_IEEE80211N=y
CONFIG_LIBNL32=y
CONFIG_PEERKEY=y
CONFIG_PKCS12=y
CONFIG_ACS=y
CONFIG_FST=y
CONFIG_MBO=y
CONFIG_FILS=y
CONFIG_ERP=y
CONFIG_IEEE80211R_AP=y

View file

@ -0,0 +1,101 @@
# Driver interface for atheros driver
CONFIG_DRIVER_ATHEROS=y
CFLAGS += -I$(ATHEROSPATH)
CFLAGS += -DCONFIG_ATHEROS_AP
CFLAGS += -DCONFIG_ATHEROS_QOS_MAP
CFLAGS += -DCONFIG_ATHEROS_OSEN
CONFIG_TLS=openssl
CONFIG_INTERNAL_LIBTOMMATH=y
CONFIG_INTERNAL_LIBTOMMATH_FAST=y
# WPA2/IEEE 802.11i RSN pre-authentication
CONFIG_RSN_PREAUTH=y
# IEEE 802.11w (management frame protection)
# This version is an experimental implementation based on IEEE 802.11w/D1.0
# draft and is subject to change since the standard has not yet been finalized.
# Driver support is also needed for IEEE 802.11w.
CONFIG_IEEE80211W=y
# Integrated EAP server
CONFIG_EAP=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
# Wi-Fi Protected Setup (WPS)
CONFIG_WPS=y
# Enable UPnP support for external WPS Registrars
CONFIG_WPS_UPNP=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., madwifi or FreeBSD/net80211)
#CONFIG_DRIVER_RADIUS_ACL=y
# Add support for writing debug log to a file: -f /tmp/hostapd.log
# Disabled by default.
CONFIG_DEBUG_FILE=y
CONFIG_NO_VLAN=y
CONFIG_NO_DUMP_STATE=y
CONFIG_WPS2=y
CONFIG_HS20=y
NEED_AP_MLME=y
CONFIG_P2P_MANAGER=y
CONFIG_INTERWORKING=y
ATH_GCM_SUPPORT=y
CONFIG_WNM=y
# Driver interface for MACsec (Only for wired network)
CONFIG_DRIVER_MACSEC_QCA=y
# Enable MACsec support for hostapd
CONFIG_MACSEC=y
CONFIG_DRIVER_NL80211=y
CONFIG_DRIVER_NL80211_QCA=y
CONFIG_IAPP=y
CONFIG_IEEE80211N=y
CONFIG_LIBNL32=y
CONFIG_PEERKEY=y
CONFIG_PKCS12=y
CONFIG_ACS=y
CONFIG_FST=y
CONFIG_MBO=y
ifdef CONFIG_MBO
CONFIG_IEEE80211W=y
endif
CONFIG_IEEE80211AC=1
CONFIG_FILS=y
CONFIG_IEEE80211R_AP=y
CONFIG_OWE=y
CONFIG_SAE=y
CONFIG_DPP=y
CONFIG_SUITEB=y
CONFIG_SUITEB192=y
CONFIG_ERP=y
CONFIG_TESTING_OPTIONS=y

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,2 @@
config macsec global
option enable '0'

View file

@ -0,0 +1,76 @@
#!/bin/sh /etc/rc.common
#
# Copyright (c) 2017 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
#
# Copyright (c) 2014, The Linux Foundation. All rights reserved.
#
START=
SERVICE_DAEMONIZE=1
SERVICE_WRITE_PID=1
start () {
config_load macsec
local enable
config_get_bool enable global enable 0
[ "${enable}" -gt 0 ] || return
config_get ifname global ifname
config_get eapol_version global eapol_version 3
eapol_version="eapol_version=$eapol_version"
config_get ap_scan global ap_scan 0
ap_scan="ap_scan=$ap_scan"
config_get key_mgmt global key_mgmt
key_mgmt="key_mgmt=$key_mgmt"
config_get eap global eap
eap="eap=$eap"
config_get identity global identity
identity="identity=\"$identity\""
config_get password global password
password="password=\"$password\""
config_get eapol_flags global eapol_flags 0
eapol_flags="eapol_flags=$eapol_flags"
config_get macsec_policy global macsec_policy 1
macsec_policy="macsec_policy=$macsec_policy"
rm -rf /var/run/wpa_supplicant-macsec-$ifname*
SERVICE_PID_FILE=/var/run/wpa_supplicant-macsec-$ifname.pid
cat > /var/run/wpa_supplicant-macsec-$ifname.conf <<EOF
ctrl_interface=/var/run/wpa_supplicant-macsec-$ifname
$eapol_version
$ap_scan
network={
$key_mgmt
$eap
$identity
$password
$eapol_flags
$macsec_policy
}
EOF
service_start /usr/sbin/wpa_supplicant-macsec -D macsec_qca -i "$ifname" -c /var/run/wpa_supplicant-macsec-$ifname.conf
}
stop() {
config_load macsec
config_get ifname global ifname
SERVICE_PID_FILE=/var/run/wpa_supplicant-macsec-$ifname.pid
service_stop /usr/sbin/wpa_supplicant-macsec
}

View file

@ -0,0 +1,21 @@
#!/bin/sh /etc/rc.common
#
# Copyright (c) 2017 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
#
# Copyright (c) 2016, The Linux Foundation. All rights reserved.
#
START=15
boot() {
if [ -e "/var/run/hostapd-global.pid" ]
then
kill $(cat /var/run/hostapd-global.pid) &> /dev/null
rm /var/run/hostapd-global.pid &> /dev/null
fi
hostapd -g /var/run/hostapd/global -B -P /var/run/hostapd-global.pid
}

View file

@ -0,0 +1,22 @@
#!/bin/sh /etc/rc.common
#
# Copyright (c) 2017 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
#
# Copyright (c) 2016, The Linux Foundation. All rights reserved.
#
START=15
boot() {
if [ -e "/var/run/wpa_supplicant-global.pid" ]
then
kill $(cat /var/run/wpa_supplicant-global.pid) &> /dev/null
rm /var/run/wpa_supplicant-global.pid &> /dev/null
fi
wpa_supplicant -g /var/run/wpa_supplicantglobal -B -P /var/run/wpa_supplicant-global.pid
}

View file

@ -0,0 +1,106 @@
#Driver interface for athr driver
CONFIG_DRIVER_ATHR=y
CFLAGS += -I$(ATHEROSPATH)
CFLAGS += -I$(ATHEROSPATH)/os/linux/include
# 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: Default OpenSSL package does not include support for all the
# functionality needed for EAP-FAST. If EAP-FAST is enabled with OpenSSL,
# the OpenSSL library must be patched (openssl-0.9.8d-tls-extensions.patch)
# to add the needed functions.
#CONFIG_EAP_FAST=y
# EAP-GTC
CONFIG_EAP_GTC=y
# EAP-OTP
CONFIG_EAP_OTP=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)
# named_pipe = Windows Named Pipe (default for Windows)
# y = use default (backwards compatibility)
# If this option is commented out, control interface is not included in the
# build.
CONFIG_CTRL_IFACE=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
# Select TLS implementation
# openssl = OpenSSL (default)
# gnutls = GnuTLS (needed for TLS/IA, see also CONFIG_GNUTLS_EXTRA)
# internal = Internal TLSv1 implementation (experimental)
# none = Empty template
CONFIG_TLS=openssl
# 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
CONFIG_INTERNAL_LIBTOMMATH_FAST=y
# Wi-Fi Protected Setup (WPS)
CONFIG_WPS=y
CONFIG_WPS2=y
CONFIG_HS20=y
# P2P
CONFIG_P2P=y
CONFIG_AP=y
ATH_GCM_SUPPORT=y
CONFIG_IEEE80211W=y
CONFIG_DRIVER_NL80211=y
CONFIG_DRIVER_NL80211_QCA=y
CONFIG_TLS=openssl
CONFIG_PEERKEY=y
CONFIG_PKCS12=y
CONFIG_LIBNL32=y
CONFIG_EAP_LEAP=y
# Remove support for Linux l2_packet socket workaround for performance
#CONFIG_NO_LINUX_SOCK_WAR=y
CONFIG_FILS=y
CONFIG_IEEE80211R=y
CONFIG_OWE=y
CONFIG_SAE=y
CONFIG_DPP=y
CONFIG_SUITEB=y
CONFIG_SUITEB192=y
CONFIG_WNM=y
CONFIG_PMKSA_CACHE_EXTERNAL=y
# Add support for writing debug log to a file (/tmp/wpa_supplicant-log-#.txt)
CONFIG_DEBUG_FILE=y
#Enabled this flag to improve throughput
CONFIG_NO_LINUX_PACKET_SOCKET_WAR=y
CONFIG_DPP2=y

View file

@ -0,0 +1,91 @@
#Driver interface for athr driver
CONFIG_DRIVER_ATHR=y
CFLAGS += -I$(ATHEROSPATH)
CFLAGS += -I$(ATHEROSPATH)/os/linux/include
# 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: Default OpenSSL package does not include support for all the
# functionality needed for EAP-FAST. If EAP-FAST is enabled with OpenSSL,
# the OpenSSL library must be patched (openssl-0.9.8d-tls-extensions.patch)
# to add the needed functions.
#CONFIG_EAP_FAST=y
# EAP-GTC
CONFIG_EAP_GTC=y
# EAP-OTP
CONFIG_EAP_OTP=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)
# named_pipe = Windows Named Pipe (default for Windows)
# y = use default (backwards compatibility)
# If this option is commented out, control interface is not included in the
# build.
CONFIG_CTRL_IFACE=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
# Select TLS implementation
# openssl = OpenSSL (default)
# gnutls = GnuTLS (needed for TLS/IA, see also CONFIG_GNUTLS_EXTRA)
# internal = Internal TLSv1 implementation (experimental)
# none = Empty template
CONFIG_TLS=internal
# 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
CONFIG_INTERNAL_LIBTOMMATH_FAST=y
# Wi-Fi Protected Setup (WPS)
CONFIG_WPS=y
CONFIG_WPS2=y
CONFIG_HS20=y
# P2P
CONFIG_P2P=y
CONFIG_AP=y
ATH_GCM_SUPPORT=y
CONFIG_IEEE80211W=y
CONFIG_DRIVER_NL80211=y
CONFIG_TLS=openssl
CONFIG_PEERKEY=y
CONFIG_PKCS12=y
CONFIG_LIBNL32=y
CONFIG_EAP_LEAP=y
CONFIG_FILS=y
CONFIG_IEEE80211R=y
# Enabled CONFIG_NO_LINUX_PACKET_SOCKET_WAR flag to improve throghput
CONFIG_NO_LINUX_PACKET_SOCKET_WAR=y

View file

@ -0,0 +1,102 @@
#Driver interface for athr driver
#CONFIG_DRIVER_ATHR=y
CFLAGS += -I$(ATHEROSPATH)
CFLAGS += -I$(ATHEROSPATH)/os/linux/include
# 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: Default OpenSSL package does not include support for all the
# functionality needed for EAP-FAST. If EAP-FAST is enabled with OpenSSL,
# the OpenSSL library must be patched (openssl-0.9.8d-tls-extensions.patch)
# to add the needed functions.
#CONFIG_EAP_FAST=y
# EAP-GTC
CONFIG_EAP_GTC=y
# EAP-OTP
CONFIG_EAP_OTP=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)
# named_pipe = Windows Named Pipe (default for Windows)
# y = use default (backwards compatibility)
# If this option is commented out, control interface is not included in the
# build.
CONFIG_CTRL_IFACE=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
# Select TLS implementation
# openssl = OpenSSL (default)
# gnutls = GnuTLS (needed for TLS/IA, see also CONFIG_GNUTLS_EXTRA)
# internal = Internal TLSv1 implementation (experimental)
# none = Empty template
CONFIG_TLS=internal
# 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
CONFIG_INTERNAL_LIBTOMMATH_FAST=y
# Wi-Fi Protected Setup (WPS)
CONFIG_WPS=y
CONFIG_WPS2=y
CONFIG_HS20=y
# P2P
CONFIG_P2P=y
CONFIG_AP=y
ATH_GCM_SUPPORT=y
CONFIG_IEEE80211W=y
# Driver interface for Posedge MACsec (Only for wired network)
CONFIG_DRIVER_MACSEC_QCA=y
# Enable MACsec support for wpa_supplicant
CONFIG_MACSEC=y
CONFIG_DRIVER_NL80211=y
CONFIG_TLS=openssl
CONFIG_PEERKEY=y
CONFIG_PKCS12=y
CONFIG_LIBNL32=y
CONFIG_EAP_LEAP=y
# Enabled CONFIG_NO_LINUX_PACKET_SOCKET_WAR flag to improve throghput
CONFIG_NO_LINUX_PACKET_SOCKET_WAR=y
CONFIG_IEEE80211R=y
CONFIG_FILS=y
CONFIG_OWE=y
CONFIG_SAE=y
CONFIG_DPP=y
CONFIG_SUITEB=y
CONFIG_SUITEB192=y

View file

@ -0,0 +1,630 @@
#
# Copyright (c) 2017 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
#
# Copyright (c) 2014, The Linux Foundation. All rights reserved.
#
wpa_supplicant_setup_vif() {
local vif="$1"
local driver="$2"
local key="$key"
local options="$3"
local freq="" crypto=""
local sae owe suite_b dpp sae_groups owe_group sae_password sae_password_id
local sae_str owe_str dpp_str dpp_connector dpp_csign dpp_netaccesskey dpp_map dpp_pfs dpp_1905_connector
local ieee80211r_str
local device beacon_prot
local pwe=""
[ -n "$4" ] && freq="frequency=$4"
config_get_bool sae "$vif" sae 0
config_get_bool owe "$vif" owe 0
config_get sae_password "$vif" sae_password
config_get sae_password_id "vif" sae_password_id
config_get ieee80211w "$vif" ieee80211w 0
config_get suite_b "$vif" suite_b 0
config_get ieee80211r "$vif" ieee80211r 0
config_get dpp "$vif" dpp 0
config_get device "$vif" device
config_get sae_pwe "$vif" sae_pwe 2
if [ $suite_b -eq 192 ]
then
key_mgmt=WPA-EAP-SUITE-B-192
pairwise="pairwise=GCMP-256"
group="group=GCMP-256"
group_mgmt="group_mgmt=BIP-GMAC-256"
ieee80211w="ieee80211w=2"
proto="proto=RSN"
config_get eap_type "$vif" eap_type
[ -n "$eap_type" ] && eap_type="eap=$eap_type"
config_get identity "$vif" identity
[ -n "$identity" ] && identity="identity=\"$identity\""
config_get ca_cert "$vif" ca_cert
[ -n "$ca_cert" ] && ca_cert="ca_cert=\"$ca_cert\""
config_get client_cert "$vif" client_cert
[ -n "$client_cert" ] && client_cert="client_cert=\"$client_cert\""
config_get priv_key "$vif" priv_key
[ -n "$priv_key" ] && priv_key="private_key=\"$priv_key\""
config_get priv_key_pwd "$vif" priv_key_pwd
[ -n "$priv_key_pwd" ] && priv_key_pwd="private_key_passwd=\"$priv_key_pwd\""
config_get phase1 "$vif" phase1
[ -n "$phase1" ] && phase1="phase1=\"$phase1\""
else
# make sure we have the encryption type and the psk
[ -n "$enc" ] || {
config_get enc "$vif" encryption
}
enc_list=`echo "$enc" | sed "s/+/ /g"`
for enc_var in $enc_list; do
case "$enc_var" in
*tkip)
crypto="TKIP $crypto"
;;
*aes)
crypto="CCMP $crypto"
;;
*ccmp)
crypto="CCMP $crypto"
;;
*ccmp-256)
crypto="CCMP-256 $crypto"
;;
*gcmp)
crypto="GCMP $crypto"
;;
*gcmp-256)
crypto="GCMP-256 $crypto"
;;
esac
done
case "$enc_list" in
dpp|sae*|psk2)
if [ -f /sys/class/net/$device/ciphercaps ]
then
cat /sys/class/net/$device/ciphercaps | grep -i "gcmp"
if [ $? -eq 0 ]
then
crypto="CCMP CCMP-256 GCMP GCMP-256"
else
crypto="CCMP"
fi
fi
;;
esac
[ -n "$key" ] || {
config_get key "$vif" key
}
local net_cfg bridge
config_get bridge "$vif" bridge
[ -z "$bridge" ] && {
net_cfg="$(find_net_config "$vif")"
[ -z "$net_cfg" ] || bridge="$(bridge_interface "$net_cfg")"
config_set "$vif" bridge "$bridge"
}
local mode ifname wds modestr=""
config_get mode "$vif" mode
config_get ifname "$vif" ifname
config_get_bool wds "$vif" wds 0
config_get_bool extap "$vif" extap 0
config_get device "$vif" device
config_get_bool qwrap_enable "$device" qwrap_enable 0
[ -z "$bridge" ] || [ "$mode" = ap ] || [ "$mode" = sta -a $wds -eq 1 ] || \
[ "$mode" = sta -a $extap -eq 1 ] || [ $qwrap_enable -ne 0 ] || {
echo "wpa_supplicant_setup_vif($ifname): Refusing to bridge $mode mode interface"
return 1
}
[ "$mode" = "adhoc" ] && modestr="mode=1"
key_mgmt='NONE'
case "$enc" in
*none*) ;;
*wep*)
config_get key "$vif" key
key="${key:-1}"
case "$key" in
[1234])
for idx in 1 2 3 4; do
local zidx
zidx=$(($idx - 1))
config_get ckey "$vif" "key${idx}"
[ -n "$ckey" ] && \
append "wep_key${zidx}" "wep_key${zidx}=$(prepare_key_wep "$ckey")"
done
wep_tx_keyidx="wep_tx_keyidx=$((key - 1))"
;;
*)
wep_key0="wep_key0=$(prepare_key_wep "$key")"
wep_tx_keyidx="wep_tx_keyidx=0"
;;
esac
case "$enc" in
*mixed*)
wep_auth_alg='auth_alg=OPEN SHARED'
;;
*shared*)
wep_auth_alg='auth_alg=SHARED'
;;
*open*)
wep_auth_alg='auth_alg=OPEN'
;;
esac
;;
*psk*)
key_mgmt='WPA-PSK'
# if you want to use PSK with a non-nl80211 driver you
# have to use WPA-NONE and wext driver for wpa_s
[ "$mode" = "adhoc" -a "$driver" != "nl80211" ] && {
key_mgmt='WPA-NONE'
driver='wext'
}
if [ "${ieee80211r}" -eq 1 ]
then
ieee80211r_str=FT-PSK
fi
if [ ${sae} -eq 1 ]
then
if [ ${sae_password} ]
then
sae_pwd="sae_password=\"${sae_password}\""
else
sae_pwd="sae_password=\"${key}\""
fi
fi
if [ ${#key} -eq 64 ]; then
passphrase="psk=${key}"
else
passphrase="psk=\"${key}\""
fi
[ -n "$crypto" ] || crypto="CCMP"
pairwise="pairwise=$crypto"
case "$enc" in
*mixed*)
proto='proto=RSN WPA'
;;
*psk2*)
proto='proto=RSN'
config_get ieee80211w "$vif" ieee80211w 0
;;
*psk*)
proto='proto=WPA'
;;
esac
;;
*wpa*|*8021x*)
proto='proto=WPA2'
key_mgmt='WPA-EAP'
config_get ieee80211w "$vif" ieee80211w 0
config_get ca_cert "$vif" ca_cert
config_get eap_type "$vif" eap_type
ca_cert=${ca_cert:+"ca_cert=\"$ca_cert\""}
[ -n "$crypto" ] || crypto="CCMP"
pairwise="pairwise=$crypto"
case "$eap_type" in
tls)
config_get identity "$vif" identity
config_get client_cert "$vif" client_cert
config_get priv_key "$vif" priv_key
config_get priv_key_pwd "$vif" priv_key_pwd
identity="identity=\"$identity\""
client_cert="client_cert=\"$client_cert\""
priv_key="private_key=\"$priv_key\""
priv_key_pwd="private_key_passwd=\"$priv_key_pwd\""
;;
peap|ttls)
config_get auth "$vif" auth
config_get identity "$vif" identity
config_get password "$vif" password
phase2="phase2=\"auth=${auth:-MSCHAPV2}\""
identity="identity=\"$identity\""
password="password=\"$password\""
;;
esac
eap_type="eap=$(echo $eap_type | tr 'a-z' 'A-Z')"
;;
ccmp*|gcmp*|sae*)
proto='proto=RSN'
if [ ${sae} -eq 1 ]
then
if [ ${sae_password} ]
then
sae_pwd="sae_password=\"${sae_password}\""
else
sae_pwd="sae_password=\"${key}\""
fi
fi
case $enc in
ccmp-256)
[ -n "$crypto" ] || crypto="CCMP-256"
pairwise="pairwise=$crypto"
;;
gcmp-256)
[ -n "$crypto" ] || crypto="GCMP-256"
pairwise="pairwise=$crypto"
;;
ccmp*)
[ -n "$crypto" ] || crypto="CCMP"
pairwise="pairwise=$crypto"
;;
gcmp*)
[ -n "$crypto" ] || crypto="GCMP"
pairwise="pairwise=$crypto"
;;
sae*)
pairwise="pairwise=$crypto"
;;
esac
;;
esac
keymgmt='NONE'
# Allow SHA256
case "$enc" in
*wpa*|*8021x*) keymgmt=WPA-EAP;;
ccmp*|gcmp*|sae*) keymgmt=;;
*psk*) keymgmt=WPA-PSK;;
esac
if [ "${sae}" -eq 1 -a "${ieee80211r}" -gt 0 ]
then
ieee80211w=2
sae_str=FT-SAE
elif [ "${sae}" -eq 1 ]
then
if [ "${keymgmt}" == "WPA-PSK" ];then
ieee80211w=1
else
ieee80211w=2
fi
sae_str=SAE
fi
if [ "${owe}" -eq 1 ]
then
proto='proto=RSN'
ieee80211w=2
owe_only='owe_only=1'
owe_str=OWE
passphrase=
config_get owe_group "$vif" owe_group
if [ "$owe_group" ];then
owe_group="owe_group=$owe_group"
else
owe_group=
fi
fi
if [ "${dpp}" -eq 1 ]
then
dpp_str=DPP
proto="proto=RSN"
config_get dpp_connector "$vif" dpp_connector
config_get dpp_1905_connector "$vif" dpp_1905_connector
config_get dpp_csign "$vif" dpp_csign
config_get dpp_netaccesskey "$vif" dpp_netaccesskey
[ -n "$dpp_connector" ] && dpp_connector="dpp_connector=\"${dpp_connector}\""
[ -n "$dpp_1905_connector" ] && dpp_1905_connector="dpp_1905_connector=${dpp_1905_connector}"
[ -n "$dpp_csign" ] && dpp_csign="dpp_csign=$dpp_csign"
[ -n "$dpp_netaccesskey" ] && dpp_netaccesskey="dpp_netaccesskey=$dpp_netaccesskey"
update_config="update_config=1"
fi
case "$ieee80211w" in
0)
key_mgmt="${keymgmt}"
;;
1)
if [ "$key_mgmt" != "NONE" ]
then
key_mgmt="${keymgmt} ${keymgmt}-SHA256"
fi
;;
2)
if [ "$owe" -eq 1 ] || [ "$sae" -eq 1 ] || [ "$dpp" -eq 1 ]
then
key_mgmt="${keymgmt}"
else
key_mgmt="${keymgmt}-SHA256"
fi
;;
esac
if [ "${sae}" -eq 1 ]
then
add_sae_groups() {
sae_groups=$(echo $1 | tr "," " ")
}
config_list_foreach "$vif" sae_groups add_sae_groups
if [ "$sae_groups" ];then
sae_groups="sae_groups=$sae_groups"
else
sae_groups=
fi
key_mgmt="${sae_str} ${key_mgmt}"
pwe="sae_pwe=$sae_pwe"
[ -n "${sae_password_id}" ] && sae_password_id="sae_password_id=$sae_password_id"
fi
if [ "${owe}" -eq 1 ]
then
key_mgmt="${key_mgmt} ${owe_str}"
fi
if [ "${ieee80211r}" -eq 1 ]
then
key_mgmt="${key_mgmt} ${ieee80211r_str}"
fi
[ "$ieee80211w" -gt "0" ] && {
config_get beacon_prot "$vif" beacon_prot 0
[ -n "$beacon_prot" ] && beacon_prot="beacon_prot=$beacon_prot"
}
[ -n "$ieee80211w" ] && ieee80211w="ieee80211w=$ieee80211w"
if [ $sae -ne 1 ] && [ $owe -ne 1 ] && [ $dpp -ne 1 ]
then
case "$pairwise" in
*CCMP-256*) group="group=CCMP-256 GCMP-256 GCMP CCMP TKIP";;
*GCMP-256*) group="group=GCMP-256 GCMP CCMP TKIP";;
*GCMP*) group="group=GCMP CCMP TKIP";;
*CCMP*) group="group=CCMP TKIP";;
*TKIP*) group="group=TKIP";;
esac
else
case "$pairwise" in
*CCMP-256*) group="group=CCMP-256 GCMP-256 GCMP CCMP";;
*GCMP-256*) group="group=GCMP-256 GCMP CCMP";;
*GCMP*) group="group=GCMP CCMP";;
*CCMP*) group="group=CCMP";;
esac
fi
if [ "${dpp}" -eq 1 ]
then
if [ "$key_mgmt" != "NONE" ]
then
key_mgmt="${dpp_str} ${key_mgmt}"
else
key_mgmt="${dpp_str}"
fi
[ -n "$crypto" ] || crypto="CCMP"
pairwise="pairwise=$crypto"
ieee80211w="ieee80211w=1"
fi
#End of suite_b is 192 check
fi
config_get MapBSSType "$vif" MapBSSType 0
config_get map "$vif" map 0
if [ "$map" -eq 3 ]; then
config_get dpp_map "$vif" dpp_map
[ -n "$dpp_map" ] && dpp_map="dpp_map=$dpp_map"
fi
config_get dpp_pfs "$vif" dpp_pfs
[ -n "$dpp_pfs" ] && dpp_pfs="dpp_pfs=$dpp_pfs"
# MapBSSType 128, vap is backhaul STA
if [ $MapBSSType -eq 128 ]; then
multi_ap_backhaul_sta=1
if [ "$map" -ge 2 ]; then
wps_cred_add_sae=1
config_get vlan_bridge "$vif" vlan_bridge
if [ -n "$vlan_bridge" ]; then
config_set "$vif" bridge "$vlan_bridge"
fi
fi
fi
wps_cred_add_sae=1
config_get ifname "$vif" ifname
config_get bridge "$vif" bridge
config_get ssid "$vif" ssid
config_get bssid "$vif" bssid
bssid=${bssid:+"bssid=$bssid"}
config_get pmf "$vif" ieee80211w 0
config_get_bool wps_pbc "$vif" wps_pbc 0
config_get config_methods "$vif" wps_config
[ "$wps_pbc" -gt 0 ] && append config_methods "push_button display"
[ -n "$config_methods" ] && {
wps_cred="wps_cred_processing=2"
wps_config_methods="config_methods=$config_methods"
update_config="update_config=1"
# fix the overlap session of WPS PBC for two STA vifs
macaddr=$(cat /sys/class/net/${bridge}/address)
uuid=$(echo "$macaddr" | sed 's/://g')
[ -n "$uuid" ] && {
uuid_config="uuid=87654321-9abc-def0-1234-$uuid"
}
}
local ctrl_interface wait_for_wrap=""
if [ $qwrap_enable -ne 0 ]; then
ctrl_interface="/var/run/wpa_supplicant"
if [ -f "/tmp/qwrap_conf_filename-$ifname.conf" ]; then
rm -rf /tmp/qwrap_conf_filename-$ifname.conf
fi
echo -e "/var/run/wpa_supplicant-$ifname.conf \c\h" > /tmp/qwrap_conf_filename-$ifname.conf
wait_for_wrap="-W"
fi
ctrl_interface="/var/run/wpa_supplicant-$ifname"
rm -rf $ctrl_interface
rm -f /var/run/wpa_supplicant-$ifname.conf
cat > /var/run/wpa_supplicant-$ifname.conf <<EOF
ctrl_interface=$ctrl_interface
$wps_config_methods
pmf=$pmf
$wps_cred
$update_config
$uuid_config
$sae_groups
$pwe
wps_cred_add_sae=$wps_cred_add_sae
$dpp_map
$dpp_1905_connector
network={
$modestr
scan_ssid=1
ssid="$ssid"
$bssid
key_mgmt=$key_mgmt
$proto
$freq
$ieee80211w
$beacon_prot
$passphrase
$sae_pwd
$sae_password_id
$pairwise
$group
$eap_type
$ca_cert
$client_cert
$priv_key
$priv_key_pwd
$phase2
$identity
$password
$wep_key0
$wep_key1
$wep_key2
$wep_key3
$wep_tx_keyidx
$wep_auth_alg
$owe_only
$group_mgmt
$phase1
$owe_group
$dpp_connector
$dpp_csign
$dpp_netaccesskey
multi_ap_backhaul_sta=$multi_ap_backhaul_sta
multi_ap_profile=$map
$dpp_pfs
}
EOF
[ -z "$proto" -a "$key_mgmt" != "NONE" ] || {\
# If there is a change in path of wpa_supplicant-$ifname.lock file, please make the path
# change also in wrapd_api.c file.
[ -f "/var/run/wpa_supplicant-$ifname.lock" ] &&
rm /var/run/wpa_supplicant-$ifname.lock
wpa_cli -g /var/run/wpa_supplicantglobal interface_add $ifname /var/run/wpa_supplicant-$ifname.conf $driver /var/run/wpa_supplicant-$ifname "" $bridge
touch /var/run/wpa_supplicant-$ifname.lock
}
if [ "${dpp}" -eq 1 ]
then
type=
config_get dpp_type "$vif" dpp_type "qrcode"
config_get dpp_curve "$vif" dpp_curve
config_get dpp_key "$vif" dpp_key
config_get channel "$device" channel auto
config_get htmode "$device" htmode auto
config_get hwmode "$device" hwmode auto
config_get pkex_code "$vif" pkex_code
config_get pkex_identifier "$vif" pkex_identifier
type=$dpp_type
dpp_type="type=$dpp_type"
if [ -z $dpp_curve ]; then
dpp_curve=
else
dpp_curve="curve=$dpp_curve"
fi
if [ -z $dpp_key ]; then
dpp_key=
else
dpp_key="key=$dpp_key"
fi
if [ "$pkex_identifier" ]; then
pkex_identifier="pkex_identifier=$pkex_identifier"
fi
if [ "$pkex_code" ]; then
pkex_code="pkex_code=$pkex_code"
fi
if [ "${htmode}" == "auto" ]
then
case "$hwmode:$htmode" in
*ng:*) htmode=HT20;;
*na:*) htmode=HT40;;
*ac:*) htmode=HT80;;
*axg:*) htmode=HT20;;
*axa:*) htmode=HT80;;
*:*) htmode=HT20;
esac
fi
if [ "$channel" == "auto" ]; then
channel=
else
dpp_operating_class_setup "$htmode" "$channel"
dpp_operating_class=$?
echo "dpp_operating_class=$dpp_operating_class" > /dev/console
channel="chan=$dpp_operating_class/$channel"
fi
run_wpa_cli() {
ifname=$1
ctrl_path=$2
arguments=$3
wpa_cli -i $ifname -p $ctrl_path $arguments
}
run_wpa_cli $ifname "/var/run/wpa_supplicant-$ifname" "-a /lib/wifi/dpp-supplicant-update-uci -B"
wpa_cli -i $ifname -p /var/run/wpa_supplicant-$ifname dpp_bootstrap_remove \*
wpa_cli -i $ifname -p /var/run/wpa_supplicant-$ifname dpp_pkex_remove \*
wpa_cli -i $ifname -p /var/run/wpa_supplicant-$ifname dpp_configurator_remove \*
if [ "$map" -eq 3 ]; then
run_wpa_cli $ifname "/var/run/wpa_supplicant-$ifname" "DPP_BOOTSTRAP_GEN $dpp_type $dpp_curve $dpp_key"
else
run_wpa_cli $ifname "/var/run/wpa_supplicant-$ifname" "DPP_BOOTSTRAP_GEN $dpp_type $dpp_curve $channel mac=$(cat /sys/class/net/$ifname/address | sed 's/://g') $dpp_key"
fi
if [ -z "$map" ] || [ "$map" -eq 0 ]; then
if [ "${type}" == "qrcode" ]
then
run_wpa_cli $ifname "/var/run/wpa_supplicant-$ifname" "dpp_auth_init peer=1 role=enrollee"
else
run_wpa_cli $ifname "/var/run/wpa_supplicant-$ifname" "dpp_pkex_add own=1 $pkex_identifier role=enrollee $pkex_code"
fi
fi
fi
}

View file

@ -0,0 +1,36 @@
#
# Copyright (c) 2017 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
#
# Copyright (c) 2015, The Linux Foundation. All rights reserved.
#
if [ "$ACTION" = "pressed" -a "$BUTTON" = "wps" ]; then
if [ -r /var/run/son.conf ] ||
[ -r /var/run/son_active ]; then
exit 0
fi
[ -r /var/run/wifi-wps-enhc-extn.conf ] || exit 0
echo "" > /dev/console
echo "WPS PUSH BUTTON EVENT DETECTED" > /dev/console
num=`grep -w "RADIO" /var/run/wifi-wps-enhc-extn.conf | wc -l`
if [ -r /var/run/wifi-wps-enhc-extn.pid ]; then
kill "$(cat "/var/run/wifi-wps-enhc-extn.pid")"
sleep 1
fi
if [ -r /var/run/wifi-wps-enhc-extn.pid ]; then
rm -f /var/run/wifi-wps-enhc-extn.pid
exit 0
fi
echo "START APP TO HANDLE WPS PUSH BUTTON EVENT" > /dev/console
/usr/sbin/wps_enhc -b /var/run/wifi-wps-enhc-extn.pid -n $num \
-d 128 -l /var/run/wifi-wps-enhc-extn.log
fi

View file

@ -0,0 +1,29 @@
#!/bin/sh
#
# Copyright (c) 2017 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
IFNAME=$1
CMD=$2
local parent=$(cat /sys/class/net/${IFNAME}/parent)
case "$CMD" in
WPS-TIMEOUT)
kill "$(cat "/var/run/hostapd-cli-$IFNAME.pid")"
env -i ACTION="wps-timeout" INTERFACE=$IFNAME /sbin/hotplug-call iface
;;
WPS-SUCCESS)
if [ -r /var/run/iface_mgr.pid ]; then
echo $IFNAME > /var/run/son_nbh.done
kill -SIGUSR1 "$(cat "/var/run/iface_mgr.pid")"
fi
kill "$(cat "/var/run/hostapd-cli-$IFNAME.pid")"
env -i ACTION="wps-success" INTERFACE=$IFNAME /sbin/hotplug-call iface
;;
DISCONNECTED)
kill "$(cat "/var/run/hostapd_cli-$IFNAME.pid")"
;;
esac

View file

@ -0,0 +1,120 @@
#!/bin/sh
#
# Copyright (c)2013, 2017 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
#
# 2013 Qualcomm Atheros, Inc..
#
# All Rights Reserved.
# Qualcomm Atheros Confidential and Proprietary.
#
IFNAME=$1
CMD=$2
parent=$(cat /sys/class/net/${IFNAME}/parent)
is_section_ifname() {
local config=$1
local ifname
config_get ifname "$config" ifname
[ "${ifname}" = "$2" ] && eval "$3=$config"
}
case "$CMD" in
WPS-NEW-AP-SETTINGS)
sleep 1
ssid=$(hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent get_config | grep ^ssid= | cut -f2- -d =)
wpa=$(hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent get_config | grep ^wpa= | cut -f2- -d=)
psk=$(hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent get_config | grep ^passphrase= | cut -f2- -d=)
wps_state=$(hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent get_config | grep ^wps_state= | cut -f2- -d=)
key_mgmt=$(hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent get_config | grep ^key_mgmt= | cut -f2- -d=)
hostapd_cli -i ${IFNAME} -p /var/run/hostapd-$parent disable
hostapd_cli -i ${IFNAME} -p /var/run/hostapd-$parent enable
ker_ver=`uname -r |cut -d. -f1`
if [ $ker_ver == 5 ]; then
. /sbin/wifi config
else
. /sbin/wifi detect
fi
sect=
config_foreach is_section_ifname wifi-iface $IFNAME sect
[ -n "$psk" ] || psk=$(hostapd_cli -i$IFNAME -p/var/run/hostapd-$parent get_config | grep ^psk= | cut -f2- -d=)
case "$wps_state" in
configured*)
uci set wireless.${sect}.wps_state=2
;;
"not configured"*)
uci set wireless.${sect}.wps_state=1
;;
*)
uci set wireless.${sect}.wps_state=0
esac
case "$wpa" in
3)
uci set wireless.${sect}.encryption='mixed-psk'
uci set wireless.${sect}.key=$psk
;;
2)
case "$key_mgmt" in
"SAE")
uci set wireless.${sect}.sae=1
uci set wireless.${sect}.encryption='ccmp'
uci add_list wireless.${sect}.sae_password=$psk
uci set wireless.${sect}.key=''
;;
"WPA-PSK SAE")
uci set wireless.${sect}.sae=1
uci set wireless.${sect}.key=$psk
uci set wireless.${sect}.encryption='psk2+ccmp'
;;
*)
uci set wireless.${sect}.encryption='psk2'
uci set wireless.${sect}.key=$psk
;;
esac
;;
1)
uci set wireless.${sect}.encryption='psk'
uci set wireless.${sect}.key=$psk
;;
*)
uci set wireless.${sect}.encryption='none'
uci set wireless.${sect}.key=''
;;
esac
uci set wireless.${sect}.ssid="$ssid"
uci commit
if [ -r /var/run/wifi-wps-enhc-extn.pid ]; then
echo $IFNAME > /var/run/wifi-wps-enhc-extn.done
kill -SIGUSR1 "$(cat "/var/run/wifi-wps-enhc-extn.pid")"
fi
kill "$(cat "/var/run/hostapd-cli-$IFNAME.pid")"
#post hotplug event to whom take care of
env -i ACTION="wps-configured" INTERFACE=$IFNAME /sbin/hotplug-call iface
;;
WPS-TIMEOUT)
kill "$(cat "/var/run/hostapd-cli-$IFNAME.pid")"
env -i ACTION="wps-timeout" INTERFACE=$IFNAME /sbin/hotplug-call iface
;;
WPS-SUCCESS)
if [ -r /var/run/wifi-wps-enhc-extn.pid ]; then
echo $IFNAME > /var/run/wifi-wps-enhc-extn.done
kill -SIGUSR1 "$(cat "/var/run/wifi-wps-enhc-extn.pid")"
fi
kill "$(cat "/var/run/hostapd-cli-$IFNAME.pid")"
env -i ACTION="wps-success" INTERFACE=$IFNAME /sbin/hotplug-call iface
;;
DISCONNECTED)
kill "$(cat "/var/run/hostapd_cli-$IFNAME.pid")"
;;
esac

View file

@ -0,0 +1,69 @@
#
# Copyright (c) 2017 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
#
# Copyright (c) 2014, The Linux Foundation. All rights reserved.
#
send_to_son()
{
local staname1
local staname2
local ret
local pattern
local count
[ -r /var/run/son.conf ] || return 0
staname1=$(grep sta /var/run/son.conf | head -n 1 | cut -f3 -d" " )
staname2=$(grep sta /var/run/son.conf | tail -n 1 | cut -f3 -d" " )
echo "$staname1 $staname2"
count=0
pattern="Not-Associated"
for sta in $staname1 $staname2;do
result=$(iwconfig $sta | head -2 | tail -1 | grep -o "Not-Associated")
if [ $result == $pattern ];then
count=$((count+1))
fi
done
if [ $count -lt 2 ];then
echo "Sending to son"
echo "wps_pbc $SEEN" > /var/run/sonwps.pipe &
touch /var/run/son_active
ret=1
else
ret=0
echo "Son not processing push - sta not connected"
fi
return $ret
}
if [ "$ACTION" = "pressed" -a "$BUTTON" = "wps" ]; then
echo "" > /dev/console
echo "WPS PUSH BUTTON EVENT DETECTED" > /dev/console
# cleanup old file
rm -f /var/run/son_active
#check for son.conf - if not there exit
# ret is 1 if push is consumed by son , if ret == 0 continue to next scripts
send_to_son
ret=$?
[ $ret -eq 1 ] && exit 0
# Son did not process the push call wps-extender if confgured
# If multi node wps is enabled then wps-extender will not process the push.
if [ -r /var/run/wifi-wps-enhc-extn.conf ] &&
[ ! -r /var/run/son.conf ]; then
exit 0
fi
# son and wps_extender are not processing the push
for dir in /var/run/hostapd-*; do
[ -d "$dir" ] || continue
for vap_dir in $dir/ath* $dir/wlan*; do
[ -r "$vap_dir" ] || continue
nopbn=`cfg80211tool "${vap_dir#"$dir/"}" get_nopbn | cut -d':' -f2`
if [ $nopbn != 1 ]; then
hostapd_cli -i "${vap_dir#"$dir/"}" -p "$dir" wps_pbc
fi
done
done
fi

View file

@ -0,0 +1,25 @@
#
# Copyright (c) 2017 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
#
#
# Copyright (c) 2014, The Linux Foundation. All rights reserved.
#
if [ "$ACTION" = "released" -a "$BUTTON" = "wps" ]; then
default_hold=3
if [ -f /var/run/plchost.pid ]
then
default_hold=12
fi
if [ "$SEEN" -gt $default_hold ]; then
echo "" > /dev/console
echo "RESET TO FACTORY SETTING EVENT DETECTED" > /dev/console
echo "PLEASE WAIT WHILE REBOOTING THE DEVICE..." > /dev/console
rm -rf /overlay/*
reboot
fi
fi

View file

@ -0,0 +1,51 @@
#
# Copyright (c) 2017 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
#
# Copyright (c) 2014, The Linux Foundation. All rights reserved.
#
restrict_pbc_for_sta_iface() {
local config=$1
local ifname
config_get ifname "$config" ifname
local wps_pbc_skip
config_get wps_pbc_skip "$config" wps_pbc_skip 0
local mode
config_get mode "$config" mode
config_get MapBSSType "$config" MapBSSType
config_get map "$config" map
# MapBSSType 128, vap is backhaul STA
if [ $MapBSSType -eq 128 ]; then
multi_ap=$map
fi
if ([ $wps_pbc_skip -eq 0 ] && [ "$dir" = "/var/run/wpa_supplicant-$ifname" ]) ||
([ $mode == "sta" ] && iwconfig $ifname | head -2 | tail -1 | grep -q "Not-Associated" ); then
wpa_cli -p "$dir" wps_pbc multi_ap=$multi_ap
[ -f $pid ] || {
wpa_cli -p"$dir" -a/lib/wifi/wps-supplicant-update-uci -P$pid -B
}
fi
}
pid=
if [ "$ACTION" = "pressed" -a "$BUTTON" = "wps" ]; then
[ -r /var/run/son_active ] && exit 0
if [ -r /var/run/wifi-wps-enhc-extn.conf ] &&
[ ! -r /var/run/son.conf ]; then
exit 0
fi
config_load wireless
for dir in /var/run/wpa_supplicant-*; do
[ -d "$dir" ] || continue
pid=/var/run/wps-hotplug-${dir#"/var/run/wpa_supplicant-"}.pid
config_foreach restrict_pbc_for_sta_iface wifi-iface
done
fi

View file

@ -0,0 +1,316 @@
#!/bin/sh
#
# Copyright (c) 2017 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
#
# Copyright (c) 2014, The Linux Foundation. All rights reserved.
#
IFNAME=$1
CMD=$2
if [ $CMD = "CONNECTED" ]; then
ker_ver=`uname -r |cut -d. -f1`
if [ $ker_ver == 5 ]; then
. /sbin/wifi config
else
. /sbin/wifi detect
fi
fi
parent=$(cat /sys/class/net/${IFNAME}/parent)
is_section_ifname() {
local config=$1
local ifname
config_get ifname "$config" ifname
[ "${ifname}" = "$2" ] && eval "$3=$config"
}
# Obtain the named configuration value in the supplicant config file,
# stripping off any double quotes.
#
# Return the value in the config_val global variable.
get_config_val() {
local conf=$1
local key=$2
# This finds the last key in the supplicant config and strips off leading
# and trailing quotes (if it has them).
#
# Note that it uses a leading space to ensure that only an exact match
# on the key is used.
config_val=$(awk "BEGIN{FS=\"=\"} /[[:space:]]${key}=/ {print \$0}" $conf |grep "${key}=" |tail -n 1 | cut -f 2 -d= | sed -e 's/^"\(.*\)"/\1/')
}
get_ssid() {
local conf=$1
get_config_val $conf 'ssid'
ssid=${config_val}
}
get_wpa_version() {
local conf=$1
local proto_key_str
get_config_val $conf 'proto'
proto_key_str="${config_val}"
get_config_val $conf 'key_mgmt'
proto_key_str="${proto_key_str} ${config_val}"
case "${proto_key_str}" in
"RSN WPA-PSK")
wpa_version="WPA2-PSK"
;;
"WPA WPA-PSK")
wpa_version="WPA-PSK"
;;
"RSN WPA-PSK SAE")
wpa_version="WPA3-PSK"
;;
"RSN SAE")
wpa_version="WPA3-SAE"
;;
# Since the proto key does not appear when no encryption
# is being used, we need to match against all possible
# combinations since the proto might have been extracted
# from a previous network section.
" NONE"|"RSN NONE"|"WPA NONE")
wpa_version="NONE"
;;
esac
}
get_psk() {
local conf=$1
get_config_val $conf 'psk'
psk=${config_val}
}
wps_pbc_enhc_get_clone_config() {
if [ -r $wps_pbc_enhc_file ]; then
local overwrite_ap_all=$(awk "/\-:overwrite_ap_settings_all/ {print;exit}" $wps_pbc_enhc_file | sed "s/\-://")
local overwrite_sta_all=$(awk "/\-:overwrite_sta_settings_all/ {print;exit}" $wps_pbc_enhc_file | sed "s/\-://")
local overwrite_ap=$(awk "/$parent:overwrite_ap_settings/ {print;exit}" $wps_pbc_enhc_file | sed "s/$parent://")
[ -n "$overwrite_ap_all" ] && \
IFNAME_OVERWRITE_AP=$(awk "/:[0-9\-]*:[0-9\-]*:.*:clone/" $wps_pbc_enhc_file | cut -f1 -d:)
[ -n "$overwrite_sta_all" ] && \
IFNAME_OVERWRITE_STA=$(awk "/:[0-9\-]*:[0-9\-]*:.*:clone/" $wps_pbc_enhc_file | cut -f1 -d:)
[ -z "$overwrite_ap_all" -a -n "$overwrite_ap" ] && \
IFNAME_OVERWRITE_AP=$(awk "/:[0-9\-]*:[0-9\-]*:$parent:clone/" $wps_pbc_enhc_file | cut -f1 -d:)
fi
}
wps_pbc_enhc_overwrite_ap_settings() {
local ifname_overwrite=$1
local ssid_overwrite=$2
local auth_overwrite=$3
local encr_overwrite=$4
local key_overwrite=
local parent_overwrite=$(cat /sys/class/net/${ifname_overwrite}/parent)
local ssid_suffix=$(awk "/\-:overwrite_ssid_suffix:/ {print;exit}" $wps_pbc_enhc_file | \
sed "s/\-:overwrite_ssid_suffix://")
local ssid_band_suffix=$(awk "/$parent_overwrite:overwrite_ssid_band_suffix:/ {print;exit}" $wps_pbc_enhc_file | \
sed "s/$parent_overwrite:overwrite_ssid_band_suffix://")
[ "${auth_overwrite}" = "SAE" -o "${auth_overwrite}" = "WPA2PSK" -o "${auth_overwrite}" = "WPAPSK" ] && key_overwrite=$5
if [ -r /var/run/hostapd-${parent_overwrite}/${ifname_overwrite} ]; then
hostapd_cli -i${ifname_overwrite} -p/var/run/hostapd-${parent_overwrite} wps_config \
${ssid_overwrite}${ssid_suffix}${ssid_band_suffix} ${auth_overwrite} ${encr_overwrite} ${key_overwrite}
fi
}
wps_pbc_enhc_overwrite_sta_settings() {
local ifname_overwrite=$1
local ssid_overwrite=$2
local auth_overwrite=$3
local key_overwrite=
local key_overwrite_len=
local nw=
local sect=
config_foreach is_section_ifname wifi-iface $ifname_overwrite sect
[ "${auth_overwrite}" = "WPA3-SAE" -o "${auth_overwrite}" = "WPA3-PSK" -o "${auth_overwrite}" = "WPA2-PSK" -o "${auth_overwrite}" = "WPA-PSK" ] && {
key_overwrite=$4
key_overwrite_len=${#key_overwrite}
}
if [ -r /var/run/wpa_supplicant-${ifname_overwrite} ]; then
nw=`wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} add_network | cut -d ' ' -f 4`
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw ssid \"${ssid_overwrite}\"
uci set wireless.${sect}.ssid="$ssid_overwrite"
case $auth_overwrite in
WPA3-SAE)
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw key_mgmt SAE
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw ieee80211w 2
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw sae 1
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw auth_alg OPEN
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw pairwise CCMP
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw proto RSN
if [ $key_overwrite_len -eq 64 ]; then
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw psk ${key_overwrite}
else
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw psk \"${key_overwrite}\"
fi
uci set wireless.${sect}.encryption='ccmp'
uci set wireless.${sect}.sae_password=$key_overwrite
uci set wireless.${sect}.sae=1
uci set wireless.${sect}.key=''
;;
WPA3-PSK)
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw key_mgmt WPA-PSK SAE
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw ieee80211w 1
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw sae 1
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw auth_alg OPEN
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw pairwise CCMP
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw proto RSN
if [ $key_overwrite_len -eq 64 ]; then
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw psk ${key_overwrite}
else
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw psk \"${key_overwrite}\"
fi
uci set wireless.${sect}.encryption='psk2+ccmp'
uci set wireless.${sect}.key=$key_overwrite
uci set wireless.${sect}.sae='1'
;;
WPA2-PSK)
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw key_mgmt WPA-PSK
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw auth_alg OPEN
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw pairwise CCMP
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw proto RSN
if [ $key_overwrite_len -eq 64 ]; then
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw psk ${key_overwrite}
else
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw psk \"${key_overwrite}\"
fi
uci set wireless.${sect}.encryption='psk2'
uci set wireless.${sect}.key=$key_overwrite
;;
WPA-PSK)
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw key_mgmt WPA-PSK
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw auth_alg OPEN
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw pairwise TKIP
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw proto WPA
if [ $key_overwrite_len -eq 64 ]; then
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw psk ${key_overwrite}
else
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw psk \"${key_overwrite}\"
fi
uci set wireless.${sect}.encryption='psk'
uci set wireless.${sect}.key=$key_overwrite
;;
NONE)
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} set_network $nw key_mgmt NONE
uci set wireless.${sect}.encryption='none'
uci set wireless.${sect}.key=''
;;
esac
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} enable_network $nw
wpa_cli -p /var/run/wpa_supplicant-${ifname_overwrite} save_config
fi
}
psk=
ssid=
wpa_version=
IFNAME_OVERWRITE_AP=
IFNAME_OVERWRITE_STA=
wps_pbc_enhc_file=/var/run/wifi-wps-enhc-extn.conf
case "$CMD" in
CONNECTED)
wpa_cli -i$IFNAME -p/var/run/wpa_supplicant-$IFNAME save_config
# Read the configuration from the file to avoid a potential
# race where the supplicant is not in the associated state when
# its status command is executed.
get_ssid /var/run/wpa_supplicant-$IFNAME.conf
get_wpa_version /var/run/wpa_supplicant-$IFNAME.conf
get_psk /var/run/wpa_supplicant-$IFNAME.conf
wps_pbc_enhc_get_clone_config
sect=
config_foreach is_section_ifname wifi-iface $IFNAME sect
case $wpa_version in
WPA2-PSK)
uci set wireless.${sect}.encryption='psk2'
uci set wireless.${sect}.key=$psk
for intf in $IFNAME_OVERWRITE_AP; do
wps_pbc_enhc_overwrite_ap_settings $intf $ssid WPA2PSK CCMP $psk
done
;;
WPA-PSK)
uci set wireless.${sect}.encryption='psk'
uci set wireless.${sect}.key=$psk
for intf in $IFNAME_OVERWRITE_AP; do
wps_pbc_enhc_overwrite_ap_settings $intf $ssid WPAPSK TKIP $psk
done
;;
WPA2-PSK-SHA256)
uci set wireless.${sect}.encryption='psk2'
uci set wireless.${sect}.key=$psk
for intf in $IFNAME_OVERWRITE_AP; do
wps_pbc_enhc_overwrite_ap_settings $intf $ssid WPA2PSK CCMP $psk
done
;;
WPA3-PSK)
uci set wireless.${sect}.encryption='psk2+ccmp'
uci set wireless.${sect}.key=$psk
uci set wireless.${sect}.sae='1'
for intf in $IFNAME_OVERWRITE_AP; do
wps_pbc_enhc_overwrite_ap_settings $intf $ssid WPA2PSK CCMP $psk
done
;;
WPA3-SAE)
uci set wireless.${sect}.encryption='ccmp'
uci set wireless.${sect}.sae_password=$psk
uci set wireless.${sect}.sae='1'
uci set wireless.${sect}.key=''
for intf in $IFNAME_OVERWRITE_AP; do
wps_pbc_enhc_overwrite_ap_settings $intf $ssid SAE CCMP $psk
done
;;
NONE)
uci set wireless.${sect}.encryption='none'
uci set wireless.${sect}.key=''
for intf in $IFNAME_OVERWRITE_AP; do
wps_pbc_enhc_overwrite_ap_settings $intf $ssid OPEN NONE
done
;;
esac
uci set wireless.${sect}.ssid="$ssid"
for intf in $IFNAME_OVERWRITE_STA; do
[ "$IFNAME" != "$intf" ] && wps_pbc_enhc_overwrite_sta_settings $intf $ssid $wpa_version $psk
done
uci commit
if [ -r /var/run/wifi-wps-enhc-extn.pid ]; then
echo $IFNAME > /var/run/wifi-wps-enhc-extn.done
kill -SIGUSR1 "$(cat "/var/run/wifi-wps-enhc-extn.pid")"
fi
kill "$(cat "/var/run/wps-hotplug-$IFNAME.pid")"
#post hotplug event to whom take care of
env -i ACTION="wps-connected" INTERFACE=$IFNAME /sbin/hotplug-call iface
;;
WPS-TIMEOUT)
kill "$(cat "/var/run/wps-hotplug-$IFNAME.pid")"
env -i ACTION="wps-timeout" INTERFACE=$IFNAME /sbin/hotplug-call iface
;;
DISCONNECTED)
;;
esac

View file

@ -0,0 +1,28 @@
#!/bin/sh
#
# Copyright (c) 2019 Qualcomm Technologies, Inc.
#
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
wpa_supplicant_enable() {
wpa_cli -p /var/run/wpa_supplicant-$1/ reconnect
}
wpa_supplicant_disable() {
wpa_cli -p /var/run/wpa_supplicant-$1/ disconnect
}
wpa_supplicant_reconfig() {
wpa_cli -p /var/run/wpa_supplicant-$1/ reconfigure
}
IFNAME=$1
case "$2" in
enable) wpa_supplicant_enable $IFNAME;;
disable) wpa_supplicant_disable $IFNAME;;
reconfig) wpa_supplicant_reconfig $IFNAME;;
*) echo "Invalid arguments. USAGE: wpsd <ifname> <enable/disable/reconfig>";;
esac