Compare commits

...

5 Commits

Author SHA1 Message Date
Omar cc7b7710dd
Merge 171bdb9e66 into fbad56f05c 2024-07-04 12:18:25 +00:00
garywill fbad56f05c get_pid_by_dbus_name() : fix stderr show 2024-04-20 20:48:05 +08:00
garywill c376609896 readme text 2024-04-20 20:46:05 +08:00
garywill a8ae765f03 fix type #73 2024-04-20 20:45:53 +08:00
Omar-AE 171bdb9e66 Now MAC filter deny is supported. (Only accept was supported.) 2022-10-12 19:35:42 +03:00
2 changed files with 40 additions and 12 deletions

View File

@ -327,7 +327,7 @@ Options:
--dns <ip>|<port>|<ip:port> --dns <ip>|<port>|<ip:port>
DNS server's upstream DNS. DNS server's upstream DNS.
Use ',' to seperate multiple servers Use ',' to seperate multiple servers
(default: use /etc/resolve.conf) (default: use /etc/resolv.conf)
(Note IPv6 addresses need '[]' around) (Note IPv6 addresses need '[]' around)
--no-dns Do not serve DNS --no-dns Do not serve DNS
--no-dnsmasq Disable dnsmasq server (DHCP, DNS, RA) --no-dnsmasq Disable dnsmasq server (DHCP, DNS, RA)
@ -453,7 +453,6 @@ Visit [**my homepage** 🏡](https://garywill.github.io) to see **more tools and
## TODO ## TODO
- WPA3 - WPA3
- Global IPv6 - Global IPv6
- Explictly ban forwarding if not needed
## License ## License

49
lnxrouter Normal file → Executable file
View File

@ -47,7 +47,7 @@ Options:
--dns <ip>|<port>|<ip:port> --dns <ip>|<port>|<ip:port>
DNS server's upstream DNS. DNS server's upstream DNS.
Use ',' to seperate multiple servers Use ',' to seperate multiple servers
(default: use /etc/resolve.conf) (default: use /etc/resolv.conf)
(Note IPv6 addresses need '[]' around) (Note IPv6 addresses need '[]' around)
--no-dns Do not serve DNS --no-dns Do not serve DNS
--no-dnsmasq Disable dnsmasq server (DHCP, DNS, RA) --no-dnsmasq Disable dnsmasq server (DHCP, DNS, RA)
@ -191,8 +191,9 @@ define_global_variables(){
CHANNEL=default CHANNEL=default
HOTSPOT20=0 # For enabling Hotspot 2.0 HOTSPOT20=0 # For enabling Hotspot 2.0
WPA_VERSION=2 WPA_VERSION=2
MAC_FILTER=0 MAC_FILTER=3 # 3 is not valid
MAC_FILTER_ACCEPT=/etc/hostapd/hostapd.accept MAC_FILTER_ACCEPT=/etc/hostapd/hostapd.accept
MAC_FILTER_DENY=/etc/hostapd/hostapd.deny
IEEE80211N=0 IEEE80211N=0
REQUIREHT=0 REQUIREHT=0
IEEE80211AC=0 IEEE80211AC=0
@ -376,13 +377,34 @@ parse_user_options(){
shift shift
HIDDEN=1 HIDDEN=1
;; ;;
--mac-filter)
shift
MAC_FILTER=1
;;
--mac-filter-accept) --mac-filter-accept)
shift shift
MAC_FILTER_ACCEPT="$1" if [ "$MAC_FILTER_TYPE" == "deny" ]
then
printf "ERROR: Can't use --mac-filter-accept and --mac-filter-deny together.\n"
exit 1
fi
MAC_FILTER_TYPE=accept
MAC_FILTER=1
MAC_FILTER_FILE=$MAC_FILTER_ACCEPT
;;
--mac-filter-deny)
shift
if [ "$MAC_FILTER_TYPE" == "accept" ]
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 shift
;; ;;
@ -862,7 +884,7 @@ get_pid_by_dbus_name() {
which dbus-send >/dev/null 2>&1 || return 1 which dbus-send >/dev/null 2>&1 || return 1
pid="$( dbus-send --system --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetConnectionUnixProcessID string:$DBUS_NAME | grep " uint32 " | awk '{print $2}' )" 2>/dev/null pid="$( dbus-send --system --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetConnectionUnixProcessID string:$DBUS_NAME 2>/dev/null | grep " uint32 " | awk '{print $2}' )"
r=$? r=$?
echo "$pid" echo "$pid"
@ -1902,8 +1924,15 @@ write_hostapd_conf() {
if [[ $MAC_FILTER -eq 1 ]]; then if [[ $MAC_FILTER -eq 1 ]]; then
cat <<- EOF >> "$CONFDIR/hostapd.conf" cat <<- EOF >> "$CONFDIR/hostapd.conf"
macaddr_acl=${MAC_FILTER} macaddr_acl=1
accept_mac_file=${MAC_FILTER_ACCEPT} 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}
EOF EOF
fi fi