1#! /bin/sh
2# $Id: genconfig.sh,v 1.78 2014/12/10 09:34:42 nanard Exp $
3# miniupnp daemon
4# http://miniupnp.free.fr or http://miniupnp.tuxfamily.org/
5# (c) 2006-2014 Thomas Bernard
6# This software is subject to the conditions detailed in the
7# LICENCE file provided within the distribution
8
9for argv; do
10case "$argv" in
11	--ipv6) IPV6=1 ;;
12	--igd2) IGD2=1 ;;
13	--strict) STRICT=1 ;;
14	--leasefile) LEASEFILE=1 ;;
15	--vendorcfg) VENDORCFG=1 ;;
16	--pcp-peer) PCP_PEER=1 ;;
17	--portinuse) PORTINUSE=1 ;;
18	--help|-h)
19		echo "Usage : $0 [options]"
20		echo " --ipv6      enable IPv6"
21		echo " --igd2      build an IGDv2 instead of an IGDv1"
22		echo " --strict    be more strict regarding compliance with UPnP specifications"
23		echo " --leasefile enable lease file"
24		echo " --vendorcfg enable configuration of manufacturer info"
25		echo " --pcp-peer  enable PCP PEER operation"
26		echo " --portinuse enable port in use check"
27		exit 1
28		;;
29	*)
30		echo "Option not recognized : $argv"
31		echo "use -h option to display help"
32		exit 1
33		;;
34esac
35done
36
37RM="rm -f"
38MV="mv"
39CONFIGFILE="config.h.tmp"
40CONFIGFILE_FINAL="config.h"
41CONFIGMACRO="CONFIG_H_INCLUDED"
42
43# version reported in XML descriptions
44#UPNP_VERSION=20070827
45UPNP_VERSION=`date +"%Y%m%d"`
46# Facility to syslog
47LOG_MINIUPNPD="LOG_DAEMON"
48
49# detecting the OS name and version
50OS_NAME=`uname -s`
51OS_VERSION=`uname -r`
52
53# pfSense special case
54if [ -f /etc/platform ]; then
55	if [ `cat /etc/platform` = "pfSense" ]; then
56		OS_NAME=pfSense
57		OS_VERSION=`cat /etc/version`
58	fi
59fi
60
61# OpenWRT special case
62if [ -f ./os.openwrt ]; then
63	OS_NAME=OpenWRT
64	OS_VERSION=$(cat ./os.openwrt)
65fi
66
67# AstLinux special case
68if [ -f ./os.astlinux ]; then
69	OS_NAME=AstLinux
70	OS_VERSION=$(cat ./os.astlinux)
71fi
72
73# Tomato USB special case
74if [ -f ../shared/tomato_version ]; then
75	OS_NAME=Tomato
76	TOMATO_VER=`cat ../shared/tomato_version | cut -d' ' -f2,3`
77	OS_VERSION="Tomato $TOMATO_VER"
78fi
79
80# AsusWRT
81if [ -f Makefile.asus ]; then
82	OS_NAME=AsusWRT
83	OS_VERSION=$(awk -F'"' '/RT_VERSION/{print $2}' ../shared/version.h)
84fi
85
86${RM} ${CONFIGFILE}
87
88echo "/* MiniUPnP Project" >> ${CONFIGFILE}
89echo " * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/" >> ${CONFIGFILE}
90echo " * (c) 2006-2014 Thomas Bernard" >> ${CONFIGFILE}
91echo " * generated by $0 on `date`" >> ${CONFIGFILE}
92echo " * using command line options $* */" >> ${CONFIGFILE}
93echo "#ifndef $CONFIGMACRO" >> ${CONFIGFILE}
94echo "#define $CONFIGMACRO" >> ${CONFIGFILE}
95echo "" >> ${CONFIGFILE}
96echo "#include <inttypes.h>" >> ${CONFIGFILE}
97echo "" >> ${CONFIGFILE}
98echo "#define MINIUPNPD_VERSION \"`cat VERSION`\"" >> ${CONFIGFILE}
99echo "" >> ${CONFIGFILE}
100echo "#define UPNP_VERSION	\"$UPNP_VERSION\"" >> ${CONFIGFILE}
101
102# OS Specific stuff
103case $OS_NAME in
104	OpenBSD)
105		MAJORVER=`echo $OS_VERSION | cut -d. -f1`
106		MINORVER=`echo $OS_VERSION | cut -d. -f2`
107		#echo "OpenBSD majorversion=$MAJORVER minorversion=$MINORVER"
108		# rtableid was introduced in OpenBSD 4.0
109		if [ $MAJORVER -ge 4 ]; then
110			echo "#define PFRULE_HAS_RTABLEID" >> ${CONFIGFILE}
111		fi
112		# from the 3.8 version, packets and bytes counters are double : in/out
113		if [ \( $MAJORVER -ge 4 \) -o \( $MAJORVER -eq 3 -a $MINORVER -ge 8 \) ]; then
114			echo "#define PFRULE_INOUT_COUNTS" >> ${CONFIGFILE}
115		fi
116		# from the 4.7 version, new pf
117		if [ \( $MAJORVER -ge 5 \) -o \( $MAJORVER -eq 4 -a $MINORVER -ge 7 \) ]; then
118			echo "#define PF_NEWSTYLE" >> ${CONFIGFILE}
119		fi
120		# onrdomain was introduced in OpenBSD 5.0
121		if [ $MAJORVER -ge 5 ]; then
122			echo "#define PFRULE_HAS_ONRDOMAIN" >> ${CONFIGFILE}
123		fi
124		FW=pf
125		echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
126		OS_URL=http://www.openbsd.org/
127		V6SOCKETS_ARE_V6ONLY=`sysctl -n net.inet6.ip6.v6only`
128		;;
129	FreeBSD)
130		VER=`grep '#define __FreeBSD_version' /usr/include/sys/param.h | awk '{print $3}'`
131		if [ $VER -ge 700049 ]; then
132			echo "#define PFRULE_INOUT_COUNTS" >> ${CONFIGFILE}
133		fi
134		# new way to see which one to use PF or IPF.
135		# see http://miniupnp.tuxfamily.org/forum/viewtopic.php?p=957
136		if [ -f /etc/rc.subr ] && [ -f /etc/rc.conf ] ; then
137			# source file with handy subroutines like checkyesno
138			. /etc/rc.subr
139			# source config file so we can probe vars
140			. /etc/rc.conf
141			if checkyesno ipfilter_enable; then
142				echo "Using ipf"
143			FW=ipf
144			elif checkyesno pf_enable; then
145				echo "Using pf"
146				FW=pf
147			elif checkyesno firewall_enable; then
148				echo "Using ifpw"
149				FW=ipfw
150			fi
151		fi
152		if [ -z $FW ] ; then
153			echo "Could not detect usage of ipf, pf, ipfw. Compiling for pf by default"
154			FW=pf
155		fi
156		echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
157		OS_URL=http://www.freebsd.org/
158		V6SOCKETS_ARE_V6ONLY=`sysctl -n net.inet6.ip6.v6only`
159		;;
160	pfSense)
161		# we need to detect if PFRULE_INOUT_COUNTS macro is needed
162		FW=pf
163		echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
164		OS_URL=http://www.pfsense.com/
165		V6SOCKETS_ARE_V6ONLY=`sysctl -n net.inet6.ip6.v6only`
166		;;
167	NetBSD)
168		if [ -f /etc/rc.subr ] && [ -f /etc/rc.conf ] ; then
169			# source file with handy subroutines like checkyesno
170			. /etc/rc.subr
171			# source config file so we can probe vars
172			. /etc/rc.conf
173			if checkyesno pf; then
174				FW=pf
175			elif checkyesno ipfilter; then
176				FW=ipf
177			fi
178		fi
179		if [ -z $FW ] ; then
180			echo "Could not detect ipf nor pf, defaulting to pf."
181			FW=pf
182		fi
183		echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
184		OS_URL=http://www.netbsd.org/
185		;;
186	DragonFly)
187		if [ -f /etc/rc.subr ] && [ -f /etc/rc.conf ] ; then
188			# source file with handy subroutines like checkyesno
189			. /etc/rc.subr
190			# source config file so we can probe vars
191			. /etc/rc.conf
192			if checkyesno pf; then
193				FW=pf
194			elif checkyesno ipfilter; then
195				FW=ipf
196			fi
197		fi
198		if [ -z $FW ] ; then
199			echo "Could not detect ipf nor pf, defaulting to pf."
200			FW=pf
201		fi
202		echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
203		OS_URL=http://www.dragonflybsd.org/
204		;;
205	SunOS)
206		echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
207		FW=ipf
208		echo "#define LOG_PERROR 0" >> ${CONFIGFILE}
209		echo "#define SOLARIS_KSTATS 1" >> ${CONFIGFILE}
210		# solaris 10 does not define u_int64_t ?
211		# but it does define uint64_t
212		echo "typedef uint64_t u_int64_t;" >> ${CONFIGFILE}
213		OS_URL=http://www.sun.com/solaris/
214		;;
215	Linux)
216		OS_URL=http://www.kernel.org/
217		KERNVERA=`echo $OS_VERSION | awk -F. '{print $1}'`
218		KERNVERB=`echo $OS_VERSION | awk -F. '{print $2}'`
219		KERNVERC=`echo $OS_VERSION | awk -F. '{print $3}'`
220		KERNVERD=`echo $OS_VERSION | awk -F. '{print $4}'`
221		#echo "$KERNVERA.$KERNVERB.$KERNVERC.$KERNVERD"
222		# Debian GNU/Linux special case
223		if [ -f /etc/debian_version ]; then
224			OS_NAME=Debian
225			OS_VERSION=`cat /etc/debian_version`
226			OS_URL=http://www.debian.org/
227		fi
228		# same thing for Gentoo linux
229		if  [ -f /etc/gentoo-release ]; then
230			OS_NAME=Gentoo
231			OS_VERSION=`cat /etc/gentoo-release`
232			OS_URL=http://www.gentoo.org/
233		fi
234		# use lsb_release (Linux Standard Base) when available
235		LSB_RELEASE=`which lsb_release`
236		if [ 0 -eq $? ]; then
237			OS_NAME=`${LSB_RELEASE} -i -s`
238			OS_VERSION=`${LSB_RELEASE} -r -s`
239			case $OS_NAME in
240				Debian)
241					OS_URL=http://www.debian.org/
242					OS_VERSION=`${LSB_RELEASE} -c -s`
243					;;
244				Ubuntu)
245					OS_URL=http://www.ubuntu.com/
246					OS_VERSION=`${LSB_RELEASE} -c -s`
247					;;
248				Gentoo)
249					OS_URL=http://www.gentoo.org/
250					;;
251				arch)
252					OS_URL=http://www.archlinux.org/
253					OS_VERSION=`uname -r`
254					;;
255			esac
256		fi
257		echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
258		FW=netfilter
259		V6SOCKETS_ARE_V6ONLY=`/sbin/sysctl -n net.ipv6.bindv6only`
260		;;
261	OpenWRT)
262		OS_URL=http://www.openwrt.org/
263		echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
264		FW=netfilter
265		;;
266	AstLinux)
267		OS_URL=http://www.astlinux.org/
268		echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
269		FW=netfilter
270		;;
271	Tomato)
272		OS_NAME=UPnP
273		OS_URL=http://tomatousb.org/
274		echo "" >> ${CONFIGFILE}
275		echo "#ifndef TOMATO" >> ${CONFIGFILE}
276		echo "#define TOMATO" >> ${CONFIGFILE}
277		echo "#endif" >> ${CONFIGFILE}
278		echo "" >> ${CONFIGFILE}
279		echo "#ifdef LINUX26" >> ${CONFIGFILE}
280		echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
281		echo "#endif" >> ${CONFIGFILE}
282		echo "#ifdef TCONFIG_IPV6" >> ${CONFIGFILE}
283		echo "#define ENABLE_IPV6" >> ${CONFIGFILE}
284		echo "#endif" >> ${CONFIGFILE}
285		FW=netfilter
286		;;
287	AsusWRT)
288		OS_URL=http://www.asus.com/
289		echo "" >> ${CONFIGFILE}
290		cat ../shared/version.h >> ${CONFIGFILE}
291		echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
292		echo "#define USE_GETIFADDRS 1" >> ${CONFIGFILE}
293		FW=netfilter
294		;;
295
296	Darwin)
297		MAJORVER=`echo $OS_VERSION | cut -d. -f1`
298		echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
299		# OS X switched to pf since 10.7 Lion (Darwin 11.0)
300		if [ $MAJORVER -ge 11 ] ; then
301			FW=pf
302			echo "#define PFRULE_INOUT_COUNTS" >> ${CONFIGFILE}
303		else
304			FW=ipfw
305		fi
306		OS_URL=http://developer.apple.com/macosx
307		;;
308	*)
309		echo "Unknown OS : $OS_NAME"
310		echo "Please contact the author at http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/."
311		exit 1
312		;;
313esac
314
315case $FW in
316	pf)
317		echo "#define USE_PF 1" >> ${CONFIGFILE}
318		;;
319	ipf)
320		echo "#define USE_IPF 1" >> ${CONFIGFILE}
321		;;
322	ipfw)
323		echo "#define USE_IPFW 1" >> ${CONFIGFILE}
324		;;
325	netfilter)
326		echo "#define USE_NETFILTER 1" >> ${CONFIGFILE}
327		;;
328	*)
329		echo "Unknown Firewall/packet filtering software [$FW]"
330		echo "Please contact the author at http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/."
331		exit 1
332		;;
333esac
334
335# set V6SOCKETS_ARE_V6ONLY to 0 if it was not set above
336if [ -z "$V6SOCKETS_ARE_V6ONLY" ] ; then
337	V6SOCKETS_ARE_V6ONLY=0
338fi
339
340echo "Configuring compilation for [$OS_NAME] [$OS_VERSION] with [$FW] firewall software."
341echo "Please edit config.h for more compilation options."
342
343# define SUPPORT_REMOTEHOST if the FW related code really supports setting
344# a RemoteHost
345if [ \( "$FW" = "netfilter" \) -o \( "$FW" = "pf" \) -o \( "$FW" = "ipfw" \) ] ; then
346	echo "#define SUPPORT_REMOTEHOST" >> ${CONFIGFILE}
347fi
348
349echo "" >> ${CONFIGFILE}
350echo "#define OS_NAME		\"$OS_NAME\"" >> ${CONFIGFILE}
351echo "#define OS_VERSION	\"$OS_NAME/$OS_VERSION\"" >> ${CONFIGFILE}
352echo "#define OS_URL		\"${OS_URL}\"" >> ${CONFIGFILE}
353echo "" >> ${CONFIGFILE}
354
355echo "/* syslog facility to be used by miniupnpd */" >> ${CONFIGFILE}
356echo "#define LOG_MINIUPNPD		 ${LOG_MINIUPNPD}" >> ${CONFIGFILE}
357echo "" >> ${CONFIGFILE}
358
359echo "/* Uncomment the following line to allow miniupnpd to be" >> ${CONFIGFILE}
360echo " * controlled by miniupnpdctl */" >> ${CONFIGFILE}
361echo "/*#define USE_MINIUPNPDCTL*/" >> ${CONFIGFILE}
362echo "" >> ${CONFIGFILE}
363
364echo "/* Comment the following line to disable NAT-PMP operations */" >> ${CONFIGFILE}
365echo "#define ENABLE_NATPMP" >> ${CONFIGFILE}
366echo "" >> ${CONFIGFILE}
367
368echo "/* Comment the following line to disable PCP operations */" >> ${CONFIGFILE}
369echo "#define ENABLE_PCP" >> ${CONFIGFILE}
370echo "" >> ${CONFIGFILE}
371
372echo "#ifdef ENABLE_PCP" >> ${CONFIGFILE}
373if [ -n "$PCP_PEER" ]; then
374echo "/* Comment the following line to disable PCP PEER operation */" >> ${CONFIGFILE}
375echo "#define PCP_PEER" >> ${CONFIGFILE}
376else
377echo "/* Uncomment the following line to enable PCP PEER operation */" >> ${CONFIGFILE}
378echo "/*#define PCP_PEER*/" >> ${CONFIGFILE}
379fi
380echo "#ifdef PCP_PEER" >> ${CONFIGFILE}
381echo "/*#define PCP_FLOWP*/" >> ${CONFIGFILE}
382echo "#endif /*PCP_PEER*/" >> ${CONFIGFILE}
383echo "/*#define PCP_SADSCP*/" >> ${CONFIGFILE}
384echo "#endif /*ENABLE_PCP*/" >> ${CONFIGFILE}
385echo "" >> ${CONFIGFILE}
386
387echo "/* Uncomment the following line to enable generation of" >> ${CONFIGFILE}
388echo " * filter rules with pf */" >> ${CONFIGFILE}
389echo "/*#define PF_ENABLE_FILTER_RULES*/">> ${CONFIGFILE}
390echo "" >> ${CONFIGFILE}
391
392echo "/* Uncomment the following line to enable caching of results of" >> ${CONFIGFILE}
393echo " * the getifstats() function */" >> ${CONFIGFILE}
394echo "/*#define ENABLE_GETIFSTATS_CACHING*/" >> ${CONFIGFILE}
395echo "/* The cache duration is indicated in seconds */" >> ${CONFIGFILE}
396echo "#define GETIFSTATS_CACHING_DURATION 2" >> ${CONFIGFILE}
397echo "" >> ${CONFIGFILE}
398
399echo "/* Uncomment the following line to enable multiple external ip support */" >> ${CONFIGFILE}
400echo "/* note : That is EXPERIMENTAL, do not use that unless you know perfectly what you are doing */" >> ${CONFIGFILE}
401echo "/* Dynamic external ip adresses are not supported when this option is enabled." >> ${CONFIGFILE}
402echo " * Also note that you would need to configure your .conf file accordingly. */" >> ${CONFIGFILE}
403echo "/*#define MULTIPLE_EXTERNAL_IP*/" >> ${CONFIGFILE}
404echo "" >> ${CONFIGFILE}
405
406echo "/* Comment the following line to use home made daemonize() func instead" >> ${CONFIGFILE}
407echo " * of BSD daemon() */" >> ${CONFIGFILE}
408echo "#define USE_DAEMON" >> ${CONFIGFILE}
409echo "" >> ${CONFIGFILE}
410
411echo "/* Uncomment the following line to enable lease file support */" >> ${CONFIGFILE}
412if [ -n "$LEASEFILE" ] ; then
413	echo "#define ENABLE_LEASEFILE" >> ${CONFIGFILE}
414else
415	echo "/*#define ENABLE_LEASEFILE*/" >> ${CONFIGFILE}
416fi
417echo "" >> ${CONFIGFILE}
418
419echo "/* Uncomment the following line to enable port in use check */" >> ${CONFIGFILE}
420if [ -n "$PORTINUSE" ]; then
421	echo "#define CHECK_PORTINUSE" >> ${CONFIGFILE}
422else
423	echo "/*#define CHECK_PORTINUSE*/" >> ${CONFIGFILE}
424fi
425echo "" >> ${CONFIGFILE}
426
427echo "/* Define one or none of the two following macros in order to make some" >> ${CONFIGFILE}
428echo " * clients happy. It will change the XML Root Description of the IGD." >> ${CONFIGFILE}
429echo " * Enabling the Layer3Forwarding Service seems to be the more compatible" >> ${CONFIGFILE}
430echo " * option. */" >> ${CONFIGFILE}
431echo "/*#define HAS_DUMMY_SERVICE*/" >> ${CONFIGFILE}
432echo "#define ENABLE_L3F_SERVICE" >> ${CONFIGFILE}
433echo "" >> ${CONFIGFILE}
434
435echo "/* Enable IP v6 support */" >> ${CONFIGFILE}
436if [ -n "$IPV6" ]; then
437	echo "#define ENABLE_IPV6" >> ${CONFIGFILE}
438else
439	echo "/*#define ENABLE_IPV6*/" >> ${CONFIGFILE}
440fi
441echo "" >> ${CONFIGFILE}
442
443echo "/* Define V6SOCKETS_ARE_V6ONLY if AF_INET6 sockets are restricted" >> ${CONFIGFILE}
444echo " * to IPv6 communications only. */" >> ${CONFIGFILE}
445if [ $V6SOCKETS_ARE_V6ONLY -eq 1 ] ; then
446	echo "#define V6SOCKETS_ARE_V6ONLY" >> ${CONFIGFILE}
447else
448	echo "/*#define V6SOCKETS_ARE_V6ONLY*/" >> ${CONFIGFILE}
449fi
450echo "" >> ${CONFIGFILE}
451
452echo "/* Enable the support of IGD v2 specification." >> ${CONFIGFILE}
453echo " * This is not fully tested yet and can cause incompatibilities with some" >> ${CONFIGFILE}
454echo " * control points, so enable with care. */" >> ${CONFIGFILE}
455if [ -n "$IGD2" ]; then
456	echo "#define IGD_V2" >> ${CONFIGFILE}
457else
458	echo "/*#define IGD_V2*/" >> ${CONFIGFILE}
459fi
460echo "" >> ${CONFIGFILE}
461
462echo "#ifdef IGD_V2" >> ${CONFIGFILE}
463echo "/* Enable DeviceProtection service (IGDv2) */" >> ${CONFIGFILE}
464echo "#define ENABLE_DP_SERVICE" >> ${CONFIGFILE}
465echo "/*#define ENABLE_HTTPS*/" >> ${CONFIGFILE}
466echo "/*#define HTTPS_CERTFILE \"/path/to/certificate.pem\"*/" >> ${CONFIGFILE}
467echo "/*#define HTTPS_KEYFILE \"/path/to/private.key\"*/" >> ${CONFIGFILE}
468echo "" >> ${CONFIGFILE}
469echo "/* Enable WANIPv6FirewallControl service (IGDv2). needs IPv6 */" >> ${CONFIGFILE}
470echo "#ifdef ENABLE_IPV6" >> ${CONFIGFILE}
471echo "#define ENABLE_6FC_SERVICE" >> ${CONFIGFILE}
472echo "#endif /* ENABLE_IPV6 */" >> ${CONFIGFILE}
473echo "#endif /* IGD_V2 */" >> ${CONFIGFILE}
474echo "" >> ${CONFIGFILE}
475
476echo "/* UPnP Events support. Working well enough to be enabled by default." >> ${CONFIGFILE}
477echo " * It can be disabled to save a few bytes. */" >> ${CONFIGFILE}
478echo "#define ENABLE_EVENTS" >> ${CONFIGFILE}
479echo "" >> ${CONFIGFILE}
480
481echo "/* include interface name in pf and ipf rules */" >> ${CONFIGFILE}
482echo "#define USE_IFNAME_IN_RULES" >> ${CONFIGFILE}
483echo "" >> ${CONFIGFILE}
484
485echo "/* Experimental NFQUEUE support. */" >> ${CONFIGFILE}
486echo "/*#define ENABLE_NFQUEUE*/" >> ${CONFIGFILE}
487echo "" >> ${CONFIGFILE}
488
489echo "/* Enable to make MiniUPnPd more strict about UPnP conformance" >> ${CONFIGFILE}
490echo " * and the messages it receives from control points */" >> ${CONFIGFILE}
491if [ -n "$STRICT" ] ; then
492	echo "#define UPNP_STRICT" >> ${CONFIGFILE}
493else
494	echo "/*#define UPNP_STRICT*/" >> ${CONFIGFILE}
495fi
496echo "" >> ${CONFIGFILE}
497
498echo "/* If SSDP_RESPOND_SAME_VERSION is defined, the M-SEARCH response" >> ${CONFIGFILE}
499echo " * include the same device version as was contained in the search" >> ${CONFIGFILE}
500echo " * request. It conforms to UPnP DA v1.1 */" >> ${CONFIGFILE}
501echo "#define SSDP_RESPOND_SAME_VERSION" >> ${CONFIGFILE}
502echo "" >> ${CONFIGFILE}
503
504echo "/* Add the optional Date: header in all HTTP responses */" >> ${CONFIGFILE}
505if [ -n "$STRICT" ] ; then
506	echo "#define ENABLE_HTTP_DATE" >> ${CONFIGFILE}
507else
508	echo "/*#define ENABLE_HTTP_DATE*/" >> ${CONFIGFILE}
509fi
510echo "" >> ${CONFIGFILE}
511
512echo "/* Wait a little before answering M-SEARCH request */" >> ${CONFIGFILE}
513if [ -n "$STRICT" ] ; then
514	echo "#define DELAY_MSEARCH_RESPONSE" >> ${CONFIGFILE}
515else
516	echo "/*#define DELAY_MSEARCH_RESPONSE*/" >> ${CONFIGFILE}
517fi
518echo "" >> ${CONFIGFILE}
519
520echo "/* disable reading and parsing of config file (miniupnpd.conf) */" >> ${CONFIGFILE}
521echo "/*#define DISABLE_CONFIG_FILE*/" >> ${CONFIGFILE}
522echo "" >> ${CONFIGFILE}
523
524echo "/* Uncomment the following line to configure all manufacturer infos through miniupnpd.conf */" >> ${CONFIGFILE}
525if [ -n "$VENDORCFG" ] ; then
526	echo "#define ENABLE_MANUFACTURER_INFO_CONFIGURATION" >> ${CONFIGFILE}
527else
528	echo "/*#define ENABLE_MANUFACTURER_INFO_CONFIGURATION*/" >> ${CONFIGFILE}
529fi
530echo "" >> ${CONFIGFILE}
531
532cat >> ${CONFIGFILE} <<EOF
533#if defined(ENABLE_6FC_SERVICE) || (defined(ENABLE_PCP) && defined(ENABLE_IPV6))
534#define ENABLE_UPNPPINHOLE
535#endif
536
537EOF
538
539cat >> ${CONFIGFILE} <<EOF
540/* Uncomment the following line if your device does not have a proper clock
541 * BOOTID.UPNP.ORG can be set with command line */
542/*#define USE_TIME_AS_BOOTID*/
543EOF
544
545echo "#endif /* ${CONFIGMACRO} */" >> ${CONFIGFILE}
546
547${MV} ${CONFIGFILE} ${CONFIGFILE_FINAL}
548
549exit 0
550