[tor-bugs] #9166 [Tor]: Write a UTP-based channel implementation

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Sep 3 22:47:41 UTC 2013


#9166: Write a UTP-based channel implementation
------------------------+------------------------------
     Reporter:  nickm   |      Owner:
         Type:  defect  |     Status:  new
     Priority:  normal  |  Milestone:  Tor: unspecified
    Component:  Tor     |    Version:
   Resolution:          |   Keywords:  tor-relay utp
Actual Points:          |  Parent ID:  #9165
       Points:          |
------------------------+------------------------------

Comment (by robgjansen):

 I spent some time looking into this problem. Here are some observations.

 libutp does not have on_write and on_read functions that the OS (or
 shadow) calls. In fact, it does not handle OS events in any way - Tor is
 responsible for that (and it uses libevent to make this less painfull).
 Tor does this in
 [https://gitweb.torproject.org/karsten/tor.git/blob/refs/heads/utp:/src/or/connection.c#l2025
 connection.c line 2025].

 It appears that only the one utp_listener socket is used for each
 chaneltls.

 Tor creates a *READ* event for the utp listener, hands the event off to
 libevent, and then never looks at it again. This seems very fragile: all
 writes can only be triggered during a read event. Even worse, the return
 value for sendto is never checked and handled: I'm not sure the
 implications of sendto failing
 [https://gitweb.torproject.org/karsten/tor.git/blob/refs/heads/utp:/src/or/channeltls.c#l303
 here]. (Failing could in fact mean EAGAIN, ie EWOULDBLOCK, and isn't
 necessarily a bad thing.)

 [https://gitweb.torproject.org/karsten/tor.git/blob/refs/heads/utp:/src/or/channeltls.c#l386
 utp_read_callback] seems to be getting called by Shadow just fine. The
 problem is that the call to
 [https://github.com/sjmurdoch/libutp/blob/master/utp.cpp#L2522
 UTP_IsIncomingUTP] triggers the sending of a reset
 [https://github.com/sjmurdoch/libutp/blob/master/utp.cpp#L2626 here],
 meaning that libutp never thinks the socket is writable and so UTP_Write
 never writes.

 I suggest the next step here is turing on libutp debug logs and trying to
 figure out why its sending resets in UTP_IsIncomingUTP.

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/9166#comment:29>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list