diff options
author | Jan Huwald <jh@sotun.de> | 2012-03-30 11:32:01 (GMT) |
---|---|---|
committer | Jan Huwald <jh@sotun.de> | 2012-03-30 11:32:01 (GMT) |
commit | 84649be9f2e0f42d039f1ac422a63c9edaf78a8d (patch) | |
tree | 18bada03dde120e5f6559a38f8d2fda1fc1bf47e | |
parent | ba08eb8e76f10b01a7c244b6818c0c09588314f7 (diff) |
adapt splash and robinson redirection to new webif
-rwxr-xr-x | files/common/etc/fsm/inetable/trans/queen.enter | 2 | ||||
-rwxr-xr-x | files/common/etc/fsm/inetable/trans/robinson.enter | 2 | ||||
-rwxr-xr-x | files/common/www/service/cgi-bin/splash.html (renamed from files/common/www/service/cgi-bin/splash) | 2 | ||||
-rwxr-xr-x | files/common/www/service/cgi-bin/splash_click.html (renamed from files/common/www/service/cgi-bin/splash_click) | 25 |
4 files changed, 21 insertions, 10 deletions
diff --git a/files/common/etc/fsm/inetable/trans/queen.enter b/files/common/etc/fsm/inetable/trans/queen.enter index 9753a81..a7c5539 100755 --- a/files/common/etc/fsm/inetable/trans/queen.enter +++ b/files/common/etc/fsm/inetable/trans/queen.enter @@ -54,7 +54,7 @@ set dhcp.mesh.end_ip=$dhcp_end ## set splash # start redirection httpd (for splash), add GW IP to the addrs service # httpd listens on -echo "http://$gwip/cgi-bin/splash? /sbin/urlencode" > /tmp/redirection_target +echo "http://$gwip/cgi-bin/splash.html? /sbin/urlencode" > /tmp/redirection_target enable_httpd redirection $gwip:81 change_service_httpd_listen $gwip:80 /etc/init.d/uhttpd restart diff --git a/files/common/etc/fsm/inetable/trans/robinson.enter b/files/common/etc/fsm/inetable/trans/robinson.enter index 42e97cb..38ae604 100755 --- a/files/common/etc/fsm/inetable/trans/robinson.enter +++ b/files/common/etc/fsm/inetable/trans/robinson.enter @@ -38,7 +38,7 @@ set dhcp.fakedns.name='#' batctl gw off # start redirection httpd, add robinson IP to service httpd -echo "http://$randip/robinson.html" > /tmp/redirection_target +echo "http://$randip/" > /tmp/redirection_target enable_httpd redirection $randip:81 change_service_httpd_listen $randip:80 /etc/init.d/uhttpd restart diff --git a/files/common/www/service/cgi-bin/splash b/files/common/www/service/cgi-bin/splash.html index 1237ce0..b8c8264 100755 --- a/files/common/www/service/cgi-bin/splash +++ b/files/common/www/service/cgi-bin/splash.html @@ -4,4 +4,4 @@ echo -en "Content-Type: text/html\r\n" echo -en "\r\n" targeturl="$(echo "$QUERY_STRING" | tr -d '/')" -sed "s/targeturl/$targeturl/g" splash.html +sed "s/targeturl/$targeturl/g" index.html diff --git a/files/common/www/service/cgi-bin/splash_click b/files/common/www/service/cgi-bin/splash_click.html index 1eb4e85..59926d0 100755 --- a/files/common/www/service/cgi-bin/splash_click +++ b/files/common/www/service/cgi-bin/splash_click.html @@ -1,15 +1,15 @@ #!/bin/sh -e + . $IPKG_INSTROOT/etc/functions.sh . /etc/splash.sh - -echo -en "Status: 200 OK\r\n" -echo -en "Content-Type: text/html\r\n" -echo -en "\r\n" +. /www/service/cgi-bin/common.sh # decode request params -URL="http://$(sed 's/target_url=//g' | urldecode)" +#URL="http://$(sed 's/target_url=//g' | urldecode || true)" +URL="http://sotun.de/" USER_MAC=$(grep ^$REMOTE_HOST </proc/net/arp \ | awk 'BEGIN { FS = " " } ; { print $4 }') +[ -n "$USER_MAC" ] # check if user is already splashed; splash otherwise lockSplash @@ -25,7 +25,9 @@ config_foreach is_mac user if [ $ISSPLASHED -eq 0 ]; then # user is now free to go chain=$chain_prefix$chain_id - iptables -t nat -I $chain 1 -m mac --mac-source $USER_MAC -j ACCEPT + if have_internet; then + iptables -t nat -I $chain 1 -m mac --mac-source $USER_MAC -j ACCEPT + fi uci -q add splash_users user >/dev/null uci -q set splash_users.@user[-1].mac=$USER_MAC @@ -34,4 +36,13 @@ fi unlockSplash # send response (encode / to not confuse sed) -sed "s/targeturl/$(echo "$URL" | sed 's#/#\\/#g')/g" iframe.html + +echo -en "Status: 200 OK\r +Content-Type: text/html\r +\r +" +if have_internet; then + sed "s/targeturl/$(echo "$URL" | sed 's#/#\\/#g')/g" iframe.html +else + cat internet.html +fi |