summaryrefslogtreecommitdiff
path: root/agent/conncheck.c
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2017-04-04 21:27:39 -0400
committerOlivier CrĂȘte <olivier.crete@collabora.com>2017-04-11 17:50:40 -0400
commitffc7fddac42728bac6e4753a17bc52e5e610ae8b (patch)
tree8708b9dcd7206ce1c843b30a8a5b5a32016d40e4 /agent/conncheck.c
parent1e9e28dbc98b4f6a7cf4bda0ca73b5abc2735ddc (diff)
downloadlibnice-ffc7fddac42728bac6e4753a17bc52e5e610ae8b.tar.gz
agent: Drop packets not from validated addresses
This is required by the WebRTC spec. Remove test-mainloop as it doesnt even try to do a negotiation. https://phabricator.freedesktop.org/T104 Differential Revision: https://phabricator.freedesktop.org/D1716
Diffstat (limited to 'agent/conncheck.c')
-rw-r--r--agent/conncheck.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/agent/conncheck.c b/agent/conncheck.c
index 1dc13dd..7ffa3db 100644
--- a/agent/conncheck.c
+++ b/agent/conncheck.c
@@ -2627,6 +2627,7 @@ static CandidateCheckPair *priv_process_response_check_for_reflexive(NiceAgent *
p->state = NICE_CHECK_SUCCEEDED;
nice_debug ("Agent %p : conncheck %p SUCCEEDED.", agent, p);
priv_conn_check_unfreeze_related (agent, stream, p);
+ nice_component_add_valid_candidate (component, remote_candidate);
}
else {
if (!local_cand) {
@@ -2652,8 +2653,10 @@ static CandidateCheckPair *priv_process_response_check_for_reflexive(NiceAgent *
/* note: this is same as "adding to VALID LIST" in the spec
text */
- if (new_pair)
+ if (new_pair) {
new_pair->valid = TRUE;
+ nice_component_add_valid_candidate (component, remote_candidate);
+ }
return new_pair;
}
@@ -2739,6 +2742,7 @@ static gboolean priv_map_reply_to_conn_check_request (NiceAgent *agent, NiceStre
nice_debug ("Agent %p : Mapped address not found."
" conncheck %p SUCCEEDED.", agent, p);
priv_conn_check_unfreeze_related (agent, stream, p);
+ nice_component_add_valid_candidate (component, p->remote);
} else {
ok_pair = priv_process_response_check_for_reflexive (agent,
stream, component, p, sockptr, &sockaddr.addr,
@@ -3654,6 +3658,8 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, NiceStream *stream,
}
}
+ nice_component_add_valid_candidate (component, remote_candidate);
+
priv_reply_to_conn_check (agent, stream, component, local_candidate,
remote_candidate, from, nicesock, rbuf_len, &msg, use_candidate);