[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-bugs] Re: #1141 [Tor - Tor client]: bug in networkstatus.c using 0.2.1.20



#1141: bug in networkstatus.c using 0.2.1.20
--------------------------------+-------------------------------------------
 Reporter:  mikeb               |         Type:  defect          
   Status:  new                 |     Priority:  minor           
Milestone:  Tor: 0.2.2.x-final  |    Component:  Tor - Tor client
  Version:  0.2.1.20            |   Resolution:  None            
 Keywords:                      |       Parent:                  
--------------------------------+-------------------------------------------

Comment(by mwenge):

 Assuming that the values reported in the trace are sane:
 valid-after 2009-10-31 19:15:00
 fresh-until 2009-10-31 19:20:00
 valid-until 2009-10-31 19:30:00

 then I think this is failing in the
 directory_fetches_dir_info_later(options) clause below:

       start = c->fresh_until + (interval*3)/4;
       /* But download the next one well before this one is expired. */
       dl_interval = ((c->valid_until - start) * 7 )/ 8;

       /* If we're a bridge user, make use of the numbers we just computed
        * to choose the rest of the interval *after* them. */
       if (directory_fetches_dir_info_later(options)) {
         /* Give all the *clients* enough time to download the consensus.
 */
         start = start + dl_interval +
 CONSENSUS_MIN_SECONDS_BEFORE_CACHING;
         /* But try to get it before ours actually expires. */
         dl_interval = (c->valid_until - start) -
                       CONSENSUS_MIN_SECONDS_BEFORE_CACHING;
       }

 So:

 valid-after 2009-10-31 19:15:00 - 0 sec
 fresh-until 2009-10-31 19:20:00 - +300 sec
 valid-until 2009-10-31 19:30:00 - +900 sec

 Once we reach:

 start = start + dl_interval + CONSENSUS_MIN_SECONDS_BEFORE_CACHING

 start is +525 sec:
     long interval = c->fresh_until - c->valid_after; ~ 300 sec
     start = c->fresh_until + (interval*3)/4; ~ +525 sec

 and dl_interval is 328 sec
   dl_interval = ((c->valid_until - start) * 7 )/ 8; ~ (900 - 525 = 375) *7
 / 8

 so start is now 853 sec + CONSENSUS_MIN_SECONDS_BEFORE_CACHING sec = +973
 sec

         dl_interval = (c->valid_until - start) -
                       CONSENSUS_MIN_SECONDS_BEFORE_CACHING;

 is 900 - 973 - 120 = -193 sec, so dl_interval gets set to 1:

     if (dl_interval < 1)
       dl_interval = 1;

 so
    tor_assert(start+dl_interval < c->valid_until);

 fails because 974 is not less than 900.

 I'm probably falling down somewhere here - but I can't see it so pressing
 submit!

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