Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zaibaq
Copy link

@zaibaq zaibaq commented Sep 23, 2022

This is to support --mac-filter-deny after only --mac-filter-accept was supported.

Use:
If you want to use deny acl, use the option --mac-filter-deny. Similarly for accept acl, use --mac-filter-accept.
Obviously, you cannot use both options at the same time.
If you want to set a specific path for the mac addresses file, whether you're using deny or accept, you need to set the option --mac-filter-file <MAC_ADDRESSES_FILE>.

@zaibaq zaibaq force-pushed the master branch 2 times, most recently from 02a153b to ee858a8 Compare September 23, 2022 19:00
@zaibaq
Copy link
Author

zaibaq commented Oct 3, 2022

Any updates regarding this? @garywill

@garywill
Copy link
Owner

garywill commented Oct 4, 2022

Hi, @zaibaq .
Thank you for sending PR to us.

Your commit has 300+ lines changes, which is too hard for us to review.
Please make a freshnew commit (based on the latest commit in master branch) containing only the feature part. Ignore those blanks, exclude them from commit.

You can use some GUI tool to choose lines to put into a commit, like git gui, gitg, git-cola`

@@ -179,8 +179,9 @@ define_global_variables(){
WIFI_IFACE=
CHANNEL=default
WPA_VERSION=2
MAC_FILTER=0
Copy link
Owner

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

@@ -179,8 +179,9 @@ define_global_variables(){
WIFI_IFACE=
CHANNEL=default
WPA_VERSION=2
MAC_FILTER=0
MAC_FILTER=3 # 3 is not valid
Copy link
Owner

Choose a reason for hiding this comment

The 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

shift
if [ "$MAC_FILTER_TYPE" == "deny" ]
then
printf "ERROR: Can't use --mac-filter-accept and --mac-filter-deny together.\n"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need >&2

shift
MAC_FILTER_ACCEPT="$1"
if [ "$MAC_FILTER_TYPE" == "accept" ]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable MAC_FILTER_TYPE would be unnecessary. Use that MACADDR_ACL

if [[ $MAC_FILTER -eq 0 ]]; then
cat <<- EOF >> "$CONFDIR/hostapd.conf"
macaddr_acl=0
deny_mac_file=${MAC_FILTER_FILE}
Copy link
Owner

@garywill garywill Oct 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking ...
maybe we can make the script option like this:

--mac-filter-accept <accept_file>
--mac-filter-deny <deny_file>

then variable MAC_FILTER_FILE and option --mac-filter-file would be unnecessary .

--mac-filter-accept - will apply the default path /etc/hostapd/hostapd.accept.
--mac-filter-deny - similar to above

What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants