-
Notifications
You must be signed in to change notification settings - Fork 672
Ability to use different ports in weave #531
Comments
It only tries the remote port of the connection if the connection is outbound. So that will not be an arbitrary port.
It's the rightest solution that is tangible. At the very least it will allow you to run disjoint weave networks by picking a different port for each. And for the the most part joining up those networks will work too, because connecting to the remote ends of outbound addresses is often sufficient. The exception are situations like "A and B are connected. C can connect to A but not B. B can connect to C. Now C connects to A.". B learns about the inbound connection through gossip from A and attempts to connect to C on the standard port, but this will succeed only if it's the same "standard" port. |
That's at least a simple solution. It obviously works just fine where every instance in the network is running on the same port. I was trying to 'do the right thing' here. I suspect the right thing is for whatever describes the IP address in the gossip exchange to also include the port (if it doesn't already) which would probably just work if it's a textual string as opposed to a packed quad in network order (for instance). For illustration in the problem cases below, I'll use Problem 1This is simpler than the case you mentioned. Let's suppose we have Connecting to Problem 2Along the lines you mentioned, but simpler.
|
That's exactly what happens. When weave gossips information about connections, the remote endpoint of the connection is an IP:port combo in text form.
That is the wrong question :) Peers do not make connections to other peers; they make connections to IP addresses and ports, where they (hope to) find other peers. The IP:port combinations a peer will attempt to connect to come from three sources:
Your concern about attempting to connect the wrong port will generally only manifest due to 3. However it can also arise anyway, because the same IP:port can represent completely different endpoints on different hosts.
That is (almost) exactly what happens. B learns from A that A has a connection to SomeIP:SomePort, where it found C. B will attempt to connect to that SomeIP:SomePort; it doesn't care what peer it finds there. |
OK great. Would you prefer I fixed Advantage of fixing it: you can change the port with Disadvantage of fixing it: currently omitting the port number means port 6783. If an IP address without a port were ever sent on the wire, the meaning of that would be different for sender and receiver if they had different |
Yes. Because we want a weave network where all peers are configured to use port 2345 to behave the same as one where all peers use the standard port. There are scenarios where (3) does provide extra connectivity that isn't accomplished with 1+2 alone. It won't help you in connecting peers that have been configured with different standard ports, but will help in connecting peers that have the same non-standard port.
That would be a violation of the weave protocol. |
Thanks. I've created PR #534 though it fails to pass Travis CI as it changes the API, hence this issue appears: #534 (comment) |
resolved by #534. |
In order to run weave 'dockerless' (and possibly for other uses) it's useful to specify different ports for weave to run on. This allows you to run two instances of weave without container separation between them.
To do this I also had to fiddle around to allow the http interface to be disabled or bind to (e.g.) localhost only, which is useful in itself.
A lightly tested patch is here.
abligh@3ad0bb3
I wrote to rade as follows:
rade replied:
I'm not entirely sure what to do about that. The code does this:
This tries the remote port number of the connection (which if the connection is inbound will be arbitrary I presume), and the standard port, as
NormalisePeerAddr
adds the default port (6783) if no port is specified. MakingNormalisePeerAddr
look atrouter.ListenPort
is not the right solution, as that would be the port this router is listening on, not the port the peer is listening on.The right solution here would be to ensure
conn.RemoteTCPAddr()
returns the port the remote peer is listening on. If the remote peer instantiated the connection, or if it's not connected at all yet, presumably that needs passing in the weave protocol?The text was updated successfully, but these errors were encountered: