From 13a6a38241784848ff505d6ad5b583d9d165f059 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Tue, 16 Feb 2016 10:55:03 +0100 Subject: [PATCH] add configId attribute to element (UDA 1.1) --- miniupnpd/testupnpdescgen.c | 3 ++- miniupnpd/upnpdescgen.c | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/miniupnpd/testupnpdescgen.c b/miniupnpd/testupnpdescgen.c index ee30a8b..4e4d204 100644 --- a/miniupnpd/testupnpdescgen.c +++ b/miniupnpd/testupnpdescgen.c @@ -1,7 +1,7 @@ /* $Id: testupnpdescgen.c,v 1.32 2014/03/10 11:04:52 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2014 Thomas Bernard + * (c) 2006-2016 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -34,6 +34,7 @@ char model_name[] = ROOTDEV_MODELNAME; char model_description[] = ROOTDEV_MODELDESCRIPTION; char model_url[] = ROOTDEV_MODELURL; #endif +unsigned int upnp_configid = 666; char * use_ext_ip_addr = NULL; const char * ext_if_name = "eth0"; diff --git a/miniupnpd/upnpdescgen.c b/miniupnpd/upnpdescgen.c index c9dc76f..763d8e5 100644 --- a/miniupnpd/upnpdescgen.c +++ b/miniupnpd/upnpdescgen.c @@ -2,7 +2,7 @@ /* vim: tabstop=4 shiftwidth=4 noexpandtab */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2015 Thomas Bernard + * (c) 2006-2016 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -952,6 +952,13 @@ genXML(char * str, int * len, int * tmplen, /*printf("<%s>\n", eltname); */ str = strcat_char(str, len, tmplen, '<'); str = strcat_str(str, len, tmplen, eltname); + if(memcmp(eltname, "root ", 5) == 0) { + char configid_str[16]; + /* add configId attribute, required by UDA 1.1 */ + snprintf(configid_str, sizeof(configid_str), "\"%u\"", upnp_configid); + str = strcat_str(str, len, tmplen, " configId="); + str = strcat_str(str, len, tmplen, configid_str); + } str = strcat_char(str, len, tmplen, '>'); k = (unsigned long)p[i].data; i = k & 0xffff;