Commit a9c2846a authored by Fabrice Bellet's avatar Fabrice Bellet Committed by Olivier Crête

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
parent 3ad39b9f
This diff is collapsed.
...@@ -478,3 +478,11 @@ nice_tcp_bsd_socket_set_passive_parent (NiceSocket *sock, NiceSocket *passive_pa ...@@ -478,3 +478,11 @@ nice_tcp_bsd_socket_set_passive_parent (NiceSocket *sock, NiceSocket *passive_pa
priv->passive_parent = passive_parent; priv->passive_parent = passive_parent;
} }
NiceSocket *
nice_tcp_bsd_socket_get_passive_parent (NiceSocket *sock)
{
TcpPriv *priv = sock->priv;
return priv->passive_parent;
}
...@@ -52,6 +52,9 @@ nice_tcp_bsd_socket_new_from_gsock (GMainContext *ctx, GSocket *gsock, ...@@ -52,6 +52,9 @@ nice_tcp_bsd_socket_new_from_gsock (GMainContext *ctx, GSocket *gsock,
void void
nice_tcp_bsd_socket_set_passive_parent (NiceSocket *socket, NiceSocket *passive_parent); 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 G_END_DECLS
#endif /* _TCP_BSD_H */ #endif /* _TCP_BSD_H */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment