core: ignore non-Ethernet AF_LINK addresses when enumerating NICs.
Also modernize the code with some C++11 features.
Change-Id: Ibd29b39c37fdce8f87f917ab0cf48750e631e76c
diff --git a/tests/core/network-interface.cpp b/tests/core/network-interface.cpp
index 2fb9c0b..5ac5a31 100644
--- a/tests/core/network-interface.cpp
+++ b/tests/core/network-interface.cpp
@@ -25,8 +25,6 @@
#include "core/network-interface.hpp"
#include "tests/test-common.hpp"
-#include <boost/foreach.hpp>
-
namespace nfd {
namespace tests {
@@ -34,20 +32,19 @@
BOOST_AUTO_TEST_CASE(ListNetworkInterfaces)
{
- std::list< shared_ptr<NetworkInterfaceInfo> > netifs;
+ std::vector<NetworkInterfaceInfo> netifs;
BOOST_CHECK_NO_THROW(netifs = listNetworkInterfaces());
- BOOST_FOREACH(shared_ptr<NetworkInterfaceInfo> netif, netifs)
- {
- BOOST_TEST_MESSAGE(netif->index << ": " << netif->name);
- BOOST_TEST_MESSAGE("\tether " << netif->etherAddress);
- BOOST_FOREACH(boost::asio::ip::address_v4 address, netif->ipv4Addresses)
+ for (const auto& netif : netifs) {
+ BOOST_TEST_MESSAGE(netif.index << ": " << netif.name);
+ BOOST_TEST_MESSAGE("\tether " << netif.etherAddress);
+ for (const auto& address : netif.ipv4Addresses)
BOOST_TEST_MESSAGE("\tinet " << address);
- BOOST_FOREACH(boost::asio::ip::address_v6 address, netif->ipv6Addresses)
+ for (const auto& address : netif.ipv6Addresses)
BOOST_TEST_MESSAGE("\tinet6 " << address);
- BOOST_TEST_MESSAGE("\tloopback : " << netif->isLoopback());
- BOOST_TEST_MESSAGE("\tmulticast : " << netif->isMulticastCapable());
- BOOST_TEST_MESSAGE("\tup : " << netif->isUp());
+ BOOST_TEST_MESSAGE("\tloopback : " << netif.isLoopback());
+ BOOST_TEST_MESSAGE("\tmulticast : " << netif.isMulticastCapable());
+ BOOST_TEST_MESSAGE("\tup : " << netif.isUp());
}
}