aboutsummaryrefslogtreecommitdiffstats
path: root/package/network
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2021-12-10 11:30:40 +0100
committerFelix Fietkau <nbd@nbd.name>2021-12-10 11:33:49 +0100
commitea49690ff47d14ee096d7c1368cff03f1cce1d76 (patch)
treee23de09f8995aea2692a1d25d6c67d6c8caab026 /package/network
parentbaba2fdaa60c2f2426ec09eaacd6dfb7cec3fd2c (diff)
downloadupstream-ea49690ff47d14ee096d7c1368cff03f1cce1d76.tar.gz
upstream-ea49690ff47d14ee096d7c1368cff03f1cce1d76.tar.bz2
upstream-ea49690ff47d14ee096d7c1368cff03f1cce1d76.zip
hostapd: add support for specifying the FILS DHCP server
The 'fils_dhcp' option can be set to '*' in order to autodetect the DHCP server For proto=dhcp networks, the discovered dhcp server will be used For all other networks, udhcpc is called to discover the address Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'package/network')
-rw-r--r--package/network/services/hostapd/Makefile1
-rw-r--r--package/network/services/hostapd/files/dhcp-get-server.sh2
-rw-r--r--package/network/services/hostapd/files/hostapd.sh16
3 files changed, 18 insertions, 1 deletions
diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile
index 12e200be3e..7e4056bb18 100644
--- a/package/network/services/hostapd/Makefile
+++ b/package/network/services/hostapd/Makefile
@@ -601,6 +601,7 @@ endef
define Package/hostapd-common/install
$(INSTALL_DIR) $(1)/etc/capabilities $(1)/etc/rc.button $(1)/etc/hotplug.d/ieee80211 $(1)/etc/init.d $(1)/lib/netifd $(1)/usr/share/acl.d
+ $(INSTALL_BIN) ./files/dhcp-get-server.sh $(1)/lib/netifd/dhcp-get-server.sh
$(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/netifd/hostapd.sh
$(INSTALL_BIN) ./files/wpad.init $(1)/etc/init.d/wpad
$(INSTALL_BIN) ./files/wps-hotplug.sh $(1)/etc/rc.button/wps
diff --git a/package/network/services/hostapd/files/dhcp-get-server.sh b/package/network/services/hostapd/files/dhcp-get-server.sh
new file mode 100644
index 0000000000..a1509ace2f
--- /dev/null
+++ b/package/network/services/hostapd/files/dhcp-get-server.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+[ "$1" = bound ] && echo "$serverid"
diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
index 30d1418789..d9d5f34877 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -370,6 +370,7 @@ hostapd_common_add_bss_config() {
config_add_string eap_user_file ca_cert server_cert private_key private_key_passwd server_id
config_add_boolean fils
+ config_add_string fils_dhcp
}
hostapd_set_vlan_file() {
@@ -670,7 +671,7 @@ hostapd_set_bss_options() {
ownip radius_client_addr \
eap_reauth_period request_cui \
erp_domain mobility_domain \
- fils_realm
+ fils_realm fils_dhcp
# radius can provide VLAN ID for clients
vlan_possible=1
@@ -689,6 +690,19 @@ hostapd_set_bss_options() {
append bss_conf "erp_domain=$erp_domain" "$N"
append bss_conf "fils_realm=$fils_realm" "$N"
append bss_conf "fils_cache_id=$(echo "$fils_realm" | md5sum | head -c 4)" "$N"
+
+ [ "$fils_dhcp" = "*" ] && {
+ json_get_values network network
+ fils_dhcp=
+ for net in $network; do
+ fils_dhcp="$(ifstatus "$net" | jsonfilter -e '@.data.dhcpserver')"
+ [ -n "$fils_dhcp" ] && break
+ done
+
+ [ -z "$fils_dhcp" -a -n "$network_bridge" -a -n "$network_ifname" ] && \
+ fils_dhcp="$(udhcpc -B -n -q -s /lib/netifd/dhcp-get-server.sh -t 1 -i "$network_ifname" 2>/dev/null)"
+ }
+ [ -n "$fils_dhcp" ] && append bss_conf "dhcp_server=$fils_dhcp" "$N"
}
set_default auth_port 1812