summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml28
-rw-r--r--NEWS15
-rw-r--r--agent/agent-priv.h2
-rw-r--r--agent/component.c6
-rw-r--r--agent/interfaces.c146
-rw-r--r--agent/meson.build4
-rw-r--r--docs/reference/libnice/libnice-sections.txt4
-rw-r--r--gst/gstnicesink.c39
-rw-r--r--gst/meson.build3
-rw-r--r--meson.build20
-rw-r--r--nice/libnice.sym1
-rw-r--r--nice/meson.build13
-rw-r--r--nice/nice-version.h.in30
-rw-r--r--stun/stunmessage.c2
-rwxr-xr-xtests/docker/fedora38/pip-installs.sh5
-rw-r--r--tests/meson.build8
16 files changed, 195 insertions, 131 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index eb1561e..8810206 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -21,6 +21,8 @@ include:
file: '/templates/ci-fairy.yml'
- project: 'freedesktop/ci-templates'
file: '/templates/centos.yml'
+ - project: 'freedesktop/ci-templates'
+ file: '/templates/fedora.yml'
.libnice.centos:7:
variables:
@@ -28,6 +30,12 @@ include:
FDO_DISTRIBUTION_TAG: '2022-10-17-cov'
FDO_UPSTREAM_REPO: 'libnice/libnice'
+.libnice.fedora:38:
+ variables:
+ FDO_DISTRIBUTION_VERSION: '38'
+ FDO_DISTRIBUTION_TAG: '2023-07-17'
+ FDO_UPSTREAM_REPO: 'libnice/libnice'
+
check-allow-collaboration:
extends:
- .fdo.ci-fairy
@@ -51,6 +59,15 @@ build-centos-container:7:
FDO_DISTRIBUTION_PACKAGES: 'git gtk-doc gnutls-devel gupnp-igd-devel gstreamer1-devel gobject-introspection-devel valgrind net-tools centos-release-scl graphviz'
FDO_DISTRIBUTION_EXEC: 'tests/docker/centos7-meson/pip-installs.sh'
+build-fedora-container:38:
+ extends:
+ - .fdo.container-build@fedora # the CI template
+ - .libnice.fedora:38 # our template job above
+ stage: containers
+ variables:
+ FDO_DISTRIBUTION_PACKAGES: 'git gtk-doc gnutls-devel gupnp-igd-devel gstreamer1-devel gobject-introspection-devel valgrind net-tools graphviz meson ninja-build lcov python3-pip'
+ FDO_DISTRIBUTION_EXEC: 'tests/docker/fedora38/pip-installs.sh'
+
build:
stage: build
extends:
@@ -74,13 +91,13 @@ build:
.build windows:
- image: 'registry.freedesktop.org/gstreamer/gstreamer/amd64/windows:2021-10-01.0-master'
+ image: 'registry.freedesktop.org/gstreamer/gstreamer/amd64/windows:2023-08-24.0-main'
stage: 'build'
interruptible: true
tags:
- 'docker'
- 'windows'
- - '1809'
+ - '2022'
variables:
MESON_ARGS: >
--prefix=${CI_PROJECT_DIR}/libnice-prefix
@@ -101,8 +118,6 @@ build msys2:
# It seems that the gpg doesn't like the SSL secured version of the keyserver
- C:\msys64\usr\bin\bash -c "pacman-key --init && pacman-key --populate msys2 && pacman-key --refresh-keys || true"
- - echo "Download newest msys2 keyring"
- - C:\msys64\usr\bin\bash -c "curl -O http://repo.msys2.org/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz && pacman -U --noconfirm msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz"
- C:\msys64\usr\bin\bash -c "pacman-key --init && pacman-key --populate msys2"
- C:\msys64\usr\bin\bash -c "pacman-key --refresh-keys || true"
- C:\msys64\usr\bin\bash -c "pacman -Sy --noconfirm --needed mingw-w64-x86_64-toolchain ninja"
@@ -285,8 +300,8 @@ doc-and-install:
submit-to-coverity:
stage: test
extends:
- - .fdo.distribution-image@centos
- - .libnice.centos:7
+ - .fdo.distribution-image@fedora
+ - .libnice.fedora:38
variables:
COVERITY_PROJECT: libnice
PREFIX: "${CI_PROJECT_DIR}/libnice-prefix"
@@ -299,7 +314,6 @@ submit-to-coverity:
script:
- curl -v https://scan.coverity.com/download/linux64 -o coverity_tool.tgz --data "token=${COVERITY_TOKEN}&project=${COVERITY_PROJECT}" && tar xf coverity_tool.tgz && rm coverity_tool.tgz
- mv cov-analysis-linux64-* cov-analysis-linux64
- - source scl_source enable rh-python36 && true
- meson --werror --warnlevel 2 -Dgtk_doc=disabled -Dintrospection=disabled --prefix=$PREFIX cov-build/
- export PATH="$PATH:${CI_PROJECT_DIR}/cov-analysis-linux64/bin"
- echo $PATH
diff --git a/NEWS b/NEWS
index afeda3e..b193a9d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,9 +1,22 @@
+libnice 0.1.22 (2024-03-04)
+===========================
+API: Make nice_address_is_local() available to applications
+Make padding be all zeros to conform to RFC8489
+Fix interface listing on Android
+Include TURN sockets in the list from nice_agent_get_sockets()
+Set consent refresh timeout in line with RFC 7675
+Fix ifr_ifindex build with cland and OpenBSD
+
+libnice 0.1.21 (2023-01-07)
+===========================
+Only use `ifr_ifindex` if OS supports it, fixes build on iOS and FreeBSD
+
libnice 0.1.20 (2023-01-06)
===========================
Remove support for GStreamer 0.10 builds
Add macro to check LIBNICE version
Added utility function to get the STUN server from a candidate
-Support additional header in built-in HTT proxy client
+Support additional header in built-in HTTP proxy client
Add boxed type for NiceAddress for bindings
Add API to get the interface index for a local address
Explicitly bind to a specific interface when creating UDP sockets
diff --git a/agent/agent-priv.h b/agent/agent-priv.h
index 4ac7739..e72eed9 100644
--- a/agent/agent-priv.h
+++ b/agent/agent-priv.h
@@ -107,7 +107,7 @@ nice_input_message_iter_compare (const NiceInputMessageIter *a,
#define NICE_AGENT_TIMER_TA_DEFAULT 20 /* timer Ta, msecs (impl. defined) */
#define NICE_AGENT_TIMER_TR_DEFAULT 25000 /* timer Tr, msecs (impl. defined) */
#define NICE_AGENT_TIMER_CONSENT_DEFAULT 5000 /* msec timer consent freshness connchecks (RFC 7675) */
-#define NICE_AGENT_TIMER_CONSENT_TIMEOUT 10000 /* msec timer for consent checks to timeout and assume consent lost (RFC 7675) */
+#define NICE_AGENT_TIMER_CONSENT_TIMEOUT 30000 /* msec timer for consent checks to timeout and assume consent lost (RFC 7675) */
#define NICE_AGENT_TIMER_MIN_CONSENT_INTERVAL 4000 /* msec timer minimum for consent lost requests (RFC 7675) */
#define NICE_AGENT_TIMER_KEEPALIVE_TIMEOUT 50000 /* msec timer for keepalive (without consent checks) to timeout and assume conection lost */
#define NICE_AGENT_MAX_CONNECTIVITY_CHECKS_DEFAULT 100 /* see RFC 8445 6.1.2.5 */
diff --git a/agent/component.c b/agent/component.c
index cb7d098..92347b1 100644
--- a/agent/component.c
+++ b/agent/component.c
@@ -1717,9 +1717,9 @@ nice_component_get_sockets (NiceComponent *component)
GPtrArray *array = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
GSList *item;
- for (item = component->local_candidates; item; item = item->next) {
- NiceCandidateImpl *c = item->data;
- NiceSocket *nicesock = c->sockptr;
+ for (item = component->socket_sources; item; item = item->next) {
+ SocketSource *source = item->data;
+ NiceSocket *nicesock = source->socket;
if (nicesock->fileno && !g_ptr_array_find (array, nicesock->fileno, NULL))
g_ptr_array_add (array, g_object_ref (nicesock->fileno));
diff --git a/agent/interfaces.c b/agent/interfaces.c
index 3590e0d..27fdaf0 100644
--- a/agent/interfaces.c
+++ b/agent/interfaces.c
@@ -126,7 +126,6 @@ get_local_interfaces_ioctl (void)
{
GList *interfaces = NULL;
gint sockfd;
- gint size = 0;
struct ifreq *ifr;
struct ifconf ifc;
@@ -137,27 +136,15 @@ get_local_interfaces_ioctl (void)
ifc.ifc_len = 0;
ifc.ifc_req = NULL;
-
- /* Loop and get each interface the system has, one by one... */
- do {
- size += sizeof (struct ifreq);
- /* realloc buffer size until no overflow occurs */
- if (NULL == (ifc.ifc_req = realloc (ifc.ifc_req, size))) {
- nice_debug ("Error : Out of memory while allocation interface"
- "configuration structure");
- close (sockfd);
- return NULL;
+ if (ioctl (sockfd, SIOCGIFCONF, &ifc)) {
+ perror ("ioctl SIOCFIFCONF");
+ goto done;
}
- ifc.ifc_len = size;
-
- if (ioctl (sockfd, SIOCGIFCONF, &ifc)) {
+ ifc.ifc_req = g_malloc0 (ifc.ifc_len);
+ if (ioctl (sockfd, SIOCGIFCONF, &ifc)) {
perror ("ioctl SIOCFIFCONF");
- close (sockfd);
- free (ifc.ifc_req);
- return NULL;
+ goto done;
}
- } while (size <= ifc.ifc_len);
-
/* Loop throught the interface list and get the IP address of each IF */
for (ifr = ifc.ifc_req;
@@ -167,7 +154,8 @@ get_local_interfaces_ioctl (void)
interfaces = g_list_prepend (interfaces, g_strdup (ifr->ifr_name));
}
- free (ifc.ifc_req);
+done:
+ g_free (ifc.ifc_req);
close (sockfd);
return interfaces;
@@ -250,7 +238,6 @@ get_local_ips_ioctl (gboolean include_loopback)
{
GList *ips = NULL;
gint sockfd;
- gint size = 0;
struct ifreq *ifr;
struct ifconf ifc;
GList *loopbacks = NULL;
@@ -266,57 +253,44 @@ get_local_ips_ioctl (gboolean include_loopback)
ifc.ifc_len = 0;
ifc.ifc_req = NULL;
-
- /* Loop and get each interface the system has, one by one... */
- do {
- size += sizeof (struct ifreq);
- /* realloc buffer size until no overflow occurs */
- if (NULL == (ifc.ifc_req = realloc (ifc.ifc_req, size))) {
- nice_debug ("Error : Out of memory while allocation interface"
- " configuration structure");
- close (sockfd);
- return NULL;
+ if (ioctl (sockfd, SIOCGIFCONF, &ifc)) {
+ perror ("ioctl SIOCFIFCONF");
+ goto done;
}
- ifc.ifc_len = size;
-
- if (ioctl (sockfd, SIOCGIFCONF, &ifc)) {
+ ifc.ifc_req = g_malloc0 (ifc.ifc_len);
+ if (ioctl (sockfd, SIOCGIFCONF, &ifc)) {
perror ("ioctl SIOCFIFCONF");
- close (sockfd);
- free (ifc.ifc_req);
- return NULL;
+ goto done;
}
- } while (size <= ifc.ifc_len);
-
/* Loop throught the interface list and get the IP address of each IF */
for (ifr = ifc.ifc_req;
(gchar *) ifr < (gchar *) ifc.ifc_req + ifc.ifc_len;
++ifr) {
gchar *addr_string;
+ struct ifreq ifr2;
- if (ioctl (sockfd, SIOCGIFFLAGS, ifr)) {
- nice_debug ("Error : Unable to get IP flags information for interface %s."
+ if (ifr->ifr_addr.sa_family != AF_INET &&
+ ifr->ifr_addr.sa_family != AF_INET6)
+ continue;
+
+ memset (&ifr2, 0, sizeof (ifr2));
+ g_strlcpy (ifr2.ifr_name, ifr->ifr_name, IFNAMSIZ);
+ if (ioctl (sockfd, SIOCGIFFLAGS, &ifr2)) {
+ nice_debug (
+ "Error : Unable to get IP flags information for interface %s."
" Skipping...", ifr->ifr_name);
- continue; /* failed to get flags, skip it */
+ continue; /* failed to get flags, skip it */
}
/* no ip address from interface that is down */
- if ((ifr->ifr_flags & IFF_UP) == 0)
+ if ((ifr2.ifr_flags & IFF_UP) == 0)
continue;
/* no ip address from interface that isn't running */
- if ((ifr->ifr_flags & IFF_RUNNING) == 0)
+ if ((ifr2.ifr_flags & IFF_RUNNING) == 0)
continue;
- if (ioctl(sockfd, SIOCGIFADDR, ifr)) {
- nice_debug ("Error : Unable to get IP address information for interface %s."
- " Skipping...", ifr->ifr_name);
- continue; /* failed to get address, skip it */
- }
-
- if (ifr->ifr_addr.sa_family != AF_INET &&
- ifr->ifr_addr.sa_family != AF_INET6)
- continue;
/* Convert to a string. */
addr_string = sockaddr_to_string (&ifr->ifr_addr);
@@ -361,8 +335,9 @@ get_local_ips_ioctl (gboolean include_loopback)
}
}
+done:
close (sockfd);
- free (ifc.ifc_req);
+ g_free (ifc.ifc_req);
if (loopbacks)
ips = g_list_concat (ips, loopbacks);
@@ -373,9 +348,8 @@ get_local_ips_ioctl (gboolean include_loopback)
static guint
get_local_if_index_by_addr_ioctl (NiceAddress *addr)
{
-#ifdef HAVE_IFR_IFINDEX
+#if defined(HAVE_IFR_INDEX) || defined(HAVE_IFR_IFINDEX)
gint sockfd;
- gint size = 0;
struct ifreq *ifr;
struct ifconf ifc;
guint if_index = 0;
@@ -387,50 +361,59 @@ get_local_if_index_by_addr_ioctl (NiceAddress *addr)
ifc.ifc_len = 0;
ifc.ifc_req = NULL;
-
- /* Loop and get each interface the system has, one by one... */
- do {
- size += sizeof (struct ifreq);
- /* realloc buffer size until no overflow occurs */
- if (NULL == (ifc.ifc_req = realloc (ifc.ifc_req, size))) {
- nice_debug ("Error : Out of memory while allocation interface"
- "configuration structure");
- close (sockfd);
- return 0;
+ if (ioctl (sockfd, SIOCGIFCONF, &ifc)) {
+ perror ("ioctl SIOCFIFCONF");
+ goto done;
}
- ifc.ifc_len = size;
-
- if (ioctl (sockfd, SIOCGIFCONF, &ifc)) {
+ ifc.ifc_req = g_malloc0 (ifc.ifc_len);
+ if (ioctl (sockfd, SIOCGIFCONF, &ifc)) {
perror ("ioctl SIOCFIFCONF");
- close (sockfd);
- free (ifc.ifc_req);
- return 0;
+ goto done;
}
- } while (size <= ifc.ifc_len);
-
/* Loop throught the interface list and get the IP address of each IF */
for (ifr = ifc.ifc_req;
(gchar *) ifr < (gchar *) ifc.ifc_req + ifc.ifc_len;
++ifr) {
NiceAddress *myaddr = (NiceAddress *) &ifr->ifr_addr;
+ struct ifreq ifr2;
if (!nice_address_equal_no_port (myaddr, addr))
continue;
- if (ifr->ifr_ifindex == 0)
+
+ memset (&ifr2, 0, sizeof (struct ifreq));
+ g_strlcpy (ifr2.ifr_name, ifr->ifr_name, IFNAMSIZ);
+
+ if (ioctl (sockfd, SIOCGIFINDEX, &ifr2)) {
+ nice_debug ("Error : Unable to get IP address information for interface %s."
+ " Failing...", ifr->ifr_name);
+ goto done;
+ }
+
+#if defined(HAVE_IFR_INDEX)
+ if (ifr2.ifr_index == 0)
+#else
+ if (ifr2.ifr_ifindex == 0)
+#endif
continue;
- if_index = ifr->ifr_ifindex;
+#if defined(HAVE_IFR_INDEX)
+ if_index = ifr2.ifr_index;
+#else
+ if_index = ifr2.ifr_ifindex;
+#endif
break;
}
- free (ifc.ifc_req);
+done:
+ g_free (ifc.ifc_req);
close (sockfd);
return if_index;
#else
g_critical ("getifaddrs() should not fail on a platform that doesn't"
- " include ifr_index in the struct ifreq. Please report the bug.");
+ " include ifr_index or ifr_ifindex in the struct ifreq."
+ " Please report the bug.");
return 0;
#endif
}
@@ -633,9 +616,8 @@ nice_interfaces_get_ip_for_interface (gchar *interface_name)
g_return_val_if_fail (interface_name != NULL, NULL);
- ifr.ifr_addr.sa_family = AF_INET;
- memset (ifr.ifr_name, 0, sizeof (ifr.ifr_name));
- g_strlcpy (ifr.ifr_name, interface_name, sizeof (ifr.ifr_name));
+ memset (&ifr, 0, sizeof (struct ifreq));
+ g_strlcpy (ifr.ifr_name, interface_name, IFNAMSIZ);
if ((sockfd = socket (AF_INET, SOCK_DGRAM, IPPROTO_IP)) < 0) {
nice_debug ("Error : Cannot open socket to retrieve interface list");
@@ -910,7 +892,7 @@ nice_interfaces_get_if_index_by_addr (NiceAddress *addr)
addresses = _nice_get_adapters_addresses ();
if (!addresses)
- return NULL;
+ return 0;
for (a = addresses; a != NULL; a = a->Next) {
/* Various conditions for ignoring the interface. */
diff --git a/agent/meson.build b/agent/meson.build
index 2e5b272..44fcd6b 100644
--- a/agent/meson.build
+++ b/agent/meson.build
@@ -29,14 +29,14 @@ gnome = import('gnome')
agent_enum_types_c = gnome.mkenums('agent-enum-types.c', sources : agent_headers,
fhead: '#include <config.h>\n#include <glib-object.h>\n#include "agent.h"\n#include "pseudotcp.h"\n#include "agent-enum-types.h"',
- fprod: '\n/* enumerations from "@filename@" */',
+ fprod: '\n/* enumerations from "@basename@" */',
vhead: 'GType\n@enum_name@_get_type (void)\n{\n static GType type = 0;\n if (!type) {\n static const G@Type@Value values[] = {',
vprod: ' { @VALUENAME@, "@VALUENAME@", "@valuenick@" },',
vtail: ' { 0, NULL, NULL }\n };\n type = g_@type@_register_static ("@EnumName@", values);\n }\n return type;\n}\n\n')
agent_enum_types_h = gnome.mkenums('agent-enum-types.h', sources : agent_headers,
fhead: '#ifndef __AGENT_ENUM_TYPES_H__\n#define __AGENT_ENUM_TYPES_H__ 1\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n',
- fprod: '/* enumerations from "@filename@" */\n',
+ fprod: '/* enumerations from "@basename@" */\n',
vhead: 'GType @enum_name@_get_type (void) G_GNUC_CONST;\n#define NICE_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n',
ftail: 'G_END_DECLS\n\n#endif /* !AGENT_ENUM_TYPES_H */')
diff --git a/docs/reference/libnice/libnice-sections.txt b/docs/reference/libnice/libnice-sections.txt
index 011e8fd..5c428a3 100644
--- a/docs/reference/libnice/libnice-sections.txt
+++ b/docs/reference/libnice/libnice-sections.txt
@@ -82,6 +82,10 @@ nice_nomination_mode_get_type
nice_proxy_type_get_type
<SUBSECTION Private>
NiceAgentClass
+NICE_VERSION_MAJOR
+NICE_VERSION_MICRO
+NICE_VERSION_MINOR
+NICE_VERSION_NANO
</SECTION>
<SECTION>
diff --git a/gst/gstnicesink.c b/gst/gstnicesink.c
index ced4bd0..204d575 100644
--- a/gst/gstnicesink.c
+++ b/gst/gstnicesink.c
@@ -504,24 +504,23 @@ gst_nice_sink_change_state (GstElement * element, GstStateChange transition)
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
- if (sink->agent == NULL)
- {
- GST_ERROR_OBJECT (element,
- "Trying to start Nice sink without an agent set");
- return GST_STATE_CHANGE_FAILURE;
- }
- else if (sink->stream_id == 0)
- {
- GST_ERROR_OBJECT (element,
- "Trying to start Nice sink without a stream set");
- return GST_STATE_CHANGE_FAILURE;
- }
- else if (sink->component_id == 0)
- {
- GST_ERROR_OBJECT (element,
- "Trying to start Nice sink without a component set");
- return GST_STATE_CHANGE_FAILURE;
- }
+ GST_OBJECT_LOCK (element);
+ if (sink->agent == NULL) {
+ GST_ERROR_OBJECT (element,
+ "Trying to start Nice sink without an agent set");
+ goto failure;
+ }
+ else if (sink->stream_id == 0) {
+ GST_ERROR_OBJECT (element,
+ "Trying to start Nice sink without a stream set");
+ goto failure;
+ }
+ else if (sink->component_id == 0) {
+ GST_ERROR_OBJECT (element,
+ "Trying to start Nice sink without a component set");
+ goto failure;
+ }
+ GST_OBJECT_UNLOCK (element);
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
@@ -536,6 +535,10 @@ gst_nice_sink_change_state (GstElement * element, GstStateChange transition)
transition);
return ret;
+
+failure:
+ GST_OBJECT_UNLOCK (element);
+ return GST_STATE_CHANGE_FAILURE;
}
gboolean
diff --git a/gst/meson.build b/gst/meson.build
index 572c6ab..4ed4794 100644
--- a/gst/meson.build
+++ b/gst/meson.build
@@ -12,8 +12,7 @@ libgstnice = library('gstnice',
gst_nice_sources,
c_args : gst_nice_args,
include_directories: nice_incs,
- dependencies: [nice_deps, gst_dep],
- link_with: libnice,
+ dependencies: [libnice_dep, gst_dep],
install_dir: gst_plugins_install_dir,
install: true)
plugins = [libgstnice]
diff --git a/meson.build b/meson.build
index ad7ae6e..badce49 100644
--- a/meson.build
+++ b/meson.build
@@ -1,5 +1,5 @@
project('libnice', 'c',
- version: '0.1.20.1',
+ version: '0.1.22',
meson_version : '>= 0.52',
default_options : ['warning_level=1', 'buildtype=debugoptimized'])
@@ -20,7 +20,7 @@ endif
# B is the ABI age, change it on new APIs that don't break existing ones, changing it resets C to 0
# C is the revision, change on new updates that don't change APIs
soversion = 10
-libversion = '10.13.0'
+libversion = '10.14.0'
glib_req = '>= 2.54'
gnutls_req = '>= 2.12.0'
@@ -30,6 +30,7 @@ gst_req = '>= 1.0.0'
nice_datadir = join_paths(get_option('prefix'), get_option('datadir'))
cc = meson.get_compiler('c')
+static_build = get_option('default_library') == 'static'
syslibs = []
@@ -84,15 +85,6 @@ add_project_arguments('-D_GNU_SOURCE',
'-DNICE_VERSION_NANO=' + version_nano,
language: 'c')
-version_conf = configuration_data()
-version_conf.set('NICE_VERSION_MAJOR', version_major)
-version_conf.set('NICE_VERSION_MINOR', version_minor)
-version_conf.set('NICE_VERSION_MICRO', version_micro)
-version_conf.set('NICE_VERSION_NANO', version_nano)
-nice_version_h = configure_file(output: 'nice-version.h',
- install_dir: get_option('includedir') / 'nice',
- configuration: version_conf)
-
cdata = configuration_data()
cdata.set_quoted('PACKAGE_STRING', meson.project_name())
@@ -119,6 +111,12 @@ foreach f : ['poll', 'getifaddrs']
endif
endforeach
+# BSD and macOS
+if cc.has_member('struct ifreq', 'ifr_index', prefix: '#include <net/if.h>')
+ cdata.set('HAVE_IFR_INDEX', 1)
+endif
+
+# Linux
if cc.has_member('struct ifreq', 'ifr_ifindex', prefix: '#include <net/if.h>')
cdata.set('HAVE_IFR_IFINDEX', 1)
endif
diff --git a/nice/libnice.sym b/nice/libnice.sym
index e2dc28a..6856fe4 100644
--- a/nice/libnice.sym
+++ b/nice/libnice.sym
@@ -8,6 +8,7 @@ nice_address_get_port
nice_address_get_type
nice_address_init
nice_address_ip_version
+nice_address_is_linklocal
nice_address_is_private
nice_address_is_valid
nice_address_new
diff --git a/nice/meson.build b/nice/meson.build
index 6916781..b1daa44 100644
--- a/nice/meson.build
+++ b/nice/meson.build
@@ -1,4 +1,3 @@
-nice_gen_sources = [nice_version_h]
nice_link_args = []
# libnice.def
@@ -31,9 +30,21 @@ libnice = library('nice',
link_depends: mapfile,
install: true)
+version_conf = configuration_data()
+version_conf.set('version_major', version_major)
+version_conf.set('version_minor', version_minor)
+version_conf.set('version_micro', version_micro)
+version_conf.set('version_nano', version_nano)
+nice_version_h = configure_file(input : 'nice-version.h.in',
+ output: 'nice-version.h',
+ install_dir: get_option('includedir') / 'nice',
+ configuration: version_conf)
+
install_headers('nice.h', subdir: 'nice')
nice_include = include_directories('.')
+nice_gen_sources = [nice_version_h]
+
# introspection
build_gir = gir.found() and not get_option('introspection').disabled()
if build_gir
diff --git a/nice/nice-version.h.in b/nice/nice-version.h.in
new file mode 100644
index 0000000..6445ae8
--- /dev/null
+++ b/nice/nice-version.h.in
@@ -0,0 +1,30 @@
+/**
+ * NICE_VERSION_MAJOR:
+ *
+ * Private, use NICE_CHECK_VERSION
+ */
+
+/**
+ * NICE_VERSION_MINOR:
+ *
+ * Private, use NICE_CHECK_VERSION
+ */
+
+/**
+ * NICE_VERSION_MICRO:
+ *
+ * Private, use NICE_CHECK_VERSION
+ */
+
+/**
+ * NICE_VERSION_NANO:
+ *
+ * Private, use NICE_CHECK_VERSION
+ */
+
+#pragma once
+
+#define NICE_VERSION_MAJOR @version_major@
+#define NICE_VERSION_MINOR @version_minor@
+#define NICE_VERSION_MICRO @version_micro@
+#define NICE_VERSION_NANO @version_nano@
diff --git a/stun/stunmessage.c b/stun/stunmessage.c
index 4cc3392..da8e412 100644
--- a/stun/stunmessage.c
+++ b/stun/stunmessage.c
@@ -358,7 +358,7 @@ stun_message_append (StunMessage *msg, StunAttribute type, size_t length)
/* Add padding if needed. Avoid a zero-length memset() call. */
if (stun_padding (length) > 0) {
- memset (a + length, ' ', stun_padding (length));
+ memset (a + length, 0, stun_padding (length));
mlen += stun_padding (length);
}
}
diff --git a/tests/docker/fedora38/pip-installs.sh b/tests/docker/fedora38/pip-installs.sh
new file mode 100755
index 0000000..5c9ffd1
--- /dev/null
+++ b/tests/docker/fedora38/pip-installs.sh
@@ -0,0 +1,5 @@
+#/bin/sh
+
+set -ex
+
+pip3 install lcov-cobertura
diff --git a/tests/meson.build b/tests/meson.build
index ce2e2d6..f149550 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -68,7 +68,11 @@ foreach tname : nice_tests
endif
endforeach
-if gst_dep.found()
+# FIXME: The GStreamer test needs nicesrc and nicesink plugins to run. libnice might be part of the GStreamer build.
+# In this case, in static mode (gstreamer-full), the test should be built after gstreamer-full to initialize
+# properly the plugins (gstreamer and libnice ones) with gst_init_static_plugins.
+# That's the reason the test is now disabled in static mode.
+if gst_dep.found() and not static_build
gst_check = dependency('gstreamer-check-1.0', required: get_option('gstreamer'),
fallback : ['gstreamer', 'gst_check_dep'])
if gst_check.found()
@@ -91,6 +95,6 @@ if find_program('sh', required : false).found() and find_program('dd', required
endif
debugenv = environment()
-debugenv.set('G_MESSAGES_DEBUG', 'all')
+#debugenv.set('G_MESSAGES_DEBUG', 'libnice')
debugenv.set('NICE_DEBUG', 'all')
add_test_setup('debug', env: debugenv)