From ffd9c553fff2e08d227e4444f2d3b9c83c3d8a22 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 14 Mar 2018 18:55:10 -0400 Subject: [PATCH] Ignore small packets claiming to be IPMI payload A particular BMC had it's wires crossed and sent a stray SOL packet with the wrong payload type. We can't do anything to correctly process said packet without making a pretty wild assumption about it, so drop it with prejudice. Change-Id: I96e68a49f55d955cc57c3e52ce70b5932e29680e --- pyghmi/ipmi/private/session.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pyghmi/ipmi/private/session.py b/pyghmi/ipmi/private/session.py index 10df65d1..3a51a29b 100644 --- a/pyghmi/ipmi/private/session.py +++ b/pyghmi/ipmi/private/session.py @@ -1570,6 +1570,15 @@ class Session(object): # For now, skip the checksums since we are in LAN only, # TODO(jbjohnso): if implementing other channels, add checksum checks # here + if len(payload) < 7: + # This cannot possibly be a valid IPMI packet. Note this is after + # the integrity checks, so this must be a buggy BMC packet + # One example was a BMC that if receiving an SOL deactivate + # from another party would emit what looks to be an attempt + # at SOL deactivation payload, but with the wrong payload type + # since we can't do anything remotely sane with such a packet, + # drop it and carry about our business. + return if self.servermode: self.seqlun = payload[4] self.clientaddr = payload[3]