Enhance DHCP beyond just OFF and IPv4/IPv6 enabled.

DHCP is not a binary option.  The network interface can have DHCP
disabled, IPv4 only, IPv6 only, and IPv4/IPv6.

Tested:
Using dbus-send or busctl:
Disabled DHCP, and confirmed only link local addresses were present.

Assigned only static addresses.  Both with/and without the gateway set
to 0.0.0.0

Deleted static IPv4 addresses.
Reassigned static addresses.

Enabled DHCP for ipv4 only, and witnessed a DHCP server assign a valid
address.

Assigned static IPv4 address.
Assigned static IPv6 address.
Confirmed both IPv4 and IPv6 static addresses are active.

Enabled DHCP for ipv6 only, and confirmed the static v4 address
remains. The ipv6 address is removed, waiting for a DHCP6 server.

Enabled DHCP for both ipv4 and ipv6. IPv4 address was assigned. IPv6
address is assumed to succeed, as systemd config file enables IPv6
DHCP.

Change-Id: I2e0ff80ac3a5e88bcff28adac419bf21e37be162
Signed-off-by: Johnathan Mantey <johnathanx.mantey@intel.com>
diff --git a/util.cpp b/util.cpp
index 63b8f7e..f8a1e34 100644
--- a/util.cpp
+++ b/util.cpp
@@ -412,9 +412,11 @@
     return "eth" + std::to_string(idx) + "addr";
 }
 
-bool getDHCPValue(const std::string& confDir, const std::string& intf)
+EthernetInterfaceIntf::DHCPConf getDHCPValue(const std::string& confDir,
+                                             const std::string& intf)
 {
-    bool dhcp = false;
+    EthernetInterfaceIntf::DHCPConf dhcp =
+        EthernetInterfaceIntf::DHCPConf::none;
     // Get the interface mode value from systemd conf
     // using namespace std::string_literals;
     fs::path confPath = confDir;
@@ -436,7 +438,15 @@
     // There will be only single value for DHCP key.
     if (values[0] == "true")
     {
-        dhcp = true;
+        dhcp = EthernetInterfaceIntf::DHCPConf::both;
+    }
+    else if (values[0] == "ipv4")
+    {
+        dhcp = EthernetInterfaceIntf::DHCPConf::v4;
+    }
+    else if (values[0] == "ipv6")
+    {
+        dhcp = EthernetInterfaceIntf::DHCPConf::v6;
     }
     return dhcp;
 }