Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#3577 closed defect (fixed)

Unable to query fingerprint when there's no connection

Reported by: atagar Owned by:
Priority: Medium Milestone: Tor: 0.2.2.x-final
Component: Core Tor/Tor Version:
Severity: Keywords: tor-relay
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

When I'm offline, start a relay, and run the GETINFO option for my fingerprint it fails (this also fails when online for a small window when first starting up):

>>> from TorCtl import TorCtl
>>> conn = TorCtl.connect(controlPort=9052)
>>> conn.get_info("fingerprint")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "TorCtl/TorCtl.py", line 1165, in get_info
    lines = self.sendAndRecv("GETINFO %s\r\n"%name)
  File "TorCtl/TorCtl.py", line 942, in sendAndRecv
    raise ErrorReply("%s %s"%(tp, msg), status = code, message = msg)
TorCtl.TorCtl.ErrorReply: 551 No routerdesc known; am I really a server?

However from the log I do have a fingerprint:

 13:41:42 [WARN] eventdns: All nameservers have failed
 13:41:25 [NOTICE] New control connection opened.
 13:38:52 [NOTICE] I learned some more directory information, but not enough to build a circuit: 
We have no recent network-status consensus.
 13:38:50 [NOTICE] Your Tor server's identity key fingerprint is 
'fenrir 30BEFE1F8E07FAD830EA885C2E067F174AB48BD3'
 13:38:50 [NOTICE] OpenSSL OpenSSL 0.9.8g 19 Oct 2007 [90807f] looks like it's older than 0.9.8l, 
but some vendors have backported 0.9.8l's renegotiation code to earlier versions, and some have backported the 
code from 0.9.8m or 0.9.8n. I'll set both SSL3_FLAGS and SSL_OP just to be safe.
 13:38:50 [WARN] Couldn't set up any working nameservers. Network not up yet? Will try again soon.
 13:38:50 [WARN] Unable to parse '/etc/resolv.conf', or no nameservers in '/etc/resolv.conf' (6)
 13:38:50 [NOTICE] Parsing GEOIP file /usr/local/share/tor/geoip.
 13:38:50 [NOTICE] Based on 239 circuit times, it looks like we don't need to wait so long for 
circuits to finish. We will now assume a circuit is too slow to use after waiting 4 seconds.
 13:38:50 [NOTICE] Tor 0.2.2.23-alpha (git-b85eb949b528f4d7) opening log file.

Looks like this is from...

  • getinfo_helper_misc (control.c, lines 1460-1464)
      const routerinfo_t *me = router_get_my_routerinfo();
      if (!me) {
        *errmsg = "No routerdesc known; am I really a server?";
        return -1;
      }
    
  • router_get_my_routerinfo (router.c, lines 1353-1356)
      if (!server_mode(get_options()))
        return NULL;
      if (router_rebuild_descriptor(0))
        return NULL;
    
  • router_rebuild_descriptor (router.c, lines 1432-1439)
      if (router_pick_published_address(options, &addr) < 0 ||
          router_get_advertised_or_port(options) == 0) {
        /* Stop trying to rebuild our descriptor every second. We'll
         * learn that it's time to try again when ip_address_changed()
         * marks it dirty. */
        desc_clean_since = time(NULL);
        return -1;
      }
    

Hopefully this result isn't intentional since it would mean falling back to log parsing. :)

Cheers! -Damian

Child Tickets

Change History (6)

comment:1 Changed 9 years ago by nickm

Milestone: Tor: 0.2.2.x-final

comment:2 Changed 9 years ago by nickm

Status: newneeds_review

Fix in branch bug3577 in my public repository; needs review.

comment:3 Changed 9 years ago by atagar

Yup, tested the bug3577 and it works beautifully - thanks Nick!

test case:

  • disconnect
  • started a tor instance with a control port
  • issue a getinfo query for the fingerprint
  • then tried it again with the branch

comment:4 Changed 9 years ago by nickm

Resolution: fixed
Status: needs_reviewclosed

Thanks; merged it!

comment:5 Changed 7 years ago by nickm

Keywords: tor-relay added

comment:6 Changed 7 years ago by nickm

Component: Tor RelayTor
Note: See TracTickets for help on using tickets.