First: How did it pick that number? It's a weird choice for a port.
Second: If this is actually your ipv6 address, you can leave out the nolisten, and that's where things get interesting. Your logs will say something like
Nov 24 01:53:42 v4 tor[10988]: Nov 24 01:53:42.001 [notice] Opening OR listener on [2a01:238:43e4:2b00:ae5a:a980:1f63:cc5e]:0Nov 24 01:53:42 v4 tor[10988]: Nov 24 01:53:42.002 [notice] Opened OR listener on [2a01:238:43e4:2b00:ae5a:a980:1f63:cc5e]:41535
but then your descriptor will still say :94.
This is happening right now to relay "Testbit": they have set :auto for their ipv6 address in their ORPort, they get the above line about how it's opened on port 41535, and yet their descriptor says it's on port 94.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items ...
Show closed items
Linked items 0
Link issues together to show that they're related.
Learn more.
But another issue is that "auto" and "nolisten" don't make a lot of sense together. "Auto" is "pick a port for me"; "nolisten" is "don't actually listen on this address, I'll set it up in a firewall rule or something".
But another issue is that "auto" and "nolisten" don't make a lot of sense together. "Auto" is "pick a port for me"; "nolisten" is "don't actually listen on this address, I'll set it up in a firewall rule or something".
No, the NoListen is just here so you can reproduce the bug. The bug exists when you say :auto on your IPv6 ORPort -- the log tells you what port it picked, and it listens on that port, and then it puts the wrong number in your descriptor.
But searches for a port like this: (if the discovered port is 0)
router_get_advertised_or_port_by_af(… , AF_INET6).
I still can't work out how the port ends up being 94. Maybe we're overwriting some memory somewhere?
I think we should try to find the memory issue, before we call this bug "fixed".
Trac: Keywords: N/Adeleted, security-low, memory-safety added Status: assigned to needs_information
It's also worth noting that we're getting 0x5e = 94 in the output, and not 0xcc5e or 0x5ecc. So it's just a one byte overflow. And it's happening some time after the port is opened, but before the relay descriptor is built.
And it only seems to affect auto IPv6 ORPorts.
Does the issue still happen if the IPv6 address is much shorter than the maximum length?
For example, does "ORPort [::1]:auto" give you a port of 1?
You might need to set some custom directory authorities to be allowed to listen on an internal address.
First: How did it pick that number? It's a weird choice for a port.
Second: If this is actually your ipv6 address, you can leave out the nolisten, and that's where things get interesting. Your logs will say something like
Nov 24 01:53:42 v4 tor[10988]: Nov 24 01:53:42.001 [notice] Opening OR listener on [2a01:238:43e4:2b00:ae5a:a980:1f63:cc5e]:0Nov 24 01:53:42 v4 tor[10988]: Nov 24 01:53:42.002 [notice] Opened OR listener on [2a01:238:43e4:2b00:ae5a:a980:1f63:cc5e]:41535
but then your descriptor will still say :94.
This is happening right now to relay "Testbit": they have set :auto for their ipv6 address in their ORPort, they get the above line about how it's opened on port 41535, and yet their descriptor says it's on port 94.
First: How did it pick that number? It's a weird choice for a port.
Second: If this is actually your ipv6 address, you can leave out the nolisten, and that's where things get interesting. Your logs will say something like
Nov 24 01:53:42 v4 tor[10988]: Nov 24 01:53:42.001 [notice] Opening OR listener on [2a01:238:43e4:2b00:ae5a:a980:1f63:cc5e]:0Nov 24 01:53:42 v4 tor[10988]: Nov 24 01:53:42.002 [notice] Opened OR listener on [2a01:238:43e4:2b00:ae5a:a980:1f63:cc5e]:41535
but then your descriptor will still say :94.
This is happening right now to relay "Testbit": they have set :auto for their ipv6 address in their ORPort, they get the above line about how it's opened on port 41535, and yet their descriptor says it's on port 94.
Anybody should be able to reproduce the bug with the initial instructions -- set two orports and a dirport, and then you can look at your descriptor on your local dirport.
When I set my ORPort to [::2]:auto it still publishes
FWIW, this isn't an "uninitialized RAM" bug: The reason it says 94 is that the "ipv6_port" field in the cfg_port_t is set to CFG_AUTO_PORT, which is 0xc4005e in hex. Once that's cast to a uint16_t, we get 0x5e, which is 94.
I wrote some tests on top of your branch, in a branch called `bug32588_035_tests. I made a PR at https://github.com/torproject/tor/pull/1811 . There will be merge conflicts later on here, but they look to be straightforward. Please let me know if you want help with those: I'm going under the assumption you might want to edit this branch some more.
I don't know whether this is everything you wanted to test or not.
FWIW, this isn't an "uninitialized RAM" bug: The reason it says 94 is that the "ipv6_port" field in the cfg_port_t is set to CFG_AUTO_PORT, which is 0xc4005e in hex. Once that's cast to a uint16_t, we get 0x5e, which is 94.
That makes sense! I misread the hex constant as 0x405e, so I couldn't work out how the cast was doing that, without some memory misalignment.