[tor-bugs] #13840 [Tor]: Use END_CIRC_REASON_TORPROTOCOL rather than "1" in connection_exit_begin_conn()

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Nov 25 20:23:00 UTC 2014


#13840: Use END_CIRC_REASON_TORPROTOCOL rather than "1" in
connection_exit_begin_conn()
-----------------------------+----------------------------------
 Reporter:  arma             |          Owner:
     Type:  defect           |         Status:  new
 Priority:  normal           |      Milestone:  Tor: unspecified
Component:  Tor              |        Version:
 Keywords:  tor-relay, easy  |  Actual Points:
Parent ID:                   |         Points:
-----------------------------+----------------------------------
 In the function comment for connection_exit_begin_conn() we see
 {{{
  * Return -(some circuit end reason) if we want to tear down <b>circ</b>.
  * Else return 0.
 }}}
 and then at the front of the function we see
 {{{
   if (rh.length > RELAY_PAYLOAD_SIZE)
     return -1;
 }}}

 Now, it happens that 1 is END_CIRC_REASON_TORPROTOCOL, which is a
 legitimate reason to use in this case. But did we just get lucky?

 Later there's also a
 {{{
   if (r < -1) {
     return -1;
 }}}

 If we want to go wilder with the change here, I think this function
 actually only ever returns 0 and -1, so it's not actually following the
 function comment and we could get rid of that part of it instead?

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


More information about the tor-bugs mailing list