Skip to content

Commit

Permalink
Merge branch 'hotfix' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescowens committed Jul 5, 2024
2 parents 9ba9e8a + 2a53b46 commit 36edb2f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,9 @@ void ThreadMapPort2(void* parg)
const char* minissdpdpath = nullptr;
struct UPNPDev* devlist = nullptr;
char lanaddr[64];
#if MINIUPNPC_API_VERSION >= 18
char wanaddr[64];
#endif

int error = 0;
#if MINIUPNPC_API_VERSION < 14
Expand All @@ -1167,10 +1170,17 @@ void ThreadMapPort2(void* parg)
struct IGDdatas data;
int r;

#if MINIUPNPC_API_VERSION < 18
r = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr));
#else
r = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr), wanaddr, sizeof(wanaddr));
#endif
if (r == 1)
{
if (fDiscover) {
// Note that the below is technically duplicative for API version > 18, since the wanaddr is filled out
// by UPNP_GetValidIGD in the internal call to UPNP_GetExternalIPAddress for API version > 18. However,
// it is not harmful to leave the additional separate call here.
char externalIPAddress[40];
r = UPNP_GetExternalIPAddress(urls.controlURL, data.first.servicetype, externalIPAddress);
if(r != UPNPCOMMAND_SUCCESS)
Expand Down

0 comments on commit 36edb2f

Please sign in to comment.