Skip to content
  • Fabrice Bellet's avatar
    conncheck: refactor local and remote candidates validation · a9c2846a
    Fabrice Bellet authored and Olivier Crête's avatar Olivier Crête committed
    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
    a9c2846a