From 8acdf66540834b9f9cf28f16d389e8b6a48516d5 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Thu, 13 Jun 2024 13:25:37 +0000 Subject: [PATCH] upnp: add compatibility for miniupnpc 2.2.8 See: https://github.com/miniupnp/miniupnp/commit/c0a50ce33e3b99ce8a96fd43049bb5b53ffac62f The return value of 2 now indicates: "A valid connected IGD has been found but its IP address is reserved (non routable)" We continue to ignore any return value other than 1. --- src/mapport.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mapport.cpp b/src/mapport.cpp index 80670230c73a8e19cedcdc3f41249ef9357acbd0..1920297be6d354e358c7537fcca51460d8d8d5c4 100644 --- a/src/mapport.cpp +++ b/src/mapport.cpp @@ -161,8 +161,11 @@ static bool ProcessUpnp() struct UPNPUrls urls; struct IGDdatas data; int r; - +#if MINIUPNPC_API_VERSION <= 17 r = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr)); +#else + r = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr), nullptr, 0); +#endif if (r == 1) { if (fDiscover) {