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