face: remove prohibited endpoint set

Prior to this commit, TcpFactory and UdpFactory each had a "prohibited
endpoint set" which prevents creating a face that connects to NFD
itself. This feature is no longer necessary after Nack-Duplicate has
been introduced, and is now removed.

refs #4189

Change-Id: I3b80ddc76ca1afb83b6f62061ccdbb69200e1841
diff --git a/tests/daemon/face/tcp-factory.t.cpp b/tests/daemon/face/tcp-factory.t.cpp
index 8dd12ec..e00e984 100644
--- a/tests/daemon/face/tcp-factory.t.cpp
+++ b/tests/daemon/face/tcp-factory.t.cpp
@@ -215,14 +215,6 @@
               "Outgoing TCP faces do not support on-demand persistency"});
 
   createFace(factory,
-             FaceUri("tcp4://127.0.0.1:20071"),
-             {},
-             ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
-             false,
-             {CreateFaceExpectedResult::FAILURE, 406,
-              "Requested endpoint is prohibited"});
-
-  createFace(factory,
              FaceUri("tcp4://198.51.100.100:6363"),
              {},
              ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
@@ -269,87 +261,6 @@
   BOOST_CHECK(face == nullptr);
 }
 
-class FakeNetworkInterfaceFixture : public TcpFactoryFixture
-{
-public:
-  FakeNetworkInterfaceFixture()
-  {
-    using namespace boost::asio::ip;
-
-    auto fakeInterfaces = make_shared<std::vector<NetworkInterfaceInfo>>();
-
-    fakeInterfaces->push_back(
-      NetworkInterfaceInfo {0, "eth0",
-        ethernet::Address::fromString("3e:15:c2:8b:65:00"),
-        {address_v4::from_string("0.0.0.0")},
-        {address_v6::from_string("::")},
-        address_v4(),
-        IFF_UP});
-    fakeInterfaces->push_back(
-      NetworkInterfaceInfo {1, "eth0",
-        ethernet::Address::fromString("3e:15:c2:8b:65:00"),
-        {address_v4::from_string("192.168.2.1"), address_v4::from_string("192.168.2.2")},
-        {},
-        address_v4::from_string("192.168.2.255"),
-        0});
-    fakeInterfaces->push_back(
-      NetworkInterfaceInfo {2, "eth1",
-        ethernet::Address::fromString("3e:15:c2:8b:65:00"),
-        {address_v4::from_string("198.51.100.1")},
-        {address_v6::from_string("2001:db8::2"), address_v6::from_string("2001:db8::3")},
-        address_v4::from_string("198.51.100.255"),
-        IFF_MULTICAST | IFF_BROADCAST | IFF_UP});
-
-    setDebugNetworkInterfaces(fakeInterfaces);
-  }
-
-  ~FakeNetworkInterfaceFixture()
-  {
-    setDebugNetworkInterfaces(nullptr);
-  }
-};
-
-BOOST_FIXTURE_TEST_CASE(Bug2292, FakeNetworkInterfaceFixture)
-{
-  using namespace boost::asio::ip;
-
-  factory.prohibitEndpoint(tcp::Endpoint(address_v4::from_string("192.168.2.1"), 1024));
-  BOOST_REQUIRE_EQUAL(factory.m_prohibitedEndpoints.size(), 1);
-  BOOST_CHECK((factory.m_prohibitedEndpoints ==
-               std::set<tcp::Endpoint> {
-                 tcp::Endpoint(address_v4::from_string("192.168.2.1"), 1024),
-               }));
-
-  factory.m_prohibitedEndpoints.clear();
-  factory.prohibitEndpoint(tcp::Endpoint(address_v6::from_string("2001:db8::1"), 2048));
-  BOOST_REQUIRE_EQUAL(factory.m_prohibitedEndpoints.size(), 1);
-  BOOST_CHECK((factory.m_prohibitedEndpoints ==
-               std::set<tcp::Endpoint> {
-                 tcp::Endpoint(address_v6::from_string("2001:db8::1"), 2048)
-               }));
-
-  factory.m_prohibitedEndpoints.clear();
-  factory.prohibitEndpoint(tcp::Endpoint(address_v4(), 1024));
-  BOOST_REQUIRE_EQUAL(factory.m_prohibitedEndpoints.size(), 4);
-  BOOST_CHECK((factory.m_prohibitedEndpoints ==
-               std::set<tcp::Endpoint> {
-                 tcp::Endpoint(address_v4::from_string("192.168.2.1"), 1024),
-                 tcp::Endpoint(address_v4::from_string("192.168.2.2"), 1024),
-                 tcp::Endpoint(address_v4::from_string("198.51.100.1"), 1024),
-                 tcp::Endpoint(address_v4::from_string("0.0.0.0"), 1024)
-               }));
-
-  factory.m_prohibitedEndpoints.clear();
-  factory.prohibitEndpoint(tcp::Endpoint(address_v6(), 2048));
-  BOOST_REQUIRE_EQUAL(factory.m_prohibitedEndpoints.size(), 3);
-  BOOST_CHECK((factory.m_prohibitedEndpoints ==
-               std::set<tcp::Endpoint> {
-                 tcp::Endpoint(address_v6::from_string("2001:db8::2"), 2048),
-                 tcp::Endpoint(address_v6::from_string("2001:db8::3"), 2048),
-                 tcp::Endpoint(address_v6::from_string("::"), 2048)
-               }));
-}
-
 BOOST_AUTO_TEST_SUITE_END() // TestTcpFactory
 BOOST_AUTO_TEST_SUITE_END() // Face
 
diff --git a/tests/daemon/face/udp-factory.t.cpp b/tests/daemon/face/udp-factory.t.cpp
index 0ad5612..7f12af3 100644
--- a/tests/daemon/face/udp-factory.t.cpp
+++ b/tests/daemon/face/udp-factory.t.cpp
@@ -652,14 +652,6 @@
               "Cannot create multicast UDP faces"});
 
   createFace(factory,
-             FaceUri("udp4://127.0.0.1:20071"),
-             {},
-             ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
-             false,
-             {CreateFaceExpectedResult::FAILURE, 406,
-              "Requested endpoint is prohibited"});
-
-  createFace(factory,
              FaceUri("udp4://127.0.0.1:20072"),
              {},
              ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
@@ -668,89 +660,6 @@
               "Local fields can only be enabled on faces with local scope"});
 }
 
-class FakeNetworkInterfaceFixture : public UdpFactoryFixture
-{
-public:
-  FakeNetworkInterfaceFixture()
-  {
-    using namespace boost::asio::ip;
-
-    auto fakeInterfaces = make_shared<std::vector<NetworkInterfaceInfo>>();
-
-    fakeInterfaces->push_back(
-      NetworkInterfaceInfo {0, "eth0",
-        ethernet::Address::fromString("3e:15:c2:8b:65:00"),
-        {address_v4::from_string("0.0.0.0")},
-        {address_v6::from_string("::")},
-        address_v4(),
-        IFF_UP});
-    fakeInterfaces->push_back(
-      NetworkInterfaceInfo {1, "eth0",
-        ethernet::Address::fromString("3e:15:c2:8b:65:00"),
-        {address_v4::from_string("192.168.2.1"), address_v4::from_string("192.168.2.2")},
-        {},
-        address_v4::from_string("192.168.2.255"),
-        0});
-    fakeInterfaces->push_back(
-      NetworkInterfaceInfo {2, "eth1",
-        ethernet::Address::fromString("3e:15:c2:8b:65:00"),
-        {address_v4::from_string("198.51.100.1")},
-        {address_v6::from_string("2001:db8::2"), address_v6::from_string("2001:db8::3")},
-        address_v4::from_string("198.51.100.255"),
-        IFF_MULTICAST | IFF_BROADCAST | IFF_UP});
-
-    setDebugNetworkInterfaces(fakeInterfaces);
-  }
-
-  ~FakeNetworkInterfaceFixture()
-  {
-    setDebugNetworkInterfaces(nullptr);
-  }
-};
-
-BOOST_FIXTURE_TEST_CASE(Bug2292, FakeNetworkInterfaceFixture)
-{
-  using namespace boost::asio::ip;
-
-  factory.prohibitEndpoint(udp::Endpoint(address_v4::from_string("192.168.2.1"), 1024));
-  BOOST_REQUIRE_EQUAL(factory.m_prohibitedEndpoints.size(), 1);
-  BOOST_CHECK((factory.m_prohibitedEndpoints ==
-               std::set<udp::Endpoint> {
-                 udp::Endpoint(address_v4::from_string("192.168.2.1"), 1024),
-               }));
-
-  factory.m_prohibitedEndpoints.clear();
-  factory.prohibitEndpoint(udp::Endpoint(address_v6::from_string("2001:db8::1"), 2048));
-  BOOST_REQUIRE_EQUAL(factory.m_prohibitedEndpoints.size(), 1);
-  BOOST_CHECK((factory.m_prohibitedEndpoints ==
-               std::set<udp::Endpoint> {
-                 udp::Endpoint(address_v6::from_string("2001:db8::1"), 2048),
-               }));
-
-  factory.m_prohibitedEndpoints.clear();
-  factory.prohibitEndpoint(udp::Endpoint(address_v4(), 1024));
-  BOOST_REQUIRE_EQUAL(factory.m_prohibitedEndpoints.size(), 6);
-  BOOST_CHECK((factory.m_prohibitedEndpoints ==
-               std::set<udp::Endpoint> {
-                 udp::Endpoint(address_v4::from_string("192.168.2.1"), 1024),
-                 udp::Endpoint(address_v4::from_string("192.168.2.2"), 1024),
-                 udp::Endpoint(address_v4::from_string("198.51.100.1"), 1024),
-                 udp::Endpoint(address_v4::from_string("198.51.100.255"), 1024),
-                 udp::Endpoint(address_v4::from_string("255.255.255.255"), 1024),
-                 udp::Endpoint(address_v4::from_string("0.0.0.0"), 1024)
-               }));
-
-  factory.m_prohibitedEndpoints.clear();
-  factory.prohibitEndpoint(udp::Endpoint(address_v6(), 2048));
-  BOOST_REQUIRE_EQUAL(factory.m_prohibitedEndpoints.size(), 3);
-  BOOST_CHECK((factory.m_prohibitedEndpoints ==
-               std::set<udp::Endpoint> {
-                 udp::Endpoint(address_v6::from_string("2001:db8::2"), 2048),
-                 udp::Endpoint(address_v6::from_string("2001:db8::3"), 2048),
-                 udp::Endpoint(address_v6::from_string("::"), 2048),
-               }));
-}
-
 BOOST_AUTO_TEST_SUITE_END() // TestUdpFactory
 BOOST_AUTO_TEST_SUITE_END() // Face
 
diff --git a/tests/daemon/mgmt/face-manager-create-face.t.cpp b/tests/daemon/mgmt/face-manager-create-face.t.cpp
index ac50913..5a39ddb 100644
--- a/tests/daemon/mgmt/face-manager-create-face.t.cpp
+++ b/tests/daemon/mgmt/face-manager-create-face.t.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
@@ -107,18 +107,6 @@
   }
 };
 
-class UdpFaceConnectToSelf // face that will cause afterCreateFaceFailure to be invoked
-                           // fails because remote endpoint is prohibited
-{
-public:
-  static ControlParameters
-  getParameters()
-  {
-    return ControlParameters()
-      .setUri("udp4://0.0.0.0:16363"); // cannot connect to self
-  }
-};
-
 class LocalTcpFaceLocalFieldsEnabled
 {
 public:
@@ -214,7 +202,6 @@
                     mpl::pair<UdpFaceOnDemand, CommandFailure<406>>,
                     mpl::pair<UdpFacePersistent, CommandSuccess>,
                     mpl::pair<UdpFacePermanent, CommandSuccess>,
-                    mpl::pair<UdpFaceConnectToSelf, CommandFailure<406>>,
                     mpl::pair<LocalTcpFaceLocalFieldsEnabled, CommandSuccess>,
                     mpl::pair<LocalTcpFaceLocalFieldsDisabled, CommandSuccess>,
                     mpl::pair<NonLocalUdpFaceLocalFieldsEnabled, CommandFailure<406>>,