types: Add constexpr ether_addr parser

Change-Id: I0ad21490239ad9b0f25dfff84726b16a9cfda927
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp
index b1ada82..9795a7e 100644
--- a/src/ethernet_interface.cpp
+++ b/src/ethernet_interface.cpp
@@ -324,7 +324,7 @@
         elog<InvalidArgument>(Argument::ARGUMENT_NAME("ipAddress"),
                               Argument::ARGUMENT_VALUE(ipAddress.c_str()));
     }
-    if (!mac_address::isUnicast(mac_address::fromString(macAddress)))
+    if (!mac_address::isUnicast(ToAddr<ether_addr>{}(macAddress)))
     {
         log<level::ERR>("Not a valid MAC address",
                         entry("MACADDRESS=%s", ipAddress.c_str()));
@@ -737,7 +737,7 @@
     std::optional<ether_addr> mac;
     if (!macStr.empty())
     {
-        mac.emplace(mac_address::fromString(macStr));
+        mac.emplace(ToAddr<ether_addr>{}(macStr));
     }
     auto info = system::InterfaceInfo{
         .idx = 0, // TODO: Query the correct value after creation
@@ -927,7 +927,7 @@
     ether_addr newMAC;
     try
     {
-        newMAC = mac_address::fromString(value);
+        newMAC = ToAddr<ether_addr>{}(value);
     }
     catch (const std::invalid_argument&)
     {
@@ -948,7 +948,7 @@
     auto validMAC = std::to_string(newMAC);
 
     // We don't need to update the system if the address is unchanged
-    ether_addr oldMAC = mac_address::fromString(MacAddressIntf::macAddress());
+    ether_addr oldMAC = ToAddr<ether_addr>{}(MacAddressIntf::macAddress());
     if (newMAC != oldMAC)
     {
         // Update everything that depends on the MAC value