From c8476e6f16f8c000aa5e882562994c8129257154 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Sat, 19 Feb 2022 23:49:18 +0100 Subject: [PATCH] miniupnpd.init.d.script: support nftables fixes #594 --- miniupnpd/Changelog.txt | 3 ++- miniupnpd/Makefile.linux_nft | 3 ++- miniupnpd/linux/miniupnpd.init.d.script | 18 ++++++++++++------ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/miniupnpd/Changelog.txt b/miniupnpd/Changelog.txt index a3048b5..6426606 100644 --- a/miniupnpd/Changelog.txt +++ b/miniupnpd/Changelog.txt @@ -1,8 +1,9 @@ -$Id: Changelog.txt,v 1.486 2022/02/19 19:15:24 nanard Exp $ +$Id: Changelog.txt,v 1.487 2022/02/19 22:45:06 nanard Exp $ 2022/02/19: prefer non-reserved over reserved addresses in getifaddr() pf: use external IP for NAT in double NAT setups + miniupnpd.init.d.script: support nftables VERSION 2.3.0 : released on 2022/01/23 diff --git a/miniupnpd/Makefile.linux_nft b/miniupnpd/Makefile.linux_nft index 7864780..65bace9 100644 --- a/miniupnpd/Makefile.linux_nft +++ b/miniupnpd/Makefile.linux_nft @@ -1,5 +1,5 @@ # MiniUPnP project -# (c) 2018-2021 Thomas Bernard +# (c) 2018-2022 Thomas Bernard # (c) 2015 Tomofumi Hayashi # http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/ # Author : Tomofumi Hayashi @@ -129,6 +129,7 @@ install: miniupnpd $(SRCDIR)/miniupnpd.8 $(SRCDIR)/miniupnpd.conf \ $(INSTALL) $(SRCDIR)/netfilter_nft/scripts/nft_removeall.sh $(DESTDIR)$(ETCINSTALLDIR) $(INSTALL) $(SRCDIR)/netfilter_nft/scripts/nft_flush.sh $(DESTDIR)$(ETCINSTALLDIR) $(INSTALL) $(SRCDIR)/netfilter_nft/scripts/nft_delete_chain.sh $(DESTDIR)$(ETCINSTALLDIR) + $(INSTALL) $(SRCDIR)/netfilter_nft/scripts/miniupnpd_functions.sh $(DESTDIR)$(ETCINSTALLDIR) $(INSTALL) --mode=0644 -b $(SRCDIR)/miniupnpd.conf $(DESTDIR)$(ETCINSTALLDIR) sed -i -e "s/^uuid=[-0-9a-f]*/uuid=$(UUID)/" $(DESTDIR)$(ETCINSTALLDIR)/miniupnpd.conf $(INSTALL) -d $(DESTDIR)$(PREFIX)/etc/init.d diff --git a/miniupnpd/linux/miniupnpd.init.d.script b/miniupnpd/linux/miniupnpd.init.d.script index f4ea7e3..a8e2b85 100644 --- a/miniupnpd/linux/miniupnpd.init.d.script +++ b/miniupnpd/linux/miniupnpd.init.d.script @@ -1,8 +1,8 @@ #!/bin/sh -# $Id: miniupnpd.init.d.script,v 1.2 2007/09/23 16:11:12 nanard Exp $ +# $Id: miniupnpd.init.d.script,v 1.4 2022/02/19 22:45:06 nanard Exp $ # MiniUPnP project # author: Thomas Bernard -# website: http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ +# website: http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/ ### BEGIN INIT INFO # Provides: miniupnpd @@ -15,11 +15,17 @@ set -e +ETCPATH=/etc/miniupnpd MINIUPNPD=/usr/sbin/miniupnpd -ARGS='-f /etc/miniupnpd/miniupnpd.conf' +ARGS="-f $ETCPATH/miniupnpd.conf" -IPTABLES_CREATE=/etc/miniupnpd/iptables_init.sh -IPTABLES_REMOVE=/etc/miniupnpd/iptables_removeall.sh +if [ -f $ETCPATH/nft_init.sh ] ; then +IPTABLES_CREATE=$ETCPATH/nft_init.sh +IPTABLES_REMOVE=$ETCPATH/nft_removeall.sh +else +IPTABLES_CREATE=$ETCPATH/iptables_init.sh +IPTABLES_REMOVE=$ETCPATH/iptables_removeall.sh +fi test -f $MINIUPNPD || exit 0 @@ -47,7 +53,7 @@ case "$1" in log_end_msg $? ;; status) - status_of_proc /usr/sbin/miniupnpd miniupnpd + status_of_proc $MINIUPNPD miniupnpd ;; *) log_action_msg "Usage: /etc/init.d/miniupnpd {start|stop|restart|reload|force-reload}"