Skip to content
  • Fabrice Bellet's avatar
    agent: do not create a GSource for UDP TURN socket · 0a2cb0a9
    Fabrice Bellet authored and Olivier Crête's avatar Olivier Crête committed
    With this patch, we don't create a new GSource for udp-turn socket,
    because it would duplicate the packets already received on the base UDP
    socket, as the underlying GSocket is the same. This is a race condition,
    because an UDP packet arriving on the base socket, may randomly be
    handled by the GSource callback created for the base socket (udp-bsd) of
    the callback created for the udp-turn socket. Moreover this callback
    already knows how to parse UDP datagrams received from a known turn
    server.
    
    This patch also prevents a subtle bug, when a STUN request is received
    directly from a peer, is handled by the udp turn socket. If the agent
    already has a valid permission for this remote candidate, established
    for another pair, it will happily send the STUN reply through the turn
    relay. This generates a source address mismatch on the peer agent, when
    it'll receive the STUN response from the turn relay instead of the
    initial address the request has been sent to.
    
    Differential Revision: https://phabricator.freedesktop.org/D932
    0a2cb0a9