summarylogtreecommitdiffstats
path: root/1870.patch
blob: bbe4bb1f95ae4f22be3a67b71b524ee59945f1dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
From 3eb874e2886540ced618ceb49fd1b8341e235e20 Mon Sep 17 00:00:00 2001
From: Cory Fields <cory-nospam-@coryfields.com>
Date: Thu, 13 Jun 2024 13:25:37 +0000
Subject: [PATCH] [backport] upnp: add compatibility for miniupnpc 2.2.8

This is a backport of https://github.com/bitcoin/bitcoin/pull/30283

Summary
---

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.

Test Plan
---

* Check with miniupnpc version 2.2.8 and 2.2.7
* `ninja all check-all`
---
 src/net.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/net.cpp b/src/net.cpp
index 9edd9e5772..2679d28681 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1545,7 +1545,11 @@ static void ThreadMapPort() {
     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) {
             char externalIPAddress[40];
-- 
GitLab