From 052655cd91e9173e43c4540737d52d031a7a9046 Mon Sep 17 00:00:00 2001 From: B BALAJI SINGH Date: Tue, 30 Aug 2016 03:05:46 -0400 Subject: [PATCH] ID:456 - Unable to disable the VLAN ID using ipmitool Currently, when a LAN parameter set command is sent through ipmitool, the corresponding parameter data is requested and compared to the command to verify that the data was written correctly. Since we do send the VLAN ID in this return data, regardless of whether VLAN is disabled or not, this mismatch between requested and received parameters causes ipmitool to retry the command 10 times and return an error. ipmitool is sending "0x00 0x00" reading back data from BMC as "0x01 0x00" which is NOT matching & hence pops up the error /warning "LAN Parameter Data does not match! Write may have failed." After 10 retries when we check "ipmitool lan print" VLAN ID is disabled successfully. --- lib/ipmi_lanp.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/ipmi_lanp.c b/lib/ipmi_lanp.c index 16a3a3e..65d881b 100644 --- a/lib/ipmi_lanp.c +++ b/lib/ipmi_lanp.c @@ -1204,12 +1204,27 @@ get_cmdline_ipaddr(char * arg, uint8_t * buf) static int ipmi_lan_set_vlan_id(struct ipmi_intf *intf, uint8_t chan, char *string) { + struct lan_param *p; uint8_t data[2]; int rc; if (string == NULL) { - data[0] = 0; - data[1] = 0; + lprintf(LOG_DEBUG, "Get current VLAN ID from BMC."); + p = get_lan_param(intf, chan, IPMI_LANP_VLAN_ID); + if (p != NULL && p->data != NULL && p->data_len > 1) { + int id = ((p->data[1] & 0x0f) << 8) + p->data[0]; + if (id < 1 || id > 4094) { + lprintf(LOG_ERR, + "Retrieved VLAN ID %i is out of range <1..4094>.", + id); + return (-1); + } + data[0] = p->data[0]; + data[1] = p->data[1] & 0x0F; + } else { + data[0] = 0; + data[1] = 0; + } } else { int id = 0;