summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0003-Fix-for-return-CC-in-setLan-command-cases.patch
blob: bab451f32edb7c4cecd7f8345e41f6f5ad462b50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
From 8b3cb6842746d43c0cab3d32821dc5239768642f Mon Sep 17 00:00:00 2001
From: "Joshi, Mansi" <mansi.joshi@linux.intel.com>
Date: Wed, 18 Dec 2019 15:10:25 +0530
Subject: [PATCH] Fix for return CC in setLan command cases

Issue: When DHCP is enabled, setting ip and setting subnet mask returns
completion code 0xff. Setting default gateway returns 0x00.

Fix: Returns CC 0xd5 because this parameter is R/W. It is only unable
to be updated because the current state blocks it (i.e. 0xd5).

Tested:
ipmitool raw 0x0c 0x01 0x03 0x03 0x00 0x00 0x00 0x00 //setting ip
0xd5 //Command, or request parameter, not supported in present state.

ipmitool raw 0x0c 0x01 0x03 0x06 0xff 0xff 0xf0 0x00 //subnet mask
0xd5 //Command, or request parameter, not supported in present state.

ipmitool raw 0x0c 0x01 0x03 0x0c 0x0a 0xfe 0xef 0x77 //default gateway
0xd5 //Command, or request parameter, not supported in present state.

%% original patch: 0065-Fix-for-return-CC-in-setLan-command-cases.patch
---
 transporthandler.cpp | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/transporthandler.cpp b/transporthandler.cpp
index 7407396..7b9ff3d 100644
--- a/transporthandler.cpp
+++ b/transporthandler.cpp
@@ -1423,6 +1423,11 @@ RspType<> setLan(uint4_t channelBits, uint4_t, uint8_t parameter,
         }
         case LanParam::IP:
         {
+            std::string dhcp = channelCall<getDHCPProperty>(channel);
+            if ((dhcp == dhcpv4) || (dhcp == dhcpv4v6))
+            {
+                return responseCommandNotAvailable();
+            }
             in_addr ip;
             std::array<uint8_t, sizeof(ip)> bytes;
             if (req.unpack(bytes) != 0 || !req.fullyUnpacked())
@@ -1477,6 +1482,11 @@ RspType<> setLan(uint4_t channelBits, uint4_t, uint8_t parameter,
         }
         case LanParam::SubnetMask:
         {
+            std::string dhcp = channelCall<getDHCPProperty>(channel);
+            if ((dhcp == dhcpv4) || (dhcp == dhcpv4v6))
+            {
+                return responseCommandNotAvailable();
+            }
             in_addr netmask;
             std::array<uint8_t, sizeof(netmask)> bytes;
             if (req.unpack(bytes) != 0 || !req.fullyUnpacked())
@@ -1490,6 +1500,11 @@ RspType<> setLan(uint4_t channelBits, uint4_t, uint8_t parameter,
         }
         case LanParam::Gateway1:
         {
+            std::string dhcp = channelCall<getDHCPProperty>(channel);
+            if ((dhcp == dhcpv4) || (dhcp == dhcpv4v6))
+            {
+                return responseCommandNotAvailable();
+            }
             in_addr gateway;
             std::array<uint8_t, sizeof(gateway)> bytes;
             if (req.unpack(bytes) != 0 || !req.fullyUnpacked())
-- 
2.7.4