Fix SIPE connectivity problems (#1337051, #1337412)

This commit is contained in:
David Woodhouse 2016-05-20 14:50:27 +01:00
parent a5545845ce
commit 7e208536bc
3 changed files with 144 additions and 2 deletions

View File

@ -0,0 +1,35 @@
From edb8b225daba690efb21674e95be187a111d245f Mon Sep 17 00:00:00 2001
From: Jakub Adam <jakub.adam@ktknet.cz>
Date: Wed, 18 May 2016 08:58:54 +0200
Subject: [PATCH] agent: don't give up gathering when can't create socket for
an IP
Candidate gathering is stopped when discovery_add_local_host_candidate()
returns HOST_CANDIDATE_CANT_CREATE_SOCKET. This may be too radical
a measure when other local addresses can still be able to generate
usable candidates.
The issue was observed by a user who had an IPv6 address with tentative
flag on one of the interfaces. That single failing address was causing
the whole gathering process to end with no candidates found.
---
agent/agent.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/agent/agent.c b/agent/agent.c
index 334198b..db1e2d2 100644
--- a/agent/agent.c
+++ b/agent/agent.c
@@ -2783,8 +2783,7 @@ nice_agent_gather_candidates (
" s%d:%d. Invalid interface?", agent, ip, stream->id,
component->id);
}
- ret = FALSE;
- goto error;
+ continue;
}
nice_address_set_port (addr, 0);
--
2.7.4

View File

@ -0,0 +1,100 @@
From 7bbcde51e11f44f69bc5b5f1eede93a9d11e11f8 Mon Sep 17 00:00:00 2001
From: Philip Withnall <philip@tecnocode.co.uk>
Date: Tue, 1 Mar 2016 22:33:51 +0000
Subject: [PATCH] conncheck: nominate only one matching pair
This patch fixes a bug in priv_mark_pair_nominated(), where the local
candidate was not passed to the function, so removing the possibility to
find which local candidate the check was sent to.
Reviewed-by: Philip Withnall <philip@tecnocode.co.uk>
Differential Revision: https://phabricator.freedesktop.org/D808
(cherry picked from commit c309905ff446bed2dc47811023b98bc586a02d63)
---
agent/conncheck.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/agent/conncheck.c b/agent/conncheck.c
index 057fc81..62be0c4 100644
--- a/agent/conncheck.c
+++ b/agent/conncheck.c
@@ -65,7 +65,7 @@ static void priv_update_check_list_failed_components (NiceAgent *agent, Stream *
static void priv_update_check_list_state_for_ready (NiceAgent *agent, Stream *stream, Component *component);
static guint priv_prune_pending_checks (Stream *stream, guint component_id);
static gboolean priv_schedule_triggered_check (NiceAgent *agent, Stream *stream, Component *component, NiceSocket *local_socket, NiceCandidate *remote_cand, gboolean use_candidate);
-static void priv_mark_pair_nominated (NiceAgent *agent, Stream *stream, Component *component, NiceCandidate *remotecand);
+static void priv_mark_pair_nominated (NiceAgent *agent, Stream *stream, Component *component, NiceCandidate *localcand, NiceCandidate *remotecand);
static size_t priv_create_username (NiceAgent *agent, Stream *stream,
guint component_id, NiceCandidate *remote, NiceCandidate *local,
uint8_t *dest, guint dest_len, gboolean inbound);
@@ -1004,7 +1004,7 @@ static void priv_preprocess_conn_check_pending_data (NiceAgent *agent, Stream *s
icheck->local_socket == pair->sockptr) {
nice_debug ("Agent %p : Updating check %p with stored early-icheck %p, %p/%u/%u (agent/stream/component).", agent, pair, icheck, agent, stream->id, component->id);
if (icheck->use_candidate)
- priv_mark_pair_nominated (agent, stream, component, pair->remote);
+ priv_mark_pair_nominated (agent, stream, component, pair->local, pair->remote);
priv_schedule_triggered_check (agent, stream, component, icheck->local_socket, pair->remote, icheck->use_candidate);
}
}
@@ -1148,7 +1148,7 @@ void conn_check_remote_candidates_set(NiceAgent *agent)
conn_check_add_for_candidate (agent, stream->id, component, candidate);
if (icheck->use_candidate)
- priv_mark_pair_nominated (agent, stream, component, candidate);
+ priv_mark_pair_nominated (agent, stream, component, local_candidate, candidate);
priv_schedule_triggered_check (agent, stream, component, icheck->local_socket, candidate, icheck->use_candidate);
}
}
@@ -1337,7 +1337,7 @@ static void priv_update_check_list_state_for_ready (NiceAgent *agent, Stream *st
* described by 'component' and 'remotecand' is nominated
* for use.
*/
-static void priv_mark_pair_nominated (NiceAgent *agent, Stream *stream, Component *component, NiceCandidate *remotecand)
+static void priv_mark_pair_nominated (NiceAgent *agent, Stream *stream, Component *component, NiceCandidate *localcand, NiceCandidate *remotecand)
{
GSList *i;
@@ -1346,10 +1346,7 @@ static void priv_mark_pair_nominated (NiceAgent *agent, Stream *stream, Componen
/* step: search for at least one nominated pair */
for (i = stream->conncheck_list; i; i = i->next) {
CandidateCheckPair *pair = i->data;
- /* XXX: hmm, how to figure out to which local candidate the
- * check was sent to? let's mark all matching pairs
- * as nominated instead */
- if (pair->remote == remotecand) {
+ if (pair->local == localcand && pair->remote == remotecand) {
nice_debug ("Agent %p : marking pair %p (%s) as nominated", agent, pair, pair->foundation);
pair->nominated = TRUE;
if (pair->state == NICE_CHECK_SUCCEEDED ||
@@ -2121,7 +2118,7 @@ static gboolean priv_schedule_triggered_check (NiceAgent *agent, Stream *stream,
*
* @pre (rcand == NULL || nice_address_equal(rcand->addr, toaddr) == TRUE)
*/
-static void priv_reply_to_conn_check (NiceAgent *agent, Stream *stream, Component *component, NiceCandidate *rcand, const NiceAddress *toaddr, NiceSocket *sockptr, size_t rbuf_len, uint8_t *rbuf, gboolean use_candidate)
+static void priv_reply_to_conn_check (NiceAgent *agent, Stream *stream, Component *component, NiceCandidate *lcand, NiceCandidate *rcand, const NiceAddress *toaddr, NiceSocket *sockptr, size_t rbuf_len, uint8_t *rbuf, gboolean use_candidate)
{
g_assert (rcand == NULL || nice_address_equal(&rcand->addr, toaddr) == TRUE);
@@ -2144,7 +2141,7 @@ static void priv_reply_to_conn_check (NiceAgent *agent, Stream *stream, Componen
priv_schedule_triggered_check (agent, stream, component, sockptr, rcand, use_candidate);
if (use_candidate)
- priv_mark_pair_nominated (agent, stream, component, rcand);
+ priv_mark_pair_nominated (agent, stream, component, lcand, rcand);
}
}
@@ -3302,8 +3299,8 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
}
}
- priv_reply_to_conn_check (agent, stream, component, remote_candidate,
- from, nicesock, rbuf_len, rbuf, use_candidate);
+ priv_reply_to_conn_check (agent, stream, component, local_candidate,
+ remote_candidate, from, nicesock, rbuf_len, rbuf, use_candidate);
if (component->remote_candidates == NULL) {
/* case: We've got a valid binding request to a local candidate
--
2.7.4

View File

@ -1,12 +1,14 @@
Name: libnice
Version: 0.1.13
Release: 3%{?dist}
Release: 4%{?dist}
Summary: GLib ICE implementation
Group: System Environment/Libraries
License: LGPLv2 and MPLv1.1
URL: http://nice.freedesktop.org/wiki/
Source0: http://nice.freedesktop.org/releases/%{name}-%{version}.tar.gz
Patch1: 0001-conncheck-nominate-only-one-matching-pair.patch
Patch2: 0001-agent-don-t-give-up-gathering-when-can-t-create-sock.patch
BuildRequires: glib2-devel
BuildRequires: gobject-introspection-devel
@ -67,7 +69,8 @@ developing applications that use %{name}.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%check
#make check
@ -123,6 +126,10 @@ find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
%changelog
* Fri May 20 2016 David Woodhouse <dwmw2@infradead.org> - 0.1.13-4
- Backport patch to fix SIPE audio disconnections (#1337051)
- Fix candidate gathering with IPV6 tentative addresses (#1337412)
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.13-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild