2006-12-05 06:24:30 +00:00
|
|
|
#!/bin/sh /etc/rc.common
|
|
|
|
START=95
|
|
|
|
start() {
|
2006-11-26 23:44:09 +00:00
|
|
|
echo "miniupnpd starting ..."
|
|
|
|
iptables_flush.sh 2>&- >&-
|
|
|
|
killall miniupnpd 2>&-
|
|
|
|
iptables_removeall.sh 2>&- >&-
|
|
|
|
iptables_init.sh
|
2006-11-29 02:02:11 +00:00
|
|
|
# get bitspeed information, if provided
|
2006-12-05 06:24:30 +00:00
|
|
|
upnpd_up_bitspeed=$(uci get upnpd.general.up_bitspeed)
|
|
|
|
upnpd_down_bitspeed=$(uci get upnpd.general.down_bitspeed)
|
2006-11-29 02:55:22 +00:00
|
|
|
bitspeed_str=""
|
2006-11-29 02:02:11 +00:00
|
|
|
[ -n "$upnpd_up_bitspeed" ] && [ -n "$upnpd_down_bitspeed" ] && {
|
|
|
|
# covert to bytespeed
|
|
|
|
let upnpd_up_bytespeed=$upnpd_up_bitspeed*1024/8
|
|
|
|
let upnpd_down_bytespeed=$upnpd_down_bitspeed*1024/8
|
|
|
|
bitspeed_str="-B $upnpd_down_bytespeed $upnpd_up_bytespeed"
|
|
|
|
}
|
2006-12-05 06:24:30 +00:00
|
|
|
upnpd_log=$(uci get upnpd.general.log_output)
|
2006-11-26 23:44:09 +00:00
|
|
|
if [ "$upnpd_log" = "1" ]; then
|
2006-12-05 06:24:30 +00:00
|
|
|
miniupnpd -i $(uci get network.wan.ifname) -a $(uci get network.lan.ipaddr) -p 5000 -U $bitspeed_str -d | logger -t miniupnpd &
|
2006-11-26 23:44:09 +00:00
|
|
|
else
|
2006-12-05 06:24:30 +00:00
|
|
|
miniupnpd -i $(uci get network.wan.ifname) -a $(uci get network.lan.ipaddr) -p 5000 -U $bitspeed_str
|
2006-11-26 23:44:09 +00:00
|
|
|
fi
|
2006-12-05 06:24:30 +00:00
|
|
|
}
|
|
|
|
stop() {
|
|
|
|
iptables_flush.sh 2>&- >&-
|
|
|
|
killall miniupnpd 2>&-
|
|
|
|
iptables_removeall.sh 2>&- >&-
|
|
|
|
}
|