diff options
author | Fabrice Bellet <fabrice@bellet.info> | 2020-02-21 15:40:56 +0100 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@ocrete.ca> | 2020-03-02 22:31:58 +0000 |
commit | a9c2846a89c4e74efbd7ef59fcfe7ff05efb2c5e (patch) | |
tree | 2f53b057af5ce8bbf997ab05968dab9e8c8f2548 /socket | |
parent | 3ad39b9f0d5895a7744ee0a6ded4b87d6486929a (diff) | |
download | libnice-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')
-rw-r--r-- | socket/tcp-bsd.c | 8 | ||||
-rw-r--r-- | socket/tcp-bsd.h | 3 |
2 files changed, 11 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; +} diff --git a/socket/tcp-bsd.h b/socket/tcp-bsd.h index 615b759..7c42ed3 100644 --- a/socket/tcp-bsd.h +++ b/socket/tcp-bsd.h @@ -52,6 +52,9 @@ nice_tcp_bsd_socket_new_from_gsock (GMainContext *ctx, GSocket *gsock, void nice_tcp_bsd_socket_set_passive_parent (NiceSocket *socket, NiceSocket *passive_parent); +NiceSocket * +nice_tcp_bsd_socket_get_passive_parent (NiceSocket *socket); + G_END_DECLS #endif /* _TCP_BSD_H */ |