packages/net/miniupnpd/Makefile
Kevin Darbyshire-Bryant 295d77943c miniupnpd: improve hotplug & interface handling
The existing interface selection/detection code was incomprehensible at
worst and convoluted at best.  The uci config file suggested it
understood an external ipv6 interface but in reality the init script
took no notice.  Re-work it so it is at least comprehendible and takes
notice of ipv6 interface details if specified.

Update the hotplug script to use the same interface selection/detection
code as the init script and take note of ipv6 interface selection, only
restarting miniupnpd on interface up events and only if that interface
isn't already known (for that ip class) by miniupnpd.

For me this has solved numerous 'flaky' startup problems, especially
with regard to ipv6.

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
2020-05-25 22:49:03 +01:00

70 lines
2 KiB
Makefile

#
# Copyright (C) 2006-2014 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=miniupnpd
PKG_VERSION:=2.1.20191006
PKG_RELEASE:=5
PKG_SOURCE_URL:=https://miniupnp.tuxfamily.org/files
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_HASH:=218fad7af31f3c22fb4c9db28a55a2a8b5067d41f5b38f52008a057a00d2206d
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
PKG_CPE_ID:=cpe:/a:miniupnp_project:miniupnpd
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/version.mk
define Package/miniupnpd
SECTION:=net
CATEGORY:=Network
DEPENDS:=+iptables +libip4tc +IPV6:libip6tc +IPV6:ip6tables +libuuid
TITLE:=Lightweight UPnP IGD, NAT-PMP & PCP daemon
SUBMENU:=Firewall
URL:=https://miniupnp.tuxfamily.org/
endef
define Package/miniupnpd/conffiles
/etc/config/upnpd
endef
define Build/Prepare
$(call Build/Prepare/Default)
echo "$(VERSION_NUMBER)" | tr '() ' '_' >$(PKG_BUILD_DIR)/os.openwrt
endef
TARGET_CFLAGS += $(FPIC) -flto
TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed
MAKE_FLAGS += \
TARGET_OPENWRT=1 TEST=0 LIBS="" \
CC="$(TARGET_CC) -DIPTABLES_143 -lip4tc -luuid \
$(if $(CONFIG_IPV6),-lip6tc)" \
CONFIG_OPTIONS="--portinuse --leasefile --igd2 \
$(if $(CONFIG_IPV6),--ipv6)" \
-f Makefile.linux miniupnpd
define Package/miniupnpd/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_DIR) $(1)/usr/share/miniupnpd
$(INSTALL_BIN) $(PKG_BUILD_DIR)/miniupnpd $(1)/usr/sbin/miniupnpd
$(INSTALL_BIN) ./files/miniupnpd.init $(1)/etc/init.d/miniupnpd
$(INSTALL_CONF) ./files/upnpd.config $(1)/etc/config/upnpd
$(INSTALL_DATA) ./files/miniupnpd.hotplug $(1)/etc/hotplug.d/iface/50-miniupnpd
$(INSTALL_BIN) ./files/miniupnpd.defaults $(1)/etc/uci-defaults/99-miniupnpd
$(INSTALL_DATA) ./files/firewall.include $(1)/usr/share/miniupnpd/firewall.include
endef
$(eval $(call BuildPackage,miniupnpd))