-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Now MAC filter deny is supported. (Only accept was supported.) #43
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -179,8 +179,9 @@ define_global_variables(){ | |
WIFI_IFACE= | ||
CHANNEL=default | ||
WPA_VERSION=2 | ||
MAC_FILTER=0 | ||
MAC_FILTER=3 # 3 is not valid | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leave it blank (or use -1 or -99) is better. hostapd may add 3 as a valid value in the future |
||
MAC_FILTER_ACCEPT=/etc/hostapd/hostapd.accept | ||
MAC_FILTER_DENY=/etc/hostapd/hostapd.deny | ||
IEEE80211N=0 | ||
IEEE80211AC=0 | ||
HT_CAPAB='[HT40+]' | ||
|
@@ -356,13 +357,34 @@ parse_user_options(){ | |
shift | ||
HIDDEN=1 | ||
;; | ||
--mac-filter) | ||
|
||
--mac-filter-accept) | ||
shift | ||
if [ "$MAC_FILTER_TYPE" == "deny" ] | ||
then | ||
printf "ERROR: Can't use --mac-filter-accept and --mac-filter-deny together.\n" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. need |
||
exit 1 | ||
fi | ||
MAC_FILTER_TYPE=accept | ||
MAC_FILTER=1 | ||
MAC_FILTER_FILE=$MAC_FILTER_ACCEPT | ||
;; | ||
--mac-filter-accept) | ||
|
||
--mac-filter-deny) | ||
shift | ||
MAC_FILTER_ACCEPT="$1" | ||
if [ "$MAC_FILTER_TYPE" == "accept" ] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This variable |
||
then | ||
printf "ERROR: Can't use --mac-filter-accept and --mac-filter-deny together.\n" | ||
exit 1 | ||
fi | ||
MAC_FILTER_TYPE=deny | ||
MAC_FILTER=0 | ||
MAC_FILTER_FILE=$MAC_FILTER_DENY | ||
;; | ||
|
||
--mac-filter-file) | ||
shift | ||
MAC_FILTER_FILE="$1" | ||
shift | ||
;; | ||
|
||
|
@@ -1715,8 +1737,15 @@ write_hostapd_conf() { | |
|
||
if [[ $MAC_FILTER -eq 1 ]]; then | ||
cat <<- EOF >> "$CONFDIR/hostapd.conf" | ||
macaddr_acl=${MAC_FILTER} | ||
accept_mac_file=${MAC_FILTER_ACCEPT} | ||
macaddr_acl=1 | ||
accept_mac_file=${MAC_FILTER_FILE} | ||
EOF | ||
fi | ||
|
||
if [[ $MAC_FILTER -eq 0 ]]; then | ||
cat <<- EOF >> "$CONFDIR/hostapd.conf" | ||
macaddr_acl=0 | ||
deny_mac_file=${MAC_FILTER_FILE} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm thinking ...
then variable
What do you think? |
||
EOF | ||
fi | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're changing the meaning of this variable (from "enable mac filter or not" to "macaddr_acl in hostapd.conf" ),
we should use a new variable name MACADDR_ACL