Opened 2 years ago

Closed 2 years ago

#23091 closed defect (fixed)

Broken condition in check_expired_networkstatus_callback()

Reported by: dgoulet Owned by:
Priority: Medium Milestone: Tor: 0.3.2.x-final
Component: Core Tor/Tor Version:
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: asn Sponsor: Sponsor8


Turns out that this condition in check_expired_networkstatus_callback():

  if (ns && ns->valid_until < now+NS_EXPIRY_SLOP &&
      router_have_minimum_dir_info()) {

... is always true if we have all our needed directory info which means that router_dir_info_changed() is called every 2 minutes (the callback interval).

Nick suggested that it should be now - NS_EXPIRY_SLOP which goes like this:

If valid_until is 6am today, then now - 24h == 1pm yesterday, and valid_until < (now - 24h) is false. But at 6:01am tomorrow, valid_until < now - 24h becomes true.

Child Tickets

Change History (4)

comment:1 Changed 2 years ago by dgoulet

Status: newneeds_review

See branch: bug23091_032_01

comment:2 Changed 2 years ago by asn

Reviewer: asn

comment:3 Changed 2 years ago by asn

Status: needs_reviewmerge_ready

Patch LGTM.

I looked to see what are the consequences of fixing this bug: Now the flag need_to_update_have_min_dir_info will be set only when we receive new dirinfo, instead of every 2 minutes. This means we will check if we have enough dirinfo to build a circuit only when needed, and not every 2 minutes. I think that's what was intended originally, so I think we are good here.

comment:4 Changed 2 years ago by nickm

Resolution: fixed
Sponsor: Sponsor8
Status: merge_readyclosed

Merged it to master. Let's remember we did this one, in case it turns out we suddenly stop updating the relevant variables.

Note: See TracTickets for help on using tickets.