Opened 5 years ago

Closed 12 months ago

#17543 closed defect (duplicate)

Bring some clarity to behavior of net_is_disabled() vs DisableNetwork vs we_are_hibernating()

Reported by: nickm Owned by:
Priority: Medium Milestone: Tor: unspecified
Component: Core Tor/Tor Version:
Severity: Normal Keywords: tor-client sponsor8-maybe technical-debt refactor
Cc: Actual Points:
Parent ID: #32195 Points: medium
Reviewer: Sponsor:


We have at least three ways to say "no network for us, please": net_is_disabled() vs options->DisableNetwork vs we_are_hibernating().

Currently, net_is_disabled() is true if either of the other is true. DisableNetwork can be set like any other option. And we_are_hibernating() is true if we are currently in any hibernation state other than "live and alert" -- for example, if we are entering hibernation in a little while, or if we are shutting down cleanly.

They have the following behavior:

net_is_disabled() --

  • makes us not continue pending pt configuration. ##
  • stops reachability tests ##
  • stops retrying listeners
  • stops constructing predicted circuits.
  • stops uploading info about HS descriptors
  • stops launching/checking port-forwarding app
  • stops warning about unreachable orport/dirport
  • stops us from warning if we mark ourself as down.
  • means that our dirport is unreachable.
  • means that our dirport shouldn't be advertised.

DisableNetwork --

  • close all noncontroller stuff and note that circuits won't work, immediately, during options_act_reversible (?)
  • Used to decide whether to launch ClientTransportPlugins and ServerTransportPlugins. ##
  • Affects discriptor.
  • Categorically prevents any outgoing socket.
  • Categorically prevents any outgoing DNS resolve.
  • Categorically prevents DNS testing and probing.
  • Prevents any descriptor upload.
  • Prevents fetching bridge descriptors.
  • Stops checking for need for new descriptor.
  • Stops launching upness checks
  • stops testing reachability
  • Stops updating ns downloads at all
  • Causes dir fetches to get delayed
  • Causes descriptor downloads not to get updated.

we_are_hibernating() --

  • makes all create cells get destroyed.
  • causes all BEGIN cells to get closed.
  • makes us recommendation-ignore bootstrap problems. ##
  • makes us decide that we are down, to dirserv_set_router_is_running. ##
  • makes us expire unused OR connections.
  • makes us suppress reachability tests.
  • makes us advertise no capacity, and say that we're hibernating.


  • we_are_hibernating() and DisableNetwork are used together in options_act_reversible to decide how and why to call retry_all_listeners()

These may all be correct, but we should try to make it so their function is more obvious, and there's a more clear division of what we do when.

Motivation: For #2149 we want to add yet another way for Tor to 'turn itself off'.

Child Tickets

Change History (13)

comment:1 Changed 5 years ago by nickm

Keywords: TorCoreTeam201511 added

comment:2 Changed 5 years ago by nickm

Keywords: TorCoreTeam201512 201511-deferred added; TorCoreTeam201511 removed

Bulk-move uncompleted items to december. :/

comment:3 Changed 5 years ago by nickm

Keywords: TorCoreTeam201512 removed

I'd look at a patch for these if we got one, but AFAIK nobody's looking at them right now, and there's no reason to expect them to get done this month.

comment:4 Changed 5 years ago by nickm

Milestone: Tor: 0.2.8.x-finalTor: 0.2.9.x-final

Throw most 0.2.8 "NEW" tickets into 0.2.9. I expect that many of them will subsequently get triaged out.

comment:5 Changed 5 years ago by nickm

Points: medium

comment:6 Changed 5 years ago by isabela

Milestone: Tor: 0.2.9.x-finalTor: 0.2.???

comment:7 Changed 4 years ago by teor

Milestone: Tor: 0.2.???Tor: 0.3.???

Milestone renamed

comment:8 Changed 4 years ago by nickm

Keywords: tor-03-unspecified-201612 added
Milestone: Tor: 0.3.???Tor: unspecified

Finally admitting that 0.3.??? was a euphemism for Tor: unspecified all along.

comment:9 Changed 3 years ago by nickm

Keywords: tor-03-unspecified-201612 removed

Remove an old triaging keyword.

comment:10 Changed 3 years ago by nickm

Keywords: 201511-deferred removed

comment:11 Changed 3 years ago by nickm

Keywords: tor-client sponsor8-maybe technical-debt refactor added

comment:12 Changed 2 years ago by nickm

Parent ID: #2149

comment:13 Changed 12 months ago by teor

Parent ID: #32195
Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.