miniupnpd: use time for BOOTID.UPNP.ORG value

This commit is contained in:
Thomas Bernard 2014-12-10 10:41:10 +01:00
parent 00d878eba3
commit 99a1bafc1f
3 changed files with 18 additions and 1 deletions

View File

@ -3,6 +3,7 @@ $Id: Changelog.txt,v 1.394 2014/12/10 09:33:24 nanard Exp $
2014/12/10:
Checking Host: HTTP request header to prevent DNS rebinding attack
configurable BOOTID.UPNP.ORG SSDP header
use time for BOOTID.UPNP.ORG value
2014/12/09:
fix upnp_add_inboundpinhole() : check inet_pton() return

View File

@ -1,5 +1,5 @@
#! /bin/sh
# $Id: genconfig.sh,v 1.77 2014/12/04 10:21:33 nanard Exp $
# $Id: genconfig.sh,v 1.78 2014/12/10 09:34:42 nanard Exp $
# miniupnp daemon
# http://miniupnp.free.fr or http://miniupnp.tuxfamily.org/
# (c) 2006-2014 Thomas Bernard
@ -518,6 +518,12 @@ cat >> ${CONFIGFILE} <<EOF
EOF
cat >> ${CONFIGFILE} <<EOF
/* Uncomment the following line if your device does not have a proper clock
* BOOTID.UPNP.ORG can be set with command line */
#define USE_TIME_AS_BOOTID
EOF
echo "#endif /* ${CONFIGMACRO} */" >> ${CONFIGFILE}
${MV} ${CONFIGFILE} ${CONFIGFILE_FINAL}

View File

@ -599,6 +599,16 @@ static void
set_startup_time(int sysuptime)
{
startup_time = time(NULL);
#ifdef USE_TIME_AS_BOOTID
if(startup_time > 60*60*24 && upnp_bootid == 1) {
/* We know we are not January the 1st 1970 */
upnp_bootid = (unsigned int)startup_time;
/* from UDA v1.1 :
* A convenient mechanism is to set this field value to the time
* that the device sends its initial announcement, expressed as
* seconds elapsed since midnight January 1, 1970; */
}
#endif /* USE_TIME_AS_BOOTID */
if(sysuptime)
{
/* use system uptime instead of daemon uptime */