akagane
13
The following thing doesn’t work too.
It is there for history log and if somebody are obsessively trying the all of methods sequentially
$ diff -ub ./lib/wifi/hostapd.sh.0 ./lib/wifi/hostapd.sh
--- ./lib/wifi/hostapd.sh.0 2021-12-13 11:19:05.000000000 +0300
+++ ./lib/wifi/hostapd.sh 2022-01-22 20:39:45.582390348 +0300
@@ -1125,6 +1125,40 @@
sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' /var/run/hostapd_cred_tmp.conf | xargs printf >> /var/run/hostapd_cred_$device.bin
}
+hostapd_config_macfilter() {
+ config_load wireless
+ local vif="$1"
+ local var="$2"
+ local maclist nmaclist macfilter
+ config_get maclist "$vif" maclist
+ #If there was configured the maclist for the iface, we proceed
+ if [ -n "$maclist" ]; then
+ for mac in $maclist; do
+ append nmaclist "$mac" "$N"
+ done
+ # Get the policy
+ config_get macfilter "$vif" macfilter
+ # Set up the maclist
+ case "$macfilter" in
+ allow)
+ echo -n "$nmaclist" > "/var/run/hostapd-$ifname.accept"
+ append "$var" "macaddr_acl=0" "$N"
+ append "$var" "accept_mac_file=/var/run/hostapd-$ifname.accept" "$N"
+ ;;
+ deny)
+ echo -n "$nmaclist" > "/var/run/hostapd-$ifname.deny"
+ append "$var" "macaddr_acl=0" "$N"
+ append "$var" "deny_mac_file=/var/run/hostapd-$ifname.deny" "$N"
+ ;;
+ *)
+ # So, there policy is not setted, but there is maclist... Why?..
+ # May be the user turned off the policy, but keep the maclist?..
+ # If that is true, we should do nothing.
+ return 0
+ ;;
+ esac
+ fi
+}
hostapd_setup_vif() {
local vif="$1" && shift
@@ -1528,6 +1562,8 @@
config_get_bool hidden "$vif" hidden 0
append hostapd_cfg "ignore_broadcast_ssid=$hidden" "$N"
+ hostapd_config_macfilter "$vif" hostapd_cfg
+
fi #end of nl80211
hostapd_set_bss_options hostapd_cfg "$vif"