source: scripts/splash/splash.sh

Last change on this file was 450, checked in by bjo, 9 months ago

fixed some bugs, ip-deletion did not work with new sudo

File size: 969 bytes
Line 
1#!/bin/sh
2echo "" >>/var/log/splash.log
3echo `date +%c` >> /var/log/splash.log
4echo $DNSMASQ_TAGS >> /var/log/splash.log
5echo $1 $2 $3 $4 $5 >> /var/log/splash.log
6
7
8if [[ "$DNSMASQ_TAGS" =~ "known" ]]; then
9        echo "known, exiting" >>/var/log/splash.log
10        exit 0;
11fi
12
13if grep -Fxq $2 /etc/ff/macs
14then
15    echo "mac found, exiting" >> /var/log/splash.log
16    exit 0;
17fi
18
19if [ "$1" = "add" ]; then
20echo "splashing $3 and adding $2" >>/var/log/splash.log
21echo $2 >> /etc/ff/macs
22/sbin/iptables -t nat -A PREROUTING -p tcp -s $3 ! -d 91.121.204.103 --dport 80 -j DNAT --to-destination 10.18.0.1
23fi
24
25if [ "$1" = "del" ]; then
26echo "$3 went away" >>/var/log/splash.log
27/sbin/iptables -t nat -D PREROUTING -p tcp -s $3 ! -d 91.121.204.103 --dport 80 -j DNAT --to-destination 10.18.0.1
28fi
29
30
31if [ "$1" = "delete" ]; then
32echo "$2 desplashed" >>/var/log/fflog
33/sbin/iptables -t nat -D PREROUTING -p tcp -s $2 ! -d 91.121.204.103 --dport 80 -j DNAT --to-destination 10.18.0.1
34fi
35
Note: See TracBrowser for help on using the repository browser.