|
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 |
|---|
| 2 | echo "" >>/var/log/splash.log |
|---|
| 3 | echo `date +%c` >> /var/log/splash.log |
|---|
| 4 | echo $DNSMASQ_TAGS >> /var/log/splash.log |
|---|
| 5 | echo $1 $2 $3 $4 $5 >> /var/log/splash.log |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | if [[ "$DNSMASQ_TAGS" =~ "known" ]]; then |
|---|
| 9 | echo "known, exiting" >>/var/log/splash.log |
|---|
| 10 | exit 0; |
|---|
| 11 | fi |
|---|
| 12 | |
|---|
| 13 | if grep -Fxq $2 /etc/ff/macs |
|---|
| 14 | then |
|---|
| 15 | echo "mac found, exiting" >> /var/log/splash.log |
|---|
| 16 | exit 0; |
|---|
| 17 | fi |
|---|
| 18 | |
|---|
| 19 | if [ "$1" = "add" ]; then |
|---|
| 20 | echo "splashing $3 and adding $2" >>/var/log/splash.log |
|---|
| 21 | echo $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 |
|---|
| 23 | fi |
|---|
| 24 | |
|---|
| 25 | if [ "$1" = "del" ]; then |
|---|
| 26 | echo "$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 |
|---|
| 28 | fi |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | if [ "$1" = "delete" ]; then |
|---|
| 32 | echo "$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 |
|---|
| 34 | fi |
|---|
| 35 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.