Alexander Afanasyev | 3136792 | 2015-02-09 20:51:10 -0800 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
Davide Pesavento | a314808 | 2018-04-12 18:21:54 -0400 | [diff] [blame] | 2 | /* |
Davide Pesavento | 4c95771 | 2024-01-01 15:40:06 -0500 | [diff] [blame] | 3 | * Copyright (c) 2014-2024, Regents of the University of California, |
Alexander Afanasyev | 3136792 | 2015-02-09 20:51:10 -0800 | [diff] [blame] | 4 | * Arizona Board of Regents, |
| 5 | * Colorado State University, |
| 6 | * University Pierre & Marie Curie, Sorbonne University, |
| 7 | * Washington University in St. Louis, |
| 8 | * Beijing Institute of Technology, |
| 9 | * The University of Memphis. |
| 10 | * |
| 11 | * This file is part of NFD (Named Data Networking Forwarding Daemon). |
| 12 | * See AUTHORS.md for complete list of NFD authors and contributors. |
| 13 | * |
| 14 | * NFD is free software: you can redistribute it and/or modify it under the terms |
| 15 | * of the GNU General Public License as published by the Free Software Foundation, |
| 16 | * either version 3 of the License, or (at your option) any later version. |
| 17 | * |
| 18 | * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 19 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 20 | * PURPOSE. See the GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License along with |
| 23 | * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 24 | */ |
| 25 | |
Junxiao Shi | b260017 | 2016-07-11 08:53:53 +0000 | [diff] [blame] | 26 | #include "service.hpp" |
Davide Pesavento | 9f8b10e | 2018-08-22 08:45:37 +0000 | [diff] [blame] | 27 | |
Davide Pesavento | 9f8b10e | 2018-08-22 08:45:37 +0000 | [diff] [blame] | 28 | #include "fib-updater.hpp" |
Davide Pesavento | 9f8b10e | 2018-08-22 08:45:37 +0000 | [diff] [blame] | 29 | #include "readvertise/client-to-nlsr-readvertise-policy.hpp" |
Yanbiao Li | f48d080 | 2018-06-01 03:00:02 -0700 | [diff] [blame] | 30 | #include "readvertise/host-to-gateway-readvertise-policy.hpp" |
Davide Pesavento | 9f8b10e | 2018-08-22 08:45:37 +0000 | [diff] [blame] | 31 | #include "readvertise/nfd-rib-readvertise-destination.hpp" |
| 32 | #include "readvertise/readvertise.hpp" |
| 33 | |
Davide Pesavento | 2cae8ca | 2019-04-18 20:48:05 -0400 | [diff] [blame] | 34 | #include "common/global.hpp" |
| 35 | #include "common/logger.hpp" |
Alexander Afanasyev | 3136792 | 2015-02-09 20:51:10 -0800 | [diff] [blame] | 36 | |
| 37 | #include <boost/property_tree/info_parser.hpp> |
Alexander Afanasyev | 3136792 | 2015-02-09 20:51:10 -0800 | [diff] [blame] | 38 | #include <ndn-cxx/transport/tcp-transport.hpp> |
Davide Pesavento | 9f8b10e | 2018-08-22 08:45:37 +0000 | [diff] [blame] | 39 | #include <ndn-cxx/transport/unix-transport.hpp> |
Alexander Afanasyev | 3136792 | 2015-02-09 20:51:10 -0800 | [diff] [blame] | 40 | |
Davide Pesavento | e422f9e | 2022-06-03 01:30:23 -0400 | [diff] [blame] | 41 | namespace nfd::rib { |
Alexander Afanasyev | 3136792 | 2015-02-09 20:51:10 -0800 | [diff] [blame] | 42 | |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 43 | NFD_LOG_INIT(RibService); |
Alexander Afanasyev | 3136792 | 2015-02-09 20:51:10 -0800 | [diff] [blame] | 44 | |
Davide Pesavento | 412c982 | 2021-07-02 00:21:05 -0400 | [diff] [blame] | 45 | const std::string CFG_RIB = "rib"; |
Wenkai Zheng | 6598fb0 | 2019-09-08 18:03:46 -0700 | [diff] [blame] | 46 | const std::string CFG_LOCALHOST_SECURITY = "localhost_security"; |
| 47 | const std::string CFG_LOCALHOP_SECURITY = "localhop_security"; |
Teng Liang | 18c2b29 | 2019-10-18 14:31:04 -0700 | [diff] [blame] | 48 | const std::string CFG_PA_VALIDATION = "prefix_announcement_validation"; |
Wenkai Zheng | 6598fb0 | 2019-09-08 18:03:46 -0700 | [diff] [blame] | 49 | const std::string CFG_PREFIX_PROPAGATE = "auto_prefix_propagate"; |
| 50 | const std::string CFG_READVERTISE_NLSR = "readvertise_nlsr"; |
| 51 | const Name READVERTISE_NLSR_PREFIX = "/localhost/nlsr"; |
Davide Pesavento | a3a7a4e | 2022-05-29 16:06:22 -0400 | [diff] [blame] | 52 | constexpr uint64_t PROPAGATE_DEFAULT_COST = 15; |
| 53 | constexpr time::milliseconds PROPAGATE_DEFAULT_TIMEOUT = 10_s; |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 54 | |
| 55 | static ConfigSection |
| 56 | loadConfigSectionFromFile(const std::string& filename) |
Alexander Afanasyev | 3136792 | 2015-02-09 20:51:10 -0800 | [diff] [blame] | 57 | { |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 58 | ConfigSection config; |
| 59 | // Any format errors should have been caught already |
| 60 | boost::property_tree::read_info(filename, config); |
| 61 | return config; |
| 62 | } |
| 63 | |
Davide Pesavento | a3a7a4e | 2022-05-29 16:06:22 -0400 | [diff] [blame] | 64 | // Look into NFD's config file and construct an appropriate transport to communicate with NFD. |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 65 | static shared_ptr<ndn::Transport> |
| 66 | makeLocalNfdTransport(const ConfigSection& config) |
| 67 | { |
| 68 | if (config.get_child_optional("face_system.unix")) { |
| 69 | // default socket path should be the same as in UnixStreamFactory::processConfig |
Eric Newberry | 2297490 | 2020-04-06 23:41:00 -0700 | [diff] [blame] | 70 | #ifdef __linux__ |
Davide Pesavento | 4c95771 | 2024-01-01 15:40:06 -0500 | [diff] [blame] | 71 | auto path = config.get<std::string>("face_system.unix.path", "/run/nfd/nfd.sock"); |
Eric Newberry | 2297490 | 2020-04-06 23:41:00 -0700 | [diff] [blame] | 72 | #else |
Davide Pesavento | 4c95771 | 2024-01-01 15:40:06 -0500 | [diff] [blame] | 73 | auto path = config.get<std::string>("face_system.unix.path", "/var/run/nfd/nfd.sock"); |
Eric Newberry | 2297490 | 2020-04-06 23:41:00 -0700 | [diff] [blame] | 74 | #endif // __linux__ |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 75 | return make_shared<ndn::UnixTransport>(path); |
Teng Liang | 04d5ce6 | 2018-08-06 10:20:24 +0800 | [diff] [blame] | 76 | } |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 77 | else if (config.get_child_optional("face_system.tcp") && |
| 78 | config.get<std::string>("face_system.tcp.listen", "yes") == "yes") { |
| 79 | // default port should be the same as in TcpFactory::processConfig |
| 80 | auto port = config.get<std::string>("face_system.tcp.port", "6363"); |
| 81 | return make_shared<ndn::TcpTransport>("localhost", port); |
Teng Liang | 04d5ce6 | 2018-08-06 10:20:24 +0800 | [diff] [blame] | 82 | } |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 83 | else { |
Davide Pesavento | 19779d8 | 2019-02-14 13:40:04 -0500 | [diff] [blame] | 84 | NDN_THROW(ConfigFile::Error("No transport is available to communicate with NFD")); |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 85 | } |
| 86 | } |
| 87 | |
| 88 | Service::Service(const std::string& configFile, ndn::KeyChain& keyChain) |
Ashlesh Gawande | f84bac5 | 2018-08-27 07:39:31 +0000 | [diff] [blame] | 89 | : Service(keyChain, makeLocalNfdTransport(loadConfigSectionFromFile(configFile)), |
| 90 | [&configFile] (ConfigFile& config, bool isDryRun) { |
| 91 | config.parse(configFile, isDryRun); |
| 92 | }) |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 93 | { |
Alexander Afanasyev | 3136792 | 2015-02-09 20:51:10 -0800 | [diff] [blame] | 94 | } |
| 95 | |
Davide Pesavento | 9f8b10e | 2018-08-22 08:45:37 +0000 | [diff] [blame] | 96 | Service::Service(const ConfigSection& configSection, ndn::KeyChain& keyChain) |
Ashlesh Gawande | f84bac5 | 2018-08-27 07:39:31 +0000 | [diff] [blame] | 97 | : Service(keyChain, makeLocalNfdTransport(configSection), |
| 98 | [&configSection] (ConfigFile& config, bool isDryRun) { |
| 99 | config.parse(configSection, isDryRun, "internal://nfd.conf"); |
| 100 | }) |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 101 | { |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 102 | } |
| 103 | |
Ashlesh Gawande | f84bac5 | 2018-08-27 07:39:31 +0000 | [diff] [blame] | 104 | template<typename ConfigParseFunc> |
| 105 | Service::Service(ndn::KeyChain& keyChain, shared_ptr<ndn::Transport> localNfdTransport, |
| 106 | const ConfigParseFunc& configParse) |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 107 | : m_keyChain(keyChain) |
| 108 | , m_face(std::move(localNfdTransport), getGlobalIoService(), m_keyChain) |
| 109 | , m_nfdController(m_face, m_keyChain) |
| 110 | , m_fibUpdater(m_rib, m_nfdController) |
| 111 | , m_dispatcher(m_face, m_keyChain) |
Davide Pesavento | 0a71dd3 | 2019-03-17 20:36:18 -0400 | [diff] [blame] | 112 | , m_ribManager(m_rib, m_face, m_keyChain, m_nfdController, m_dispatcher) |
Alexander Afanasyev | 3136792 | 2015-02-09 20:51:10 -0800 | [diff] [blame] | 113 | { |
Teng Liang | 04d5ce6 | 2018-08-06 10:20:24 +0800 | [diff] [blame] | 114 | if (s_instance != nullptr) { |
Davide Pesavento | 19779d8 | 2019-02-14 13:40:04 -0500 | [diff] [blame] | 115 | NDN_THROW(std::logic_error("RIB service cannot be instantiated more than once")); |
Teng Liang | 04d5ce6 | 2018-08-06 10:20:24 +0800 | [diff] [blame] | 116 | } |
| 117 | if (&getGlobalIoService() != &getRibIoService()) { |
Davide Pesavento | 19779d8 | 2019-02-14 13:40:04 -0500 | [diff] [blame] | 118 | NDN_THROW(std::logic_error("RIB service must run on RIB thread")); |
Teng Liang | 04d5ce6 | 2018-08-06 10:20:24 +0800 | [diff] [blame] | 119 | } |
| 120 | s_instance = this; |
Ashlesh Gawande | f84bac5 | 2018-08-27 07:39:31 +0000 | [diff] [blame] | 121 | |
| 122 | ConfigFile config(ConfigFile::ignoreUnknownSection); |
Davide Pesavento | 412c982 | 2021-07-02 00:21:05 -0400 | [diff] [blame] | 123 | config.addSectionHandler(CFG_RIB, [this] (auto&&... args) { |
| 124 | processConfig(std::forward<decltype(args)>(args)...); |
| 125 | }); |
Ashlesh Gawande | f84bac5 | 2018-08-27 07:39:31 +0000 | [diff] [blame] | 126 | configParse(config, true); |
| 127 | configParse(config, false); |
| 128 | |
| 129 | m_ribManager.registerWithNfd(); |
| 130 | m_ribManager.enableLocalFields(); |
Alexander Afanasyev | 3136792 | 2015-02-09 20:51:10 -0800 | [diff] [blame] | 131 | } |
| 132 | |
Teng Liang | 04d5ce6 | 2018-08-06 10:20:24 +0800 | [diff] [blame] | 133 | Service::~Service() |
| 134 | { |
| 135 | s_instance = nullptr; |
| 136 | } |
| 137 | |
| 138 | Service& |
| 139 | Service::get() |
| 140 | { |
| 141 | if (s_instance == nullptr) { |
Davide Pesavento | 19779d8 | 2019-02-14 13:40:04 -0500 | [diff] [blame] | 142 | NDN_THROW(std::logic_error("RIB service is not instantiated")); |
Teng Liang | 04d5ce6 | 2018-08-06 10:20:24 +0800 | [diff] [blame] | 143 | } |
| 144 | if (&getGlobalIoService() != &getRibIoService()) { |
Davide Pesavento | 19779d8 | 2019-02-14 13:40:04 -0500 | [diff] [blame] | 145 | NDN_THROW(std::logic_error("Must get RIB service on RIB thread")); |
Teng Liang | 04d5ce6 | 2018-08-06 10:20:24 +0800 | [diff] [blame] | 146 | } |
| 147 | return *s_instance; |
| 148 | } |
Alexander Afanasyev | c3ea5a7 | 2015-02-12 20:14:16 -0800 | [diff] [blame] | 149 | |
Alexander Afanasyev | 3136792 | 2015-02-09 20:51:10 -0800 | [diff] [blame] | 150 | void |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 151 | Service::processConfig(const ConfigSection& section, bool isDryRun, const std::string& filename) |
Alexander Afanasyev | 3136792 | 2015-02-09 20:51:10 -0800 | [diff] [blame] | 152 | { |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 153 | if (isDryRun) { |
| 154 | checkConfig(section, filename); |
| 155 | } |
| 156 | else { |
| 157 | applyConfig(section, filename); |
| 158 | } |
| 159 | } |
Alexander Afanasyev | 3136792 | 2015-02-09 20:51:10 -0800 | [diff] [blame] | 160 | |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 161 | void |
| 162 | Service::checkConfig(const ConfigSection& section, const std::string& filename) |
| 163 | { |
Wenkai Zheng | 6598fb0 | 2019-09-08 18:03:46 -0700 | [diff] [blame] | 164 | bool hasLocalhop = false; |
| 165 | bool hasPropagate = false; |
| 166 | |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 167 | for (const auto& item : section) { |
| 168 | const std::string& key = item.first; |
Ashlesh Gawande | f84bac5 | 2018-08-27 07:39:31 +0000 | [diff] [blame] | 169 | const ConfigSection& value = item.second; |
Jongseok Lee | 854866f | 2020-03-10 19:16:25 -0400 | [diff] [blame] | 170 | if (key == CFG_LOCALHOST_SECURITY || key == CFG_PA_VALIDATION) { |
| 171 | ndn::ValidatorConfig testValidator(m_face); |
| 172 | testValidator.load(value, filename); |
| 173 | } |
| 174 | else if (key == CFG_LOCALHOP_SECURITY) { |
| 175 | hasLocalhop = true; |
Alexander Afanasyev | 3c0c035 | 2018-10-17 11:59:23 -0400 | [diff] [blame] | 176 | ndn::ValidatorConfig testValidator(m_face); |
| 177 | testValidator.load(value, filename); |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 178 | } |
| 179 | else if (key == CFG_PREFIX_PROPAGATE) { |
Wenkai Zheng | 6598fb0 | 2019-09-08 18:03:46 -0700 | [diff] [blame] | 180 | hasPropagate = true; |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 181 | // AutoPrefixPropagator does not support config dry-run |
| 182 | } |
| 183 | else if (key == CFG_READVERTISE_NLSR) { |
Davide Pesavento | 412c982 | 2021-07-02 00:21:05 -0400 | [diff] [blame] | 184 | ConfigFile::parseYesNo(item, CFG_RIB + "." + CFG_READVERTISE_NLSR); |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 185 | } |
| 186 | else { |
Davide Pesavento | 412c982 | 2021-07-02 00:21:05 -0400 | [diff] [blame] | 187 | NDN_THROW(ConfigFile::Error("Unrecognized option " + CFG_RIB + "." + key)); |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 188 | } |
| 189 | } |
Wenkai Zheng | 6598fb0 | 2019-09-08 18:03:46 -0700 | [diff] [blame] | 190 | |
| 191 | if (hasLocalhop && hasPropagate) { |
| 192 | NDN_THROW(ConfigFile::Error(CFG_LOCALHOP_SECURITY + " and " + CFG_PREFIX_PROPAGATE + |
| 193 | " cannot be enabled at the same time")); |
| 194 | } |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 195 | } |
| 196 | |
| 197 | void |
| 198 | Service::applyConfig(const ConfigSection& section, const std::string& filename) |
| 199 | { |
| 200 | bool wantPrefixPropagate = false; |
| 201 | bool wantReadvertiseNlsr = false; |
| 202 | |
| 203 | for (const auto& item : section) { |
| 204 | const std::string& key = item.first; |
| 205 | const ConfigSection& value = item.second; |
| 206 | if (key == CFG_LOCALHOST_SECURITY) { |
| 207 | m_ribManager.applyLocalhostConfig(value, filename); |
| 208 | } |
| 209 | else if (key == CFG_LOCALHOP_SECURITY) { |
| 210 | m_ribManager.enableLocalhop(value, filename); |
| 211 | } |
Teng Liang | 18c2b29 | 2019-10-18 14:31:04 -0700 | [diff] [blame] | 212 | else if (key == CFG_PA_VALIDATION) { |
| 213 | m_ribManager.applyPaConfig(value, filename); |
| 214 | } |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 215 | else if (key == CFG_PREFIX_PROPAGATE) { |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 216 | wantPrefixPropagate = true; |
Yanbiao Li | f48d080 | 2018-06-01 03:00:02 -0700 | [diff] [blame] | 217 | |
| 218 | if (!m_readvertisePropagation) { |
| 219 | NFD_LOG_DEBUG("Enabling automatic prefix propagation"); |
| 220 | |
Yanbiao Li | f48d080 | 2018-06-01 03:00:02 -0700 | [diff] [blame] | 221 | auto cost = item.second.get_optional<uint64_t>("cost"); |
Wenkai Zheng | 6598fb0 | 2019-09-08 18:03:46 -0700 | [diff] [blame] | 222 | auto parameters = ndn::nfd::ControlParameters() |
| 223 | .setCost(cost.value_or(PROPAGATE_DEFAULT_COST)) |
| 224 | .setOrigin(ndn::nfd::ROUTE_ORIGIN_CLIENT); |
Yanbiao Li | f48d080 | 2018-06-01 03:00:02 -0700 | [diff] [blame] | 225 | |
Yanbiao Li | f48d080 | 2018-06-01 03:00:02 -0700 | [diff] [blame] | 226 | auto timeout = item.second.get_optional<uint64_t>("timeout"); |
Wenkai Zheng | 6598fb0 | 2019-09-08 18:03:46 -0700 | [diff] [blame] | 227 | auto options = ndn::nfd::CommandOptions() |
| 228 | .setPrefix(RibManager::LOCALHOP_TOP_PREFIX) |
| 229 | .setTimeout(timeout ? time::milliseconds(*timeout) : PROPAGATE_DEFAULT_TIMEOUT); |
Yanbiao Li | f48d080 | 2018-06-01 03:00:02 -0700 | [diff] [blame] | 230 | |
| 231 | m_readvertisePropagation = make_unique<Readvertise>( |
| 232 | m_rib, |
Yanbiao Li | f48d080 | 2018-06-01 03:00:02 -0700 | [diff] [blame] | 233 | make_unique<HostToGatewayReadvertisePolicy>(m_keyChain, item.second), |
| 234 | make_unique<NfdRibReadvertiseDestination>(m_nfdController, m_rib, options, parameters)); |
| 235 | } |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 236 | } |
| 237 | else if (key == CFG_READVERTISE_NLSR) { |
Davide Pesavento | 412c982 | 2021-07-02 00:21:05 -0400 | [diff] [blame] | 238 | wantReadvertiseNlsr = ConfigFile::parseYesNo(item, CFG_RIB + "." + CFG_READVERTISE_NLSR); |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 239 | } |
| 240 | else { |
Davide Pesavento | 412c982 | 2021-07-02 00:21:05 -0400 | [diff] [blame] | 241 | NDN_THROW(ConfigFile::Error("Unrecognized option " + CFG_RIB + "." + key)); |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 242 | } |
Alexander Afanasyev | 3136792 | 2015-02-09 20:51:10 -0800 | [diff] [blame] | 243 | } |
| 244 | |
Yanbiao Li | f48d080 | 2018-06-01 03:00:02 -0700 | [diff] [blame] | 245 | if (!wantPrefixPropagate && m_readvertisePropagation != nullptr) { |
| 246 | NFD_LOG_DEBUG("Disabling automatic prefix propagation"); |
| 247 | m_readvertisePropagation.reset(); |
Davide Pesavento | 9f8b10e | 2018-08-22 08:45:37 +0000 | [diff] [blame] | 248 | } |
| 249 | |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 250 | if (wantReadvertiseNlsr && m_readvertiseNlsr == nullptr) { |
| 251 | NFD_LOG_DEBUG("Enabling readvertise-to-nlsr"); |
Yanbiao Li | f48d080 | 2018-06-01 03:00:02 -0700 | [diff] [blame] | 252 | auto options = ndn::nfd::CommandOptions().setPrefix(READVERTISE_NLSR_PREFIX); |
Davide Pesavento | 9f8b10e | 2018-08-22 08:45:37 +0000 | [diff] [blame] | 253 | m_readvertiseNlsr = make_unique<Readvertise>( |
| 254 | m_rib, |
| 255 | make_unique<ClientToNlsrReadvertisePolicy>(), |
Yanbiao Li | f48d080 | 2018-06-01 03:00:02 -0700 | [diff] [blame] | 256 | make_unique<NfdRibReadvertiseDestination>(m_nfdController, m_rib, options)); |
Davide Pesavento | 9f8b10e | 2018-08-22 08:45:37 +0000 | [diff] [blame] | 257 | } |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 258 | else if (!wantReadvertiseNlsr && m_readvertiseNlsr != nullptr) { |
| 259 | NFD_LOG_DEBUG("Disabling readvertise-to-nlsr"); |
Davide Pesavento | 9f8b10e | 2018-08-22 08:45:37 +0000 | [diff] [blame] | 260 | m_readvertiseNlsr.reset(); |
| 261 | } |
Alexander Afanasyev | 3136792 | 2015-02-09 20:51:10 -0800 | [diff] [blame] | 262 | } |
| 263 | |
Davide Pesavento | e422f9e | 2022-06-03 01:30:23 -0400 | [diff] [blame] | 264 | } // namespace nfd::rib |