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

Redirect to localhost #83

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions lnxrouter
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ Options:
--mac-filter Enable Wifi hotspot MAC address filtering
--mac-filter-accept Location of Wifi hotspot MAC address filter list
(defaults to /etc/hostapd/hostapd.accept)
--redirect-to-localhost If -n is set, redirect every web request to
localhost (useful for public information networks)
--hostapd-debug <level> 1 or 2. Passes -d or -dd to hostapd
--isolate-clients Disable wifi communication between clients

Expand Down Expand Up @@ -183,6 +185,7 @@ define_global_variables(){
FREQ_BAND=2.4
NO_HAVEGED=0
HOSTAPD_DEBUG_ARGS=
REDIRECT_TO_LOCALHOST=0
USE_PSK=0
ISOLATE_CLIENTS=0
QR=0 # show wifi qr
Expand Down Expand Up @@ -430,6 +433,10 @@ parse_user_options(){
fi
shift
;;
--redirect-to-localhost)
shift
REDIRECT_TO_LOCALHOST=1
;;
--psk)
shift
USE_PSK=1
Expand Down Expand Up @@ -1812,6 +1819,12 @@ write_dnsmasq_conf() {
echo log-queries=extra >> "$CONFDIR/dnsmasq.conf"
fi

if [[ "$SHARE_METHOD" == "none" && "$REDIRECT_TO_LOCALHOST" == "1" ]]; then
cat <<EOF >>$CONFDIR/dnsmasq.conf
address=/#/$GATEWAY
EOF
fi

if [[ $DNS ]]; then
DNS_count=$(echo "$DNS" | awk -F, '{print NF}')
for (( i=1;i<=DNS_count;i++ )); do
Expand Down