From 6126547e532a0f92d175ca09d97df696b517a970 Mon Sep 17 00:00:00 2001 From: Davide Pesavento Date: Tue, 8 Aug 2017 15:48:10 -0400 Subject: [PATCH] face: EthernetFactory: skip non-Ethernet interfaces Change-Id: Ifa42755b032cf23ea688e055477820d27e7dc8df Refs: #4021 --- daemon/face/ethernet-factory.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/daemon/face/ethernet-factory.cpp b/daemon/face/ethernet-factory.cpp index ce8e4557..b00fa5fd 100644 --- a/daemon/face/ethernet-factory.cpp +++ b/daemon/face/ethernet-factory.cpp @@ -264,13 +264,18 @@ EthernetFactory::applyUnicastConfigToNetif(const shared_ptrgetType() != ndn::net::InterfaceType::ETHERNET) { + NFD_LOG_DEBUG("Not creating channel on " << netif->getName() << ": incompatible netif type"); + return nullptr; + } + if (!netif->isUp()) { NFD_LOG_DEBUG("Not creating channel on " << netif->getName() << ": netif is down"); return nullptr; } - if (netif->isLoopback()) { - NFD_LOG_DEBUG("Not creating channel on " << netif->getName() << ": netif is loopback"); + if (netif->getEthernetAddress().isNull()) { + NFD_LOG_DEBUG("Not creating channel on " << netif->getName() << ": invalid Ethernet address"); return nullptr; } @@ -293,6 +298,11 @@ EthernetFactory::applyMcastConfigToNetif(const ndn::net::NetworkInterface& netif return nullptr; } + if (netif.getType() != ndn::net::InterfaceType::ETHERNET) { + NFD_LOG_DEBUG("Not creating multicast face on " << netif.getName() << ": incompatible netif type"); + return nullptr; + } + if (!netif.isUp()) { NFD_LOG_DEBUG("Not creating multicast face on " << netif.getName() << ": netif is down"); return nullptr; @@ -303,6 +313,11 @@ EthernetFactory::applyMcastConfigToNetif(const ndn::net::NetworkInterface& netif return nullptr; } + if (netif.getEthernetAddress().isNull()) { + NFD_LOG_DEBUG("Not creating multicast face on " << netif.getName() << ": invalid Ethernet address"); + return nullptr; + } + if (!m_mcastConfig.netifPredicate(netif)) { NFD_LOG_DEBUG("Not creating multicast face on " << netif.getName() << ": rejected by whitelist/blacklist"); return nullptr;