2006-10-04 20:57:49 +00:00
|
|
|
#!/bin/sh /etc/rc.common
|
|
|
|
# Copyright (C) 2006 OpenWrt.org
|
2006-08-07 12:39:12 +00:00
|
|
|
|
2006-10-15 21:03:30 +00:00
|
|
|
START=60
|
2006-08-07 12:39:12 +00:00
|
|
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
|
|
|
NAME=reaim
|
|
|
|
DESC="Transparent proxy for IM behind NAT"
|
|
|
|
IPT=/usr/sbin/iptables
|
|
|
|
|
2006-10-04 20:57:49 +00:00
|
|
|
set_rules() {
|
2006-10-15 21:03:30 +00:00
|
|
|
include /lib/network
|
|
|
|
scan_interfaces
|
|
|
|
config_get WAN wan ifname
|
|
|
|
|
2006-10-04 20:57:49 +00:00
|
|
|
[ -z "$WAN" ] && exit
|
|
|
|
$IPT $1 input_rule -i $WAN -p tcp --dport 1863:1864 -j ACCEPT
|
|
|
|
$IPT $1 input_rule -i $WAN -p tcp --dport 4443 -j ACCEPT
|
|
|
|
$IPT $1 input_rule -i $WAN -p tcp --dport 5566 -j ACCEPT
|
|
|
|
$IPT $1 input_rule -i $WAN -p tcp --dport 40000:40099 -j ACCEPT
|
|
|
|
}
|
|
|
|
|
|
|
|
start() {
|
|
|
|
if [ -e /var/run/$NAME.pid ]; then
|
|
|
|
echo "$DESC: $NAME already started."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
echo -n "Starting $DESC: $NAME"
|
|
|
|
|
|
|
|
set_rules -A
|
|
|
|
test -e /var/run/$NAME.pid || touch /var/run/$NAME.pid
|
|
|
|
/usr/sbin/$NAME
|
|
|
|
echo "."
|
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
|
|
|
set_rules -D 2>/dev/null >/dev/null
|
|
|
|
|
|
|
|
if [ ! -e /var/run/$NAME.pid ]; then
|
|
|
|
echo "$DESC: $NAME is not running."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
echo -n "Stopping $DESC: $NAME"
|
|
|
|
|
|
|
|
killall $NAME
|
|
|
|
rm -f /var/run/$NAME.pid
|
|
|
|
|
|
|
|
echo "."
|
|
|
|
}
|