summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Barth2014-10-15 21:05:34 +0000
committerSteven Barth2014-10-15 21:05:34 +0000
commit8bc38fccc73b40e9599b897e335f2e7a5a67e879 (patch)
tree8dcaea46ece728fa927332ed573a59174eaa9bc0
parent93f7d5cacb64aa229e5aa17e95d0b2761ab2e675 (diff)
downloadrouting-8bc38fccc73b40e9599b897e335f2e7a5a67e879.tar.gz
miniupnpd: avoid unnecessary restarts, add SPDX tag
-rw-r--r--miniupnpd/Makefile3
-rw-r--r--miniupnpd/files/miniupnpd.hotplug29
2 files changed, 20 insertions, 12 deletions
diff --git a/miniupnpd/Makefile b/miniupnpd/Makefile
index 139320f..4575dad 100644
--- a/miniupnpd/Makefile
+++ b/miniupnpd/Makefile
@@ -9,13 +9,14 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=miniupnpd
PKG_VERSION:=1.8.20140906
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE_URL:=http://miniupnp.free.fr/files
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_MD5SUM:=72a68c5757031d906a555f84e9a2a8f2
PKG_MAINTAINER:=Markus Stenberg <fingon@iki.fi>
+PKG_LICENSE:=BSD-3-Clause
include $(INCLUDE_DIR)/package.mk
diff --git a/miniupnpd/files/miniupnpd.hotplug b/miniupnpd/files/miniupnpd.hotplug
index 09a4913..8b643f1 100644
--- a/miniupnpd/files/miniupnpd.hotplug
+++ b/miniupnpd/files/miniupnpd.hotplug
@@ -16,22 +16,29 @@ fi
[ ! "$ACTION" = "ifup" ] && service_check /usr/sbin/miniupnpd && exit 0
-# DEVICE is set only in ifup as of 20140625 netifd
-[ -z "$DEVICE" ] && network_get_device DEVICE $INTERFACE
-
local iface
-local ext_iface
-local ext_iface6
+local ifname
+local tmpconf="/var/etc/miniupnpd.conf"
+local extiface=$(uci get upnpd.config.external_iface)
+local extzone=$(uci get upnpd.config.external_zone)
. /lib/functions/network.sh
-network_find_wan ext_iface
-network_find_wan6 ext_iface6
-for iface in $ext_iface $ext_iface6 $(uci_get upnpd config internal_iface; uci_get upnpd config external_iface); do
+for iface in $(uci get upnpd.config.internal_iface); do
network_get_device device $iface
[ "$DEVICE" = "$device" ] && /etc/init.d/miniupnpd restart && exit 0
done
-for device in $(fw3 -q zone `uci_get upnpd config external_zone`); do
- [ "$DEVICE" = "$device" ] && /etc/init.d/miniupnpd restart && exit 0
-done
+
+if [ -z "$extiface" ] ; then
+ # manual external zone (if dynamically find interfaces
+ # belonging to it) overrides network_find_wan*
+ if [ -n "$extzone" ] ; then
+ ifname=$(fw3 -q zone $extzone | head -1)
+ fi
+ [ -n "$extiface" ] || network_find_wan extiface
+ [ -n "$extiface" ] || network_find_wan6 extiface
+fi
+
+[ -n "$ifname" ] || network_get_device ifname ${extiface}
+grep -q "ext_ifname=$ifname" $tmpconf || /etc/init.d/miniupnpd restart