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
|
From cc8b232a1ade1b4997b940697cdbfeb39bdde6c6 Mon Sep 17 00:00:00 2001
From: Kelvie Wong <kelvie@kelvie.ca>
Date: Sat, 29 Jun 2024 22:59:41 -0700
Subject: [PATCH] Fix miniupnpc 18 compatibility
A wanaddr return argument was added to UPNP_GetValidIGD
---
src/upnp.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/upnp.cpp b/src/upnp.cpp
index 7a6f7efc..6e4adaee 100644
--- a/src/upnp.cpp
+++ b/src/upnp.cpp
@@ -109,7 +109,11 @@ namespace upnp {
IGDdatas data;
urls_t urls;
std::array<char, INET6_ADDRESS_STRLEN> lan_addr;
+#if MINIUPNPC_API_VERSION >= 18
+ auto status = UPNP_GetValidIGD(device.get(), &urls.el, &data, lan_addr.data(), lan_addr.size() , nullptr, 0);
+#else
auto status = UPNP_GetValidIGD(device.get(), &urls.el, &data, lan_addr.data(), lan_addr.size());
+#endif
if (status != 1 && status != 2) {
BOOST_LOG(debug) << "No valid IPv6 IGD: "sv << status_string(status);
return false;
@@ -331,7 +335,11 @@ namespace upnp {
std::array<char, INET6_ADDRESS_STRLEN> lan_addr;
urls_t urls;
+#if MINIUPNPC_API_VERSION >= 18
+ auto status = UPNP_GetValidIGD(device.get(), &urls.el, &data, lan_addr.data(), lan_addr.size(), nullptr, 0);
+#else
auto status = UPNP_GetValidIGD(device.get(), &urls.el, &data, lan_addr.data(), lan_addr.size());
+#endif
if (status != 1 && status != 2) {
BOOST_LOG(error) << status_string(status);
mapped = false;
--
2.45.2
|