platform/upstream/libnice.git
5 years agogitlab-ci: Run autotools tests in CI too
Olivier Crête [Thu, 3 Jan 2019 21:16:57 +0000 (16:16 -0500)]
gitlab-ci: Run autotools tests in CI too

5 years agogitlab-ci: Add meson tests to build
Olivier Crête [Thu, 3 Jan 2019 20:21:33 +0000 (15:21 -0500)]
gitlab-ci: Add meson tests to build

5 years agogitlab-ci: Skip meson build on schedules
Olivier Crête [Thu, 3 Jan 2019 20:21:23 +0000 (15:21 -0500)]
gitlab-ci: Skip meson build on schedules

5 years agotest-tcp: Use IPv4 instead of IPv6
Olivier Crête [Thu, 3 Jan 2019 20:12:21 +0000 (15:12 -0500)]
test-tcp: Use IPv4 instead of IPv6

This is because Docker doesn't have IPv6 by default.

5 years agotests/test-different-number-streams: Make it work with only localhost
Olivier Crête [Thu, 3 Jan 2019 19:58:44 +0000 (14:58 -0500)]
tests/test-different-number-streams: Make it work with only localhost

5 years agomeson: fix test-gstreamer
Jan Tojnar [Thu, 3 Jan 2019 13:16:47 +0000 (14:16 +0100)]
meson: fix test-gstreamer

On Nix, test-gstreamer fails with

36/38 test-gstreamer                          FAIL     0.07 s (exit status 1)

--- command ---
BUILT_WITH_MESON='1' /build/libnice/build/tests/nice-test-gstreamer
--- stdout ---
Running suite(s): nice_gstreamer_test
0%: Checks: 1, Failures: 1, Errors: 0
../libs/gst/check/gstcheck.c:466:F:nice:buffer_list_test:0: Could not create a 'nicesink' element
Check suite udpsink ran in 0.002s (tests failed: 1)
-------

Let’s add the build directory to GST_PLUGIN_SYSTEM_PATH_1_0, so that
the test can find the built GStreamer element.

5 years agomeson: Fix DLL search path during test execution on Windows
Jakub Adam [Wed, 2 Jan 2019 11:55:02 +0000 (12:55 +0100)]
meson: Fix DLL search path during test execution on Windows

Meson needs to see all libraries a target depends on so that it can add
each to PATH when running "meson test".

Avoids "*.dll was not found" errors.

5 years agomeson: Add fallback for openssl
Jakub Adam [Wed, 2 Jan 2019 11:53:56 +0000 (12:53 +0100)]
meson: Add fallback for openssl

5 years agoVersion 0.1.15.1
Olivier Crête [Thu, 27 Dec 2018 22:54:17 +0000 (16:54 -0600)]
Version 0.1.15.1

5 years agoVersion 0.1.15 0.1.15
Olivier Crête [Thu, 27 Dec 2018 21:23:09 +0000 (15:23 -0600)]
Version 0.1.15

5 years agoMakefiles: Add meson.build files to tarball
Olivier Crête [Thu, 27 Dec 2018 22:46:19 +0000 (16:46 -0600)]
Makefiles: Add meson.build files to tarball

5 years agoAdd more files to .gitignore
Olivier Crête [Thu, 27 Dec 2018 22:32:01 +0000 (16:32 -0600)]
Add more files to .gitignore

5 years agoFix little bugs found by clang-analyzer
Olivier Crête [Thu, 27 Dec 2018 22:25:28 +0000 (16:25 -0600)]
Fix little bugs found by clang-analyzer

5 years agodocs: Add _get_type() symbols to hidden section
Olivier Crête [Thu, 27 Dec 2018 21:47:49 +0000 (15:47 -0600)]
docs: Add _get_type() symbols to hidden section

5 years agomeson.build: Sync libversion with libtool
Olivier Crête [Thu, 27 Dec 2018 21:08:32 +0000 (15:08 -0600)]
meson.build: Sync libversion with libtool

5 years agonice/test-symbols.sh: Make symbols test work from other path too
Olivier Crête [Thu, 27 Dec 2018 20:56:38 +0000 (14:56 -0600)]
nice/test-symbols.sh: Make symbols test work from other path too

5 years agoMakefile.am: Export *_get_type() symbols like meson does
Olivier Crête [Thu, 27 Dec 2018 20:55:08 +0000 (14:55 -0600)]
Makefile.am: Export *_get_type() symbols like meson does

5 years agoconncheck.c: Fix negotiation problem
Jose Antonio Santos Cadenas [Fri, 29 Jan 2016 18:04:54 +0000 (19:04 +0100)]
conncheck.c: Fix negotiation problem

When a peer reflexive candidate is discovered, it is added to the
list of connection checks, but is is not nominated by default.

This causes a problem if parent pair is already nominated and
the remote peer does not send more requests because it has already
selected a candidate. (i.e.: This is the case of WebRtc in Firefox)

5 years agoagent: Check for early checks on dribbled candidates too
Olivier Crête [Sat, 17 Nov 2018 00:02:01 +0000 (19:02 -0500)]
agent: Check for early checks on dribbled candidates too

We have to check this list every time candidates are added.

5 years agoconncheck: Don't free all incoming checks on credentials
Olivier Crête [Fri, 16 Nov 2018 23:56:04 +0000 (18:56 -0500)]
conncheck: Don't free all incoming checks on credentials

Candidates could also be dribbled.

5 years agocomponent: Make incoming_checks into a GQueue
Olivier Crête [Fri, 16 Nov 2018 23:51:32 +0000 (18:51 -0500)]
component: Make incoming_checks into a GQueue

We check the size regularly, so add a little efficiency.

5 years agomeson: Allow building of g-i with static libs.
Tim-Philipp Müller [Fri, 14 Dec 2018 16:44:43 +0000 (16:44 +0000)]
meson: Allow building of g-i with static libs.

Allow building of g-i with static libs which should
work since Meson 0.49 and sufficiently recent
gobject-introspection (>= 1.58.1). If g-i is too
old people will get a suitable error message and
can disable g-i via build options.

5 years agomeson: Fix pkg-config generation with internal dependencies
Jakub Adam [Tue, 18 Dec 2018 13:11:04 +0000 (14:11 +0100)]
meson: Fix pkg-config generation with internal dependencies

Prevents Meson error:

ERROR:  requires argument not a string, library with pkgconfig-generated
file or pkgconfig-dependency object, got <InternalDependency null: True>

Requires Meson 0.49.

5 years agomeson: Fix build with fallback glib
Jakub Adam [Mon, 17 Dec 2018 12:03:24 +0000 (13:03 +0100)]
meson: Fix build with fallback glib

When building libnice with glib fallback, its 'libgio_dep' internal
dependency doesn't provide all needed include and library search paths.

To avoid unresolved header files and linker errors in such case,
'libglib_dep', 'libmodule_dep' and 'libgobject_dep' from glib submodule
must be pulled in as well.

The problem should be fixed in GLib 2.60.

5 years agoagent: Fix use of freed stream in nice_agent_dispose()
Jakub Adam [Fri, 21 Dec 2018 18:05:17 +0000 (19:05 +0100)]
agent: Fix use of freed stream in nice_agent_dispose()

nice_stream_close() calls agent_find_stream(), which iterates over
agent->streams list.

Therefore, when we're freeing agent->streams in a loop, we must also
delete the respective GSList item from the list at the end of each
iteration. Otherwise agent_find_stream() would stumble over already
deleted NiceStream instance the next time it gets called.

Fixes random crashes when running test-different-number-streams on
Windows.

5 years agomeson ci: Add logs to artifacts
Olivier Crête [Tue, 18 Dec 2018 21:38:35 +0000 (16:38 -0500)]
meson ci: Add logs to artifacts

5 years agopseudotcp: Rename state enums to not clash with system ones
Olivier Crête [Tue, 18 Dec 2018 20:50:56 +0000 (15:50 -0500)]
pseudotcp: Rename state enums to not clash with system ones

5 years agotests: Initialize Windows Sockets where needed
Jakub Adam [Tue, 18 Dec 2018 10:27:46 +0000 (11:27 +0100)]
tests: Initialize Windows Sockets where needed

Fixes failing test cases on Windows.

5 years agoudp-bsd: Fix recv with small buffer on Windows
Jakub Adam [Tue, 18 Dec 2018 09:36:53 +0000 (10:36 +0100)]
udp-bsd: Fix recv with small buffer on Windows

The underlying GSocket implementation on Windows returns an error when
the user-provided buffer isn't large enough to fit the whole datagram
received on a message-oriented socket.

When this occurs, in order to preserve identical behavior of udp-bsd
NiceSocket across platforms, we have to mute the error and set the
received message length to the size of the provided NiceInputMessage.
Any excess portion of the message gets discarded.

Fixed udp-bsd test on Windows.

GLib 2.48 is required in order to use G_IO_ERROR_MESSAGE_TOO_LARGE.

5 years agoagent: Expose input_message_get_size() in agent-priv.h
Jakub Adam [Tue, 18 Dec 2018 09:35:15 +0000 (10:35 +0100)]
agent: Expose input_message_get_size() in agent-priv.h

5 years agolibnice.sym: add some generated get_type functions and fix gtk-doc build
Tim-Philipp Müller [Tue, 18 Dec 2018 14:43:08 +0000 (14:43 +0000)]
libnice.sym: add some generated get_type functions and fix gtk-doc build

https://gitlab.freedesktop.org/gstreamer/gst-build/issues/14

5 years agomeson: tests: make fullmode-with-stun non-parallel and disable fuzzing test
Tim-Philipp Müller [Fri, 14 Dec 2018 20:22:29 +0000 (20:22 +0000)]
meson: tests: make fullmode-with-stun non-parallel and disable fuzzing test

test-fullmode-with-stun needs to run in non-parallel mode to work.

test-pseudotcp-fuzzy sometimes just times out, which needs investigating.

meson test -C builddir --repeat=20

5 years agowindows: use proper fallback for ssize_t and use stdint.h for types
Tim-Philipp Müller [Fri, 14 Dec 2018 17:09:58 +0000 (17:09 +0000)]
windows: use proper fallback for ssize_t and use stdint.h for types

stdint.h is available since vs2010 and stdbool.h since vs2013,
so we should be able to just use that these days.

5 years agoFix build with MSVC
Nirbheek Chauhan [Fri, 23 Nov 2018 03:52:12 +0000 (09:22 +0530)]
Fix build with MSVC

Tested inside Cerbero with VS 2017

5 years agomeson: fix gtk-doc message
Tim-Philipp Müller [Fri, 14 Dec 2018 16:41:14 +0000 (16:41 +0000)]
meson: fix gtk-doc message

It's disabled by default, so saying it wasn't found is confusing.

5 years agostun: tools: drop getopt for arg parsing for better windows compatibility
Tim-Philipp Müller [Fri, 14 Dec 2018 13:47:32 +0000 (13:47 +0000)]
stun: tools: drop getopt for arg parsing for better windows compatibility

Just implement argument parsing ourselves here.

It's not really more lines of code than the getopt.h variant
and makes things build on Windows with MSVC without having to
ship a separate getopt implementation.

5 years agoCI: rename autotools build target
Tim-Philipp Müller [Wed, 21 Nov 2018 13:58:31 +0000 (13:58 +0000)]
CI: rename autotools build target

No tests are being built or run here.

5 years agoCI: use -werror for meson
Tim-Philipp Müller [Wed, 21 Nov 2018 13:56:44 +0000 (13:56 +0000)]
CI: use -werror for meson

And drop gstreamer1-plugins-base-devel dep
which is not needed.

5 years agoCI: Add a meson build job
Jordan Petridis [Wed, 21 Nov 2018 12:36:35 +0000 (14:36 +0200)]
CI: Add a meson build job

5 years agomeson: disable introspection if g-ir-scanner is not found
Víctor Manuel Jáquez Leal [Thu, 22 Nov 2018 10:55:51 +0000 (11:55 +0100)]
meson: disable introspection if g-ir-scanner is not found

5 years agomeson: add fallbacks for glib and gio
Tim-Philipp Müller [Sat, 3 Nov 2018 00:30:01 +0000 (00:30 +0000)]
meson: add fallbacks for glib and gio

5 years agomeson: don't error out if clock_gettime() was not found
Tim-Philipp Müller [Sat, 3 Nov 2018 00:14:30 +0000 (00:14 +0000)]
meson: don't error out if clock_gettime() was not found

It's not a requirement, there's a fallback.

5 years agomeson: check for gtkdoc-scan
Tim-Philipp Müller [Sat, 3 Nov 2018 00:10:19 +0000 (00:10 +0000)]
meson: check for gtkdoc-scan

5 years agomeson: add new unit test
Tim-Philipp Müller [Fri, 2 Nov 2018 19:26:25 +0000 (19:26 +0000)]
meson: add new unit test

5 years agomeson: allow selecting crypto library manually via an option
Tim-Philipp Müller [Fri, 2 Nov 2018 19:16:36 +0000 (19:16 +0000)]
meson: allow selecting crypto library manually via an option

5 years agoAdd support for Meson build system
Tim-Philipp Müller [Sun, 30 Jul 2017 15:42:52 +0000 (16:42 +0100)]
Add support for Meson build system

5 years agoagent: Don't require stream names to parse remote SDP
Jakub Adam [Fri, 14 Dec 2018 09:45:37 +0000 (10:45 +0100)]
agent: Don't require stream names to parse remote SDP

The streams are matched by the order in which they appear in the SDP,
not by name, so insisting on local streams to have one makes no sense.

This likely should have been removed in 5972db0.

5 years agotcp-passive: Clear connection on child closing
Olivier Crête [Sun, 21 Oct 2018 10:01:55 +0000 (12:01 +0200)]
tcp-passive: Clear connection on child closing

If this isn't done, then there may be invalid points left inside the
passive socket which could be used and cause a crash.

Fixes #33

5 years agotcp-bsd: Restore global locks
Jakub Adam [Tue, 20 Nov 2018 18:35:04 +0000 (19:35 +0100)]
tcp-bsd: Restore global locks

Avoids race between socket_send_more() and socket_close() leading either
to crash on use of freed NiceSocket, or abort upon attempting to
g_mutex_clear() a locked mutex.

Akin to what d1611c0c0ba6c5bce500b96a8f61de4fe5f144e9 did to udp-turn.

5 years agoudp-turn: Create locked version of realm&nonce cache function
Olivier Crête [Fri, 16 Nov 2018 22:34:16 +0000 (17:34 -0500)]
udp-turn: Create locked version of realm&nonce cache function

To be able to call it from a context that is already locked.

5 years agoudp-bsd: Protect the GSocketAddress cache with a mutex
Olivier Crête [Fri, 16 Nov 2018 22:03:39 +0000 (17:03 -0500)]
udp-bsd: Protect the GSocketAddress cache with a mutex

6 years agoagent: check message length before extracting RFC4571 frame size
Jakub Adam [Wed, 31 Oct 2018 00:56:39 +0000 (01:56 +0100)]
agent: check message length before extracting RFC4571 frame size

nice_socket_recv_messages() may return a NiceInputMessage of length = 0,
so before attempting to read the RFC4571 header check the message really
has at least sizeof (guint16) bytes of data.

The bug's always been there, the previous commit only made it more
apparent.

6 years agoudp-turn: handle multiple RFC4571 frames received in a TCP-TURN message
Jakub Adam [Fri, 26 Oct 2018 22:31:53 +0000 (00:31 +0200)]
udp-turn: handle multiple RFC4571 frames received in a TCP-TURN message

There might be multiple RFC4571-framed messages (or fragments thereof)
within a single TCP-TURN message. Make sure each NiceInputMessage
passed by the user into socket_recv_messages() gets exactly one RFC4571
frame, or remains empty if there aren't any messages to receive.

We should keep any data that doesn't fit into the user buffers for
the next time socket_recv_messages() gets called with the socket.

6 years agoudp-turn: don't re-iterate incoming TURN control messages
Jakub Adam [Fri, 26 Oct 2018 23:10:22 +0000 (01:10 +0200)]
udp-turn: don't re-iterate incoming TURN control messages

After being parsed, a TURN control message turns into a NiceInputMessage
with zero length. Such message doesn't increment the iteration counter i
and so is re-processed in the next iteration, which detects right away
that message->length == 0 and continues to the next element in
recv_messages.

Thus, n_valid_messages variable serves no real purpose and to achieve
the same result we can simply increment the iteration counter after each
message.

6 years agoudp-turn: Start function with lock instead of unlock
Olivier Crête [Wed, 31 Oct 2018 11:44:16 +0000 (11:44 +0000)]
udp-turn: Start function with lock instead of unlock

6 years agoudp-turn: Restore global locks
Olivier Crête [Sun, 28 Oct 2018 16:32:27 +0000 (16:32 +0000)]
udp-turn: Restore global locks

The socket abstraction not being reference counted, we need a global
lock for them in the short term.

6 years agoudp-turn: Rename misleading function, it's a timeout
Olivier Crête [Sun, 28 Oct 2018 16:11:54 +0000 (16:11 +0000)]
udp-turn: Rename misleading function, it's a timeout

It's not locked in any way.

6 years agoudp-turn: Factor our SendRequest destruction
Olivier Crête [Sun, 28 Oct 2018 16:09:55 +0000 (16:09 +0000)]
udp-turn: Factor our SendRequest destruction

6 years agocomponent: Replace agent pointer with weak reference
Olivier Crête [Sun, 28 Oct 2018 14:46:11 +0000 (14:46 +0000)]
component: Replace agent pointer with weak reference

This should make it safer.

6 years agoudp-turn: Restore synchronized seconds timeout
Olivier Crête [Sun, 28 Oct 2018 14:43:42 +0000 (14:43 +0000)]
udp-turn: Restore synchronized seconds timeout

6 years agoagent: Remove explicit parent pointers
Olivier Crête [Sun, 28 Oct 2018 13:54:45 +0000 (13:54 +0000)]
agent: Remove explicit parent pointers

Remove all pointers that don't include have a reference except to agents

6 years agoUse per-agent locks and GWeakRefs in callbacks from timeout sources
Juan Navarro [Mon, 20 Aug 2018 16:01:02 +0000 (18:01 +0200)]
Use per-agent locks and GWeakRefs in callbacks from timeout sources

Work on libnice's bug #1 in Gitlab. This work is composed of multiple
merged parts:

- "Global lock contention removed"
Phabricator D1900: https://phabricator.freedesktop.org/D1900
By @nifigase
Opened in GitLab as Merge Request !12

- "agent: properly handle NiceAgent ref in callbacks from timeout
sources"
Phabricator D1898: https://phabricator.freedesktop.org/D1898
By @mparis
This patch was itself based upon a previous version of the work done in
D1900. After the switch of hosting, it got lost.

On top of these, additions to follow some review comments from @ocrete:
- https://phabricator.freedesktop.org/D1900#40412
- https://phabricator.freedesktop.org/D1898#39332

6 years agocomponent: Also accept TCP from udp-turn socket
Olivier Crête [Sun, 21 Oct 2018 09:18:00 +0000 (11:18 +0200)]
component: Also accept TCP from udp-turn socket

6 years agoFix build with android NDK r16
Matthew Waters [Wed, 14 Feb 2018 12:22:16 +0000 (23:22 +1100)]
Fix build with android NDK r16

getifaddrs() may only be available if the target API is >= 24

6 years agoconncheck: don't disable keepalive on TCP if it's explicitly enabled
Michael Olbrich [Mon, 9 Jul 2018 13:22:01 +0000 (15:22 +0200)]
conncheck: don't disable keepalive on TCP if it's explicitly enabled

This makes it possible to enable keepalive for TCP candidates. It is useful
to detect disappearing peers or network failures faster.

6 years agostun: check identifier before using it
Michael Olbrich [Mon, 9 Jul 2018 13:08:15 +0000 (15:08 +0200)]
stun: check identifier before using it

By default, 'candidate_identifier == NULL' only happens for 'compatibility
== NICE_COMPATIBILITY_GOOGLE'. However, keepalive=true will also trigger
the same code path so candidate_identifier must be checked to avoid a
segfault.

6 years agoagent: fix crash with debugging enabled
Michael Olbrich [Mon, 9 Jul 2018 12:52:08 +0000 (14:52 +0200)]
agent: fix crash with debugging enabled

For some connection types nicesock->fileno is never set.
Make sure it is not NULL before using it.

6 years agoconfigure: Allow selecting crypto library manually
Olivier Crête [Sun, 21 Oct 2018 08:02:43 +0000 (04:02 -0400)]
configure: Allow selecting crypto library manually

6 years agostun: Add support to detect OpenSSL
Brendan Shanks [Thu, 10 May 2018 00:50:13 +0000 (17:50 -0700)]
stun: Add support to detect OpenSSL

6 years agostun: Add implementation using OpenSSL for rand/SHA1/MD5
Brendan Shanks [Thu, 10 May 2018 00:18:44 +0000 (17:18 -0700)]
stun: Add implementation using OpenSSL for rand/SHA1/MD5

6 years agoopenssl: Add ax_check_openssl.m4
Brendan Shanks [Wed, 9 May 2018 19:45:22 +0000 (12:45 -0700)]
openssl: Add ax_check_openssl.m4

6 years agotests: Remove non-existing mainloop test from Makefile.am
Olivier Crête [Sun, 21 Oct 2018 07:31:48 +0000 (03:31 -0400)]
tests: Remove non-existing mainloop test from Makefile.am

6 years agoAdd GitLab CI configuration
Olivier Crête [Tue, 19 Jun 2018 17:59:31 +0000 (13:59 -0400)]
Add GitLab CI configuration

6 years agodocs: Add missing symbols to various sections
Olivier Crête [Tue, 19 Jun 2018 17:58:30 +0000 (13:58 -0400)]
docs: Add missing symbols to various sections

6 years agoMakefile.am: Replace valgrind.sh with valgrind-test-driver
Olivier Crête [Tue, 19 Jun 2018 17:58:05 +0000 (13:58 -0400)]
Makefile.am: Replace valgrind.sh with valgrind-test-driver

6 years agoRemove Phabricator .arcconfig
Olivier Crête [Mon, 18 Jun 2018 15:47:04 +0000 (11:47 -0400)]
Remove Phabricator .arcconfig

Now, we use GitLab at https://gitlab.freedesktop.org/libnice/libnice

6 years agotest-bind: define MSG_NOSIGNAL if undefined
Justin Kim [Wed, 13 Jun 2018 04:59:09 +0000 (13:59 +0900)]
test-bind: define MSG_NOSIGNAL if undefined

MacOS X and Windows don't have MSG_NOSIGNAL.

Signed-off-by: Justin Kim <justin.kim@collabora.com>
6 years agoFix queue_clear replaced by queue_free error
Nicolas Dufresne [Mon, 18 Jun 2018 12:43:17 +0000 (08:43 -0400)]
Fix queue_clear replaced by queue_free error

There was two cases where instead of freeing the queue, we actually
clear the queue so it's ready for reused. Notably in
nice_socket_free_send_queue(), a missed name function and nicesrc
element state change.

This regression was introduced by: fa783b1dd727a6ee2b99a111ca24790ae850c2f7

6 years agoFix cast-function-type warning introduced in GCC 8
Nicolas Dufresne [Sat, 26 May 2018 15:58:21 +0000 (15:58 +0000)]
Fix cast-function-type warning introduced in GCC 8

This is new warning introduced with GCC 8. This is being fixed by using appropriate function, like g_queue_free_full/g_list_free_full or by casting to GCallback before casting to the target function signature.

Closes: #46

6 years agodiscovery: fix candidate foundation using valid characters
Miguel París Díaz [Tue, 5 Jul 2016 12:42:44 +0000 (14:42 +0200)]
discovery: fix candidate foundation using valid characters

Following [1] and [2], "-" character is not allowed for foundation

Refs
[1] https://tools.ietf.org/html/rfc5245#page-73
[2] https://tools.ietf.org/html/rfc5234#appendix-B.1

6 years agotest-pseudotcp(-fuzzy): Fix format string warnings causing build errors on 32-bit
Brendan Shanks [Wed, 9 May 2018 22:05:18 +0000 (15:05 -0700)]
test-pseudotcp(-fuzzy): Fix format string warnings causing build errors on 32-bit

Closes: ttps://gitlab.freedesktop.org/libnice/libnice/issues/45

6 years agostun: Also rename windows-specific function
Edward Hervey [Wed, 21 Feb 2018 07:49:15 +0000 (08:49 +0100)]
stun: Also rename windows-specific function

Like all other instances of nice_RAND_bytes that were renamed
to nice_RAND_nonce.

Fixes the windows build

6 years agoagent: Redefine socket error messages for windows
Edward Hervey [Wed, 21 Feb 2018 08:05:45 +0000 (09:05 +0100)]
agent: Redefine socket error messages for windows

In the same way we do it for the other error messages

6 years agostund: Pass sockaddr_storage size for both families
Olivier Crête [Fri, 4 May 2018 14:50:45 +0000 (16:50 +0200)]
stund: Pass sockaddr_storage size for both families

6 years agostund: Pass the right length for ipv6
Olivier Crête [Fri, 4 May 2018 14:44:45 +0000 (16:44 +0200)]
stund: Pass the right length for ipv6

6 years agoIgnore function case warnings
Olivier Crête [Fri, 4 May 2018 13:44:05 +0000 (15:44 +0200)]
Ignore function case warnings

This makes GLib usage annoying as it makes GSourceFunc casts invalid.

6 years agoagent: don't require "reliable" be TRUE in order to use "ice-tcp"
Jakub Adam [Wed, 19 Apr 2017 12:17:04 +0000 (14:17 +0200)]
agent: don't require "reliable" be TRUE in order to use "ice-tcp"

Setting writable socket callbacks doesn't have to be limited to reliable
agents. TCP sockets need the callback in any case for correct operation
and calling nice_socket_set_writable_callback() on a NiceSocket that has
UDP as its base has no effect.

Differential Revision: https://phabricator.freedesktop.org/D1726

6 years agodiscovery: ignore bogus Skype for Business srflx addresses
Jakub Adam [Sat, 3 Feb 2018 22:59:20 +0000 (23:59 +0100)]
discovery: ignore bogus Skype for Business srflx addresses

If main SfB TURN server sends our allocation request to an alternate
server, the response will have XOR_MAPPED_ADDRESS containing the IP
address of the turn server that proxied the message instead of our own
actual external IP.

Before we create server reflexive candidates upon receiving an allocate
response, check that the TURN port got assigned on the same server we
sent out allocate request to. Otherwise, the request was proxied and
XOR_MAPPED_ADDRESS contains a bogus value we should ignore.

Issue introduced by 59fcf95d505c3995f858b826d10cd48321ed383e.
Differential Revision: https://phabricator.freedesktop.org/D1949

6 years agoagent: make candidate username and password immutable
Fabrice Bellet [Mon, 11 Dec 2017 07:50:33 +0000 (08:50 +0100)]
agent: make candidate username and password immutable

With this patch we prevent the username and the password of a candidate
to be modified during a session, as required by the RFC, sect 9.1.2.
This is also needed from a memory management point of view, because the
password string pointer may be recorded in the components stun agent
sent_ids[] struct key member, and freeing these values there may cause
an use-after-free condition, when an inbound stun is received from this
candidate. This behavior has been observed with pidgin, xmpp, and
farstream when a same remote candidates are "updated" several times,
even if the credentials don't change in this case.

Reviewed-by: Olivier Crête <olivier.crete@collabora.com>
Differential Revision: https://phabricator.freedesktop.org/D1917

6 years agodiscovery: ignore all non-relay local candidates when relay is forced
Fabrice Bellet [Thu, 30 Nov 2017 19:11:22 +0000 (20:11 +0100)]
discovery: ignore all non-relay local candidates when relay is forced

The tcp server reflexive discovered local candidates must be ignored
when force_relay is set.

Reviewed-by: Olivier Crête <olivier.crete@collabora.com>
Differential Revision: https://phabricator.freedesktop.org/D1899

6 years agoconncheck: dont fail a stream with a empty conncheck list
Fabrice Bellet [Wed, 29 Nov 2017 10:04:04 +0000 (11:04 +0100)]
conncheck: dont fail a stream with a empty conncheck list

Since commit 17f30e4, we may have a stream with an empty conncheck list,
and such a stream obviously should not be tested for failed components.

Reviewed-by: Olivier Crête <olivier.crete@collabora.com>
Differential Revision: https://phabricator.freedesktop.org/D1895

6 years agosocket: ping the stun server address on the right socket
Fabrice Bellet [Mon, 27 Nov 2017 22:56:17 +0000 (23:56 +0100)]
socket: ping the stun server address on the right socket

Verify the compatibility of the socket domain with the stun server
IP address, before sending a request.

Reviewed-by: Olivier Crête <olivier.crete@collabora.com>
Differential Revision: https://phabricator.freedesktop.org/D1894

6 years agoconncheck: make debug more homonegeous
Fabrice Bellet [Sun, 26 Nov 2017 18:31:39 +0000 (19:31 +0100)]
conncheck: make debug more homonegeous

Reviewed-by: Olivier Crête <olivier.crete@collabora.com>
Differential Revision: https://phabricator.freedesktop.org/D1893

6 years agoconncheck: factorize pair state debug
Fabrice Bellet [Sun, 26 Nov 2017 17:10:12 +0000 (18:10 +0100)]
conncheck: factorize pair state debug

Reviewed-by: Olivier Crête <olivier.crete@collabora.com>
Differential Revision: https://phabricator.freedesktop.org/D1892

6 years agoconncheck: the conncheck send function may fail
Fabrice Bellet [Sun, 26 Nov 2017 16:49:25 +0000 (17:49 +0100)]
conncheck: the conncheck send function may fail

With this patch, we put the pair in state failed if we cannot send
the connection check, for example due to missing local credentials.

Reviewed-by: Olivier Crête <olivier.crete@collabora.com>
Differential Revision: https://phabricator.freedesktop.org/D1891

6 years agotest-new-dribble: make credentials swap asymmetric
Fabrice Bellet [Sun, 26 Nov 2017 16:36:27 +0000 (17:36 +0100)]
test-new-dribble: make credentials swap asymmetric

the first case of test-new-dribble (standard-test) is updated, by making
the credentials swap between the left and right agent asymmetric.
Previously, ragent started to receive stun requests without initially
knowing lagent candidates. Now, ragent also ignores lagent credentials.
This modification allows to test changes introduced by the previous
commit.

Reviewed-by: Olivier Crête <olivier.crete@collabora.com>
Differential Revision: https://phabricator.freedesktop.org/D1890

6 years agoconncheck: rework early stun requests handling
Fabrice Bellet [Sun, 26 Nov 2017 16:13:19 +0000 (17:13 +0100)]
conncheck: rework early stun requests handling

With this patch we simplify the code used to handle the incoming stun
request when remote candidates or remote credentials have not been
received yet.

When the remote credentials is unknown, the stun request is stored
in a list of incoming_checks for later processing, and no further
processing is done, except responding to the request.

When the remote credentials are received, the triggered checks for these
incoming checks can now be queued, and the related pairs are created.

If the remote candidates have not been received when the stun request
on a valid local port arrives, a peer-reflexive remote candidate will be
created. This candidate may need to be updated later when remote
candidates are finally received, including candidate priority and
foundation, and also related pairs.

Reviewed-by: Olivier Crête <olivier.crete@collabora.com>
Differential Revision: https://phabricator.freedesktop.org/D1889

6 years agoagent: Fixes incompatible pointer type warning on OSX.
Jozsef Vass [Mon, 8 Jan 2018 18:53:23 +0000 (10:53 -0800)]
agent: Fixes incompatible pointer type warning on OSX.

The variable tie is actually never read.

6 years agoconncheck: handle alternate-server for turn relays differently
Youness Alaoui [Tue, 28 Nov 2017 21:05:18 +0000 (16:05 -0500)]
conncheck: handle alternate-server for turn relays differently

If a relay gives us an alternate-server, we need to cancel and reset
every candidate discovery attempt that uses the same server, to avoid
ending up with one component on one server and the other component on
another server (causing relay candidates with mismatched foundations).

6 years agodiscovery: Increase discovery_unsched_items whenever we restart a check
Youness Alaoui [Tue, 28 Nov 2017 20:14:11 +0000 (15:14 -0500)]
discovery: Increase discovery_unsched_items whenever we restart a check

The discovery_unsched_items is decremented every time a DiscoveryCandidate
goes from non-pending to pending. So if we restart a check by setting
pending to FALSE, we should re-increase the discovery_unsched_items.