Fix bug in returning IGD LAN address

This commit is contained in:
Denis Leroy 2015-12-11 16:59:38 +01:00
parent 0d0728e2d1
commit 53804c3db3
1 changed files with 3 additions and 1 deletions

View File

@ -546,6 +546,7 @@ UPNP_GetValidIGD(struct UPNPDev * devlist,
int state = -1; /* state 1 : IGD connected. State 2 : IGD. State 3 : anything */ int state = -1; /* state 1 : IGD connected. State 2 : IGD. State 3 : anything */
int n_igd = 0; int n_igd = 0;
char extIpAddr[16]; char extIpAddr[16];
char myLanAddr[40];
if(!devlist) if(!devlist)
{ {
#ifdef DEBUG #ifdef DEBUG
@ -568,7 +569,7 @@ UPNP_GetValidIGD(struct UPNPDev * devlist,
/* we should choose an internet gateway device. /* we should choose an internet gateway device.
* with st == urn:schemas-upnp-org:device:InternetGatewayDevice:1 */ * with st == urn:schemas-upnp-org:device:InternetGatewayDevice:1 */
desc[i].xml = miniwget_getaddr(dev->descURL, &(desc[i].size), desc[i].xml = miniwget_getaddr(dev->descURL, &(desc[i].size),
lanaddr, lanaddrlen, myLanAddr, sizeof(myLanAddr),
dev->scope_id); dev->scope_id);
#ifdef DEBUG #ifdef DEBUG
if(!desc[i].xml) if(!desc[i].xml)
@ -586,6 +587,7 @@ UPNP_GetValidIGD(struct UPNPDev * devlist,
{ {
desc[i].is_igd = 1; desc[i].is_igd = 1;
n_igd++; n_igd++;
strncpy(lanaddr, myLanAddr, lanaddrlen);
} }
} }
} }