3b70e33939
- better integration with uci firewall - add options to configure external and internal interface - trigger add/remove of upnp rules with hotplug - use start-stop-daemon in initscript - drop miniupnpd iptables heler scripts git-svn-id: svn://svn.openwrt.org/openwrt/packages@13742 3c298f89-4303-0410-b956-a3cf2f4a3e73
56 lines
1.2 KiB
Bash
56 lines
1.2 KiB
Bash
#!/bin/sh /etc/rc.common
|
|
START=95
|
|
|
|
include /lib/miniupnpd
|
|
|
|
start() {
|
|
local extif
|
|
local intif
|
|
local upload
|
|
local download
|
|
local logging
|
|
|
|
config_load "upnpd"
|
|
config_get extif config external_iface
|
|
config_get intif config internal_iface
|
|
config_get upload config upload
|
|
config_get download config download
|
|
config_get_bool logging config log_output 0
|
|
|
|
scan_interfaces
|
|
config_get extif ${extif:-wan} ifname
|
|
|
|
if [ -n "$extif" ]; then
|
|
logger -t "upnp daemon" "starting ..."
|
|
|
|
upnp_firewall_start
|
|
|
|
local args="-i $extif"
|
|
|
|
for iface in ${intif:-lan}; do
|
|
local ipaddr
|
|
config_get ipaddr "$iface" ipaddr
|
|
[ -n "$ipaddr" ] && append args "-a $ipaddr"
|
|
done
|
|
|
|
append args "-p 5000 -U"
|
|
|
|
[ -n "$upload" -a -n "$download" ] && \
|
|
append args "-B $(($upload * 1024 / 8)) $(($download * 1024 / 8))"
|
|
|
|
if [ "$logging" = "1" ]; then
|
|
eval start-stop-daemon -S -x miniupnpd -- $args -d | logger -t miniupnpd &
|
|
else
|
|
eval start-stop-daemon -S -x miniupnpd -- $args
|
|
fi
|
|
else
|
|
logger -t "upnp daemon" "external interface not found, not starting"
|
|
fi
|
|
}
|
|
|
|
stop() {
|
|
logger -t "upnp daemon" "stopping ..."
|
|
start-stop-daemon -K -q -x miniupnpd -p /var/run/miniupnpd.pid
|
|
upnp_firewall_stop
|
|
}
|