mgmt: create Ethernet multicast faces according to whitelist/blacklist
Refs: #1712
Change-Id: Iaabaeaf58e460c86ca58f9099b5c2b904a5a5c93
diff --git a/daemon/mgmt/face-manager.cpp b/daemon/mgmt/face-manager.cpp
index c03f9d8..0ce16c5 100644
--- a/daemon/mgmt/face-manager.cpp
+++ b/daemon/mgmt/face-manager.cpp
@@ -24,8 +24,8 @@
*/
#include "face-manager.hpp"
-
#include "core/network-interface.hpp"
+#include "core/network-interface-predicate.hpp"
#include "face/generic-link-service.hpp"
#include "face/tcp-factory.hpp"
#include "face/udp-factory.hpp"
@@ -872,6 +872,7 @@
// }
#if defined(HAVE_LIBPCAP)
+ NetworkInterfacePredicate nicPredicate;
bool useMcast = true;
ethernet::Address mcastGroup(ethernet::getDefaultMulticastAddress());
@@ -887,6 +888,12 @@
}
NFD_LOG_TRACE("Ethernet multicast group set to " << mcastGroup);
}
+ else if (i.first == "whitelist") {
+ nicPredicate.parseWhitelist(i.second);
+ }
+ else if (i.first == "blacklist") {
+ nicPredicate.parseBlacklist(i.second);
+ }
else {
BOOST_THROW_EXCEPTION(ConfigFile::Error("Unrecognized option \"" +
i.first + "\" in \"ether\" section"));
@@ -910,7 +917,7 @@
if (useMcast) {
for (const auto& nic : nicList) {
- if (nic.isUp() && nic.isMulticastCapable()) {
+ if (nic.isUp() && nic.isMulticastCapable() && nicPredicate(nic)) {
try {
auto newFace = factory->createMulticastFace(nic, mcastGroup);
m_faceTable.add(newFace);