From: Steven Barth Date: Wed, 15 Oct 2014 21:05:34 +0000 (+0200) Subject: miniupnpd: avoid unnecessary restarts, add SPDX tag X-Git-Url: http://git.openwrt.org/?p=feed%2Frouting.git;a=commitdiff_plain;h=8bc38fccc73b40e9599b897e335f2e7a5a67e879 miniupnpd: avoid unnecessary restarts, add SPDX tag --- 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 +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