Correct the MAC address format in Redfish

The MAC address format in Redfish requires 2 character per octet.
ether_ntoa() converts the MAC address to string but omits the
leading zeros which results in one character per octet.
Changed the conversion to display two characters for each octet.

Tested:
sit0 interface:
  "MACAddress": "00:00:00:00:00:00",

eth0 interface:
  "MACAddress": "00:bd:4f:29:0f:d2",

Change-Id: I7660616d4026c4237964be048fea10d7b0d3d18d
Signed-off-by: Karthick Sundarrajan <karthick.sundarrajan@intel.com>
diff --git a/test/test_util.cpp b/test/test_util.cpp
index 4bc9d5b..89723f5 100644
--- a/test/test_util.cpp
+++ b/test/test_util.cpp
@@ -324,6 +324,10 @@
 {
     EXPECT_EQ("11:22:33:44:55:66",
               toString({0x11, 0x22, 0x33, 0x44, 0x55, 0x66}));
+    EXPECT_EQ("01:02:03:04:05:67",
+              toString({0x01, 0x02, 0x03, 0x04, 0x05, 0x67}));
+    EXPECT_EQ("00:00:00:00:00:00",
+              toString({0x00, 0x00, 0x00, 0x00, 0x00, 0x00}));
 }
 
 TEST(MacIsEmpty, True)
diff --git a/util.cpp b/util.cpp
index afbc229..13a607f 100644
--- a/util.cpp
+++ b/util.cpp
@@ -612,7 +612,12 @@
 
 std::string toString(const ether_addr& mac)
 {
-    return ether_ntoa(&mac);
+    char buf[18] = {0};
+    snprintf(buf, 18, "%02x:%02x:%02x:%02x:%02x:%02x", mac.ether_addr_octet[0],
+             mac.ether_addr_octet[1], mac.ether_addr_octet[2],
+             mac.ether_addr_octet[3], mac.ether_addr_octet[4],
+             mac.ether_addr_octet[5]);
+    return buf;
 }
 
 bool isEmpty(const ether_addr& mac)