Commit Graph
56 Commits
Author SHA1 Message Date
Matthias Radestock 7cfb79cfc1 close connection when failing to decrypt packets
Since we may never recover from that if nonces got out of sync.

Closes #274.
2014-12-28 19:52:56 +00:00
Matthias Radestock f792bf7ef8 don't log packet on decryption error
since that is expensive and clutters the logs
2014-12-28 19:09:41 +00:00
Matthias Radestock 73bbb95f7f refactor: move LocalPeer code into separate file 2014-12-25 14:05:41 +00:00
Matthias Radestock f304543ddf refactor: move definition of Peer and related types 2014-12-25 14:02:53 +00:00
Matthias Radestock 7a026f5a14 cosmetic: move a method 2014-12-25 13:57:49 +00:00
Matthias Radestock 5e6bb8ee67 cosmetic: more logical field order 2014-12-25 13:57:31 +00:00
Matthias Radestock 75ed7d52b9 refactor: give Peers knowledge of Ourself.Peer and MacCache
so their use (when applying updates and performing gc) is opaque
2014-12-25 13:49:58 +00:00
Matthias Radestock af59b38134 refactor: Peers no longer has dependency on Router
or ConnectionMaker
2014-12-25 13:33:45 +00:00
Matthias Radestock 6f990d217d refactor: fewer references to Router 2014-12-25 13:12:42 +00:00
Matthias Radestock 3ba5a5024e refactor: Peer no longer needs Router
Hooray!
2014-12-25 13:05:22 +00:00
Matthias Radestock 465915d7d4 refactor: split out LocalPeer
This has been a source of confusion for a long time.
2014-12-25 12:57:45 +00:00
Matthias Radestock 059360416a gofmt 2014-12-25 11:27:42 +00:00
Matthias Radestock da8e9fd0eb refactor: further reduce dependency on router 2014-12-24 20:43:35 +00:00
Matthias Radestock 2d4baa8dba refactor: reduce dependency on peer.Router
now the only code depending on it is Peer itself
2014-12-24 20:12:48 +00:00
Matthias Radestock 945a5cf7fe refactor: reduce dependencies of ConnectionMaker
it doesn't need to know about Router, just Ourself and Peers
2014-12-24 19:53:11 +00:00
Matthias Radestock 71cd83bf20 refactor: move ConnectionMaker and related types 2014-12-24 19:46:12 +00:00
Matthias Radestock 03b338a252 remove cruft 2014-12-24 19:42:49 +00:00
Matthias Radestock b3be24248e refactor: narrow dependencies of Routes
it doesn't need to know about the Router, just Ourself and Peers.
2014-12-24 19:40:18 +00:00
Matthias Radestock 2b2f47c031 refactor: rename PeerCache to Peers
It was never much of a cache, and that aspect of it is certainly not
its defining characteristic.
2014-12-24 19:23:43 +00:00
Matthias Radestock e8f836ad85 refactor: rename 'Topology' to 'Routes'
Since that is what it is. By contrast, when the docs talk about
topology they actually refer to the peer connectivity graph.
2014-12-24 19:12:01 +00:00
Matthias Radestock fc1ec6ada2 refactor: go straight to PeerCache for fetching topology
There is no need to go via Topology. Fetching does not access or
modify the Topology state, and none of the functions on Topology
update the PeerCache. So there is no point serialising the fetching
with RebuildRoutes (or anything else).

This does mean the connections' receiveTCP goroutines will take a
direct lock on PeerCache, but a) it is only a read lock, and b) they
already take a write lock in another code path.

There may be some extra load on the PeerCache as a result of this
change, due to the topology fetching of multiple connections no longer
being funneled through the single Topology goroutine. Consequently,
write locks on the PeerCache may take a little longer to
acquire. Until we encounter this as a genuine problem though it's
better to stick with the simpler code.
2014-12-24 18:34:59 +00:00
Matthias Radestock aa5fc62184 remove cruft 2014-12-24 16:06:31 +00:00
Matthias Radestock 1c5d720db4 simplify some more 2014-12-24 13:38:17 +00:00
Matthias Radestock fecbf220cc simplify 2014-12-24 13:35:51 +00:00
Matthias Radestock 9cd652ef0b refactor: introduce small helper 2014-12-24 13:29:13 +00:00
Matthias Radestock 108e468ada Merge branch 'master' into eliminate_heartbeater
Conflicts:
	router/connection.go
2014-12-24 10:48:39 +00:00
Matthias Radestock 5ccc753367 kill stale connections
The weave protocol already effectively performs heartbeating -
FetchAll is performed at regular intervals. Hence we can detect stale
connections by the lack of receiving any data for approximately that
interval (we use x2).

We use the same interval to set a time limit on the handshake too, and
any subsequent interactions prior to the connection being fully
established.

Fixes #272.
2014-12-24 10:33:37 +00:00
Matthias Radestock 3c50909a49 nodelay is the default, according to the docs 2014-12-24 09:09:00 +00:00
Matthias Radestock e850127ed4 git rid of heartbeater goroutine
...by moving the logic into the connection actor goroutine.

The heartbeater goroutine was doing a lot more than just heartbeating;
namely it also had tickers for triggering a ProtocolFetchAll and
initiating a fragmentation test. Furhermore, ensureHeartbeats also
spawned the forwarders.

So this was quite a mix of functionality, and, furthermore, most of it
related quite closely to the connection actor. So moving the
functionality into that simplifies the code.

In the process we also fix #294.
2014-12-23 22:01:03 +00:00
Matthias Radestock 3b3d5e6261 document mac_cache max age constraint 2014-12-18 18:21:31 +00:00
Matthias Radestock 1b140e3aa9 don't enter src MACs of forwarded packets in our cache
There is no point, and it populates the cache with entries we don't
need. Local containers will still need to issue an ARP request when
they first talk to an IP corresponding to the MAC, so we learn about
the MAC at that point, just as normally happens.
2014-12-18 17:39:01 +00:00
Matthias Radestock 801b2f6761 refactor for consistency 2014-12-13 10:19:17 +00:00
Matthias Radestock 9ecef5e458 refactor 2014-12-12 14:39:14 +00:00
rade 8dfdeb3eff Merge pull request #271 from bboreham/258_rebuild_routes
Move call to Topology.RebuildRoutes

Closes #258
2014-12-12 14:34:52 +00:00
Bryan Boreham 4c88eb48c0 Move call to Topology.RebuildRoutes
It doesn't belong in handleBroadcastTCP(), so moved it up
to the two places that cause that function to be called.
2014-12-11 00:50:45 +00:00
Bryan Boreham 3a684ba3a9 Fixed typo in error message 2014-12-05 17:44:41 +00:00
Bryan Boreham 4eeeabcf56 Cosmetic changes applied by 2014-12-01 16:51:16 +00:00
Matthias Radestock 9e2123fa4e Merge branch 'master' into refactor_and_explain_route_calculation 2014-12-01 13:50:34 +00:00
Matthias Radestock 89317a24ee oops 2014-12-01 12:56:02 +00:00
Matthias Radestock 37eb2a4598 fix typo 2014-12-01 11:04:51 +00:00
Matthias Radestock c4a64c8649 refactor and explain route calculation
This was rather impenetrable and had some significant code
duplication. So add some words of explanation, and refactor to remove
the duplication.
Some fly-by fixing of minor bug too: buildUnicastRoutes failed to
exclude asymmetric connections from the first hop.
2014-11-30 16:04:55 +00:00
Matthias Radestock 89a1e0fb24 eliminate a deadlock
Golang locks aren't re-entrant. As result one can get deadlocks on
RWMutexes like this:

goroutine #1: attempt to acquire read lock -> success
goroutine #2: attempt to acquire write lock -> wait
goroutine #1: attempt to acquire read lock again -> wait

(a pending write lock prevents subsequent acquisitions of read locks)

Peer.HasPathTo could run into this since it could attempt to acquire
the read lock on a peer multiple times if previously it had
encountered that peer via an asymmetric connection.
2014-11-30 15:48:46 +00:00
Bryan Boreham 997e6ed2b9 squash two ifs together 2014-11-14 14:28:45 +00:00
Bryan Boreham 57aecb868f Add check during initial handshake whether we already have an established connection to this peer 2014-11-14 14:02:33 +00:00
Matthias Radestock f9f29bbe42 refactor: reduce indent 2014-11-12 19:24:06 +00:00
Matthias Radestock 58efafd44e add explanation for why we don't use async send 2014-11-12 08:26:44 +00:00
Matthias Radestock acbabc4f9e s/StatusPort/HttpPort
since we are adding functionality other than status
2014-10-27 08:22:22 +00:00
Matthias Radestock 83464a38eb remove explicit multicast detection
We don't need. Multicast addresses never appear as sources and hence
never end up in the peer_cache. And the router always broadcasts
frames with destination addresses that aren't in the peer cache.
2014-10-24 14:30:58 +01:00
Bryan Boreham 9b90e119e5 Say 'name' instead of 'identity' in log and status 2014-10-24 11:38:10 +01:00
Matthias Radestock 4ddfc47448 don't trip over truncated udp packets
and log such events, plus any other errors during decoding, nicely,
including the connection on which this occured.

Closes #123.
2014-10-15 21:03:15 +01:00