2295d502f6
git-svn-id: svn://svn.openwrt.org/openwrt/packages@4917 3c298f89-4303-0410-b956-a3cf2f4a3e73
48 lines
978 B
Bash
48 lines
978 B
Bash
#!/bin/sh /etc/rc.common
|
|
# Copyright (C) 2006 OpenWrt.org
|
|
|
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
|
NAME=reaim
|
|
DESC="Transparent proxy for IM behind NAT"
|
|
IPT=/usr/sbin/iptables
|
|
|
|
include /lib/network
|
|
scan_interfaces
|
|
config_get WAN wan ifname
|
|
|
|
set_rules() {
|
|
[ -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 "."
|
|
}
|