From 89e63507ac952086989184bce78c7792d7d7cd50 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Tue, 21 Apr 2020 00:13:26 +0200 Subject: [PATCH] Remove FW API detecting code from Makefile (BSD) generate bsdmake.inc --- miniupnpd/.gitignore | 2 ++ miniupnpd/Changelog.txt | 3 +++ miniupnpd/Makefile | 57 +++-------------------------------------- miniupnpd/genconfig.sh | 12 +++++++++ 4 files changed, 20 insertions(+), 54 deletions(-) diff --git a/miniupnpd/.gitignore b/miniupnpd/.gitignore index 986edf1..6c06bd9 100644 --- a/miniupnpd/.gitignore +++ b/miniupnpd/.gitignore @@ -26,3 +26,5 @@ pf/testpfpinhole netfilter/test_nfct_get testminissdp dox/ +bsdmake.inc +upnpstun diff --git a/miniupnpd/Changelog.txt b/miniupnpd/Changelog.txt index 9f04bcd..a1e0929 100644 --- a/miniupnpd/Changelog.txt +++ b/miniupnpd/Changelog.txt @@ -1,5 +1,8 @@ $Id: Changelog.txt,v 1.460 2020/04/12 17:27:31 nanard Exp $ +2020/04/21: + Remove FW API detecting code from Makefile (BSD). generate bsdmake.inc + 2020/04/20: Fix "IGD2 Port Triggering" in update_portmapping() diff --git a/miniupnpd/Makefile b/miniupnpd/Makefile index 78ccc59..f072a37 100644 --- a/miniupnpd/Makefile +++ b/miniupnpd/Makefile @@ -1,6 +1,6 @@ # $Id: Makefile,v 1.96 2020/04/06 09:56:53 nanard Exp $ # MiniUPnP project -# http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ +# http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/ # Author: Thomas Bernard # # Makefile for miniupnpd (MiniUPnP daemon) @@ -34,59 +34,9 @@ DOXYGEN ?= doxygen # OSNAME and FWNAME are used for building OS or FW dependent code. OSNAME != uname -s ARCH != uname -m + .ifndef FWNAME -#.if exists(/usr/include/net/pfvar.h) -#FWNAME = pf -#.else -#FWNAME = ipf -#.endif - -.if $(OSNAME) == "OpenBSD" -FWNAME = pf -.endif - -# better way to find if we are using ipf or pf -.if $(OSNAME) == "FreeBSD" -.if exists(/etc/rc.subr) && exists(/etc/defaults/rc.conf) -FWNAME != . /etc/rc.subr; . /etc/defaults/rc.conf; \ - if [ -f /etc/rc.conf ] ; then . /etc/rc.conf ; fi ; \ - if checkyesno ipfilter_enable; then \ - echo "ipf"; elif checkyesno pf_enable; then \ - echo "pf"; elif checkyesno firewall_enable; then \ - echo "ipfw"; else echo "pf"; fi -.else -FWNAME = pf -.endif -.endif - -.if $(OSNAME) == "NetBSD" -.if exists(/etc/rc.subr) && exists(/etc/rc.conf) -FWNAME != . /etc/rc.subr; . /etc/rc.conf; \ - if checkyesno pf; then \ - echo "pf"; elif checkyesno ipfilter; then \ - echo "ipf"; else echo "pf"; fi -.else -FWNAME = pf -.endif -.endif - -.if $(OSNAME) == "DragonFly" -.if exists(/etc/rc.subr) && exists(/etc/rc.conf) -FWNAME != . /etc/rc.subr; . /etc/rc.conf; \ - if checkyesno pf; then \ - echo "pf"; elif checkyesno ipfilter; then \ - echo "ipf"; else echo "pf"; fi -.else -FWNAME = pf -.endif -.endif - -.if $(OSNAME) == "Darwin" -# Firewall is ipfw up to OS X 10.6 Snow Leopard -# and pf since OS X 10.7 Lion (Darwin 11.0) -FWNAME != [ `uname -r | cut -d. -f1` -ge 11 ] && echo "pf" || echo "ipfw" -.endif - +.include "bsdmake.inc" .endif # Solaris specific CFLAGS @@ -284,4 +234,3 @@ config.h: genconfig.sh VERSION # $(CC) $(CFLAGS) -c -o $(.TARGET) $(.IMPSRC) - diff --git a/miniupnpd/genconfig.sh b/miniupnpd/genconfig.sh index 6f77c72..5f92cb6 100755 --- a/miniupnpd/genconfig.sh +++ b/miniupnpd/genconfig.sh @@ -75,6 +75,8 @@ LOG_MINIUPNPD="LOG_DAEMON" # detecting the OS name and version OS_NAME=`uname -s` OS_VERSION=`uname -r` +# set BSDMAKE to 1 to use BSD make, to 0 to use GNU make +BSDMAKE=0 # pfSense special case if [ -f /etc/platform ]; then @@ -156,6 +158,7 @@ echo "" >> ${CONFIGFILE} # OS Specific stuff case $OS_NAME in OpenBSD) + BSDMAKE=1 MAJORVER=`echo $OS_VERSION | cut -d. -f1` MINORVER=`echo $OS_VERSION | cut -d. -f2` #echo "OpenBSD majorversion=$MAJORVER minorversion=$MINORVER" @@ -191,6 +194,7 @@ case $OS_NAME in fi ;; FreeBSD | GNU/kFreeBSD) + BSDMAKE=1 VER=`grep '#define __FreeBSD_version' /usr/include/sys/param.h | awk '{print $3}'` if [ $VER -ge 700049 ]; then echo "#define PFRULE_INOUT_COUNTS" >> ${CONFIGFILE} @@ -226,6 +230,7 @@ case $OS_NAME in V6SOCKETS_ARE_V6ONLY=`sysctl -n net.inet6.ip6.v6only` ;; pfSense) + BSDMAKE=1 # we need to detect if PFRULE_INOUT_COUNTS macro is needed FW=pf echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE} @@ -233,6 +238,7 @@ case $OS_NAME in V6SOCKETS_ARE_V6ONLY=`sysctl -n net.inet6.ip6.v6only` ;; NetBSD) + BSDMAKE=1 if [ -f /etc/rc.subr ] && [ -f /etc/rc.conf ] ; then # source file with handy subroutines like checkyesno . /etc/rc.subr @@ -252,6 +258,7 @@ case $OS_NAME in OS_URL=http://www.netbsd.org/ ;; DragonFly) + BSDMAKE=1 if [ -f /etc/rc.subr ] && [ -f /etc/rc.conf ] ; then # source file with handy subroutines like checkyesno . /etc/rc.subr @@ -277,6 +284,7 @@ case $OS_NAME in OS_URL=http://www.dragonflybsd.org/ ;; SunOS) + BSDMAKE=1 echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE} FW=ipf echo "#define LOG_PERROR 0" >> ${CONFIGFILE} @@ -425,6 +433,10 @@ case $FW in ;; esac +if [ $BSDMAKE -ne 0 ] || [ "$OS_NAME" = "Darwin" ] || [ "$OS_NAME" = "SunOS" ] ; then + echo "FWNAME = $FW" > bsdmake.inc +fi + # UUID API case $OS_NAME in OpenWRT)