summaryrefslogblamecommitdiff
path: root/net-p2p/monero/files/monero-9999-upnp-add-support-for-miniupnpc-API-version-18.patch
blob: 782a10b43baa738eb4e838ecef9194094a32a2b9 (plain) (tree)











































                                                                                                                          
From a027bb81013d7864179b75a26dd0774ad232d644 Mon Sep 17 00:00:00 2001
From: Bertrand Jacquin <bertrand@jacquin.bzh>
Date: Wed, 17 Jul 2024 20:05:38 +0100
Subject: [PATCH] upnp: add support for miniupnpc API version 18

miniupnpc 2.2.8 updated API to version 18, with breaking change to
UPNP_GetValidIGD().

See: https://github.com/miniupnp/miniupnp/commit/c0a50ce33e3b99ce8a96fd43049bb5b53ffac62f
See: http://miniupnp.free.fr/files/changelog.php?file=miniupnpc-2.2.8.tar.gz
---
 src/p2p/net_node.inl | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index a5a1e0f8cec2..4212f3c63cf1 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -2985,7 +2985,12 @@ namespace nodetool
     UPNPUrls urls;
     IGDdatas igdData;
     char lanAddress[64];
+#if MINIUPNPC_API_VERSION < 18
     result = UPNP_GetValidIGD(deviceList, &urls, &igdData, lanAddress, sizeof lanAddress);
+#else
+    char wanAddress[64];
+    result = UPNP_GetValidIGD(deviceList, &urls, &igdData, lanAddress, sizeof lanAddress, wanAddress, sizeof wanAddress);
+#endif
     freeUPNPDevlist(deviceList);
     if (result > 0) {
       if (result == 1) {
@@ -3053,7 +3058,12 @@ namespace nodetool
     UPNPUrls urls;
     IGDdatas igdData;
     char lanAddress[64];
+#if MINIUPNPC_API_VERSION < 18
     result = UPNP_GetValidIGD(deviceList, &urls, &igdData, lanAddress, sizeof lanAddress);
+#else
+    char wanAddress[64];
+    result = UPNP_GetValidIGD(deviceList, &urls, &igdData, lanAddress, sizeof lanAddress, wanAddress, sizeof wanAddress);
+#endif
     freeUPNPDevlist(deviceList);
     if (result > 0) {
       if (result == 1) {