mgmt: use a separate validator for prefix announcements

This commit also configures the default prefix_announcement_validation
section in nfd.conf.sample to accept any prefix announcement.

refs: #5031
Change-Id: I82e34ce783dfe77c170dd02e78a4bc86faa0147a
diff --git a/daemon/rib/service.cpp b/daemon/rib/service.cpp
index 72045bf..f7b4719 100644
--- a/daemon/rib/service.cpp
+++ b/daemon/rib/service.cpp
@@ -48,6 +48,7 @@
 const std::string CFG_SECTION = "rib";
 const std::string CFG_LOCALHOST_SECURITY = "localhost_security";
 const std::string CFG_LOCALHOP_SECURITY = "localhop_security";
+const std::string CFG_PA_VALIDATION = "prefix_announcement_validation";
 const std::string CFG_PREFIX_PROPAGATE = "auto_prefix_propagate";
 const std::string CFG_READVERTISE_NLSR = "readvertise_nlsr";
 const Name READVERTISE_NLSR_PREFIX = "/localhost/nlsr";
@@ -166,7 +167,7 @@
   for (const auto& item : section) {
     const std::string& key = item.first;
     const ConfigSection& value = item.second;
-    if (key == CFG_LOCALHOST_SECURITY || key == CFG_LOCALHOP_SECURITY) {
+    if (key == CFG_LOCALHOST_SECURITY || key == CFG_LOCALHOP_SECURITY || key == CFG_PA_VALIDATION) {
       hasLocalhop = key == CFG_LOCALHOP_SECURITY;
       ndn::ValidatorConfig testValidator(m_face);
       testValidator.load(value, filename);
@@ -204,6 +205,9 @@
     else if (key == CFG_LOCALHOP_SECURITY) {
       m_ribManager.enableLocalhop(value, filename);
     }
+    else if (key == CFG_PA_VALIDATION) {
+      m_ribManager.applyPaConfig(value, filename);
+    }
     else if (key == CFG_PREFIX_PROPAGATE) {
       wantPrefixPropagate = true;