diff options
author | Fabrice Bellet <fabrice@bellet.info> | 2017-11-27 23:56:17 +0100 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@collabora.com> | 2018-03-23 13:56:18 -0400 |
commit | 00dfcc6a625e6c6ed758a4b3b4d0858113508a2f (patch) | |
tree | 51feba6ed532983c404ce0a498684826735c4e29 /agent | |
parent | 05f1e30239a448385709df0edd43ec3ac5173218 (diff) | |
download | libnice-00dfcc6a625e6c6ed758a4b3b4d0858113508a2f.tar.gz |
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
Diffstat (limited to 'agent')
-rw-r--r-- | agent/agent.c | 12 | ||||
-rw-r--r-- | agent/conncheck.c | 4 |
2 files changed, 10 insertions, 6 deletions
diff --git a/agent/agent.c b/agent/agent.c index 49fc371..3306378 100644 --- a/agent/agent.c +++ b/agent/agent.c @@ -3062,11 +3062,13 @@ nice_agent_gather_candidates ( if (nice_address_set_from_string (&stun_server, agent->stun_server_ip)) { nice_address_set_port (&stun_server, agent->stun_server_port); - priv_add_new_candidate_discovery_stun (agent, - host_candidate->sockptr, - stun_server, - stream, - cid); + if (nice_address_ip_version (&host_candidate->addr) == + nice_address_ip_version (&stun_server)) + priv_add_new_candidate_discovery_stun (agent, + host_candidate->sockptr, + stun_server, + stream, + cid); } } diff --git a/agent/conncheck.c b/agent/conncheck.c index 25bfd80..4d91f41 100644 --- a/agent/conncheck.c +++ b/agent/conncheck.c @@ -1459,7 +1459,9 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent) for (k = component->local_candidates; k; k = k->next) { NiceCandidate *candidate = (NiceCandidate *) k->data; if (candidate->type == NICE_CANDIDATE_TYPE_HOST && - candidate->transport == NICE_CANDIDATE_TRANSPORT_UDP) { + candidate->transport == NICE_CANDIDATE_TRANSPORT_UDP && + nice_address_ip_version (&candidate->addr) == + nice_address_ip_version (&stun_server)) { /* send the conncheck */ nice_debug ("Agent %p : resending STUN on %s to keep the " "candidate alive.", agent, candidate->foundation); |