X-Git-Url: https://git.archive.openwrt.org/?p=openwrt.git;a=blobdiff_plain;f=package%2Fnetwork%2Fservices%2Fhostapd%2Ffiles%2Fhostapd.sh;h=8d6f30538d3fdefb2642a6c0534875e961855c2c;hp=00c6a094cf3fc6b17413183e74669d97e2c6636a;hb=d6c58ab4df263261596dd91b6f401761b77e9954;hpb=d749dd4b04157515752d3f1c3ed34339af7fc21a diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh index 00c6a094cf..8d6f30538d 100644 --- a/package/network/services/hostapd/files/hostapd.sh +++ b/package/network/services/hostapd/files/hostapd.sh @@ -215,10 +215,31 @@ hostapd_set_bss_options() { esac fi - config_get macfilter "$vif" macfilter - macfile="/var/run/hostapd-$ifname.maclist" - [ -e "$macfile" ] && rm -f "$macfile" + config_get macfile "$vif" macfile + config_get maclist "$vif" maclist + if [ -z "$macfile" ] + then + # if no macfile has been specified, fallback to the default name + macfile="/var/run/hostapd-$ifname.maclist" + else + if [ -n "$maclist" ] + then + # to avoid to overwrite the original file, make a copy + # before appending the entries specified by the maclist + # option + cp $macfile $macfile.maclist + macfile=$macfile.maclist + fi + fi + + if [ -n "$maclist" ] + then + for mac in $maclist; do + echo "$mac" >> $macfile + done + fi + config_get macfilter "$vif" macfilter case "$macfilter" in allow) append "$var" "macaddr_acl=1" "$N" @@ -229,12 +250,6 @@ hostapd_set_bss_options() { append "$var" "deny_mac_file=$macfile" "$N" ;; esac - config_get maclist "$vif" maclist - [ -n "$maclist" ] && { - for mac in $maclist; do - echo "$mac" >> $macfile - done - } } hostapd_set_log_options() {