diff options
-rw-r--r-- | .SRCINFO | 18 | ||||
-rw-r--r-- | 0001-interfaces-Add-debug-logging-to-sockaddr_to_string.patch | 46 | ||||
-rw-r--r-- | 0001-rand-Use-crypto-libs-instead-of-CryptGenRandom.patch | 74 | ||||
-rw-r--r-- | 0001-stund-Use-lowercase-winsock2.h.patch | 30 | ||||
-rw-r--r-- | 0002-interfaces-Port-to-GetBestInterfaceEx-for-UWP-compat.patch | 45 | ||||
-rw-r--r-- | 0002-meson-Fix-typos-in-crypto-library-detection.patch | 34 | ||||
-rw-r--r-- | 0003-interfaces-Remove-unused-win32-code.patch | 59 | ||||
-rw-r--r-- | 0004-interfaces-Fix-fetching-of-interfaces-on-Win32.patch | 257 | ||||
-rw-r--r-- | PKGBUILD | 33 |
9 files changed, 590 insertions, 6 deletions
@@ -1,6 +1,6 @@ pkgbase = mingw-w64-libnice pkgdesc = An implementation of the IETF's draft ICE (for p2p UDP data streams) (mingw-w64) - pkgver = 0.1.16 + pkgver = 0.1.17 pkgrel = 1 url = https://nice.freedesktop.org arch = any @@ -13,8 +13,22 @@ pkgbase = mingw-w64-libnice options = !strip options = !buildflags options = staticlibs - source = git+https://gitlab.freedesktop.org/libnice/libnice.git#commit=5969b34e3acd9150506ed8d9d109c73665858f3e + source = git+https://gitlab.freedesktop.org/libnice/libnice.git#commit=5fb2511725a690a68ed9ace030931b78bc6fe92c + source = 0001-rand-Use-crypto-libs-instead-of-CryptGenRandom.patch + source = 0001-stund-Use-lowercase-winsock2.h.patch + source = 0002-meson-Fix-typos-in-crypto-library-detection.patch + source = 0001-interfaces-Add-debug-logging-to-sockaddr_to_string.patch + source = 0002-interfaces-Port-to-GetBestInterfaceEx-for-UWP-compat.patch + source = 0003-interfaces-Remove-unused-win32-code.patch + source = 0004-interfaces-Fix-fetching-of-interfaces-on-Win32.patch sha256sums = SKIP + sha256sums = 60cb90e75a33fb1a7b27c3d44427292f57fef5e323bbc34059c882f7ac915fd7 + sha256sums = 678ae8681958699e0f75ef203b6feead7cf3fd2693f11f6f05f4ff1bdc9317b8 + sha256sums = c13cf63b6f53939349d7ef19713ce1b9b25a387a1bc185c596471017bcf3aa27 + sha256sums = 71c1f26848645d635f08361859e0878fd818ed1730146f6f764dc1ecacd76beb + sha256sums = 57de9f9b97f05de2cc7c03fd76484b49f005285145252f7206ef4d5e56d21c3c + sha256sums = 398011d48d899713fc79b440ca8237488e3291939cb16885b618e5a8c8bcae1b + sha256sums = f888e748c970311303fe6b4e0761223c5966bd2eb57be4476d19def21881bc43 pkgname = mingw-w64-libnice diff --git a/0001-interfaces-Add-debug-logging-to-sockaddr_to_string.patch b/0001-interfaces-Add-debug-logging-to-sockaddr_to_string.patch new file mode 100644 index 000000000000..33ff4a96a55b --- /dev/null +++ b/0001-interfaces-Add-debug-logging-to-sockaddr_to_string.patch @@ -0,0 +1,46 @@ +From c7c78c964850172768a7ad062578b36913d3ce59 Mon Sep 17 00:00:00 2001 +From: Nirbheek Chauhan <nirbheek@centricular.com> +Date: Thu, 9 Jul 2020 16:43:19 +0530 +Subject: [PATCH 1/4] interfaces: Add debug logging to sockaddr_to_string + +Helps when you forgot to call WSAStartup, for instance. +--- + agent/interfaces.c | 17 ++++++++++++++--- + 1 file changed, 14 insertions(+), 3 deletions(-) + +diff --git a/agent/interfaces.c b/agent/interfaces.c +index 95e64a8..5c8d131 100644 +--- a/agent/interfaces.c ++++ b/agent/interfaces.c +@@ -89,14 +89,25 @@ sockaddr_to_string (const struct sockaddr *addr) + size_t addr_len; + + switch (addr->sa_family) { +- case AF_INET: addr_len = sizeof (struct sockaddr_in); break; +- case AF_INET6: addr_len = sizeof (struct sockaddr_in6); break; +- default: return NULL; ++ case AF_INET: ++ addr_len = sizeof (struct sockaddr_in); ++ break; ++ case AF_INET6: ++ addr_len = sizeof (struct sockaddr_in6); ++ break; ++ default: ++ nice_debug ("Unknown sockaddr family: %i", addr->sa_family); ++ return NULL; + } + + if (getnameinfo (addr, addr_len, + addr_as_string, sizeof (addr_as_string), NULL, 0, + NI_NUMERICHOST) != 0) { ++#ifdef G_OS_WIN32 ++ gchar *msg = g_win32_error_message (WSAGetLastError ()); ++ nice_debug ("Error running getnameinfo: %s", msg); ++ g_free (msg); ++#endif + return NULL; + } + +-- +2.27.0.windows.1 + diff --git a/0001-rand-Use-crypto-libs-instead-of-CryptGenRandom.patch b/0001-rand-Use-crypto-libs-instead-of-CryptGenRandom.patch new file mode 100644 index 000000000000..6b090c4e7dc3 --- /dev/null +++ b/0001-rand-Use-crypto-libs-instead-of-CryptGenRandom.patch @@ -0,0 +1,74 @@ +From 3fa32bb651f0cbd3ee86a3f221ecb3bb24a9d585 Mon Sep 17 00:00:00 2001 +From: Nirbheek Chauhan <nirbheek@centricular.com> +Date: Tue, 16 Jun 2020 03:49:14 +0530 +Subject: [PATCH 1/2] rand: Use crypto libs instead of CryptGenRandom() + +We will always have either openssl or gnutls, which are better sources +for random nonces. Also, CryptGenRandom is deprecated API that's not +available on WinRT/UWP. +--- + stun/rand.c | 37 +++---------------------------------- + 1 file changed, 3 insertions(+), 34 deletions(-) + +diff --git a/stun/rand.c b/stun/rand.c +index cc0927f..1361245 100644 +--- a/stun/rand.c ++++ b/stun/rand.c +@@ -39,36 +39,7 @@ + + #include "rand.h" + +- +-#ifdef _WIN32 +- +-#include <windows.h> +-#include <wincrypt.h> +- +-void nice_RAND_nonce (uint8_t *dst, int len) +-{ +- HCRYPTPROV hCryptProv; +- LPCSTR container = "Libnice key container"; +- +- if(!CryptAcquireContext(&hCryptProv, container, NULL, PROV_RSA_FULL, 0)) { +- /* non existing container. try to create a new one */ +- // I hope this cast here doesn't cause issues +- // gcc was complaining about comparing signed and unsigned values +- if (GetLastError() == (DWORD) NTE_BAD_KEYSET) { +- if(!CryptAcquireContext(&hCryptProv, container, NULL, PROV_RSA_FULL, CRYPT_NEWKEYSET)) { +- return; +- } +- } +- return; +- } +- +- CryptGenRandom (hCryptProv, len, dst); +- +- CryptReleaseContext(hCryptProv,0); +-} +-#else +- +-#ifdef HAVE_OPENSSL ++#if defined(HAVE_OPENSSL) + + #include <openssl/rand.h> + +@@ -77,7 +48,7 @@ void nice_RAND_nonce (uint8_t *dst, int len) + RAND_bytes (dst, len); + } + +-#else ++#elif defined(HAVE_GNUTLS) + + #include <sys/types.h> + #include <gnutls/gnutls.h> +@@ -88,6 +59,4 @@ void nice_RAND_nonce (uint8_t *dst, int len) + gnutls_rnd (GNUTLS_RND_NONCE, dst, len); + } + +-#endif /* HAVE_OPENSSL */ +- +-#endif /* _WIN32 */ ++#endif +-- +2.27.0.windows.1 + diff --git a/0001-stund-Use-lowercase-winsock2.h.patch b/0001-stund-Use-lowercase-winsock2.h.patch new file mode 100644 index 000000000000..d9d3992e45bd --- /dev/null +++ b/0001-stund-Use-lowercase-winsock2.h.patch @@ -0,0 +1,30 @@ +From ffb45c21af0c0f028a800cfe4c1b7235ee8febba Mon Sep 17 00:00:00 2001 +From: Nirbheek Chauhan <nirbheek@centricular.com> +Date: Mon, 15 Jun 2020 19:54:21 +0530 +Subject: [PATCH] stund: Use lowercase winsock2.h + +Windows ships with `WinSock2.h` but mingw ships with `winsock2.h`. +This is fine on Windows because files are case-insensitive, but on +Linux it causes the compiler to not find the header. + +All other #includes are lowercase, so just use that. +--- + stun/tools/stund.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/stun/tools/stund.c b/stun/tools/stund.c +index ed74c87..5d0987a 100644 +--- a/stun/tools/stund.c ++++ b/stun/tools/stund.c +@@ -54,7 +54,7 @@ + #include <sys/types.h> + + #ifdef _WIN32 +-#include <WinSock2.h> ++#include <winsock2.h> + #else + #include <sys/socket.h> + #include <netdb.h> +-- +2.26.2 + diff --git a/0002-interfaces-Port-to-GetBestInterfaceEx-for-UWP-compat.patch b/0002-interfaces-Port-to-GetBestInterfaceEx-for-UWP-compat.patch new file mode 100644 index 000000000000..0954add5dbeb --- /dev/null +++ b/0002-interfaces-Port-to-GetBestInterfaceEx-for-UWP-compat.patch @@ -0,0 +1,45 @@ +From fab226c5cf4d1ae1306d6d48d684e9bb231a3cc7 Mon Sep 17 00:00:00 2001 +From: Nirbheek Chauhan <nirbheek@centricular.com> +Date: Thu, 9 Jul 2020 16:43:45 +0530 +Subject: [PATCH 2/4] interfaces: Port to GetBestInterfaceEx for UWP compat + +Still prefer ipv4 addresses for backwards-compat. GetBestInterface is +not allowed when targeting UWP, so use GetBestInterfaceEx. + +Also add some debug logging to ensure that the function is actually +running correctly. +--- + agent/interfaces.c | 17 +++++++++++++++-- + 1 file changed, 15 insertions(+), 2 deletions(-) + +diff --git a/agent/interfaces.c b/agent/interfaces.c +index 5c8d131..309ca65 100644 +--- a/agent/interfaces.c ++++ b/agent/interfaces.c +@@ -600,8 +600,21 @@ GList * nice_interfaces_get_local_ips (gboolean include_loopback) + * Get the best interface for transport to 0.0.0.0. + * This interface should be first in list! + */ +- if (GetBestInterface (0, &pref) != NO_ERROR) +- pref = 0; ++ { ++ DWORD retcode; ++ struct sockaddr_in sa_any = {0}; ++ ++ sa_any.sin_family = AF_INET; ++ sa_any.sin_addr.s_addr = htonl (INADDR_ANY); ++ ++ retcode = GetBestInterfaceEx ((SOCKADDR *) &sa_any, &pref); ++ if (retcode != NO_ERROR) { ++ gchar *msg = g_win32_error_message (retcode); ++ nice_debug ("Error fetching best interface: %s", msg); ++ g_free (msg); ++ pref = 0; ++ } ++ } + + /* Loop over the adapters. */ + for (a = addresses; a != NULL; a = a->Next) { +-- +2.27.0.windows.1 + diff --git a/0002-meson-Fix-typos-in-crypto-library-detection.patch b/0002-meson-Fix-typos-in-crypto-library-detection.patch new file mode 100644 index 000000000000..5ccfcc6bddfc --- /dev/null +++ b/0002-meson-Fix-typos-in-crypto-library-detection.patch @@ -0,0 +1,34 @@ +From e75f9730c64301f68aaf42bb8d1e8d7ccf9cd6d5 Mon Sep 17 00:00:00 2001 +From: Nirbheek Chauhan <nirbheek@centricular.com> +Date: Tue, 16 Jun 2020 03:54:28 +0530 +Subject: [PATCH 2/2] meson: Fix typos in crypto-library detection + +--- + meson.build | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/meson.build b/meson.build +index 0004d91..5b876de 100644 +--- a/meson.build ++++ b/meson.build +@@ -189,7 +189,7 @@ gthread_dep = dependency('gthread-2.0', + + # Cryto library + opt_cryptolib = get_option('crypto-library') +-message('Crypto librar requested: ' + opt_cryptolib) ++message('Crypto library requested: ' + opt_cryptolib) + if opt_cryptolib != 'openssl' + crypto_dep = dependency('gnutls', version: gnutls_req, required: false) + cdata.set('HAVE_GNUTLS', crypto_dep.found()) +@@ -243,7 +243,7 @@ endif + if not crypto_dep.found() + if opt_cryptolib == 'gnutls' + error('GnuTLS requested as crypto library, but not found') +- elif opt_cryptolib == 'gnutls' ++ elif opt_cryptolib == 'openssl' + error('OpenSSL requested as crypto library, but not found') + else + error('Either GnuTLS or OpenSSL is required as crypto library, but neither was found') +-- +2.27.0.windows.1 + diff --git a/0003-interfaces-Remove-unused-win32-code.patch b/0003-interfaces-Remove-unused-win32-code.patch new file mode 100644 index 000000000000..8ae0788e8e03 --- /dev/null +++ b/0003-interfaces-Remove-unused-win32-code.patch @@ -0,0 +1,59 @@ +From 8ad450a37365799af3259d070a07405b847650b4 Mon Sep 17 00:00:00 2001 +From: Nirbheek Chauhan <nirbheek@centricular.com> +Date: Thu, 9 Jul 2020 17:55:08 +0530 +Subject: [PATCH 3/4] interfaces: Remove unused win32 code + +--- + agent/interfaces.c | 36 ------------------------------------ + 1 file changed, 36 deletions(-) + +diff --git a/agent/interfaces.c b/agent/interfaces.c +index 309ca65..9a5300e 100644 +--- a/agent/interfaces.c ++++ b/agent/interfaces.c +@@ -497,42 +497,6 @@ nice_interfaces_get_ip_for_interface (gchar *interface_name) + #define MIB_IPADDR_DELETED 0x0040 + #endif + +-#if 0 +-static gboolean started_wsa_engine = FALSE; +- +-/* +- * private function that initializes the WinSock engine and +- * returns a prebuilt socket +- */ +-SOCKET nice_interfaces_get_WSA_socket () +-{ +- WORD wVersionRequested; +- WSADATA wsaData; +- int err; +- SOCKET sock; +- +- if (started_wsa_engine == FALSE) { +- wVersionRequested = MAKEWORD ( 2, 0 ); +- +- err = WSAStartup ( wVersionRequested, &wsaData ); +- if ( err != 0 ) { +- nice_debug ("Error : Could not start the winsocket engine"); +- return INVALID_SOCKET; +- } +- started_wsa_engine = TRUE; +- } +- +- +- if ((sock = socket (AF_INET, SOCK_DGRAM, 0)) == INVALID_SOCKET) { +- nice_debug ("Error : Could not open socket to retrieve interface list," +- " error no : %d", WSAGetLastError ()); +- return INVALID_SOCKET; +- } +- +- return sock; +-} +-#endif +- + GList * nice_interfaces_get_local_interfaces (void) + { + ULONG size = 0; +-- +2.27.0.windows.1 + diff --git a/0004-interfaces-Fix-fetching-of-interfaces-on-Win32.patch b/0004-interfaces-Fix-fetching-of-interfaces-on-Win32.patch new file mode 100644 index 000000000000..6d8c08d0db04 --- /dev/null +++ b/0004-interfaces-Fix-fetching-of-interfaces-on-Win32.patch @@ -0,0 +1,257 @@ +From 0754179c2d0db97d06a3f0f9e500bfc54fc48108 Mon Sep 17 00:00:00 2001 +From: Nirbheek Chauhan <nirbheek@centricular.com> +Date: Thu, 9 Jul 2020 17:55:53 +0530 +Subject: [PATCH 4/4] interfaces: Fix fetching of interfaces on Win32 + +nice_interfaces_get_local_interfaces() was returning the hardware +device names of interfaces that have been seen in the past or could be +connected. It had no relation to the actual interfaces present on the +device. Perhaps this worked back in the XP days, but it is returning +garbage today. + +Use GetAdapterAddresses(), and return the adapter friendly names as +the interface names. At the same time, update +nice_interfaces_get_ip_for_interface() to match. + +Coincidentally, this also fixes UWP compatibility since GetIfTable and +GetIpAddrTable are not available when targeting UWP. They are only +available for desktop apps: + +https://docs.microsoft.com/en-us/windows/win32/api/iphlpapi/nf-iphlpapi-getiftable +https://docs.microsoft.com/en-us/windows/win32/api/iphlpapi/nf-iphlpapi-getipaddrtable +--- + agent/interfaces.c | 174 ++++++++++++++++++++++----------------------- + 1 file changed, 85 insertions(+), 89 deletions(-) + +diff --git a/agent/interfaces.c b/agent/interfaces.c +index 9a5300e..b99450d 100644 +--- a/agent/interfaces.c ++++ b/agent/interfaces.c +@@ -497,39 +497,13 @@ nice_interfaces_get_ip_for_interface (gchar *interface_name) + #define MIB_IPADDR_DELETED 0x0040 + #endif + +-GList * nice_interfaces_get_local_interfaces (void) ++static IP_ADAPTER_ADDRESSES * ++_nice_get_adapters_addresses (void) + { +- ULONG size = 0; +- PMIB_IFTABLE if_table; +- GList * ret = NULL; +- +- GetIfTable(NULL, &size, TRUE); +- +- if (!size) +- return NULL; +- +- if_table = (PMIB_IFTABLE)g_malloc0(size); +- +- if (GetIfTable(if_table, &size, TRUE) == ERROR_SUCCESS) { +- DWORD i; +- for (i = 0; i < if_table->dwNumEntries; i++) { +- ret = g_list_prepend (ret, g_strdup ((gchar*)if_table->table[i].bDescr)); +- } +- } +- +- g_free(if_table); +- +- return ret; +-} +- +-GList * nice_interfaces_get_local_ips (gboolean include_loopback) +-{ +- IP_ADAPTER_ADDRESSES *addresses = NULL, *a; ++ IP_ADAPTER_ADDRESSES *addresses = NULL; + ULONG status; + guint iterations; + ULONG addresses_size; +- DWORD pref = 0; +- GList *ret = NULL; + + /* As suggested on + * http://msdn.microsoft.com/en-gb/library/windows/desktop/aa365915%28v=vs.85%29.aspx */ +@@ -555,11 +529,45 @@ GList * nice_interfaces_get_local_ips (gboolean include_loopback) + + /* Error? */ + if (status != NO_ERROR) { +- nice_debug ("Error retrieving local addresses (error code %lu).", status); ++ gchar *msg = g_win32_error_message (status); ++ nice_debug ("Error retrieving local addresses: %s", msg); ++ g_free (msg); + g_free (addresses); + return NULL; + } + ++ return addresses; ++} ++ ++GList * nice_interfaces_get_local_interfaces (void) ++{ ++ IP_ADAPTER_ADDRESSES *addresses, *a; ++ GList *ret = NULL; ++ ++ addresses = _nice_get_adapters_addresses (); ++ if (!addresses) ++ return NULL; ++ ++ for (a = addresses; a != NULL; a = a->Next) { ++ gchar *name = g_utf16_to_utf8 (a->FriendlyName, -1, NULL, NULL, NULL); ++ ret = g_list_append (ret, name); ++ } ++ ++ g_free(addresses); ++ ++ return ret; ++} ++ ++GList * nice_interfaces_get_local_ips (gboolean include_loopback) ++{ ++ IP_ADAPTER_ADDRESSES *addresses, *a; ++ DWORD pref = 0; ++ GList *ret = NULL; ++ ++ addresses = _nice_get_adapters_addresses (); ++ if (!addresses) ++ return NULL; ++ + /* + * Get the best interface for transport to 0.0.0.0. + * This interface should be first in list! +@@ -613,7 +621,7 @@ GList * nice_interfaces_get_local_ips (gboolean include_loopback) + continue; + } + +- nice_debug ("IP address: %s", addr_string); ++ nice_debug ("Adapter %S IP address: %s", a->FriendlyName, addr_string); + + if (a->IfIndex == pref || a->Ipv6IfIndex == pref) + ret = g_list_prepend (ret, addr_string); +@@ -627,79 +635,67 @@ GList * nice_interfaces_get_local_ips (gboolean include_loopback) + return ret; + } + +-/* +- * returns ip address as an utf8 string +- */ +-// Source for idx's type (Was IF_INDEX): +-// http://msdn.microsoft.com/en-us/library/aa366836(v=VS.85).aspx +-// (Title: MIB_IFROW structure) +-static gchar * +-win32_get_ip_for_interface (DWORD idx) ++gchar * nice_interfaces_get_ip_for_interface (gchar *interface_name) + { +- ULONG size = 0; +- PMIB_IPADDRTABLE ip_table; ++ IP_ADAPTER_ADDRESSES *addresses, *a; ++ IP_ADAPTER_UNICAST_ADDRESS *unicast; ++ DWORD status; + gchar * ret = NULL; + +- GetIpAddrTable (NULL, &size, TRUE); +- +- if (!size) ++ addresses = _nice_get_adapters_addresses (); ++ if (!addresses) + return NULL; + +- ip_table = (PMIB_IPADDRTABLE)g_malloc0 (size); +- +- if (GetIpAddrTable (ip_table, &size, TRUE) == ERROR_SUCCESS) { +- DWORD i; +- for (i = 0; i < ip_table->dwNumEntries; i++) { +- PMIB_IPADDRROW ipaddr = &ip_table->table[i]; +- if (ipaddr->dwIndex == idx && +- !(ipaddr->wType & (MIB_IPADDR_DISCONNECTED | MIB_IPADDR_DELETED))) { +- ret = g_strdup_printf ("%lu.%lu.%lu.%lu", +- (ipaddr->dwAddr ) & 0xFF, +- (ipaddr->dwAddr >> 8) & 0xFF, +- (ipaddr->dwAddr >> 16) & 0xFF, +- (ipaddr->dwAddr >> 24) & 0xFF); +- break; +- } +- } +- } +- +- g_free (ip_table); +- return ret; +-} ++ for (a = addresses; a != NULL; a = a->Next) { ++ IP_ADAPTER_UNICAST_ADDRESS *unicast; ++ gchar *name; + +-gchar * nice_interfaces_get_ip_for_interface (gchar *interface_name) +-{ +- ULONG size = 0; +- PMIB_IFTABLE if_table; +- gchar * ret = NULL; ++ /* Various conditions for ignoring the interface. */ ++ if (a->OperStatus == IfOperStatusDown || ++ a->OperStatus == IfOperStatusNotPresent || ++ a->OperStatus == IfOperStatusLowerLayerDown) { ++ nice_debug ("Rejecting interface '%S' because it is down or not present", ++ a->FriendlyName); ++ continue; ++ } + +- GetIfTable (NULL, &size, TRUE); ++ name = g_utf16_to_utf8 (a->FriendlyName, -1, NULL, NULL, NULL); ++ status = g_ascii_strcasecmp (interface_name, name); ++ g_free (name); + +- if (!size) +- return NULL; ++ /* Found the adapter */ ++ if (status == 0) ++ break; + +- if_table = (PMIB_IFTABLE)g_malloc0 (size); ++ nice_debug ("Rejecting interface '%s' != '%s'", name, interface_name); ++ } + +- if (GetIfTable (if_table, &size, TRUE) == ERROR_SUCCESS) { +- DWORD i; +- gchar * tmp_str; +- for (i = 0; i < if_table->dwNumEntries; i++) { +- tmp_str = g_utf16_to_utf8 ( +- if_table->table[i].wszName, MAX_INTERFACE_NAME_LEN, +- NULL, NULL, NULL); ++ if (!a) { ++ nice_debug ("No matches found for interface %s", interface_name); ++ goto out; ++ } + +- if (strlen (interface_name) == strlen (tmp_str) && +- g_ascii_strncasecmp (interface_name, tmp_str, strlen (interface_name)) == 0) { +- ret = win32_get_ip_for_interface (if_table->table[i].dwIndex); +- g_free (tmp_str); +- break; +- } ++ /* Grab the interface’s ipv4 unicast addresses. */ ++ for (unicast = a->FirstUnicastAddress; ++ unicast != NULL; unicast = unicast->Next) { ++ if (unicast->Address.lpSockaddr->sa_family != AF_INET) { ++ nice_debug ("Rejecting ipv6 address on interface %S", a->FriendlyName); ++ continue; ++ } + +- g_free (tmp_str); ++ ret = sockaddr_to_string (unicast->Address.lpSockaddr); ++ if (ret == NULL) { ++ nice_debug ("Failed to convert address to string for interface: %S", ++ a->FriendlyName); ++ continue; + } ++ ++ nice_debug ("Adapter %S IP address: %s", a->FriendlyName, ret); ++ break; + } + +- g_free (if_table); ++out: ++ g_free (addresses); + + return ret; + } +-- +2.27.0.windows.1 + @@ -1,6 +1,6 @@ # Maintainer: drakkan <nicola.murino at gmail dot com> pkgname=mingw-w64-libnice -pkgver=0.1.16 +pkgver=0.1.17 pkgrel=1 pkgdesc="An implementation of the IETF's draft ICE (for p2p UDP data streams) (mingw-w64)" arch=(any) @@ -10,12 +10,37 @@ makedepends=('mingw-w64-meson' 'git' 'mingw-w64-gstreamer') depends=('mingw-w64-glib2' 'mingw-w64-gnutls') options=('!strip' '!buildflags' 'staticlibs') -_commit=5969b34e3acd9150506ed8d9d109c73665858f3e # tags/0.1.16^0 -source=("git+https://gitlab.freedesktop.org/libnice/libnice.git#commit=$_commit") -sha256sums=('SKIP') +_commit=5fb2511725a690a68ed9ace030931b78bc6fe92c # tags/0.1.17^0 +source=("git+https://gitlab.freedesktop.org/libnice/libnice.git#commit=$_commit" + "0001-rand-Use-crypto-libs-instead-of-CryptGenRandom.patch" + "0001-stund-Use-lowercase-winsock2.h.patch" + "0002-meson-Fix-typos-in-crypto-library-detection.patch" + "0001-interfaces-Add-debug-logging-to-sockaddr_to_string.patch" + "0002-interfaces-Port-to-GetBestInterfaceEx-for-UWP-compat.patch" + "0003-interfaces-Remove-unused-win32-code.patch" + "0004-interfaces-Fix-fetching-of-interfaces-on-Win32.patch") +sha256sums=('SKIP' + '60cb90e75a33fb1a7b27c3d44427292f57fef5e323bbc34059c882f7ac915fd7' + '678ae8681958699e0f75ef203b6feead7cf3fd2693f11f6f05f4ff1bdc9317b8' + 'c13cf63b6f53939349d7ef19713ce1b9b25a387a1bc185c596471017bcf3aa27' + '71c1f26848645d635f08361859e0878fd818ed1730146f6f764dc1ecacd76beb' + '57de9f9b97f05de2cc7c03fd76484b49f005285145252f7206ef4d5e56d21c3c' + '398011d48d899713fc79b440ca8237488e3291939cb16885b618e5a8c8bcae1b' + 'f888e748c970311303fe6b4e0761223c5966bd2eb57be4476d19def21881bc43') _architectures="i686-w64-mingw32 x86_64-w64-mingw32" +prepare() { + cd "${srcdir}/libnice" + patch -Np1 -i ../0001-stund-Use-lowercase-winsock2.h.patch + patch -Np1 -i ../0001-rand-Use-crypto-libs-instead-of-CryptGenRandom.patch + patch -Np1 -i ../0002-meson-Fix-typos-in-crypto-library-detection.patch + patch -Np1 -i ../0001-interfaces-Add-debug-logging-to-sockaddr_to_string.patch + patch -Np1 -i ../0002-interfaces-Port-to-GetBestInterfaceEx-for-UWP-compat.patch + patch -Np1 -i ../0003-interfaces-Remove-unused-win32-code.patch + patch -Np1 -i ../0004-interfaces-Fix-fetching-of-interfaces-on-Win32.patch +} + build() { cd "${srcdir}/libnice" for _arch in $_architectures; do |