[packages] git: update to 2.0.0
[packages.git] / net / miniupnpd / files / miniupnpd.init
index c29e672..ef67d72 100644 (file)
@@ -57,10 +57,11 @@ upnpd_write_bool() {
        fi
 }
 
-start() {
-       type miniupnpd_add_rules >/dev/null 2>/dev/null || \
-               ACTION=- . /etc/hotplug.d/firewall/50-miniupnpd
+boot() {
+       return
+}
 
+start() {
        config_load "upnpd"
        local extiface intiface upload download logging secure enabled natpmp
        local extip port usesysuptime conffile serial_number model_number
@@ -86,11 +87,10 @@ start() {
 
        local args
 
-       include /lib/network
-       scan_interfaces
+       . /lib/functions/network.sh
 
        local ifname
-       config_get ifname ${extiface:-wan} ifname
+       network_get_device ifname ${extiface:-wan}
 
        if [ -n "$conffile" ]; then
                args="-f $conffile"
@@ -106,11 +106,10 @@ start() {
 
                local iface
                for iface in ${intiface:-lan}; do
-                       local ipaddr netmask
-                       config_get ipaddr "$iface" ipaddr
-                       config_get netmask "$iface" netmask "255.255.255.0"
-                       [ -n "$ipaddr" ] && \
-                               echo "listening_ip=$ipaddr/$netmask" >>$tmpconf
+                       local device
+                       network_get_device device "$iface" && {
+                               echo "listening_ip=$device" >>$tmpconf
+                       }
                done
 
                [ "$port" != "auto" ] && \
@@ -163,12 +162,7 @@ start() {
 
        if [ -n "$ifname" ]; then
                # start firewall
-               local zone
-               config_load firewall
-               config_get zone core "${extiface:-wan}_zone"
-
-           [ -n "$zone" ] && \
-                       miniupnpd_add_rules "$zone" "${extiface:-wan}" "$ifname"
+               iptables -L MINIUPNPD >/dev/null 2>/dev/null || fw3 reload
 
                if [ "$logging" = "1" ]; then
                        SERVICE_DAEMONIZE=1 \
@@ -185,13 +179,6 @@ start() {
 stop() {
        service_stop /usr/sbin/miniupnpd
 
-       type miniupnpd_remove_rules >/dev/null 2>/dev/null || \
-               ACTION=- . /etc/hotplug.d/firewall/50-miniupnpd
-
-       miniupnpd_remove_rules
-
        iptables -t nat -F MINIUPNPD 2>/dev/null
-       iptables -t nat -X MINIUPNPD 2>/dev/null
        iptables -t filter -F MINIUPNPD 2>/dev/null
-       iptables -t filter -X MINIUPNPD 2>/dev/null
 }