summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoregon_ffj <egon@freifunk-jena.de>2011-06-22 23:14:54 (GMT)
committeregon_ffj <egon@freifunk-jena.de>2011-06-22 23:14:54 (GMT)
commite002a1adca04354dc9e5b9f8721f9fd55ff2401b (patch)
treebc798b5ae2f76b2366fffe5bc9e49bdd652b5ac2
parentfcc656eab7da3de5fca7c145b2d5162f1edaf6fe (diff)
* switched splash stuff from ip based to mac based
-rwxr-xr-xfiles/sbin/splash_sync10
-rwxr-xr-xfiles/www/cgi-bin/splash_click18
2 files changed, 15 insertions, 13 deletions
diff --git a/files/sbin/splash_sync b/files/sbin/splash_sync
index f54fbb4..3a2b0f1 100755
--- a/files/sbin/splash_sync
+++ b/files/sbin/splash_sync
@@ -7,18 +7,18 @@ myip=`uci get network.mesh.ipaddr`
splash_check() {
timeout=6000
current_time=`date +%s`
- config_get ip "$1" ip
+ config_get mac "$1" mac
config_get time "$1" time
local config="$1"
let time_check=$time+$timeout
if [ $time_check -gt $current_time ]; then
# User ist noch gesplashed
- iptables -t nat -D ffj_splash -s $ip -j ACCEPT
- iptables -t nat -I ffj_splash 1 -s $ip -j ACCEPT
+ iptables -t nat -D ffj_splash -m mac --mac-source $mac -j ACCEPT
+ iptables -t nat -I ffj_splash 1 -m mac --mac-source $mac -j ACCEPT
else
# User is not longer splashed / the user must click again
- iptables -t nat -D ffj_splash -s $ip -j ACCEPT
- uci delete splash_users.@user[$x].ip
+ iptables -t nat -D ffj_splash -m mac --mac-source $mac -j ACCEPT
+ uci delete splash_users.@user[$x].mac
uci delete splash_users.@user[$x].time
uci delete splash_users.@user[$x]
diff --git a/files/www/cgi-bin/splash_click b/files/www/cgi-bin/splash_click
index 92e898a..d08af6a 100755
--- a/files/www/cgi-bin/splash_click
+++ b/files/www/cgi-bin/splash_click
@@ -6,28 +6,30 @@ TEST=`cat `
TEST=`echo $TEST | sed 's/'target_url='/''/g'`
TEST=`/bin/urldecode "$TEST"`
TEST=`echo $TEST | sed 's/%2F/\//g'`
+USER_MAC=`cat /proc/net/arp | grep $REMOTE_HOST | awk 'BEGIN { FS = " " } ; { print $4 }'`
+
. $IPKG_INSTROOT/etc/functions.sh
ISSPLASHED=0
config_load splash_users
-is_ip() {
- config_get ip "$1" ip
- if [ "$ip" == "$REMOTE_HOST" ]; then
+is_mac() {
+ config_get mac "$1" mac
+ if [ "$mac" == "$USER_MAC" ]; then
ISSPLASHED=1
fi
}
#check if user is alredy splashed
-config_foreach is_ip user
+config_foreach is_mac user
sed 's/targeturl/'"$(echo $TEST| sed 's#/#\\/#g')"'/g' /www/iframe.html
if [ $ISSPLASHED -eq 1 ]; then
exit
fi
#User is now free to go
-iptables -t nat -I ffj_splash 1 -s $REMOTE_HOST -j ACCEPT
+iptables -t nat -I ffj_splash 1 -m --mac-source $USER_MAC -j ACCEPT
-uci add splash_users user
-uci set splash_users.@user[-1].ip=$REMOTE_HOST
-uci set splash_users.@user[-1].time=`date +%s`
+uci -q add splash_users user
+uci -q set splash_users.@user[-1].mac=$USER_MAC
+uci -q set splash_users.@user[-1].time=`date +%s`
exit 0
contact: Jan Huwald // Impressum