From 7e208536bcc4ff9377256ad01672860242ac56d7 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Fri, 20 May 2016 14:50:27 +0100 Subject: [PATCH] Fix SIPE connectivity problems (#1337051, #1337412) --- ...-up-gathering-when-can-t-create-sock.patch | 35 ++++++ ...heck-nominate-only-one-matching-pair.patch | 100 ++++++++++++++++++ libnice.spec | 11 +- 3 files changed, 144 insertions(+), 2 deletions(-) create mode 100644 0001-agent-don-t-give-up-gathering-when-can-t-create-sock.patch create mode 100644 0001-conncheck-nominate-only-one-matching-pair.patch diff --git a/0001-agent-don-t-give-up-gathering-when-can-t-create-sock.patch b/0001-agent-don-t-give-up-gathering-when-can-t-create-sock.patch new file mode 100644 index 0000000..c06b8ea --- /dev/null +++ b/0001-agent-don-t-give-up-gathering-when-can-t-create-sock.patch @@ -0,0 +1,35 @@ +From edb8b225daba690efb21674e95be187a111d245f Mon Sep 17 00:00:00 2001 +From: Jakub Adam +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 + diff --git a/0001-conncheck-nominate-only-one-matching-pair.patch b/0001-conncheck-nominate-only-one-matching-pair.patch new file mode 100644 index 0000000..52a8743 --- /dev/null +++ b/0001-conncheck-nominate-only-one-matching-pair.patch @@ -0,0 +1,100 @@ +From 7bbcde51e11f44f69bc5b5f1eede93a9d11e11f8 Mon Sep 17 00:00:00 2001 +From: Philip Withnall +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 +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 + diff --git a/libnice.spec b/libnice.spec index c71a1c6..c3fee82 100644 --- a/libnice.spec +++ b/libnice.spec @@ -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 - 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 - 0.1.13-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild