miniupnpcmodule.c: follow UPNP_GetValidIGD() changes

This commit is contained in:
Thomas Bernard 2024-05-09 15:53:09 +02:00
parent 3ab526b665
commit 2b4c0c5ca2
No known key found for this signature in database
GPG Key ID: DB511043A31ACAAF
1 changed files with 6 additions and 1 deletions

View File

@ -49,6 +49,7 @@ typedef struct {
unsigned int discoverdelay; /* value passed to upnpDiscover() */
unsigned int localport; /* value passed to upnpDiscover() */
char lanaddr[40]; /* our ip address on the LAN */
char wanaddr[40]; /* the ExternalIPAddress returned by the IGD */
char * multicastif;
char * minissdpdsocket;
} UPnPObject;
@ -57,6 +58,9 @@ static PyMemberDef UPnP_members[] = {
{"lanaddr", T_STRING_INPLACE, offsetof(UPnPObject, lanaddr),
READONLY, "ip address on the LAN"
},
{"wanaddr", T_STRING_INPLACE, offsetof(UPnPObject, lanaddr),
READONLY, "public ip address on the WAN"
},
{"discoverdelay", T_UINT, offsetof(UPnPObject, discoverdelay),
0/*READWRITE*/, "value in ms used to wait for SSDP responses"
},
@ -164,7 +168,8 @@ UPnP_selectigd(UPnPObject *self, PyObject *args)
Py_BEGIN_ALLOW_THREADS
if (rootDescUrl == NULL) {
r = UPNP_GetValidIGD(self->devlist, &self->urls, &self->data,
self->lanaddr, sizeof(self->lanaddr));
self->lanaddr, sizeof(self->lanaddr),
self->wanaddr, sizeof(self->wanaddr));
} else {
r = UPNP_GetIGDFromUrl(rootDescUrl, &self->urls, &self->data,
self->lanaddr, sizeof(self->lanaddr));