Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#11049 closed defect (fixed)

Spec for net/listeners/* doesn't cover socket files

Reported by: atagar Owned by:
Priority: Low Milestone: Tor: 0.2.5.x-final
Component: Core Tor/Tor Version:
Severity: Keywords: tor-spec controller lorax
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Hi Nick. I'm expanding stem to take advantage of the 'GETINFO net/listener/*' options. Presently the spec simply says...

    "net/listeners/or"
    "net/listeners/dir"
    "net/listeners/socks"
    "net/listeners/trans"
    "net/listeners/natd"
    "net/listeners/dns"
    "net/listeners/control"
    A space-separated list of the addresses at which Tor is listening for
    connections of each specified type.  [New in Tor 0.2.2.26-beta.]

Output is usually a quoted, space separated listing of 'address:port', such as...

% telnet localhost 9051
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
AUTHENTICATE
250 OK
GETINFO net/listeners/control
250-net/listeners/control="127.0.0.1:9051"
250 OK

This led me to believe that the output would always be IPv4 address and port tuples. However, turned out that for control sockets it's different...

% socat UNIX-CONNECT:/tmp/tor/socket STDIN
AUTHENTICATE
250 OK
GETINFO net/listeners/control
250-net/listeners/control="unix:/tmp/tor/socket"
250 OK

It would be nice if the spec better detailed what callers can expect to receive. Another question I have is if tor will always use '127.0.0.1' for localhost - I thought I recalled seeing '0.0.0.0' at one point but I might be misremembering.

Cheers! -Damian

Child Tickets

Change History (5)

comment:1 Changed 6 years ago by atagar

On reflection it would also be nice if the spec described how the quoting works. I'm not clear from the spec if each entry is quoted or if quotes encompass the whole line - that is to say...

"127.0.0.1:9050 127.0.0.1:9051"

... or...

"127.0.0.1:9050" "127.0.0.1:9051"

The 'GETINFO exit-policy/default' seemed like another good option to look at since it's a list of entries as well, but its output doesn't include any quotes.

comment:2 Changed 6 years ago by nickm

Keywords: tor-spec controller lorax added
Milestone: Tor: 0.2.5.x-final

Based on a little testing, it seems like the format for multiple ports, including unix sockets, is:

GETINFO net/listeners/control
250-net/listeners/control="127.0.0.1:9999" "unix:/home/nickm/foobar/baz"
250 OK

I think we should document the existing format rather than change it. I'll happily take a patch to do that.

comment:3 Changed 6 years ago by atagar

Status: newneeds_review

Thanks! Pushed a potential patch to my 11049 branch...

https://gitweb.torproject.org/user/atagar/torspec.git/commitdiff/38de503d8f1a6d8956362c6414d19f798134b865

If this GETINFO option permits IPv6 addresses then please include an output of that as well. As I understand it that would be something like...

"[2001:0db8:0000:0000:0000:ff00:0042:8329]:9050"

comment:4 Changed 6 years ago by nickm

Resolution: fixed
Status: needs_reviewclosed

thanks; merged!

I've added IPv6 addresses; I am 80% certain that the code outputs them, and 100% certain that we should document that the code is allowed to output them. :)

comment:5 Changed 6 years ago by atagar

I've added IPv6 addresses; I am 80% certain that the code outputs them, and 100% certain that we should document that the code is allowed to output them. :)

Gotcha. My only concern was about the format that it outputs them with (ie, if it has the '[]' around the address as it should). :)

Note: See TracTickets for help on using tickets.