Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Trac Trac
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Service Desk
    • Milestones
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Legacy
  • TracTrac
  • Issues
  • #24895

Closed (moved)
(moved)
Open
Created Jan 15, 2018 by Roger Dingledine@arma

MAX_REND_FAILURES is 1, but we will try three times

Off-by-2 error counting to MAX_REND_FAILURES for onion services:

In can_relaunch_service_rendezvous_point(), we check

  if (circ->build_state->failure_count > MAX_REND_FAILURES ||
      circ->build_state->expiry_time <= time(NULL)) {

to decide whether to abort the relaunch.

But the incrementing of failure_count happens in the relaunch, i.e. after this code. Also, it says ">" rather than ">=".

Yet the definition of MAX_REND_FAILURES is

/** How many times will a hidden service operator attempt to connect to a
 * requested rendezvous point before giving up? */
#define MAX_REND_FAILURES 1

So when the first attempt fails, failure_count is 0, which is not > 1, so we try again. When the second attempt fails, failure_count is 1, which is also not > 1. It's only after the third attempt fails that we decide that MAX_REND_FAILURES has been reached.

This bug affects legacy onion services, and it will also affect nextgen onion services once #24894 (moved) is fixed.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking