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(){
179
179
WIFI_IFACE=
180
180
CHANNEL=default
181
181
WPA_VERSION=2
182
- MAC_FILTER=0
182
+ MAC_FILTER=3 # 3 is not valid
183
183
MAC_FILTER_ACCEPT=/etc/hostapd/hostapd.accept
184
+ MAC_FILTER_DENY=/etc/hostapd/hostapd.deny
184
185
IEEE80211N=0
185
186
IEEE80211AC=0
186
187
HT_CAPAB=' [HT40+]'
@@ -356,13 +357,34 @@ parse_user_options(){
356
357
shift
357
358
HIDDEN=1
358
359
;;
359
- --mac-filter)
360
+
361
+ --mac-filter-accept)
360
362
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
361
369
MAC_FILTER=1
370
+ MAC_FILTER_FILE=$MAC_FILTER_ACCEPT
362
371
;;
363
- --mac-filter-accept)
372
+
373
+ --mac-filter-deny)
364
374
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 "
366
388
shift
367
389
;;
368
390
@@ -1715,8 +1737,15 @@ write_hostapd_conf() {
1715
1737
1716
1738
if [[ $MAC_FILTER -eq 1 ]]; then
1717
1739
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}
1720
1749
EOF
1721
1750
fi
1722
1751
You can’t perform that action at this time.
0 commit comments