aboutsummaryrefslogtreecommitdiffstats
path: root/package/network
diff options
context:
space:
mode:
authorJohn Crispin <john@phrozen.org>2020-05-25 11:39:40 +0200
committerJohn Crispin <john@phrozen.org>2020-06-04 13:36:37 +0200
commit5aa2ddd0d6b9759c62bbb7bb11b72a7f4269c16b (patch)
tree32e400899dcfcf6bc6fb2218279643879693f2b9 /package/network
parent303b463394c151aa3962f9e837c0da54b1340a73 (diff)
downloadupstream-5aa2ddd0d6b9759c62bbb7bb11b72a7f4269c16b.tar.gz
upstream-5aa2ddd0d6b9759c62bbb7bb11b72a7f4269c16b.tar.bz2
upstream-5aa2ddd0d6b9759c62bbb7bb11b72a7f4269c16b.zip
hostapd: add support for wifi-station and wifi-vlan sections
This patch adds support for 2 new uci sections. config wifi-vlan # iface is optional. if it is not defined the vlan will apply # to all interfaces option iface default_radio0 option name guest option vid 100 option network guest config wifi-station # iface is optional. if it is not defined the station will apply # to all interfaces option iface default_radio0 # mac is optional. if it is not defined it will be a catch all # for any sta using this key option mac '00:11:22:33:44:55' # vid is optional. if it is not defined, the sta will be part of # the primary iface. option vid 100 option key testtest With this patch applied it is possible to use multiple PSKs on a single BSS. Signed-off-by: John Crispin <john@phrozen.org>
Diffstat (limited to 'package/network')
-rw-r--r--package/network/services/hostapd/files/hostapd.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
index 09de3994b8..f04d8229a7 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -262,6 +262,39 @@ hostapd_common_add_bss_config() {
config_add_string 'owe_transition_bssid:macaddr' 'owe_transition_ssid:string'
}
+hostapd_set_vlan_file() {
+ local ifname="$1"
+ local vlan="$2"
+ json_get_vars name vid
+ echo "${vid} ${ifname}-${name}" >> /var/run/hostapd-${ifname}.vlan
+ wireless_add_vlan "${vlan}" "${ifname}-${name}"
+}
+
+hostapd_set_vlan() {
+ local ifname="$1"
+
+ rm /var/run/hostapd-${ifname}.vlan
+ for_each_vlan hostapd_set_vlan_file ${ifname}
+}
+
+hostapd_set_psk_file() {
+ local ifname="$1"
+ local vlan="$2"
+ local vlan_id=""
+
+ json_get_vars mac vid key
+ set_default isolate "00:00:00:00:00:00"
+ [ -n "$vid" ] && vlan_id="vlanid=$vid "
+ echo "${vlan_id} ${mac} ${key}" >> /var/run/hostapd-${ifname}.psk
+}
+
+hostapd_set_psk() {
+ local ifname="$1"
+
+ rm /var/run/hostapd-${ifname}.psk
+ for_each_station hostapd_set_psk_file ${ifname}
+}
+
hostapd_set_bss_options() {
local var="$1"
local phy="$2"
@@ -377,12 +410,15 @@ hostapd_set_bss_options() {
else
append bss_conf "wpa_passphrase=$key" "$N"
fi
+ [ -z "$wpa_psk_file" ] && set_default wpa_psk_file /var/run/hostapd-$ifname.psk
[ -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"
+ set_default dynamic_vlan 0
+ vlan_possible=1
wps_possible=1
;;
eap|eap192|eap-eap192)
@@ -639,6 +675,7 @@ hostapd_set_bss_options() {
[ -n "$vlan_possible" -a -n "$dynamic_vlan" ] && {
json_get_vars vlan_naming vlan_tagged_interface vlan_bridge vlan_file
set_default vlan_naming 1
+ [ -z "$vlan_file" ] && set_default vlan_file /var/run/hostapd-$ifname.vlan
append bss_conf "dynamic_vlan=$dynamic_vlan" "$N"
append bss_conf "vlan_naming=$vlan_naming" "$N"
[ -n "$vlan_bridge" ] && \