2011-09-28 19:13:20 +00:00
|
|
|
#! /bin/sh
|
2013-05-03 11:17:07 +00:00
|
|
|
# $Id: genconfig.sh,v 1.63 2013/05/03 09:30:10 nanard Exp $
|
2011-09-28 19:13:20 +00:00
|
|
|
# miniupnp daemon
|
|
|
|
# http://miniupnp.free.fr or http://miniupnp.tuxfamily.org/
|
2012-04-14 22:35:31 +00:00
|
|
|
# (c) 2006-2012 Thomas Bernard
|
2011-09-28 19:13:20 +00:00
|
|
|
# This software is subject to the conditions detailed in the
|
|
|
|
# LICENCE file provided within the distribution
|
|
|
|
|
2012-04-14 22:35:31 +00:00
|
|
|
for argv; do
|
|
|
|
case "$argv" in
|
|
|
|
--ipv6) IPV6=1 ;;
|
|
|
|
--igd2) IGD2=1 ;;
|
|
|
|
--strict) STRICT=1 ;;
|
|
|
|
--leasefile) LEASEFILE=1 ;;
|
2013-07-09 13:36:53 +00:00
|
|
|
--pcp) PCP=1 ;;
|
|
|
|
--pcp-peer)
|
|
|
|
PCP=1
|
|
|
|
PCP_PEER=1
|
|
|
|
;;
|
2012-04-14 22:35:31 +00:00
|
|
|
--help|-h)
|
|
|
|
echo "Usage : $0 [options]"
|
|
|
|
echo " --ipv6 enable IPv6"
|
|
|
|
echo " --igd2 build an IGDv2 instead of an IGDv1"
|
|
|
|
echo " --strict be more strict regarding compliance with UPnP specifications"
|
|
|
|
echo " --leasefile enable lease file"
|
2013-07-09 13:36:53 +00:00
|
|
|
echo " --pcp enable PCP"
|
|
|
|
echo " --pcp-peer enable PCP PEER operation"
|
2012-04-14 22:35:31 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Option not recognized : $argv"
|
|
|
|
echo "use -h option to display help"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2011-09-28 19:13:20 +00:00
|
|
|
RM="rm -f"
|
2013-04-24 17:04:00 +00:00
|
|
|
MV="mv"
|
|
|
|
CONFIGFILE="config.h.tmp"
|
|
|
|
CONFIGFILE_FINAL="config.h"
|
2012-09-20 20:52:51 +00:00
|
|
|
CONFIGMACRO="CONFIG_H_INCLUDED"
|
2011-09-28 19:13:20 +00:00
|
|
|
|
|
|
|
# version reported in XML descriptions
|
|
|
|
#UPNP_VERSION=20070827
|
|
|
|
UPNP_VERSION=`date +"%Y%m%d"`
|
|
|
|
# Facility to syslog
|
|
|
|
LOG_MINIUPNPD="LOG_DAEMON"
|
|
|
|
|
|
|
|
# detecting the OS name and version
|
|
|
|
OS_NAME=`uname -s`
|
|
|
|
OS_VERSION=`uname -r`
|
|
|
|
|
|
|
|
# pfSense special case
|
|
|
|
if [ -f /etc/platform ]; then
|
|
|
|
if [ `cat /etc/platform` = "pfSense" ]; then
|
|
|
|
OS_NAME=pfSense
|
|
|
|
OS_VERSION=`cat /etc/version`
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# OpenWRT special case
|
|
|
|
if [ -f ./os.openwrt ]; then
|
|
|
|
OS_NAME=OpenWRT
|
|
|
|
OS_VERSION=$(cat ./os.openwrt)
|
|
|
|
fi
|
|
|
|
|
2012-07-10 21:19:08 +00:00
|
|
|
# AstLinux special case
|
|
|
|
if [ -f ./os.astlinux ]; then
|
|
|
|
OS_NAME=AstLinux
|
|
|
|
OS_VERSION=$(cat ./os.astlinux)
|
|
|
|
fi
|
|
|
|
|
2012-01-20 21:53:15 +00:00
|
|
|
# Tomato USB special case
|
|
|
|
if [ -f ../shared/tomato_version ]; then
|
|
|
|
OS_NAME=Tomato
|
|
|
|
OS_VERSION="Tomato $(cat ../shared/tomato_version)"
|
|
|
|
fi
|
|
|
|
|
2011-09-28 19:13:20 +00:00
|
|
|
${RM} ${CONFIGFILE}
|
|
|
|
|
|
|
|
echo "/* MiniUPnP Project" >> ${CONFIGFILE}
|
|
|
|
echo " * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/" >> ${CONFIGFILE}
|
2012-04-14 22:35:31 +00:00
|
|
|
echo " * (c) 2006-2012 Thomas Bernard" >> ${CONFIGFILE}
|
2012-05-09 21:32:05 +00:00
|
|
|
echo " * generated by $0 on `date`" >> ${CONFIGFILE}
|
|
|
|
echo " * using command line options $* */" >> ${CONFIGFILE}
|
2011-09-28 19:13:20 +00:00
|
|
|
echo "#ifndef $CONFIGMACRO" >> ${CONFIGFILE}
|
|
|
|
echo "#define $CONFIGMACRO" >> ${CONFIGFILE}
|
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
echo "#include <inttypes.h>" >> ${CONFIGFILE}
|
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
echo "#define MINIUPNPD_VERSION \"`cat VERSION`\"" >> ${CONFIGFILE}
|
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
echo "#define UPNP_VERSION \"$UPNP_VERSION\"" >> ${CONFIGFILE}
|
|
|
|
|
|
|
|
# OS Specific stuff
|
|
|
|
case $OS_NAME in
|
|
|
|
OpenBSD)
|
|
|
|
MAJORVER=`echo $OS_VERSION | cut -d. -f1`
|
|
|
|
MINORVER=`echo $OS_VERSION | cut -d. -f2`
|
|
|
|
#echo "OpenBSD majorversion=$MAJORVER minorversion=$MINORVER"
|
|
|
|
# rtableid was introduced in OpenBSD 4.0
|
|
|
|
if [ $MAJORVER -ge 4 ]; then
|
|
|
|
echo "#define PFRULE_HAS_RTABLEID" >> ${CONFIGFILE}
|
|
|
|
fi
|
|
|
|
# from the 3.8 version, packets and bytes counters are double : in/out
|
|
|
|
if [ \( $MAJORVER -ge 4 \) -o \( $MAJORVER -eq 3 -a $MINORVER -ge 8 \) ]; then
|
|
|
|
echo "#define PFRULE_INOUT_COUNTS" >> ${CONFIGFILE}
|
|
|
|
fi
|
|
|
|
# from the 4.7 version, new pf
|
|
|
|
if [ \( $MAJORVER -ge 5 \) -o \( $MAJORVER -eq 4 -a $MINORVER -ge 7 \) ]; then
|
|
|
|
echo "#define PF_NEWSTYLE" >> ${CONFIGFILE}
|
|
|
|
fi
|
2012-01-20 22:00:37 +00:00
|
|
|
# onrdomain was introduced in OpenBSD 5.0
|
|
|
|
if [ $MAJORVER -ge 5 ]; then
|
|
|
|
echo "#define PFRULE_HAS_ONRDOMAIN" >> ${CONFIGFILE}
|
|
|
|
fi
|
2011-09-28 19:13:20 +00:00
|
|
|
FW=pf
|
|
|
|
echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
|
|
|
|
OS_URL=http://www.openbsd.org/
|
|
|
|
;;
|
|
|
|
FreeBSD)
|
|
|
|
VER=`grep '#define __FreeBSD_version' /usr/include/sys/param.h | awk '{print $3}'`
|
|
|
|
if [ $VER -ge 700049 ]; then
|
|
|
|
echo "#define PFRULE_INOUT_COUNTS" >> ${CONFIGFILE}
|
|
|
|
fi
|
|
|
|
# new way to see which one to use PF or IPF.
|
|
|
|
# see http://miniupnp.tuxfamily.org/forum/viewtopic.php?p=957
|
2012-05-31 13:33:16 +00:00
|
|
|
if [ -f /etc/rc.subr ] && [ -f /etc/rc.conf ] ; then
|
|
|
|
# source file with handy subroutines like checkyesno
|
|
|
|
. /etc/rc.subr
|
|
|
|
# source config file so we can probe vars
|
|
|
|
. /etc/rc.conf
|
|
|
|
if checkyesno ipfilter_enable; then
|
|
|
|
echo "Using ipf"
|
2011-09-28 19:13:20 +00:00
|
|
|
FW=ipf
|
2012-05-31 13:33:16 +00:00
|
|
|
elif checkyesno pf_enable; then
|
|
|
|
echo "Using pf"
|
|
|
|
FW=pf
|
|
|
|
elif checkyesno firewall_enable; then
|
|
|
|
echo "Using ifpw"
|
|
|
|
FW=ipfw
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ -z $FW ] ; then
|
2012-04-14 22:35:31 +00:00
|
|
|
echo "Could not detect usage of ipf, pf, ipfw. Compiling for pf by default"
|
2011-09-28 19:13:20 +00:00
|
|
|
FW=pf
|
|
|
|
fi
|
|
|
|
echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
|
|
|
|
OS_URL=http://www.freebsd.org/
|
|
|
|
;;
|
|
|
|
pfSense)
|
|
|
|
# we need to detect if PFRULE_INOUT_COUNTS macro is needed
|
|
|
|
FW=pf
|
|
|
|
echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
|
|
|
|
OS_URL=http://www.pfsense.com/
|
|
|
|
;;
|
|
|
|
NetBSD)
|
2012-05-31 13:33:16 +00:00
|
|
|
if [ -f /etc/rc.subr ] && [ -f /etc/rc.conf ] ; then
|
|
|
|
# source file with handy subroutines like checkyesno
|
|
|
|
. /etc/rc.subr
|
|
|
|
# source config file so we can probe vars
|
|
|
|
. /etc/rc.conf
|
|
|
|
if checkyesno pf; then
|
|
|
|
FW=pf
|
|
|
|
elif checkyesno ipfilter; then
|
|
|
|
FW=ipf
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ -z $FW ] ; then
|
2011-09-28 19:13:20 +00:00
|
|
|
echo "Could not detect ipf nor pf, defaulting to pf."
|
|
|
|
FW=pf
|
|
|
|
fi
|
|
|
|
echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
|
|
|
|
OS_URL=http://www.netbsd.org/
|
|
|
|
;;
|
|
|
|
DragonFly)
|
2012-05-31 13:33:16 +00:00
|
|
|
if [ -f /etc/rc.subr ] && [ -f /etc/rc.conf ] ; then
|
|
|
|
# source file with handy subroutines like checkyesno
|
|
|
|
. /etc/rc.subr
|
|
|
|
# source config file so we can probe vars
|
|
|
|
. /etc/rc.conf
|
|
|
|
if checkyesno pf; then
|
|
|
|
FW=pf
|
|
|
|
elif checkyesno ipfilter; then
|
|
|
|
FW=ipf
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ -z $FW ] ; then
|
2011-09-28 19:13:20 +00:00
|
|
|
echo "Could not detect ipf nor pf, defaulting to pf."
|
|
|
|
FW=pf
|
|
|
|
fi
|
|
|
|
echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
|
|
|
|
OS_URL=http://www.dragonflybsd.org/
|
|
|
|
;;
|
|
|
|
SunOS)
|
|
|
|
echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
|
|
|
|
FW=ipf
|
|
|
|
echo "#define LOG_PERROR 0" >> ${CONFIGFILE}
|
|
|
|
echo "#define SOLARIS_KSTATS 1" >> ${CONFIGFILE}
|
2012-05-24 16:52:27 +00:00
|
|
|
# solaris 10 does not define u_int64_t ?
|
|
|
|
# but it does define uint64_t
|
|
|
|
echo "typedef uint64_t u_int64_t;" >> ${CONFIGFILE}
|
2011-09-28 19:13:20 +00:00
|
|
|
OS_URL=http://www.sun.com/solaris/
|
|
|
|
;;
|
|
|
|
Linux)
|
|
|
|
OS_URL=http://www.kernel.org/
|
|
|
|
KERNVERA=`echo $OS_VERSION | awk -F. '{print $1}'`
|
|
|
|
KERNVERB=`echo $OS_VERSION | awk -F. '{print $2}'`
|
|
|
|
KERNVERC=`echo $OS_VERSION | awk -F. '{print $3}'`
|
|
|
|
KERNVERD=`echo $OS_VERSION | awk -F. '{print $4}'`
|
|
|
|
#echo "$KERNVERA.$KERNVERB.$KERNVERC.$KERNVERD"
|
|
|
|
# Debian GNU/Linux special case
|
|
|
|
if [ -f /etc/debian_version ]; then
|
|
|
|
OS_NAME=Debian
|
|
|
|
OS_VERSION=`cat /etc/debian_version`
|
|
|
|
OS_URL=http://www.debian.org/
|
|
|
|
fi
|
|
|
|
# same thing for Gentoo linux
|
|
|
|
if [ -f /etc/gentoo-release ]; then
|
|
|
|
OS_NAME=Gentoo
|
|
|
|
OS_VERSION=`cat /etc/gentoo-release`
|
|
|
|
OS_URL=http://www.gentoo.org/
|
|
|
|
fi
|
|
|
|
# use lsb_release (Linux Standard Base) when available
|
|
|
|
LSB_RELEASE=`which lsb_release`
|
|
|
|
if [ 0 -eq $? ]; then
|
|
|
|
OS_NAME=`${LSB_RELEASE} -i -s`
|
|
|
|
OS_VERSION=`${LSB_RELEASE} -r -s`
|
|
|
|
case $OS_NAME in
|
|
|
|
Debian)
|
|
|
|
OS_URL=http://www.debian.org/
|
|
|
|
OS_VERSION=`${LSB_RELEASE} -c -s`
|
|
|
|
;;
|
|
|
|
Ubuntu)
|
|
|
|
OS_URL=http://www.ubuntu.com/
|
|
|
|
OS_VERSION=`${LSB_RELEASE} -c -s`
|
|
|
|
;;
|
|
|
|
Gentoo)
|
|
|
|
OS_URL=http://www.gentoo.org/
|
|
|
|
;;
|
2013-05-03 11:17:07 +00:00
|
|
|
arch)
|
|
|
|
OS_URL=http://www.archlinux.org/
|
|
|
|
OS_VERSION=`uname -r`
|
|
|
|
;;
|
2011-09-28 19:13:20 +00:00
|
|
|
esac
|
|
|
|
fi
|
|
|
|
echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
|
|
|
|
FW=netfilter
|
|
|
|
;;
|
|
|
|
OpenWRT)
|
|
|
|
OS_URL=http://www.openwrt.org/
|
|
|
|
echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
|
|
|
|
FW=netfilter
|
2012-01-20 21:53:15 +00:00
|
|
|
;;
|
2012-07-10 21:19:08 +00:00
|
|
|
AstLinux)
|
|
|
|
OS_URL=http://www.astlinux.org/
|
|
|
|
echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
|
|
|
|
FW=netfilter
|
|
|
|
;;
|
2012-01-20 21:53:15 +00:00
|
|
|
Tomato)
|
|
|
|
OS_NAME=UPnP
|
|
|
|
OS_URL=http://tomatousb.org/
|
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
echo "#include <tomato_config.h>" >> ${CONFIGFILE}
|
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
echo "#ifdef LINUX26" >> ${CONFIGFILE}
|
|
|
|
echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
|
|
|
|
echo "#endif" >> ${CONFIGFILE}
|
|
|
|
echo "#ifdef TCONFIG_IPV6" >> ${CONFIGFILE}
|
|
|
|
echo "#define ENABLE_IPV6" >> ${CONFIGFILE}
|
|
|
|
echo "#endif" >> ${CONFIGFILE}
|
|
|
|
FW=netfilter
|
2011-09-28 19:13:20 +00:00
|
|
|
;;
|
|
|
|
Darwin)
|
|
|
|
echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
|
|
|
|
FW=ipfw
|
|
|
|
OS_URL=http://developer.apple.com/macosx
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unknown OS : $OS_NAME"
|
|
|
|
echo "Please contact the author at http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/."
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2012-04-14 22:35:31 +00:00
|
|
|
case $FW in
|
|
|
|
pf)
|
|
|
|
echo "#define USE_PF 1" >> ${CONFIGFILE}
|
|
|
|
;;
|
|
|
|
ipf)
|
|
|
|
echo "#define USE_IPF 1" >> ${CONFIGFILE}
|
|
|
|
;;
|
|
|
|
ipfw)
|
|
|
|
echo "#define USE_IPFW 1" >> ${CONFIGFILE}
|
|
|
|
;;
|
|
|
|
netfilter)
|
|
|
|
echo "#define USE_NETFILTER 1" >> ${CONFIGFILE}
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unknown Firewall/packet filtering software [$FW]"
|
|
|
|
echo "Please contact the author at http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/."
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2011-09-28 19:13:20 +00:00
|
|
|
echo "Configuring compilation for [$OS_NAME] [$OS_VERSION] with [$FW] firewall software."
|
|
|
|
echo "Please edit config.h for more compilation options."
|
|
|
|
|
|
|
|
# define SUPPORT_REMOTEHOST if the FW related code really supports setting
|
|
|
|
# a RemoteHost
|
|
|
|
if [ \( "$FW" = "netfilter" \) -o \( "$FW" = "pf" \) -o \( "$FW" = "ipfw" \) ] ; then
|
|
|
|
echo "#define SUPPORT_REMOTEHOST" >> ${CONFIGFILE}
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
echo "#define OS_NAME \"$OS_NAME\"" >> ${CONFIGFILE}
|
|
|
|
echo "#define OS_VERSION \"$OS_NAME/$OS_VERSION\"" >> ${CONFIGFILE}
|
|
|
|
echo "#define OS_URL \"${OS_URL}\"" >> ${CONFIGFILE}
|
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
|
|
|
|
echo "/* syslog facility to be used by miniupnpd */" >> ${CONFIGFILE}
|
|
|
|
echo "#define LOG_MINIUPNPD ${LOG_MINIUPNPD}" >> ${CONFIGFILE}
|
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
|
|
|
|
echo "/* Uncomment the following line to allow miniupnpd to be" >> ${CONFIGFILE}
|
|
|
|
echo " * controlled by miniupnpdctl */" >> ${CONFIGFILE}
|
|
|
|
echo "/*#define USE_MINIUPNPDCTL*/" >> ${CONFIGFILE}
|
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
|
|
|
|
echo "/* Comment the following line to disable NAT-PMP operations */" >> ${CONFIGFILE}
|
|
|
|
echo "#define ENABLE_NATPMP" >> ${CONFIGFILE}
|
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
|
2013-07-09 13:36:53 +00:00
|
|
|
if [ -n "$PCP" ]; then
|
|
|
|
echo "/* Comment the following line to disable PCP operations */" >> ${CONFIGFILE}
|
|
|
|
echo "#define ENABLE_PCP" >> ${CONFIGFILE}
|
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
else
|
|
|
|
echo "/* Uncomment the following line to enable PCP operations */" >> ${CONFIGFILE}
|
|
|
|
echo "/*#define ENABLE_PCP*/" >> ${CONFIGFILE}
|
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "#ifdef ENABLE_PCP" >> ${CONFIGFILE}
|
|
|
|
if [ -n "$PCP_PEER" ]; then
|
|
|
|
echo "/* Comment the following line to disable PCP PEER operation */" >> ${CONFIGFILE}
|
|
|
|
echo "#define PCP_PEER" >> ${CONFIGFILE}
|
|
|
|
else
|
|
|
|
echo "/* Uncomment the following line to enable PCP PEER operation */" >> ${CONFIGFILE}
|
|
|
|
echo "/*#define PCP_PEER*/" >> ${CONFIGFILE}
|
|
|
|
fi
|
|
|
|
echo "#ifdef PCP_PEER" >> ${CONFIGFILE}
|
|
|
|
echo "/*#define PCP_FLOWP*/" >> ${CONFIGFILE}
|
|
|
|
echo "#endif //PCP_PEER" >> ${CONFIGFILE}
|
|
|
|
echo "/*#define PCP_SADSCP*/" >> ${CONFIGFILE}
|
|
|
|
echo "#endif //ENABLE_PCP" >> ${CONFIGFILE}
|
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
|
2011-09-28 19:13:20 +00:00
|
|
|
echo "/* Uncomment the following line to enable generation of" >> ${CONFIGFILE}
|
|
|
|
echo " * filter rules with pf */" >> ${CONFIGFILE}
|
|
|
|
echo "/*#define PF_ENABLE_FILTER_RULES*/">> ${CONFIGFILE}
|
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
|
|
|
|
echo "/* Uncomment the following line to enable caching of results of" >> ${CONFIGFILE}
|
|
|
|
echo " * the getifstats() function */" >> ${CONFIGFILE}
|
|
|
|
echo "/*#define ENABLE_GETIFSTATS_CACHING*/" >> ${CONFIGFILE}
|
|
|
|
echo "/* The cache duration is indicated in seconds */" >> ${CONFIGFILE}
|
|
|
|
echo "#define GETIFSTATS_CACHING_DURATION 2" >> ${CONFIGFILE}
|
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
|
|
|
|
echo "/* Uncomment the following line to enable multiple external ip support */" >> ${CONFIGFILE}
|
|
|
|
echo "/* note : That is EXPERIMENTAL, do not use that unless you know perfectly what you are doing */" >> ${CONFIGFILE}
|
|
|
|
echo "/* Dynamic external ip adresses are not supported when this option is enabled." >> ${CONFIGFILE}
|
|
|
|
echo " * Also note that you would need to configure your .conf file accordingly. */" >> ${CONFIGFILE}
|
|
|
|
echo "/*#define MULTIPLE_EXTERNAL_IP*/" >> ${CONFIGFILE}
|
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
|
|
|
|
echo "/* Comment the following line to use home made daemonize() func instead" >> ${CONFIGFILE}
|
|
|
|
echo " * of BSD daemon() */" >> ${CONFIGFILE}
|
|
|
|
echo "#define USE_DAEMON" >> ${CONFIGFILE}
|
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
|
|
|
|
echo "/* Uncomment the following line to enable lease file support */" >> ${CONFIGFILE}
|
2012-04-14 22:35:31 +00:00
|
|
|
if [ -n "$LEASEFILE" ] ; then
|
|
|
|
echo "#define ENABLE_LEASEFILE" >> ${CONFIGFILE}
|
|
|
|
else
|
|
|
|
echo "/*#define ENABLE_LEASEFILE*/" >> ${CONFIGFILE}
|
|
|
|
fi
|
2011-09-28 19:13:20 +00:00
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
|
|
|
|
echo "/* Define one or none of the two following macros in order to make some" >> ${CONFIGFILE}
|
|
|
|
echo " * clients happy. It will change the XML Root Description of the IGD." >> ${CONFIGFILE}
|
|
|
|
echo " * Enabling the Layer3Forwarding Service seems to be the more compatible" >> ${CONFIGFILE}
|
|
|
|
echo " * option. */" >> ${CONFIGFILE}
|
|
|
|
echo "/*#define HAS_DUMMY_SERVICE*/" >> ${CONFIGFILE}
|
|
|
|
echo "#define ENABLE_L3F_SERVICE" >> ${CONFIGFILE}
|
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
|
|
|
|
echo "/* Enable IP v6 support */" >> ${CONFIGFILE}
|
2012-04-14 22:35:31 +00:00
|
|
|
if [ -n "$IPV6" ]; then
|
|
|
|
echo "#define ENABLE_IPV6" >> ${CONFIGFILE}
|
|
|
|
else
|
|
|
|
echo "/*#define ENABLE_IPV6*/" >> ${CONFIGFILE}
|
|
|
|
fi
|
2011-09-28 19:13:20 +00:00
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
|
|
|
|
echo "/* Enable the support of IGD v2 specification." >> ${CONFIGFILE}
|
|
|
|
echo " * This is not fully tested yet and can cause incompatibilities with some" >> ${CONFIGFILE}
|
|
|
|
echo " * control points, so enable with care. */" >> ${CONFIGFILE}
|
2012-04-14 22:35:31 +00:00
|
|
|
if [ -n "$IGD2" ]; then
|
|
|
|
echo "#define IGD_V2" >> ${CONFIGFILE}
|
|
|
|
else
|
|
|
|
echo "/*#define IGD_V2*/" >> ${CONFIGFILE}
|
|
|
|
fi
|
2011-09-28 19:13:20 +00:00
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
|
|
|
|
echo "#ifdef IGD_V2" >> ${CONFIGFILE}
|
|
|
|
echo "/* Enable DeviceProtection service (IGDv2) */" >> ${CONFIGFILE}
|
|
|
|
echo "#define ENABLE_DP_SERVICE" >> ${CONFIGFILE}
|
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
echo "/* Enable WANIPv6FirewallControl service (IGDv2). needs IPv6 */" >> ${CONFIGFILE}
|
|
|
|
echo "#ifdef ENABLE_IPV6" >> ${CONFIGFILE}
|
|
|
|
echo "#define ENABLE_6FC_SERVICE" >> ${CONFIGFILE}
|
|
|
|
echo "#endif /* ENABLE_IPV6 */" >> ${CONFIGFILE}
|
|
|
|
echo "#endif /* IGD_V2 */" >> ${CONFIGFILE}
|
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
|
|
|
|
echo "/* UPnP Events support. Working well enough to be enabled by default." >> ${CONFIGFILE}
|
|
|
|
echo " * It can be disabled to save a few bytes. */" >> ${CONFIGFILE}
|
|
|
|
echo "#define ENABLE_EVENTS" >> ${CONFIGFILE}
|
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
|
|
|
|
echo "/* include interface name in pf and ipf rules */" >> ${CONFIGFILE}
|
|
|
|
echo "#define USE_IFNAME_IN_RULES" >> ${CONFIGFILE}
|
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
|
|
|
|
echo "/* Experimental NFQUEUE support. */" >> ${CONFIGFILE}
|
|
|
|
echo "/*#define ENABLE_NFQUEUE*/" >> ${CONFIGFILE}
|
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
|
|
|
|
echo "/* Enable to make MiniUPnPd more strict about UPnP conformance" >> ${CONFIGFILE}
|
|
|
|
echo " * and the messages it receives from control points */" >> ${CONFIGFILE}
|
2012-04-14 22:35:31 +00:00
|
|
|
if [ -n "$STRICT" ] ; then
|
|
|
|
echo "#define UPNP_STRICT" >> ${CONFIGFILE}
|
|
|
|
else
|
|
|
|
echo "/*#define UPNP_STRICT*/" >> ${CONFIGFILE}
|
|
|
|
fi
|
2011-09-28 19:13:20 +00:00
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
|
2012-10-04 22:17:40 +00:00
|
|
|
echo "/* Add the optional Date: header in all HTTP responses */" >> ${CONFIGFILE}
|
|
|
|
if [ -n "$STRICT" ] ; then
|
|
|
|
echo "#define ENABLE_HTTP_DATE" >> ${CONFIGFILE}
|
|
|
|
else
|
|
|
|
echo "/*#define ENABLE_HTTP_DATE*/" >> ${CONFIGFILE}
|
|
|
|
fi
|
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
|
2012-06-29 19:39:34 +00:00
|
|
|
echo "/* disable reading and parsing of config file (miniupnpd.conf) */" >> ${CONFIGFILE}
|
|
|
|
echo "/*#define DISABLE_CONFIG_FILE*/" >> ${CONFIGFILE}
|
|
|
|
echo "" >> ${CONFIGFILE}
|
|
|
|
|
2011-09-28 19:13:20 +00:00
|
|
|
echo "#endif" >> ${CONFIGFILE}
|
|
|
|
|
2013-04-24 17:04:00 +00:00
|
|
|
${MV} ${CONFIGFILE} ${CONFIGFILE_FINAL}
|
|
|
|
|
2011-09-28 19:13:20 +00:00
|
|
|
exit 0
|