File tree Expand file tree Collapse file tree 1 file changed +35
-6
lines changed Expand file tree Collapse file tree 1 file changed +35
-6
lines changed Original file line number Diff line number Diff line change @@ -179,8 +179,9 @@ define_global_variables(){
179179 WIFI_IFACE=
180180 CHANNEL=default
181181 WPA_VERSION=2
182- MAC_FILTER=0
182+ MAC_FILTER=3 # 3 is not valid
183183 MAC_FILTER_ACCEPT=/etc/hostapd/hostapd.accept
184+ MAC_FILTER_DENY=/etc/hostapd/hostapd.deny
184185 IEEE80211N=0
185186 IEEE80211AC=0
186187 HT_CAPAB=' [HT40+]'
@@ -356,13 +357,34 @@ parse_user_options(){
356357 shift
357358 HIDDEN=1
358359 ;;
359- --mac-filter)
360+
361+ --mac-filter-accept)
360362 shift
363+ if [ " $MAC_FILTER_TYPE " == " deny" ]
364+ then
365+ printf " ERROR: Can't use --mac-filter-accept and --mac-filter-deny together.\n"
366+ exit 1
367+ fi
368+ MAC_FILTER_TYPE=accept
361369 MAC_FILTER=1
370+ MAC_FILTER_FILE=$MAC_FILTER_ACCEPT
362371 ;;
363- --mac-filter-accept)
372+
373+ --mac-filter-deny)
364374 shift
365- MAC_FILTER_ACCEPT=" $1 "
375+ if [ " $MAC_FILTER_TYPE " == " accept" ]
376+ then
377+ printf " ERROR: Can't use --mac-filter-accept and --mac-filter-deny together.\n"
378+ exit 1
379+ fi
380+ MAC_FILTER_TYPE=deny
381+ MAC_FILTER=0
382+ MAC_FILTER_FILE=$MAC_FILTER_DENY
383+ ;;
384+
385+ --mac-filter-file)
386+ shift
387+ MAC_FILTER_FILE=" $1 "
366388 shift
367389 ;;
368390
@@ -1715,8 +1737,15 @@ write_hostapd_conf() {
17151737
17161738 if [[ $MAC_FILTER -eq 1 ]]; then
17171739 cat << - EOF >> "$CONFDIR /hostapd.conf"
1718- macaddr_acl=${MAC_FILTER}
1719- accept_mac_file=${MAC_FILTER_ACCEPT}
1740+ macaddr_acl=1
1741+ accept_mac_file=${MAC_FILTER_FILE}
1742+ EOF
1743+ fi
1744+
1745+ if [[ $MAC_FILTER -eq 0 ]]; then
1746+ cat << - EOF >> "$CONFDIR /hostapd.conf"
1747+ macaddr_acl=0
1748+ deny_mac_file=${MAC_FILTER_FILE}
17201749 EOF
17211750 fi
17221751
You can’t perform that action at this time.
0 commit comments