Skip to content

Commit

Permalink
miniupnpd: create iptables and nftables variant
Browse files Browse the repository at this point in the history
The next OpenWrt stable release aims to use firewall4 by default. As
this uses nftables as backend, miniupnpd will no longer work. Create an
iptables and nftables variant of the miniupnpd package so that miniupnpd
can be used with either firewall variant.

See openwrt#16818 for more info.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
  • Loading branch information
stintel committed Nov 7, 2021
1 parent c7c240b commit 8707a22
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 15 deletions.
58 changes: 43 additions & 15 deletions net/miniupnpd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=miniupnpd
PKG_VERSION:=2.2.3
PKG_RELEASE:=1
PKG_RELEASE:=2

PKG_SOURCE_URL:=https://miniupnp.tuxfamily.org/files
PKG_HASH:=f89c310ce9575183af3fec61af65e548f85114133df8caaaa9e204c13b7a9da5
Expand All @@ -26,15 +26,11 @@ PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/version.mk

define Package/miniupnpd
define Package/miniupnpd/Default
SECTION:=net
CATEGORY:=Network
DEPENDS:= \
+IPV6:ip6tables \
+IPV6:libip6tc \
+iptables \
+libcap-ng \
+libip4tc \
+libmnl \
+libnetfilter-conntrack \
+libuuid
Expand All @@ -43,10 +39,34 @@ define Package/miniupnpd
URL:=https://miniupnp.tuxfamily.org/
endef

define Package/miniupnpd/conffiles
define Package/miniupnpd-iptables
$(call Package/miniupnpd/Default)
DEPENDS+= \
+IPV6:ip6tables \
+IPV6:libip6tc \
+iptables \
+libip4tc
TITLE+= (iptables)
CONFLICTS:=miniupnpd-nftables
VARIANT:=iptables
endef

define Package/miniupnpd-nftables
$(call Package/miniupnpd/Default)
DEPENDS+= \
+nftables
TITLE+= (nftables)
PROVIDES:=miniupnpd
VARIANT:=nftables
endef

define Package/miniupnpd/conffiles/Default
/etc/config/upnpd
endef

Package/miniupnpd-iptables/conffiles = $(Package/miniupnpd/conffiles/Default)
Package/miniupnpd-nftables/conffiles = $(Package/miniupnpd/conffiles/Default)

define Build/Prepare
$(call Build/Prepare/Default)
echo "$(VERSION_NUMBER)" | tr '() ' '_' >$(PKG_BUILD_DIR)/os.openwrt
Expand All @@ -57,26 +77,34 @@ CONFIGURE_ARGS = \
--igd2 \
--leasefile \
--portinuse \
--firewall=iptables \
--firewall=$(BUILD_VARIANT) \
--disable-fork

TARGET_CFLAGS += $(FPIC) -flto
TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed

define Package/miniupnpd/install
define Package/miniupnpd/install/Default
$(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_INSTALL_DIR)/usr/sbin/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))
define Package/miniupnpd-iptables/install
$(call Package/miniupnpd/install/Default,$1)
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_DIR) $(1)/usr/share/miniupnpd
$(INSTALL_BIN) ./files/miniupnpd.defaults.firewall3 $(1)/etc/uci-defaults/99-miniupnpd
$(INSTALL_DATA) ./files/firewall3.include $(1)/usr/share/miniupnpd/firewall.include
endef

define Package/miniupnpd-nftables/install
$(call Package/miniupnpd/install/Default,$1)
endef

$(eval $(call BuildPackage,miniupnpd-iptables))
$(eval $(call BuildPackage,miniupnpd-nftables))
File renamed without changes.
File renamed without changes.

0 comments on commit 8707a22

Please sign in to comment.