Re: git: a270dbfaa9ce - main - net/miniupnpc: Update to 2.2.8

From: Vladimir Druzenko <vvd_at_freebsd.org>
Date: Mon, 15 Jul 2024 14:54:54 UTC
15.07.2024 17:10, Vladimir Druzenko пишет:
> 15.07.2024 15:01, Dirk Meyer пишет:
>> The branch main has been updated by dinoex:
>>
>> URL: 
>> https://cgit.FreeBSD.org/ports/commit/?id=a270dbfaa9ce47608d63a201c786e5d4695447ca
>>
>> commit a270dbfaa9ce47608d63a201c786e5d4695447ca
>> Author:     Dirk Meyer <dinoex@FreeBSD.org>
>> AuthorDate: 2024-07-15 11:44:33 +0000
>> Commit:     Dirk Meyer <dinoex@FreeBSD.org>
>> CommitDate: 2024-07-15 11:45:00 +0000
>>
>>      net/miniupnpc: Update to 2.2.8
>>
>> -PORTVERSION=    2.2.6
>> +PORTVERSION=    2.2.8
>
> Broken build of transmission:
>
> /tmp/work/usr/ports/net-p2p/transmission-components/work-cli/transmission-4.0.6/libtransmission/port-forwarding-upnp.cc:278:13: 
> error: no matching function for call to 'UPNP_GetValidIGD'
>   278 |         if (UPNP_GetValidIGD(devlist, &handle->urls, 
> &handle->data, std::data(lanaddr), std::size(lanaddr) - 1) ==
>       |             ^~~~~~~~~~~~~~~~
> /usr/local/include/miniupnpc/miniupnpc.h:122:1: note: candidate 
> function not viable: requires 7 arguments, but 5 were provided
>   122 | UPNP_GetValidIGD(struct UPNPDev * devlist,
>       | ^                ~~~~~~~~~~~~~~~~~~~~~~~~~
>   123 |                  struct UPNPUrls * urls,
>       |                  ~~~~~~~~~~~~~~~~~~~~~~~
>   124 |                  struct IGDdatas * data,
>       |                  ~~~~~~~~~~~~~~~~~~~~~~~
>   125 |                  char * lanaddr, int lanaddrlen,
>       |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   126 |                  char * wanaddr, int wanaddrlen);
>       |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1 error generated.
>
>
> Function UPNP_GetValidIGD changed from:
>
> /* UPNP_GetValidIGD() :
>  * return values :
>  *     0 = NO IGD found
>  *     1 = A valid connected IGD has been found
>  *     2 = A valid IGD has been found but it reported as
>  *         not connected
>  *     3 = an UPnP device has been found but was not recognized as an IGD
>  *
>  * In any non zero return case, the urls and data structures
>  * passed as parameters are set. Donc forget to call 
> FreeUPNPUrls(urls) to
>  * free allocated memory.
>  */
> MINIUPNP_LIBSPEC int
> UPNP_GetValidIGD(struct UPNPDev * devlist,
>                  struct UPNPUrls * urls,
>                                  struct IGDdatas * data,
>                                  char * lanaddr, int lanaddrlen);
>
> to:
>
> /* UPNP_GetValidIGD() :
>  * return values :
>  *     0 = NO IGD found
>  *     1 = A valid connected IGD has been found
>  *     2 = A valid connected IGD has been found but its
>  *         IP address is reserved (non routable)
>  *     3 = A valid IGD has been found but it reported as
>  *         not connected
>  *     4 = an UPnP device has been found but was not recognized as an IGD
>  *
>  * In any non zero return case, the urls and data structures
>  * passed as parameters are set. Donc forget to call 
> FreeUPNPUrls(urls) to
>  * free allocated memory.
>  */
> MINIUPNP_LIBSPEC int
> UPNP_GetValidIGD(struct UPNPDev * devlist,
>                  struct UPNPUrls * urls,
>                  struct IGDdatas * data,
>                  char * lanaddr, int lanaddrlen,
>                  char * wanaddr, int wanaddrlen);
>
>
> Upstream commit with API breakage:
> https://github.com/miniupnp/miniupnp/commit/c0a50ce33e3b99ce8a96fd43049bb5b53ffac62f 
>
>
transmission already committed patches:
https://github.com/transmission/transmission/pull/6907

We can use this before new release:
net-p2p/transmission-components/files/patch-libtransmission_port-forwarding-upnp.cc:
--- libtransmission/port-forwarding-upnp.cc.orig        2024-05-29 
01:38:35 UTC
+++ libtransmission/port-forwarding-upnp.cc
@@ -275,8 +275,11 @@ tr_port_forwarding_state tr_upnpPulse(tr_upnp* handle,

          FreeUPNPUrls(&handle->urls);
          auto lanaddr = std::array<char, TR_ADDRSTRLEN>{};
-        if (UPNP_GetValidIGD(devlist, &handle->urls, &handle->data, 
std::data(lanaddr), std::size(lanaddr) - 1) ==
-            UPNP_IGD_VALID_CONNECTED)
+        if (UPNP_GetValidIGD(devlist, &handle->urls, &handle->data, 
std::data(lanaddr), std::size(lanaddr) - 1
+#if (MINIUPNPC_API_VERSION >= 18)
+            , nullptr, 0
+#endif
+            ) == UPNP_IGD_VALID_CONNECTED)
          {
              tr_logAddInfo(fmt::format(_("Found Internet Gateway Device 
'{url}'"), fmt::arg("url", handle->urls.controlURL)));
              tr_logAddInfo(fmt::format(_("Local Address is 
'{address}'"), fmt::arg("address", lanaddr.data())));

-- 
Best regards,
Vladimir Druzenko