2
0
mirror of https://opendev.org/x/pyghmi synced 2025-08-20 01:50:19 +00:00

Fix coping with incoming packet in incomplete state

If a session is partially ready to go, but not fully, drop packets.
This can occur if just the right packets drop such that the remote
end gets going but the local end does not receive them.

Change-Id: I63ac506484a1792db673f6e90e13cc4b0132719c
This commit is contained in:
Jarrod Johnson
2014-05-12 10:10:13 -04:00
parent f69716506c
commit 61c3bfd867

View File

@@ -1059,6 +1059,8 @@ class Session(object):
if data[5] & 0b10000000:
encrypted = 1
authcode = rawdata[-12:]
if self.k1 is None: # we are in no shape to process a packet now
return
expectedauthcode = hmac.new(
self.k1, rawdata[4:-12], hashlib.sha1).digest()[:12]
if authcode != expectedauthcode: