diff --git a/pyghmi/ipmi/bmc.py b/pyghmi/ipmi/bmc.py index dd3d68a3..284d3cbf 100644 --- a/pyghmi/ipmi/bmc.py +++ b/pyghmi/ipmi/bmc.py @@ -18,6 +18,7 @@ import pyghmi.ipmi.command as ipmicommand import pyghmi.ipmi.console as console import pyghmi.ipmi.private.serversession as serversession import pyghmi.ipmi.private.session as ipmisession +import struct import traceback __author__ = 'jjohnson2@lenovo.com' @@ -65,8 +66,9 @@ class Bmc(serversession.IpmiServer): session.send_ipmi_response(code=0x80) else: self.activated = True + solport = list(struct.unpack('BB', struct.pack('!H', self.port))) session.send_ipmi_response( - data=[0, 0, 0, 0, 1, 0, 1, 0, 2, 0x6f, 0xff, 0xff]) + data=[0, 0, 0, 0, 1, 0, 1, 0] + solport + [0xff, 0xff]) self.sol = console.ServerConsole(session, self.iohandler) def deactivate_payload(self, request, session): diff --git a/pyghmi/ipmi/console.py b/pyghmi/ipmi/console.py index db0544a5..368ac52e 100644 --- a/pyghmi/ipmi/console.py +++ b/pyghmi/ipmi/console.py @@ -56,6 +56,7 @@ class Console(object): self.awaitingack = False self.activated = False self.force_session = force + self.port = port self.ipmi_session = session.Session(bmc=bmc, userid=userid, password=password, @@ -126,7 +127,10 @@ class Console(object): # BMC tells us this is the maximum allowed size # data[6:7] is the promise of how small packets are going to be, but we # don't have any reason to worry about it - if (data[8] + (data[9] << 8)) not in (623, 28418): + # some BMCs disagree on the endianness, so do both + valid_ports = (self.port, struct.unpack( + 'H', self.port))[0]) + if (data[8] + (data[9] << 8)) not in valid_ports: # TODO(jbjohnso): support atypical SOL port number raise NotImplementedError("Non-standard SOL Port Number") # ignore data[10:11] for now, the vlan detail, shouldn't matter to this