Fix representation IPv6 DNS servers
The `getNameServerFromResolvd` function ignores the family type of
address received from `systemd-resolvd`. It leads to an incorrect
representation of IPv6 addresses.
This commit fixes that.
Resolves openbmc/phosphor-networkd#34
Testing:
Add an IPv6 DNS server:
```
busctl set-property xyz.openbmc_project.Network \
/xyz/openbmc_project/network/eth0 \
xyz.openbmc_project.Network.EthernetInterface \
StaticNameServers as 1 2001:db8:1::1
```
After the setting will be applied the `Nameservers` property must
contain valid representation:
```
busctl get-property xyz.openbmc_project.Network \
/xyz/openbmc_project/network/eth0 \
xyz.openbmc_project.Network.EthernetInterface \
Nameservers
as 1 "2001:db8:1::1"
```
Change-Id: Id69a0ffcceedd5be28e26ea9b9aca7f37e6a9345
Signed-off-by: Alexander Filippov <a.filippov@yadro.com>
diff --git a/test/test_util.cpp b/test/test_util.cpp
index e3a1fba..7742ca7 100644
--- a/test/test_util.cpp
+++ b/test/test_util.cpp
@@ -57,10 +57,12 @@
{
struct in_addr ip1;
EXPECT_EQ(1, inet_pton(AF_INET, "192.168.10.1", &ip1));
+ EXPECT_EQ("192.168.10.1", toString(ip1));
EXPECT_EQ("192.168.10.1", toString(InAddrAny(ip1)));
struct in6_addr ip2;
EXPECT_EQ(1, inet_pton(AF_INET6, "fdd8:b5ad:9d93:94ee::2:1", &ip2));
+ EXPECT_EQ("fdd8:b5ad:9d93:94ee::2:1", toString(ip2));
EXPECT_EQ("fdd8:b5ad:9d93:94ee::2:1", toString(InAddrAny(ip2)));
}