Opened 4 months ago

Closed 8 weeks ago

#22245 closed defect (fixed)

Logic error with monthly accounting

Reported by: arma Owned by:
Priority: Medium Milestone: Tor: 0.2.9.x-final
Component: Core Tor/Tor Version:
Severity: Normal Keywords: 029-backport, 030-backport
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Here's the code in src/or/hibernate.c:

      /* If this is before the Nth, we want the Nth of last month. */
      if (tm.tm_mday < cfg_start_day ||
          (tm.tm_mday < cfg_start_day && before)) {
        --tm.tm_mon;
      }

Andrey Karpov points out in https://www.viva64.com/en/b/0507/ that the second clause of the if is redundant with the first clause.

Looking at it more, I think we wanted that second clause to be (tm.tm_mday == cfg_start_day && before).

What are the implications of this bug for relays that do monthly accounting?

Child Tickets

Change History (5)

comment:1 in reply to:  description Changed 4 months ago by teor

Replying to arma:

What are the implications of this bug for relays that do monthly accounting?

Tor rolls over all monthly accounting at 00:00, rather than the configured hour and minute.

comment:2 Changed 4 months ago by nickm

Keywords: 029-backport 030-backport added
Milestone: Tor: 0.3.1.x-finalTor: 0.3.0.x-final
Status: newneeds_review

I've made the suggested fix in a branch bug22245_024. I suggest that we backport no farther than 0.2.9. I've merged this in master. Marking for possible backport

comment:3 Changed 4 months ago by nickm

Status: needs_reviewmerge_ready

comment:4 Changed 4 months ago by nickm

Keywords: 029-backport 030-backport029-backport, 030-backport

comment:5 Changed 8 weeks ago by nickm

Milestone: Tor: 0.3.0.x-finalTor: 0.2.9.x-final
Resolution: fixed
Status: merge_readyclosed

Backported to 0.2.9 and 0.3.0

Note: See TracTickets for help on using tickets.