cjdelisle/cjdns — pull request #555 by Arceliar (2014-06-05 18:59:43+00:00)
Title: Possible fix to the bad-CA-state bug.

Title pretty much says it.

timeOfLastPacket was always being updated by decryptHandshake, even in cases where the handshake was ignored (because it was a peer with a higher key, trying to negotiate a new session, and these are ignored to prevent livelocks when packets cross in the wire).

Note that a stupid (i.e. old) or malicious node will still be able to cause the problem by refusing to reset the CA session. It may be a good idea to also slowly throttle back on the rate at which outgoing hello packets are sent. (That would eventually let old nodes timeout the session on their end, and waste less CPU/bandwidth on malicious ones.)