diff --git a/site/how-it-works.md b/site/how-it-works.md index c5202e51..0d7af1fe 100644 --- a/site/how-it-works.md +++ b/site/how-it-works.md @@ -12,9 +12,9 @@ different each time it is run. These are opaque identifiers as far as the router is concerned, although the name defaults to a MAC address. Weave routers establish TCP connections to each other, over which they -perform a protocol handshake and subsequently exchange topology -information (see below). These connections are encrypted if so -configured. Peers also establish UDP "connections", possibly +perform a protocol handshake and subsequently exchange +[topology](#topology) information. These connections are encrypted if +so configured. Peers also establish UDP "connections", possibly encrypted, which carry encapsulated network packets. These "connections" are duplex and can traverse firewalls. @@ -35,19 +35,11 @@ packet to peers. Weave routers learn which peer host a particular MAC address resides on. They combine this knowledge with topology information in order to make routing decisions and thus avoid forwarding every packet to every -peer. The topology information captures which peers are connected to -which other peers; weave can route packets in partially connected -networks with changing topology. - -For example, in this network, peer 1 is connected directly to 2 and 3, -but if 1 needs to send a packet to 4 or 5 it must first send it to -peer 3: -![diagram showing five peers in a weave network][diagram1] -Weave peers [communicate their own topology](#topology) with neighbours, who then -pass on changes to their neighbours, and so on, until the entire -network knows about any change. - -[diagram1]: images/top-diag1.png "Diagram 1" +peer. Weave can route packets in partially connected networks with +changing topology. For example, in this network, peer 1 is connected +directly to 2 and 3, but if 1 needs to send a packet to 4 or 5 it must +first send it to peer 3: +![Partially connected Weave Network](images/top-diag1.png "Partially connected Weave Network") ### Encapsulation @@ -105,24 +97,31 @@ the MAC. This way weave peers never need to exchange the MAC addresses of clients and need not take any special action for ARP traffic and MAC discovery. -### Topology Communication +### Topology -Topology is communicated over the TCP links between peers. There are +The topology information captures which peers are connected to which +other peers. Weave peers communicate their knowledge of the topology +(and changes to it) to their neighbours, who then pass this +information on to their own neighbours, and so on, until the entire +network knows about any change. + +Topology is communicated over the TCP links between peers. There are two message types: ##### FetchAll This carries no payload. The receiver responds with the entire topology model as the receiver has it. FetchAll is sent: - * when an update is received that references a peer that the receiver does not know + * when an update is received that references a peer that the receiver + does not know * periodically, on a timer, in case any updates have been missed ##### Update This carries a topology payload. This is sent: * upon receipt of a FetchAll message, as above, - * when a connection is established - the update contains the two peers -that have just connected + * when a connection is established - the update contains the two +peers that have just connected * when a connection is deleted - the update contains just the peer that lost the connection @@ -191,7 +190,6 @@ If a peer, after receiving a topology update, sees that another peer no longer has any connections within the network, it drops all knowledge of that second peer. - #### Out-of-date topology The peer-to-peer passing of updates is not instantaneous, so it is very possible for a node elsewhere in the network to have an