summaryrefslogtreecommitdiff
path: root/socket/tcp-bsd.c
diff options
context:
space:
mode:
authorFabrice Bellet <fabrice@bellet.info>2020-02-21 15:40:56 +0100
committerOlivier CrĂȘte <olivier.crete@ocrete.ca>2020-03-02 22:31:58 +0000
commita9c2846a89c4e74efbd7ef59fcfe7ff05efb2c5e (patch)
tree2f53b057af5ce8bbf997ab05968dab9e8c8f2548 /socket/tcp-bsd.c
parent3ad39b9f0d5895a7744ee0a6ded4b87d6486929a (diff)
downloadlibnice-a9c2846a89c4e74efbd7ef59fcfe7ff05efb2c5e.tar.gz
conncheck: refactor local and remote candidates validation
The same code to get and validate local and remote candidates from an incoming stun is shared between regular inbound stun, early checks replay, and partially in the local peer-reflexive discovery function. The selection of the matching local and remote candidate from an incoming stun sometimes requires more information than just the local socket, and the sender address and port. It happens more frequently when the port range is reduced, and when the conncheck handles both tcp and udp candidates. To help to disambiguate such situations, we add supplementary checks when two candidates in the list have the same address and and port number: * the type of the socket must compatible with the candidate transport. A socket for a tcp candidate may be active of passive, but also of type "tcp-bsd" when the parent active or passive socket is replaced after a bind() or accept(). It gives several cases. * the remote candidate transport and the local candidate transport must be compatible
Diffstat (limited to 'socket/tcp-bsd.c')
-rw-r--r--socket/tcp-bsd.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/socket/tcp-bsd.c b/socket/tcp-bsd.c
index 00a46ed..3cac22c 100644
--- a/socket/tcp-bsd.c
+++ b/socket/tcp-bsd.c
@@ -478,3 +478,11 @@ nice_tcp_bsd_socket_set_passive_parent (NiceSocket *sock, NiceSocket *passive_pa
priv->passive_parent = passive_parent;
}
+
+NiceSocket *
+nice_tcp_bsd_socket_get_passive_parent (NiceSocket *sock)
+{
+ TcpPriv *priv = sock->priv;
+
+ return priv->passive_parent;
+}