platform/upstream/libnice.git
2 years agostun: Make the headers usable from C++ code
abhijeetbhagat [Sun, 6 Jun 2021 06:39:09 +0000 (12:09 +0530)]
stun: Make the headers usable from C++ code

Add the relevant ifdef extern C bits

2 years agoagent: Simplify accepting state changes to FAILED
Olivier Crête [Tue, 20 Jul 2021 17:06:58 +0000 (13:06 -0400)]
agent: Simplify accepting state changes to FAILED

The component can go from any state to FAILED, so simplify
that and make it explicit.

2 years agoagent: Accept any transition back to the gathering state
Olivier Crête [Tue, 20 Jul 2021 17:04:17 +0000 (13:04 -0400)]
agent: Accept any transition back to the gathering state

When doing a ICE restart, which can be done from any state, we can
always go back into the gathering state.

This fixes a regression introduced by b20ac5ba7b731f2cc698f26e8def28a518de058e

2 years agogitlab-ci: Allow msys CI to fail
Olivier Crête [Tue, 20 Jul 2021 20:55:41 +0000 (16:55 -0400)]
gitlab-ci: Allow msys CI to fail

It just won't work for now.

2 years agosubprojects: Get zlib from Qt mirror
Olivier Crête [Tue, 20 Jul 2021 17:30:09 +0000 (13:30 -0400)]
subprojects: Get zlib from Qt mirror

Getting it from the upstream mirror seems to fail miserably

2 years agogitlab-ci: Remove meson update
Olivier Crête [Tue, 20 Jul 2021 17:25:13 +0000 (13:25 -0400)]
gitlab-ci: Remove meson update

2 years agoUpdate Windows image
Olivier Crête [Tue, 20 Jul 2021 17:14:11 +0000 (13:14 -0400)]
Update Windows image

3 years agotest-restart: fix potential stack buffer overflow with new candidate API
Fabrice Bellet [Sat, 13 Feb 2021 13:16:10 +0000 (14:16 +0100)]
test-restart: fix potential stack buffer overflow with new candidate API

3 years agotest-consent: fix potential stack buffer overflow with new candidate API
Fabrice Bellet [Sat, 13 Feb 2021 13:15:58 +0000 (14:15 +0100)]
test-consent: fix potential stack buffer overflow with new candidate API

3 years agotest-io-stream-pollable: Handle partial reads
Ole André Vadla Ravnås [Tue, 11 May 2021 08:52:55 +0000 (10:52 +0200)]
test-io-stream-pollable: Handle partial reads

3 years agopseudotcp: Disable Nagle algorithm by default
Ole André Vadla Ravnås [Mon, 10 May 2021 10:37:18 +0000 (12:37 +0200)]
pseudotcp: Disable Nagle algorithm by default

To be consistent with what we do for ICE-TCP.

3 years agotcp-bsd: Handle send before connect() completes
Ole André Vadla Ravnås [Sun, 9 May 2021 21:55:07 +0000 (23:55 +0200)]
tcp-bsd: Handle send before connect() completes

3 years agoagent: Remove duplicated early return
Olivier Crête [Mon, 3 May 2021 21:04:34 +0000 (17:04 -0400)]
agent: Remove duplicated early return

The type is already checked to not be peer reflexive earlier.

3 years agoagent: Avoid leak on programming error
Olivier Crête [Mon, 3 May 2021 21:01:59 +0000 (17:01 -0400)]
agent: Avoid leak on programming error

Even if the agent is invalid, don't leak.

This makes coverity a little happier.

3 years agoconncheck: Free password in more obvious way
Olivier Crête [Mon, 3 May 2021 21:00:51 +0000 (17:00 -0400)]
conncheck: Free password in more obvious way

This should make Coverity's job a little easier. And also fix a little
leak in the error path.

3 years agoudp-turn: Remove request before freeing it
Olivier Crête [Mon, 3 May 2021 20:58:01 +0000 (16:58 -0400)]
udp-turn: Remove request before freeing it

As removing the request from the queue looks into the SendRequest, one
needs to unqueue it before freeing it.

3 years agoagent: avoid leak of all turn refreshes when disposing the agent
Fabrice Bellet [Sat, 19 Dec 2020 16:56:16 +0000 (17:56 +0100)]
agent: avoid leak of all turn refreshes when disposing the agent

With this patch we free all outstanding refreshes when the agent dispose
method is called, even those that are in the way to be discarded
asynchronously, when a stream is removed.

We also make the final user callback of the refresh proces synchronous,
so we don't have to deal with an heap use-after-free problem. This also
requires to order some parts of code.

3 years agodiscovery: fix asynchronous agent refreshes pruning
Fabrice Bellet [Thu, 17 Dec 2020 11:06:38 +0000 (12:06 +0100)]
discovery: fix asynchronous agent refreshes pruning

Asynchronous refreshes pruning may occur when the agent async close
function is called, but also when a stream is closed. A flag
'discarding' is used in the CandidateRefresh object to determine
if a refresh is already on the way to be asynchronously freed. A refresh
definitely freed is removed from agent refresh_list.

When the agent async close function is called, it is passed a user
callback that will be invoked when all refreshes have been freed.

This is not exactly how things work currently, because right now, the
callback function is also invoked when all CandidateRefresh objects have
the discarding flag set, with the test 'data->items_to_free==0'. In that
case, clearly not all refreshes have been freed, as some are still there
in the refresh_list with the discarding flag set.

This is probably not what the user expects from the function
nice_agent_close_async(), where the callback is supposed to be invoked
after all refreshes have been freed: and including those asynchronously
pruned by nice_prune_stream_async().

This patch adds a supplementary timeout when closing the agent async,
that waits until the agent refresh list becomes empty.

3 years agoagent: avoid leak of turn refreshes
Fabrice Bellet [Sun, 13 Dec 2020 16:59:41 +0000 (17:59 +0100)]
agent: avoid leak of turn refreshes

We keep refreshes having the discarding flag set. They may be freed later
if the agent main context remains alive after agent deletion.

3 years agoagent: warn when closing the agent with alive turn refreshes
Fabrice Bellet [Sat, 12 Dec 2020 20:12:52 +0000 (21:12 +0100)]
agent: warn when closing the agent with alive turn refreshes

This patch suggests the developer to close its alive reservations on
the turn server before disposing the agent.

Not removing reservations on the turn server, will make them alive until
their default timeout, generally 300 seconds, which is not fair for the
turn server resources, but also it may cause a fatal error 437,
"Mismatched allocation: wrong transaction ID", when another agent tries
to contact the same turn server using the same nat mapping before this
delay expires.

3 years agoagent: Verify the source before dereferencing the pointer
Olivier Crête [Tue, 20 Apr 2021 19:09:11 +0000 (15:09 -0400)]
agent: Verify the source before dereferencing the pointer

The reason is that the component object could have been destroyed in the
mean time.

3 years agoagent: don't allocate large arrays on the stack
Fabrice Bellet [Sun, 6 Dec 2020 18:12:48 +0000 (19:12 +0100)]
agent: don't allocate large arrays on the stack

3 years agoudp-turn: don't allocate large arrays on the stack
Fabrice Bellet [Sun, 6 Dec 2020 18:09:33 +0000 (19:09 +0100)]
udp-turn: don't allocate large arrays on the stack

3 years agoagent: keep a track of the candidate refreshes being pruned
Fabrice Bellet [Mon, 6 Jul 2020 11:53:44 +0000 (13:53 +0200)]
agent: keep a track of the candidate refreshes being pruned

Refreshes with zero lifetime sent over tcp transport may cause the
removal of the underlying socket when the remote peer closes the
connection taking our request into account. These refreshes must be
tracked and freeed on our side to avoid retransmission attempt on a
closed socket and a heap-use-after-free error in that case.

3 years agointerfaces: Skip special interfaces on Apple OSes
Ole André Vadla Ravnås [Mon, 19 Apr 2021 19:05:51 +0000 (21:05 +0200)]
interfaces: Skip special interfaces on Apple OSes

Including unused utun devices.

3 years agointerfaces: Skip special interfaces on Apple OSes
Ole André Vadla Ravnås [Mon, 19 Apr 2021 19:05:51 +0000 (21:05 +0200)]
interfaces: Skip special interfaces on Apple OSes

Including unused utun devices.

3 years agogitlab-ci: Accept double pipeline otherwise MRs arent mergeable
Olivier Crête [Tue, 20 Apr 2021 00:06:37 +0000 (20:06 -0400)]
gitlab-ci: Accept double pipeline otherwise MRs arent mergeable

3 years agogitlab-ci: Stop base msvc build on msys
Olivier Crête [Mon, 19 Apr 2021 23:50:21 +0000 (19:50 -0400)]
gitlab-ci: Stop base msvc build on msys

3 years agogitlab-ci: Mark all tasks as interruptible
Olivier Crête [Mon, 19 Apr 2021 23:35:42 +0000 (19:35 -0400)]
gitlab-ci: Mark all tasks as interruptible

3 years agogitlab-ci: Move pacman setup to before_script
Olivier Crête [Mon, 19 Apr 2021 23:10:13 +0000 (19:10 -0400)]
gitlab-ci: Move pacman setup to before_script

3 years agogitlab-ci: Run meson, ninja and meson test separately
Olivier Crête [Mon, 19 Apr 2021 22:09:04 +0000 (18:09 -0400)]
gitlab-ci: Run meson, ninja and meson test separately

3 years agogitlab-ci: Just skip the msys global upgrade
Olivier Crête [Mon, 19 Apr 2021 20:48:40 +0000 (16:48 -0400)]
gitlab-ci: Just skip the msys global upgrade

3 years agogitlab-ci: Update to 2021-02-04 Windows image
Olivier Crête [Mon, 19 Apr 2021 20:33:03 +0000 (16:33 -0400)]
gitlab-ci: Update to 2021-02-04 Windows image

3 years agogitlab-ci: Verify that allow-edit is set
Olivier Crête [Mon, 19 Apr 2021 20:37:31 +0000 (16:37 -0400)]
gitlab-ci: Verify that allow-edit is set

3 years agoagent: reset remote credentials when restarting ice
Fabrice Bellet [Sun, 21 Feb 2021 10:10:12 +0000 (11:10 +0100)]
agent: reset remote credentials when restarting ice

The remote credentials recorded in the streams should be reset,
in the case the restarted conncheck begins with new remote candidates
*before* the updated remote credentials are received.

3 years agoagent: transition to state gathering when restarting ice
Fabrice Bellet [Sun, 21 Feb 2021 10:06:00 +0000 (11:06 +0100)]
agent: transition to state gathering when restarting ice

The state of the component is downgraded to gathering state, so it can
really restart a new conncheck from scratch. It'll transition to state
connecting when receiving the updated remote candidates.

3 years agoagent: don't change agent role when restarting ice
Fabrice Bellet [Sun, 21 Feb 2021 10:04:14 +0000 (11:04 +0100)]
agent: don't change agent role when restarting ice

Ice restart must not change the role of the agents since RFC8445,
section 9, "ICE Restarts".

3 years agoAdd (in) annotation to buf_len argument
demotomohiro [Thu, 4 Mar 2021 11:24:33 +0000 (20:24 +0900)]
Add (in) annotation to buf_len argument

3 years agogst: Fix gst-env and libgstreamer-full.so suppport
Nicolas Dufresne [Fri, 5 Mar 2021 02:18:47 +0000 (21:18 -0500)]
gst: Fix gst-env and libgstreamer-full.so suppport

gst-build uses meson introspection and reads the plugins array of each
subproject in order to locate the plugins. Setting libnice plugins array allow
enabling nice plugin in both gst-env.py and when building single library
libgstreamer-full.so.

3 years agointerfaces: Accept only IPv4/IPv4 addresses using ioctl() method
Olivier Crête [Thu, 25 Feb 2021 19:37:37 +0000 (14:37 -0500)]
interfaces: Accept only IPv4/IPv4 addresses  using ioctl() method

Android now spits other address types too confusing libnice.

This patch is a collaborative work with Tom Gilbert <twcgilbert@gmail.com>

3 years agogitlab-ci: Lock meson to 0.56.2
Olivier Crête [Tue, 16 Feb 2021 18:01:17 +0000 (13:01 -0500)]
gitlab-ci: Lock meson to 0.56.2

3 years agointerfaces: Fix small warnings on Win32
Olivier Crête [Tue, 16 Feb 2021 17:37:22 +0000 (12:37 -0500)]
interfaces: Fix small warnings on Win32

3 years agoUse a namespace http://www.w3.org/2001/XInclude instead of a deprecated one
Lemures Lemniscati [Wed, 6 Jan 2021 13:03:16 +0000 (22:03 +0900)]
Use a namespace w3.org/2001/XInclude instead of a deprecated one

Avoid to use a deprecated namespace http://www.w3.org/2003/XInclude

3 years agoUse https instead of http as far as possible in README
Lemures Lemniscati [Wed, 6 Jan 2021 13:33:05 +0000 (22:33 +0900)]
Use https instead of http as far as possible in README

3 years agoUse https instead of http in libnice-docs.xml
Lemures Lemniscati [Wed, 6 Jan 2021 13:33:03 +0000 (22:33 +0900)]
Use https instead of http in libnice-docs.xml

3 years agotest-fallback: fix stack buffer overflow with new candidate API
Fabrice Bellet [Thu, 24 Sep 2020 19:12:10 +0000 (21:12 +0200)]
test-fallback: fix stack buffer overflow with new candidate API

3 years agoagent: reject addition of peer-reflexive remote candidates
Fabrice Bellet [Fri, 20 Nov 2020 21:17:09 +0000 (22:17 +0100)]
agent: reject addition of peer-reflexive remote candidates

Peer-reflexive candidates are not supposed to be set by the application,
since they are not exchanged in the SDP.

3 years agodiscovery: use the address of a relayed candidate for its foundation
Fabrice Bellet [Thu, 16 Apr 2020 18:09:59 +0000 (20:09 +0200)]
discovery: use the address of a relayed candidate for its foundation

According to the RFC, the base address of a relayed candidate is that
candidate itself. This precision is interesting and not just
anecdotical, since it allows the relayed candidates from the same turn
server to share the same foundation, and to not be tested concurrently.

However, since the base address in its current form is required to
compute a unique priority, we choose the keep the
candidate->base_address for this purpose, and to apply the RFC
consequence about relay candidate base being equal to the candidate
itself in the foundation assignment instead.

3 years agodiscovery: remove turn refresh after discarding relay candidate
Fabrice Bellet [Sun, 19 Apr 2020 15:22:35 +0000 (17:22 +0200)]
discovery: remove turn refresh after discarding relay candidate

When a redundant relay candidate is discarded, a turn refresh with zero
lifetime must be sent to release its allocation on the turn server.

3 years agodiscovery: redundant candidates should have the same transport
Fabrice Bellet [Fri, 8 May 2020 20:44:35 +0000 (22:44 +0200)]
discovery: redundant candidates should have the same transport

When dropping redundant server-reflexive and relay candidates, they
should of course have the same transport too.

3 years agodiscovery: use a single server reflexive and relay local candidate
Fabrice Bellet [Wed, 26 Feb 2020 19:46:56 +0000 (20:46 +0100)]
discovery: use a single server reflexive and relay local candidate

The rationale with this patch is that an agent running on a multihomed
host have no gain to store multiple identical server reflexive and relay
local candidates (those obtained by a stun bind request sent from each
local interface). The stun requests that use the same default route are
all expected to provide the same answer.

This patch should keep intact the ICE conncheck versatility, and
drastically improve the conncheck time to completion, as the number of
checked pairs is reduced.

3 years agointerfaces: skip unhandled interface families early
Fabrice Bellet [Sat, 26 Sep 2020 17:46:04 +0000 (19:46 +0200)]
interfaces: skip unhandled interface families early

We handle interfaces of type AF_INET or AF_INET6 only, so discard other
families before calling sockaddr_to_string() on them, for example
PF_PACKET.

3 years agoagent: set component is state gathering earlier
Fabrice Bellet [Mon, 1 Jun 2020 19:40:59 +0000 (21:40 +0200)]
agent: set component is state gathering earlier

This patch avoids to bypass state gathering, with transition
from disconnected to connecting.

3 years agocandidate: fix unused variable
Fabrice Bellet [Mon, 7 Sep 2020 19:51:04 +0000 (21:51 +0200)]
candidate: fix unused variable

3 years agoagent: implement support for RFC7675 - Consent Freshness
Matthew Waters [Tue, 15 Sep 2020 04:54:00 +0000 (14:54 +1000)]
agent: implement support for RFC7675 - Consent Freshness

Specified in https://tools.ietf.org/html/rfc7675

RFC 7675 is a slight modification of the existing keepalive connection
checks that could be enabled manually or were used with the GOOGLE
compatibility mode.

Slight differences from the existing keepalive connection checks
include:
- an additional consent expiry timer instead of relying on all binding
  requests to succeed.
- 403: 'Forbidden' stun error-code which revokes consent with immediate
  effect.

3 years agointerfaces: IPv6 addresses can have a scope and be very long
Olivier Crête [Wed, 18 Nov 2020 00:14:46 +0000 (19:14 -0500)]
interfaces: IPv6 addresses can have a scope and be very long

Just put a much larger buffer for this to work.

Fixes #126

3 years agoconncheck: fix a buggy state transition
Fabrice Bellet [Mon, 23 Nov 2020 21:53:45 +0000 (22:53 +0100)]
conncheck: fix a buggy state transition

The previous patch handling tcp disconnections forgot a case when the
selected pair is removed, while in state ready, and in that situation,
we should not jump back to connecting state, but fail instead. Just like
we did at the beginning of the function.

3 years agoagent: report duplicated port in udp bsd sockets too
Fabrice Bellet [Sat, 26 Sep 2020 15:02:12 +0000 (17:02 +0200)]
agent: report duplicated port in udp bsd sockets too

This patch fixes cases, where the range is full, some ports fail with
HOST_CANDIDATE_CANT_CREATE_SOCKET, other fail with
HOST_CANDIDATE_DUPLICATE_PORT, the value of res we keep when leaving the
loop is randomly the one of the last iteration of the loop.

CANT_CREATE_SOCKET still happens when trying to create an udp bsd socket
with the same address and port than one of another component, so it is
also a case of duplicate port in fact.

To be homogeneous, we add a gerror for nice_udp_bsd_socket_new(), like
we did in nice_tcp_passive_socket_new(), and we can catch the same
G_IO_ERROR_ADDRESS_IN_USE there too, when failing to get free available
udp ports.

This patch is a complement to merge request !158

3 years agoconncheck: better handle remote tcp disconnection
Fabrice Bellet [Mon, 23 Nov 2020 21:53:45 +0000 (22:53 +0100)]
conncheck: better handle remote tcp disconnection

With this patch, we handle tcp disconnections in a more robust way.
Such disconnections cause the underlying socket to be detached, and
various related pairs have to be discarded from the conncheck list.
This may cause unexpected behaviour, like a previously connected
component to come back in state connecting, if the selected pair
is concerned by a tcp disconnection for example.

3 years agocomponent: Fix potential NULL deference
Olivier Crête [Mon, 26 Oct 2020 14:54:37 +0000 (10:54 -0400)]
component: Fix potential NULL deference

This was introduced recently and flagged by Coverity.

3 years agogitlab-ci: mingw now works, so dont allow failure
Olivier Crête [Wed, 21 Oct 2020 22:42:37 +0000 (18:42 -0400)]
gitlab-ci: mingw now works, so dont allow failure

3 years agogitlab-ci: Download an updated keyring
Olivier Crête [Wed, 21 Oct 2020 21:59:55 +0000 (17:59 -0400)]
gitlab-ci: Download an updated keyring

The keyring in our base image is outdated.

3 years agogitlab-ci: Limit ninja to 1 job on mingw
Olivier Crête [Wed, 21 Oct 2020 22:17:47 +0000 (18:17 -0400)]
gitlab-ci: Limit ninja to 1 job on mingw

3 years agogitlab-ci: Switch to new Windows v13-master Windows image
Olivier Crête [Wed, 21 Oct 2020 20:08:01 +0000 (16:08 -0400)]
gitlab-ci: Switch to new Windows v13-master Windows image

3 years agogitlab-ci: Kill all msys tasks after upgrading
Olivier Crête [Thu, 25 Jun 2020 18:36:27 +0000 (14:36 -0400)]
gitlab-ci: Kill all msys tasks after upgrading

Also don't fail the first iteration of upgrade

Solution found by Jordan Petritis

3 years agogitlab-ci: Disable trigger again
Olivier Crête [Wed, 21 Oct 2020 19:47:49 +0000 (15:47 -0400)]
gitlab-ci: Disable trigger again

3 years agoconncheck: add stun transaction id of stun ping response in debugging logs
Chi Liu [Thu, 3 Sep 2020 21:08:52 +0000 (17:08 -0400)]
conncheck: add stun transaction id of stun ping response in debugging logs

3 years agogitlab-ci: Trigger website after pages stage
Olivier Crête [Wed, 21 Oct 2020 19:21:04 +0000 (15:21 -0400)]
gitlab-ci: Trigger website after pages stage

3 years agoagent: Start connchecks when credentials are set
Olivier Crête [Tue, 6 Oct 2020 20:06:19 +0000 (16:06 -0400)]
agent: Start connchecks when credentials are set

This should make it work even if no remote candidates at all are set
in the case where we can establish a connection based only on peer reflexive
candidates.

3 years agoagent: Move UPnP handling to each stream
Olivier Crête [Tue, 18 Aug 2020 20:04:58 +0000 (16:04 -0400)]
agent: Move UPnP handling to each stream

Also rewrite the logic a little, and try to make the code a little clearer.

3 years agoversion 0.1.18.1
Olivier Crête [Wed, 21 Oct 2020 00:58:23 +0000 (20:58 -0400)]
version 0.1.18.1

3 years agoversion 0.1.18 0.1.18
Olivier Crête [Wed, 21 Oct 2020 00:45:24 +0000 (20:45 -0400)]
version 0.1.18

3 years agoconncheck: Only valid stun messages used for Keepalive
Johan Sternerup [Thu, 9 Jul 2020 11:37:27 +0000 (13:37 +0200)]
conncheck: Only valid stun messages used for Keepalive

Previously, a STUN response for which there was no associated request
would be considered valid media input and as such could keep a dead
connection alive. If peer A was communicating with peer B and peer B got
disconnected, the keepalive mechanism in peer A should detect this.
However, a misbehaving STUN server could keep sending STUN responses to
peer A which would then be considered a valid communication between A
and B and thereby prevent the keepalive mechanism from shutting down the
connection.

Situation above refers to a stun message validated as
STUN_VALIDATION_UNMATCHED_RESPONSE. With this change only messages
validated as STUN_VALIDATION_SUCCESS may keep the connection alive.

3 years agoagent: Enable both UDP and TCP to the same TURN server
Johan Sternerup [Thu, 17 Sep 2020 14:20:05 +0000 (16:20 +0200)]
agent: Enable both UDP and TCP to the same TURN server

Previously if we enabled both UDP and TCP to the same TURN server, the
TCP connection would not work. What happened was that when traffic was
targeted at the TCP connection we would fail to route the traffic to
the right socket due to a too early jump out of the loop searching for
the socket. The search would stop when finding a TURN server matching
the address of the incoming message source. Thus, a UDP TURN server
with the same address as the TCP TURN server would effectively mean
that traffic got routed to a different stun agent that would complain
about receiving responses without matching requests.

3 years agocandidate: Hide the internal implementation from API
Olivier Crête [Fri, 22 May 2020 02:13:14 +0000 (22:13 -0400)]
candidate: Hide the internal implementation from API

This is slightly an API break, but it should never have been public.

3 years agoVersion 0.1.17 with tizen patch 53/241453/2 accepted/tizen_6.0_unified_hotfix tizen_6.0_hotfix accepted/tizen/6.0/unified/20201030.110054 accepted/tizen/6.0/unified/hotfix/20201102.234034 accepted/tizen/6.0/unified/hotfix/20201103.050554 accepted/tizen/unified/20200820.213428 submit/tizen/20200820.092250 submit/tizen_6.0/20201029.205502 submit/tizen_6.0_hotfix/20201102.192902 submit/tizen_6.0_hotfix/20201103.115102 tizen_6.0.m2_release
Hyunil [Thu, 20 Aug 2020 08:39:07 +0000 (17:39 +0900)]
Version 0.1.17 with tizen patch

remove doc from Makefile.am and configue.ac

Change-Id: If82a404c5c29e0481afa05396d71f1e8cdccfeec

3 years agoMerge branch 'upstream' into tizen 52/241452/1
Hyunil [Thu, 20 Aug 2020 08:35:41 +0000 (17:35 +0900)]
Merge branch 'upstream' into tizen

Change-Id: I64747e2043743986156f15d883a136c4fcbc0375

3 years agoImported Upstream version 0.1.17 50/241450/1 upstream/0.1.17
Hyunil [Thu, 20 Aug 2020 08:32:40 +0000 (17:32 +0900)]
Imported Upstream version 0.1.17

Change-Id: I4574844e0f8310d9f89f80a4315861ad87ef070d

3 years agoagent: Actually fail gathering on UDP port unavailability
Olivier Crête [Wed, 22 Jul 2020 20:23:09 +0000 (16:23 -0400)]
agent: Actually fail gathering on UDP port unavailability

This will make it fail if either our test of UDP port clash fails
or if the kernel rejects the new socket because there is a port clash.

Also include a unit test for this.

3 years agomeson: Remove duplicated entry
Olivier Crête [Tue, 18 Aug 2020 19:55:22 +0000 (15:55 -0400)]
meson: Remove duplicated entry

3 years agoIgnore interfaces in windows
Ami Perlmutter [Thu, 13 Aug 2020 11:34:50 +0000 (14:34 +0300)]
Ignore interfaces in windows

3 years agogitlab-ci: Use curl --data to make coverity happy
Olivier Crête [Mon, 10 Aug 2020 23:00:16 +0000 (19:00 -0400)]
gitlab-ci: Use curl --data to make coverity happy

3 years agoaddress: Use union
Olivier Crête [Mon, 10 Aug 2020 22:33:49 +0000 (18:33 -0400)]
address: Use union

This makes coverity happier.

3 years agoUse g_alloca instead of g_malloc_n in socket_send_messages
Lorenzo Miniero [Tue, 4 Aug 2020 13:53:42 +0000 (15:53 +0200)]
Use g_alloca instead of g_malloc_n in socket_send_messages

3 years agoChanged type of variable to signed
Lorenzo Miniero [Thu, 23 Jul 2020 16:33:57 +0000 (18:33 +0200)]
Changed type of variable to signed

3 years agoFixed wrong return value in socket_send_messages for n_messages=1
Lorenzo Miniero [Tue, 21 Jul 2020 13:30:32 +0000 (15:30 +0200)]
Fixed wrong return value in socket_send_messages for n_messages=1

3 years agoRefactored UDP socket_send_messages to use g_socket_send_messages
Lorenzo Miniero [Tue, 21 Jul 2020 10:31:06 +0000 (12:31 +0200)]
Refactored UDP socket_send_messages to use g_socket_send_messages

3 years agotests: Fix warning when building with newer GLib version
Olivier Crête [Wed, 22 Jul 2020 19:29:24 +0000 (15:29 -0400)]
tests: Fix warning when building with newer GLib version

3 years agoagent: Accept duplicated ports if no other option
Olivier Crête [Tue, 23 Jun 2020 21:32:39 +0000 (17:32 -0400)]
agent: Accept duplicated ports if no other option

Commit a04fa4d492 introduced a new feature to try to have a different port for every
local candidate, even if they are on different interfaces. This breaks setups where the
application really wants a specific port and sets a range of exactly 1 port or a very small range.
In that case, if we can't find non-duplicated ports, then we just go around again and skip that check,
but only if both ports are in the same stream and component. Otherwise, we fail the whole component!

3 years agocandidate: Make debug string functions public
Olivier Crête [Tue, 21 Jul 2020 23:35:42 +0000 (19:35 -0400)]
candidate: Make debug string functions public

Adds new public APIs, nice_candidate_type_to_string() and
nice_candidate_transport_to_string().

3 years agointerfaces: Fix code style for function declarations
Nirbheek Chauhan [Thu, 9 Jul 2020 17:27:34 +0000 (22:57 +0530)]
interfaces: Fix code style for function declarations

3 years agointerfaces: Fix fetching of interfaces on Win32
Nirbheek Chauhan [Thu, 9 Jul 2020 12:25:53 +0000 (17:55 +0530)]
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

3 years agointerfaces: Remove unused win32 code
Nirbheek Chauhan [Thu, 9 Jul 2020 12:25:08 +0000 (17:55 +0530)]
interfaces: Remove unused win32 code

3 years agointerfaces: Port to GetBestInterfaceEx for UWP compat
Nirbheek Chauhan [Thu, 9 Jul 2020 11:13:45 +0000 (16:43 +0530)]
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.

3 years agointerfaces: Add debug logging to sockaddr_to_string
Nirbheek Chauhan [Thu, 9 Jul 2020 11:13:19 +0000 (16:43 +0530)]
interfaces: Add debug logging to sockaddr_to_string

Helps when you forgot to call WSAStartup, for instance.

3 years agoagent: Don't go haywire if only a partial message is available
Olivier Crête [Tue, 23 Jun 2020 22:26:31 +0000 (18:26 -0400)]
agent: Don't go haywire if only a partial message is available

Instead, collect all the pieces until it's complete.

3 years agostund: Use lowercase winsock2.h
Nirbheek Chauhan [Mon, 15 Jun 2020 14:24:21 +0000 (19:54 +0530)]
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.

3 years agomeson: Fix typos in crypto-library detection
Nirbheek Chauhan [Mon, 15 Jun 2020 22:24:28 +0000 (03:54 +0530)]
meson: Fix typos in crypto-library detection

3 years agorand: Use crypto libs instead of CryptGenRandom()
Nirbheek Chauhan [Mon, 15 Jun 2020 22:19:14 +0000 (03:49 +0530)]
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.

3 years agoApply ASLR to stund and stunbdc of stun/tools 12/236112/3 accepted/tizen/unified/20200616.040956 submit/tizen/20200615.034320
Hyunil [Mon, 15 Jun 2020 03:18:23 +0000 (12:18 +0900)]
Apply ASLR to stund and stunbdc of stun/tools

Change-Id: Ieb4ad8f0098329ff6145828fc0f1ec617e85f6f6
Signed-off-by: Hyunil <hyunil46.park@samsung.com>