summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--transporthandler.cpp46
1 files changed, 31 insertions, 15 deletions
diff --git a/transporthandler.cpp b/transporthandler.cpp
index 8172cc4..7d678a8 100644
--- a/transporthandler.cpp
+++ b/transporthandler.cpp
@@ -382,6 +382,35 @@ struct set_lan_t
uint8_t data[8]; // Per IPMI spec, not expecting more than this size
} __attribute__((packed));
+ipmi_ret_t checkAndUpdateNetwork(int channel)
+{
+ auto channelConf = getChannelConfig(channel);
+ using namespace std::chrono_literals;
+ // time to wait before applying the network changes.
+ constexpr auto networkTimeout = 10000000us; // 10 sec
+
+ // Skip the timer. Expecting more update as we are in SET_IN_PROGRESS
+ if (channelConf->lan_set_in_progress == SET_IN_PROGRESS)
+ {
+ return IPMI_CC_OK;
+ }
+
+ // Start the timer, if it is direct single param update without
+ // SET_IN_PROGRESS or many params updated through SET_IN_PROGRESS to
+ // SET_COMPLETE Note: Even for update with SET_IN_PROGRESS, don't apply the
+ // changes immediately, as ipmitool sends each param individually
+ // through SET_IN_PROGRESS to SET_COMPLETE.
+ channelConf->flush = true;
+ if (!networkTimer)
+ {
+ log<level::ERR>("Network timer is not instantiated");
+ return IPMI_CC_UNSPECIFIED_ERROR;
+ }
+ // start the timer.
+ networkTimer->start(networkTimeout);
+ return IPMI_CC_OK;
+}
+
ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
ipmi_request_t request,
ipmi_response_t response,
@@ -391,11 +420,6 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
ipmi_ret_t rc = IPMI_CC_OK;
*data_len = 0;
- using namespace std::chrono_literals;
-
- // time to wait before applying the network changes.
- constexpr auto networkTimeout = 10000000us; // 10 sec
-
char ipaddr[INET_ADDRSTRLEN];
char netmask[INET_ADDRSTRLEN];
char gateway[INET_ADDRSTRLEN];
@@ -494,20 +518,10 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
entry("ADDRESS=%s", channelConf->ipaddr.c_str()),
entry("GATEWAY=%s", channelConf->gateway.c_str()),
entry("VLAN=%d", channelConf->vlanID));
-
- if (!networkTimer)
- {
- log<level::ERR>("Network timer is not instantiated");
- return IPMI_CC_UNSPECIFIED_ERROR;
- }
-
- // start/restart the timer
- networkTimer->start(networkTimeout);
}
else if (reqptr->data[0] == SET_IN_PROGRESS) // Set In Progress
{
channelConf->lan_set_in_progress = SET_IN_PROGRESS;
- channelConf->flush = true;
}
}
break;
@@ -515,8 +529,10 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
default:
{
rc = IPMI_CC_PARM_NOT_SUPPORTED;
+ return rc;
}
}
+ rc = checkAndUpdateNetwork(channel);
return rc;
}
OpenPOWER on IntegriCloud