diff options
| author | Jan Huwald <jh@sotun.de> | 2012-04-23 16:33:37 (GMT) | 
|---|---|---|
| committer | Jan Huwald <jh@sotun.de> | 2012-04-23 16:33:37 (GMT) | 
| commit | 4176db98cb9a9437c939ac6b9f85fb176614b2cc (patch) | |
| tree | b7bd9497beed44948c1bcadca34246ad0c29e55d /files/common/sbin | |
| parent | 312d7c1eb3b92e11b192c0717b1480d096db20d3 (diff) | |
rewrite splash to use a p2ptbl
- add p2ptbl splash (see doc/splash.org)
- replace all uci queries with p2ptbl queries
- centralize splash db modification in /etc/splash.sh
- add node to the list of splashed devices upon first use of
  /etc/splash.sh (shortly after booting)
- remove locks in cgi-bin/splash_click
Diffstat (limited to 'files/common/sbin')
| -rwxr-xr-x | files/common/sbin/splash_sync | 39 | 
1 files changed, 13 insertions, 26 deletions
| diff --git a/files/common/sbin/splash_sync b/files/common/sbin/splash_sync index 992ec3f..bbb4182 100755 --- a/files/common/sbin/splash_sync +++ b/files/common/sbin/splash_sync @@ -1,38 +1,25 @@  #!/bin/sh -e -. $IPKG_INSTROOT/etc/functions.sh  . /etc/splash.sh -x=0 -current_time=$(date +%s) -splash_check() { -   config_get mac "$1" mac -   config_get time "$1" time -   let time_check=$time+$timeout -   if [ $time_check -gt  $current_time ]; then -	# user is splashed -       iptables -t nat -I $chain -m mac --mac-source $mac -j ACCEPT -   else -	# user is no longer splashed / must click again -       uci delete splash_users.@user[$x] -   fi -   let x=$x+1 -} -  # check for current inetable state, allowing a command line override  lockSplash -state=${1:-$(fsm get inetable)} -if [ "$state" == "queen" ]; then -    # functional gateway: copy splash db to a new iptables chain and -    # replace the old chain with the new one; this ensures that a user -    # stays splashed during the runtime of this script +if have_splash_iptable $1; then +    # remove old entries from splash p2ptbl +    p2ptbl filter $tbl \ +	awk '{ if ($2 > '$(date +%s)') print $0 }' + +    # create new iptables chain from splash p2ptbl and replace the old +    # chain with the new one; this ensures that a user stays splashed +    # during the runtime of this script      chain_id=$(($chain_id + 1))      chain=$chain_prefix$chain_id -    echo $chain_id > $chain_id_file      iptables -t nat -N $chain - -    config_load splash_users -    config_foreach splash_check user      iptables -t nat -I prerouting_inet_splashed -j $chain +    echo $chain_id > $chain_id_file +    p2ptbl show $tbl \ +	| while read mac rest; do +	    add_splash_iptable "$mac" +        done      while iptables -t nat -D prerouting_inet_splashed 2 &>/dev/null; do :; done  else      # no working gw -> remove reference to iptable copy of splash db | 
