miniupnpd/minissdp: Introduce SSDP_RESPOND_SAME_VERSION

changes something when compiled as IGDv2.
This commit is contained in:
Thomas Bernard 2014-02-25 11:45:51 +01:00
parent 7fb5fe5dcb
commit ec1686f29f
3 changed files with 37 additions and 3 deletions

View File

@ -1,4 +1,7 @@
$Id: Changelog.txt,v 1.351 2014/02/11 09:35:52 nanard Exp $ $Id: Changelog.txt,v 1.352 2014/02/24 18:41:23 nanard Exp $
2014/02/24:
Defaulting to SSDP_RESPOND_SAME_VERSION
2014/02/11: 2014/02/11:
Fix PCP Map renewal Fix PCP Map renewal

View File

@ -1,5 +1,5 @@
#! /bin/sh #! /bin/sh
# $Id: genconfig.sh,v 1.65 2013/12/13 14:07:08 nanard Exp $ # $Id: genconfig.sh,v 1.69 2014/02/24 18:41:25 nanard Exp $
# miniupnp daemon # miniupnp daemon
# http://miniupnp.free.fr or http://miniupnp.tuxfamily.org/ # http://miniupnp.free.fr or http://miniupnp.tuxfamily.org/
# (c) 2006-2013 Thomas Bernard # (c) 2006-2013 Thomas Bernard
@ -457,6 +457,12 @@ else
fi fi
echo "" >> ${CONFIGFILE} echo "" >> ${CONFIGFILE}
echo "/* If SSDP_RESPOND_SAME_VERSION is defined, the M-SEARCH response" >> ${CONFIGFILE}
echo " * include the same device version as was contained in the search" >> ${CONFIGFILE}
echo " * request. It conforms to UPnP DA v1.1 */" >> ${CONFIGFILE}
echo "#define SSDP_RESPOND_SAME_VERSION" >> ${CONFIGFILE}
echo "" >> ${CONFIGFILE}
echo "/* Add the optional Date: header in all HTTP responses */" >> ${CONFIGFILE} echo "/* Add the optional Date: header in all HTTP responses */" >> ${CONFIGFILE}
if [ -n "$STRICT" ] ; then if [ -n "$STRICT" ] ; then
echo "#define ENABLE_HTTP_DATE" >> ${CONFIGFILE} echo "#define ENABLE_HTTP_DATE" >> ${CONFIGFILE}

View File

@ -1,4 +1,4 @@
/* $Id: minissdp.c,v 1.57 2014/02/06 09:52:03 nanard Exp $ */ /* $Id: minissdp.c,v 1.58 2014/02/24 18:41:24 nanard Exp $ */
/* MiniUPnP project /* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2014 Thomas Bernard * (c) 2006-2014 Thomas Bernard
@ -767,9 +767,34 @@ ProcessSSDPData(int s, const char *bufr, int n,
#endif #endif
) )
{ {
/* SSDP_RESPOND_SAME_VERSION :
* response is urn:schemas-upnp-org:service:WANIPConnection:1 when
* M-SEARCH included urn:schemas-upnp-org:service:WANIPConnection:1
* else the implemented versions is included in the response
*
* From UPnP Device Architecture v1.1 :
* 1.3.2 [...] Updated versions of device and service types
* are REQUIRED to be fully backward compatible with
* previous versions. Devices MUST respond to M-SEARCH
* requests for any supported version. For example, if a
* device implements urn:schemas-upnporg:service:xyz:2,
* it MUST respond to search requests for both that type
* and urn:schemas-upnp-org:service:xyz:1. The response
* MUST specify the same version as was contained in the
* search request. [...] */
#ifndef SSDP_RESPOND_SAME_VERSION
if(i==0)
ver_str[0] = '\0';
else
snprintf(ver_str, sizeof(ver_str), "%d", known_service_types[i].version);
#endif
syslog(LOG_INFO, "Single search found"); syslog(LOG_INFO, "Single search found");
SendSSDPResponse(s, sender, SendSSDPResponse(s, sender,
#ifdef SSDP_RESPOND_SAME_VERSION
st, st_len, "", st, st_len, "",
#else
known_service_types[i].s, l, ver_str,
#endif
announced_host, port, announced_host, port,
known_service_types[i].uuid); known_service_types[i].uuid);
break; break;