transporthandler: Synchronous get IP address and IP address source

In case both DHCP and static IP addresses are assigned, the IPMI
code just returns one of them. The IPMI code always returns the
first object dbus on the interface by the fixed index, which is
always 0. That may cause a mismatch between the IP address and
IP address source.

This patch will check if the DHCP or static mode is enabling,
then return the IP address accordingly.

Tested:
1. Change to static source
ipmitool lan set 1 ipsrc static

2. Set a static IP address.
ipmitool lan set 1 ipaddr xx.xx.xx.xx

3. Back to DHCP source
ipmitool lan set 1 ipsrc dhcp

4. Check the IP Lan print.
Expect the IP address and IP source address report accordingly.

ipmitool lan print 1

Fixes openbmc/phosphor-host-ipmid#207

Change-Id: If1d2bcfb9e3ab79e02ebf78682e3ac5638c18b0c
Signed-off-by: Chanh Nguyen <chanh@os.amperecomputing.com>
diff --git a/transportconstants.hpp b/transportconstants.hpp
index b9ce46b..3f865c6 100644
--- a/transportconstants.hpp
+++ b/transportconstants.hpp
@@ -123,6 +123,9 @@
 constexpr uint16_t VLAN_VALUE_MASK = 0x0fff;
 constexpr uint16_t VLAN_ENABLE_FLAG = 0x8000;
 
+// Arbitrary v4 Address Limits
+constexpr uint8_t MAX_IPV4_ADDRESSES = 2;
+
 // Arbitrary v6 Address Limits to prevent too much output in ipmitool
 constexpr uint8_t MAX_IPV6_STATIC_ADDRESSES = 15;
 constexpr uint8_t MAX_IPV6_DYNAMIC_ADDRESSES = 15;