From 582168e31eb6cc1d0488ae9d247a0ebb9e63faf6 Mon Sep 17 00:00:00 2001 From: XuWei Date: Thu, 10 May 2018 01:59:05 -0400 Subject: [PATCH] modify ipmi rsp check to support openbmc ipmi interface --- xCAT-server/lib/perl/xCAT/IPMI.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/IPMI.pm b/xCAT-server/lib/perl/xCAT/IPMI.pm index 4b444ac48..51367fce2 100644 --- a/xCAT-server/lib/perl/xCAT/IPMI.pm +++ b/xCAT-server/lib/perl/xCAT/IPMI.pm @@ -679,9 +679,14 @@ sub handle_ipmi_packet { if ($rsp[5] & 0b10000000) { $encrypted = 1; } + +#------------------------modified to support openbmc ipmi command---------------- unless ($rsp[5] & 0b01000000) { - return 3; #we refuse to examine unauthenticated packets in this context + if ($self->{max_privilege} != 0) { + return 3; #we refuse to examine unauthenticated packets in this context + } } + splice(@rsp, 0, 4); #ditch the rmcp header my @authcode = splice(@rsp, -12); #strip away authcode and remember it my @expectedcode = unpack("C*", hmac_sha1(pack("C*", @rsp), $self->{k1})); @@ -763,10 +768,13 @@ sub got_rmcp_response { return 9; } $byte = shift @data; - unless ($byte >= 4) { + + # add $byte == 0 to support openbmc ipmi command + unless ($byte >= 4 or $byte == 0) { $self->{onlogon}->("ERROR: Cannot acquire sufficient privilege", $self->{onlogon_args}); return 9; } + $self->{max_privilege} = $byte if ($byte == 0); splice @data, 0, 5; $self->{pendingsessionid} = [ splice @data, 0, 4 ];