[tor-bugs] #5528 [Tor]: router->address is redundant with router->addr

Tor Bug Tracker & Wiki blackhole at torproject.org
Sat Jun 8 00:27:44 UTC 2013


#5528: router->address is redundant with router->addr
-----------------------------+----------------------------------------------
 Reporter:  arma             |          Owner:                    
     Type:  enhancement      |         Status:  needs_review      
 Priority:  normal           |      Milestone:  Tor: 0.2.5.x-final
Component:  Tor              |        Version:                    
 Keywords:  tor-client easy  |         Parent:                    
   Points:                   |   Actualpoints:                    
-----------------------------+----------------------------------------------

Comment(by arma):

 Replying to [comment:11 andrea]:
 > Hmm; the change in the unit test seems to hint at a problem with this:
 sometimes router->address is set from the public address rather than the
 address we're listening on, and thus does not always match router->addr.

 I believe this only happens in this one case in the unit tests. Basically,
 our test assumed that it could set address and addr to different things.
 Nothing else in the code thinks this.

 > Are we okay with changing every instance of anything using
 router->address to use the actual listener address?

 Don't be fooled about 'actual listener address' or any of that.
 router->addr is always set from the IP address in the router descriptor,
 and router->address was always just the string representation of
 router->addr (except as you note in the unit tests, where it just
 fabricates some values and assigns them).

 I assume you're looking at
 {{{
 -  strlcpy(buf2, "router Magri 18.244.0.1 9000 0 9003\n"
 +  strlcpy(buf2, "router Magri 192.168.0.1 9000 0 9003\n"
 }}}

 The reason I made this change was because of
 {{{
 -  r1->address = tor_strdup("18.244.0.1");
    r1->addr = 0xc0a80001u; /* 192.168.0.1 */
 }}}

 We could have left it at "router Magri 18.244.0.1 9000 0 9003\n" if
 somebody wants to compute what the hex of 18.244.0.1 is (and then we
 assign that to r1->addr).

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


More information about the tor-bugs mailing list