Commit Graph
367 Commits
Author SHA1 Message Date
David Wragg f522f5b730 Ensure we send a gossip update whenever a new connection requires it
Previously, if LocalConnection run() failed before calling
AddConnection, it would not gossip anything. This was benign, because
the peer information we learn in the handshake is just a placeholder
until the full information arrived via gossip, and if a connection is
not formed, there is nothing else to gossip about.

With short ids, there's a corner case where this is no longer true: If
a new peer connects to us, and it has the same short id as we do, then
we might change our short id.  If we do, then it is important that we
gossip that out, even if the attempt to establish the connection fails
further along.
2015-06-12 16:22:13 +01:00
David Wragg bd185abb29 Introduce PeerShortIDs
These are needed to support vxlan encapsulation.  In a vxlan packet,
the only place we can straightforwardly hold the source and
destination peers identifiers used by the weave router is in the
24-bit VNI (vxlan network identifier) field.  This gives us 12 bits to
indicate a peer. The resulting limit of 4096 peers on a weave network
does not seem like a problem in the near future.  But it does mean
that decentralized allocation makes collisions fairly likely even in
weave networks of sizes that are common today.  Fortunately, the
problem is much more tractable than IPAM because we can detect when
collisions occur and take action to resolve them.

TODO: We already notify the InterHost when a short id -> peer mapping
changes, but we also need to flush any entries in the router MAC cache
that might be affected.
2015-06-12 16:22:13 +01:00
David Wragg 203dfbb3e9 Always include local peer in Peers 2015-06-12 16:22:13 +01:00
David Wragg c09f0f7037 Fold ApplyUpdate and applyUpdate together
In order to do "defer peers.Unlock()". ApplyUpdate now does slightly
more work with the lock held, but the difference is modest.
2015-06-12 16:21:16 +01:00
David Wragg a334059e85 Add NewPeerFromSummary
To reduce the number of places that are explicit about which values
go into a new Peer.
2015-06-12 16:12:59 +01:00
David Wragg a9c710211b Notify the InterHost when routes change 2015-06-12 16:12:59 +01:00
David Wragg 0f888e9735 Flows 2015-06-12 16:12:59 +01:00
David Wragg 17c8a16757 Move ICMP frag-needed handling into sleeveForwarder 2015-06-12 16:12:59 +01:00
David Wragg 4e41f649fb Introduce InterHost / sleeve 2015-06-12 16:12:59 +01:00
David Wragg f8ed319428 Don't inspect the DF flag earlier than we need to 2015-06-12 16:12:58 +01:00
David Wragg ef0153cb0f Introduce IntraHost 2015-06-12 16:12:54 +01:00
David Wragg b77abf480b Move DF indication into LogFrame 2015-06-12 16:11:32 +01:00
David Wragg 2fa5cda2c7 Make the full EthernetDecoder available to LogFrame
So that LogFrame can include information about the decoded frame beyond
the ethernet layer.
2015-06-12 16:11:32 +01:00
David Wragg 225e6871e3 Add a comment to Router's Start method 2015-06-12 16:11:32 +01:00
David Wragg 5d2d857dbe Eliminate the GossipSender Start method 2015-06-12 16:11:32 +01:00
David Wragg d7c4bc04d3 Eliminate ConnectionMaker Start method 2015-06-12 16:11:32 +01:00
David Wragg 32b2bcf01b Eliminate the Routes Start method 2015-06-12 16:11:32 +01:00
David Wragg b1308823d2 Eliminate the LocalPeer Start method 2015-06-12 16:11:32 +01:00
David Wragg 0627ade9de Eliminate MacCache Start method 2015-06-12 16:11:32 +01:00
David Wragg 4d0ca39f97 Eliminate the Start method on LocalConnection 2015-06-12 16:11:32 +01:00
David Wragg 8a54af92ef Remove forwarder Start methods 2015-06-12 16:11:32 +01:00
Matthias Radestock f36af211c0 cosmetic 2015-05-22 15:41:29 +01:00
David Wragg dfa93436c2 Fix use of "break" within "select" in LocalConnection actorLoop
From the golang spec: 'A "break" statement terminates execution of the
innermost "for", "switch", or "select" statement within the same
function.'  But the LocalConnection actorLoop seems to assume it
skips the "select" and terminates the enclosing "for".

As a result, if something did conn.Shutdown(nil), it would not actually
shutdown the connection. It turns out this is never a problem, because
Shutdown is always called with a non-nil error, even though there is code
in a few places to handle the nil case. By cleaning that up, the dubious
"break" is eliminated.
2015-05-22 11:26:30 +01:00
Matthias Radestock dc96fc17a9 correct protocol version
let us not get ahead of ourselves
2015-05-16 01:09:53 +01:00
Bryan Boreham 3cd1a17c23 IP Allocation Management
Using the Ring CRDT and Weave gossip, provides an interface
for the weave script to allocate IP addresses in `weave run`,
`weave start` and `weave expose`.

See docs/ipam.md for implementation details, and site/features.md
for user-visible changes.
2015-05-14 17:44:06 +01:00
Matthias Radestock c158b86dc6 refactor: shorten a method name 2015-05-14 15:13:10 +01:00
Matthias Radestock c7dd48d769 introduce PeerUID type 2015-05-14 12:35:01 +01:00
Matthias Radestock ace56da7b3 allow Gossiper.Gossip to return nil
...to indicate 'no data'
2015-05-14 12:02:56 +01:00
Matthias Radestock 953449c215 refactor: extract Peer.ForEachConnectedPeer helper 2015-05-11 21:06:07 +01:00
Matthias Radestock c5c93d3a77 refactor: increase similarity betweeen parts of route calculation 2015-05-11 20:14:24 +01:00
Matthias Radestock 039446f756 cosmetic: remove outdated comment 2015-05-11 20:00:04 +01:00
Matthias Radestock 43133b5851 increase tolerance for missed udp heartbeats
3 are quite easy to miss when there is contention. 6 less so.
2015-05-11 18:35:06 +01:00
Matthias Radestock e246e6acc6 coarser lock granularity
- get rid of individual Peer locks
- hold Peers read (or write) lock and LocalPeer read lock while
  performing route calculations

This eliminates the deadlock resulting from the inconsistent lock
acquisition order in route calculcation.

Fixes #643.
2015-05-11 17:19:54 +01:00
Matthias Radestock 5bd8730353 make Peer.Encode lock-free 2015-05-11 17:19:51 +01:00
Matthias Radestock c210f0e3c1 make Peer.Info lock-free 2015-05-11 17:19:46 +01:00
Matthias Radestock 426d8edb31 remove Peer.SetVersionAndConnections
further shrinking Peer API
2015-05-11 17:19:43 +01:00
Matthias Radestock 86ba3be4f7 move Connections from Peer to LocalPeer
further shrinking the former's API
2015-05-11 17:19:38 +01:00
Matthias Radestock 5bf6889250 remove Peer.Version
further shrinking the Peer API
2015-05-11 17:19:35 +01:00
Matthias Radestock 0229185ffe move ConnectionTo from Peer to LocalPeer
further shrinking the former's API
2015-05-11 17:19:31 +01:00
Matthias Radestock 505ced5cc8 move localRefCount accounting responsibility from Peer to Peers
This makes for a more symmetric API - Peers.FetchWithDefault does the
increment and Peers.Dereference does the decrement, whereas previously
the latter was done by Peer.DecrementLocalRefCount.

This does increase lock granularity, i.e. modifying any ref count now
requires a write lock on Peers.
2015-05-11 17:19:23 +01:00
Matthias Radestock 3e6eef5ebd refactor(ish): move a bunch of methods from Peer to LocalPeer
in order to reduce the former's API surface
2015-05-11 17:19:15 +01:00
Matthias Radestock 4bef9d90fb cosmetic: resolve some linter complaints 2015-05-11 02:33:56 +01:00
Matthias Radestock ef2c55141b keep linter happy 2015-05-11 02:25:01 +01:00
Matthias Radestock 0cbbe9bac3 make Peer.String() return the common case
When we want a string representation of a Peer, we nearly always just
want the full name. So make String() return that and introduce Info()
to return expanded info.
2015-05-10 23:58:23 +01:00
Matthias Radestock 7b0f432339 cosmetic: fix typo 2015-05-09 17:11:52 +01:00
Matthias Radestock 8caa58af26 Merge branch 'weave-common-signals' of https://github.com/inercia/weave into inercia-weave-common-signals 2015-05-06 19:33:06 +01:00
Alvaro Saurin f723d5afd8 Move the router to the new signals handler 2015-05-06 15:07:36 +02:00
Matthias Radestock e656d74633 cosmetic 2015-05-05 22:08:03 +01:00
Matthias Radestock 22e612a738 Merge branch 'reduced_gob' of https://github.com/awh/weave into awh-reduced_gob 2015-05-05 21:36:09 +01:00
Adam Harrison ab68a1c325 Introduce PeerSummary 2015-05-05 10:59:09 +01:00