Fix for Subnet Mask update
User unable to update Subnet Mask and getting error as Unspecified
error. The existing condition is only evaluating the IP Address and
not evaluating the Subnet Mask. This is preventing user to update
subnet mask. Update the condition to consider the case of setting
subnet mask as well.
Tested:
verified by executing set Lan configuration IPMI command
Before fix:
Command : ipmitool raw 0x0C 0x01 0x03 0x06 0xFF 0xFF 0xFE 0x00
Response: Unable to send RAW command (channel=0x0 netfn=0xc lun=0x0
cmd=0x1 rsp=0xff): Unspecified error
After fix:
Command : ipmitool raw 0x0C 0x01 0x03 0x06 0xFF 0xFF 0xFE 0x00
Response: //Success
Command : ipmitool lan print 3
Response:
Set in Progress : Set Complete
Auth Type Support :
Auth Type Enable : Callback :
: User :
: Operator :
: Admin :
: OEM :
IP Address Source : Static Address
IP Address : 10.xxx.xx.xx
Subnet Mask : 255.255.254.0
MAC Address : 00:xx:xx:xx:xx:xx
Default Gateway IP : 10.xxx.xxx.1
Default Gateway MAC : 00:00:00:00:00:00
802.1q VLAN ID : Disabled
RMCP+ Cipher Suites : 17
Cipher Suite Priv Max : aaaaaaaaaaaaaaa
: X=Cipher Suite Unused
: c=CALLBACK
: u=USER
: o=OPERATOR
: a=ADMIN
: O=OEM
Bad Password Threshold : Not Available
Signed-off-by: athuljox <athulx.joseph@intel.com>
Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
Change-Id: I6fbb9d0377ba03d7dc8296c7b4e29d73bdc99981
diff --git a/transporthandler.cpp b/transporthandler.cpp
index a533e8c..da4231a 100644
--- a/transporthandler.cpp
+++ b/transporthandler.cpp
@@ -390,7 +390,9 @@
}
if (struct in_addr nullIPv4{0};
- (address == std::nullopt || address.value().s_addr != nullIPv4.s_addr))
+ (address == std::nullopt && prefix != std::nullopt) ||
+ (address != std::nullopt &&
+ (address.value().s_addr != nullIPv4.s_addr)))
{
createIfAddr<AF_INET>(bus, params, address.value_or(ifaddr->address),
prefix.value_or(fallbackPrefix));