Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
Junxiao Shi | 7530635 | 2018-02-01 21:59:44 +0000 | [diff] [blame] | 2 | /* |
Davide Pesavento | 45c1f6a | 2025-01-01 19:30:30 -0500 | [diff] [blame] | 3 | * Copyright (c) 2014-2025, Regents of the University of California, |
Junxiao Shi | 1e46be3 | 2015-01-08 20:18:05 -0700 | [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. |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 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/>. |
Vince | 12e4946 | 2014-06-09 13:29:32 -0500 | [diff] [blame] | 24 | */ |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 25 | |
| 26 | #include "rib-manager.hpp" |
Nick Gordon | 9fcf123 | 2017-03-10 22:30:20 +0000 | [diff] [blame] | 27 | |
Davide Pesavento | 2cae8ca | 2019-04-18 20:48:05 -0400 | [diff] [blame] | 28 | #include "common/global.hpp" |
| 29 | #include "common/logger.hpp" |
Davide Pesavento | 78ddcab | 2019-02-28 22:00:03 -0500 | [diff] [blame] | 30 | #include "rib/rib.hpp" |
Davide Pesavento | 2cae8ca | 2019-04-18 20:48:05 -0400 | [diff] [blame] | 31 | #include "table/fib.hpp" |
Nick Gordon | 9fcf123 | 2017-03-10 22:30:20 +0000 | [diff] [blame] | 32 | |
Davide Pesavento | 5d64263 | 2023-10-03 00:36:08 -0400 | [diff] [blame] | 33 | #include <boost/asio/defer.hpp> |
Davide Pesavento | 21e24f9 | 2025-01-10 22:22:43 -0500 | [diff] [blame] | 34 | #include <boost/lexical_cast.hpp> |
Davide Pesavento | 5d64263 | 2023-10-03 00:36:08 -0400 | [diff] [blame] | 35 | |
Junxiao Shi | cbc8e94 | 2016-09-06 03:17:45 +0000 | [diff] [blame] | 36 | #include <ndn-cxx/lp/tags.hpp> |
Junxiao Shi | 25c6ce4 | 2016-09-09 13:49:59 +0000 | [diff] [blame] | 37 | #include <ndn-cxx/mgmt/nfd/rib-entry.hpp> |
Davide Pesavento | 4064127 | 2023-03-16 13:31:12 -0400 | [diff] [blame] | 38 | #include <ndn-cxx/mgmt/nfd/status-dataset.hpp> |
Alexander Afanasyev | a158370 | 2020-06-03 13:55:45 -0400 | [diff] [blame] | 39 | #include <ndn-cxx/security/certificate-fetcher-direct-fetch.hpp> |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 40 | |
| 41 | namespace nfd { |
Davide Pesavento | 8a05c7f | 2019-02-28 02:26:19 -0500 | [diff] [blame] | 42 | |
Davide Pesavento | 8a05c7f | 2019-02-28 02:26:19 -0500 | [diff] [blame] | 43 | using rib::Route; |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 44 | |
Davide Pesavento | a314808 | 2018-04-12 18:21:54 -0400 | [diff] [blame] | 45 | NFD_LOG_INIT(RibManager); |
Alexander Afanasyev | 89cf5e0 | 2014-04-17 12:08:57 -0700 | [diff] [blame] | 46 | |
Davide Pesavento | a3a7a4e | 2022-05-29 16:06:22 -0400 | [diff] [blame] | 47 | const std::string MGMT_MODULE_NAME = "rib"; |
| 48 | const Name LOCALHOST_TOP_PREFIX = "/localhost/nfd"; |
Davide Pesavento | 20d94f6 | 2022-09-26 03:30:53 -0400 | [diff] [blame] | 49 | constexpr time::seconds ACTIVE_FACE_FETCH_INTERVAL = 5_min; |
Yanbiao Li | f48d080 | 2018-06-01 03:00:02 -0700 | [diff] [blame] | 50 | |
Davide Pesavento | 8a05c7f | 2019-02-28 02:26:19 -0500 | [diff] [blame] | 51 | RibManager::RibManager(rib::Rib& rib, ndn::Face& face, ndn::KeyChain& keyChain, |
Davide Pesavento | 0a71dd3 | 2019-03-17 20:36:18 -0400 | [diff] [blame] | 52 | ndn::nfd::Controller& nfdController, Dispatcher& dispatcher) |
Davide Pesavento | 78ddcab | 2019-02-28 22:00:03 -0500 | [diff] [blame] | 53 | : ManagerBase(MGMT_MODULE_NAME, dispatcher) |
Davide Pesavento | 9f8b10e | 2018-08-22 08:45:37 +0000 | [diff] [blame] | 54 | , m_rib(rib) |
Junxiao Shi | 5ba7dfc | 2018-09-26 14:24:05 +0000 | [diff] [blame] | 55 | , m_keyChain(keyChain) |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 56 | , m_nfdController(nfdController) |
| 57 | , m_dispatcher(dispatcher) |
Davide Pesavento | 9f8b10e | 2018-08-22 08:45:37 +0000 | [diff] [blame] | 58 | , m_faceMonitor(face) |
| 59 | , m_localhostValidator(face) |
Alexander Afanasyev | a158370 | 2020-06-03 13:55:45 -0400 | [diff] [blame] | 60 | , m_localhopValidator(make_unique<ndn::security::CertificateFetcherDirectFetch>(face)) |
| 61 | , m_paValidator(make_unique<ndn::security::CertificateFetcherDirectFetch>(face)) |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 62 | , m_isLocalhopEnabled(false) |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 63 | { |
Davide Pesavento | 1db1bb6 | 2025-01-06 01:23:41 -0500 | [diff] [blame] | 64 | registerCommandHandler<ndn::nfd::RibRegisterCommand>([this] (auto&&, auto&&... args) { |
| 65 | registerEntry(std::forward<decltype(args)>(args)...); |
| 66 | }); |
| 67 | registerCommandHandler<ndn::nfd::RibUnregisterCommand>([this] (auto&&, auto&&... args) { |
| 68 | unregisterEntry(std::forward<decltype(args)>(args)...); |
| 69 | }); |
jaczhi | b065768 | 2025-01-08 23:01:45 -0800 | [diff] [blame] | 70 | registerCommandHandler<ndn::nfd::RibAnnounceCommand>([this] (auto&&, auto&&... args) { |
| 71 | announceEntry(std::forward<decltype(args)>(args)...); |
| 72 | }); |
Davide Pesavento | 1db1bb6 | 2025-01-06 01:23:41 -0500 | [diff] [blame] | 73 | registerStatusDatasetHandler("list", [this] (auto&&, auto&&, auto&&... args) { |
| 74 | listEntries(std::forward<decltype(args)>(args)...); |
| 75 | }); |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 76 | } |
| 77 | |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 78 | void |
| 79 | RibManager::applyLocalhostConfig(const ConfigSection& section, const std::string& filename) |
| 80 | { |
| 81 | m_localhostValidator.load(section, filename); |
| 82 | } |
| 83 | |
| 84 | void |
| 85 | RibManager::enableLocalhop(const ConfigSection& section, const std::string& filename) |
| 86 | { |
| 87 | m_localhopValidator.load(section, filename); |
| 88 | m_isLocalhopEnabled = true; |
| 89 | } |
| 90 | |
| 91 | void |
| 92 | RibManager::disableLocalhop() |
| 93 | { |
| 94 | m_isLocalhopEnabled = false; |
| 95 | } |
Vince Lehman | 26b215c | 2014-08-17 15:00:41 -0500 | [diff] [blame] | 96 | |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 97 | void |
Teng Liang | 18c2b29 | 2019-10-18 14:31:04 -0700 | [diff] [blame] | 98 | RibManager::applyPaConfig(const ConfigSection& section, const std::string& filename) |
| 99 | { |
| 100 | m_paValidator.load(section, filename); |
| 101 | } |
| 102 | |
| 103 | void |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 104 | RibManager::registerWithNfd() |
| 105 | { |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 106 | registerTopPrefix(LOCALHOST_TOP_PREFIX); |
Alexander Afanasyev | b3893c9 | 2014-05-15 01:49:54 -0700 | [diff] [blame] | 107 | |
Junxiao Shi | a329574 | 2014-05-16 22:40:10 -0700 | [diff] [blame] | 108 | if (m_isLocalhopEnabled) { |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 109 | registerTopPrefix(LOCALHOP_TOP_PREFIX); |
Junxiao Shi | a329574 | 2014-05-16 22:40:10 -0700 | [diff] [blame] | 110 | } |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 111 | |
Alexander Afanasyev | 89cf5e0 | 2014-04-17 12:08:57 -0700 | [diff] [blame] | 112 | NFD_LOG_INFO("Start monitoring face create/destroy events"); |
Davide Pesavento | 412c982 | 2021-07-02 00:21:05 -0400 | [diff] [blame] | 113 | m_faceMonitor.onNotification.connect([this] (const auto& notif) { onNotification(notif); }); |
Junxiao Shi | 15b12e7 | 2014-08-09 19:56:24 -0700 | [diff] [blame] | 114 | m_faceMonitor.start(); |
Vince Lehman | cd613c5 | 2014-07-30 14:34:49 -0500 | [diff] [blame] | 115 | |
Vince Lehman | 26b215c | 2014-08-17 15:00:41 -0500 | [diff] [blame] | 116 | scheduleActiveFaceFetch(ACTIVE_FACE_FETCH_INTERVAL); |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 117 | } |
| 118 | |
| 119 | void |
Eric Newberry | ecc45cb | 2016-11-08 19:57:12 +0000 | [diff] [blame] | 120 | RibManager::enableLocalFields() |
Yanbiao Li | cf0db02 | 2016-01-29 00:54:25 -0800 | [diff] [blame] | 121 | { |
Eric Newberry | ecc45cb | 2016-11-08 19:57:12 +0000 | [diff] [blame] | 122 | m_nfdController.start<ndn::nfd::FaceUpdateCommand>( |
Junxiao Shi | 5200904 | 2018-09-10 12:33:56 +0000 | [diff] [blame] | 123 | ControlParameters().setFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED, true), |
Davide Pesavento | 19779d8 | 2019-02-14 13:40:04 -0500 | [diff] [blame] | 124 | [] (const ControlParameters&) { |
Davide Pesavento | 21e24f9 | 2025-01-10 22:22:43 -0500 | [diff] [blame] | 125 | NFD_LOG_TRACE("Local fields enabled"); |
Junxiao Shi | 5200904 | 2018-09-10 12:33:56 +0000 | [diff] [blame] | 126 | }, |
| 127 | [] (const ControlResponse& res) { |
Davide Pesavento | 21e24f9 | 2025-01-10 22:22:43 -0500 | [diff] [blame] | 128 | NDN_THROW(Error("Could not enable local fields (error " + |
| 129 | std::to_string(res.getCode()) + ": " + res.getText() + ")")); |
Junxiao Shi | 5200904 | 2018-09-10 12:33:56 +0000 | [diff] [blame] | 130 | }); |
Yanbiao Li | cf0db02 | 2016-01-29 00:54:25 -0800 | [diff] [blame] | 131 | } |
| 132 | |
| 133 | void |
Davide Pesavento | a745025 | 2025-01-12 00:20:01 -0500 | [diff] [blame^] | 134 | RibManager::addRoute(const Name& name, Route route, const time::steady_clock::time_point& now, |
| 135 | const std::function<void(RibUpdateResult)>& done) |
Yanbiao Li | cf0db02 | 2016-01-29 00:54:25 -0800 | [diff] [blame] | 136 | { |
Davide Pesavento | a745025 | 2025-01-12 00:20:01 -0500 | [diff] [blame^] | 137 | if (route.expires && *route.expires <= now) { |
Junxiao Shi | 5ba7dfc | 2018-09-26 14:24:05 +0000 | [diff] [blame] | 138 | m_rib.onRouteExpiration(name, route); |
Davide Pesavento | a745025 | 2025-01-12 00:20:01 -0500 | [diff] [blame^] | 139 | if (done) { |
| 140 | done(RibUpdateResult::EXPIRED); |
| 141 | } |
| 142 | return; |
Junxiao Shi | 5200904 | 2018-09-10 12:33:56 +0000 | [diff] [blame] | 143 | } |
| 144 | |
| 145 | NFD_LOG_INFO("Adding route " << name << " nexthop=" << route.faceId << |
| 146 | " origin=" << route.origin << " cost=" << route.cost); |
| 147 | |
Davide Pesavento | a745025 | 2025-01-12 00:20:01 -0500 | [diff] [blame^] | 148 | if (route.expires) { |
| 149 | auto delay = *route.expires - now; |
| 150 | auto event = getScheduler().schedule(delay, [=] { m_rib.onRouteExpiration(name, route); }); |
| 151 | route.setExpirationEvent(std::move(event)); |
| 152 | // cast to milliseconds to make the logs easier to read |
| 153 | NFD_LOG_TRACE("Route will expire in " << time::duration_cast<time::milliseconds>(delay)); |
Junxiao Shi | 5200904 | 2018-09-10 12:33:56 +0000 | [diff] [blame] | 154 | } |
| 155 | |
Davide Pesavento | a745025 | 2025-01-12 00:20:01 -0500 | [diff] [blame^] | 156 | beginRibUpdate({rib::RibUpdate::REGISTER, name, std::move(route)}, done); |
Junxiao Shi | 5200904 | 2018-09-10 12:33:56 +0000 | [diff] [blame] | 157 | } |
| 158 | |
| 159 | void |
Davide Pesavento | c2442be | 2025-01-11 17:25:40 -0500 | [diff] [blame] | 160 | RibManager::beginRibUpdate(const rib::RibUpdate& update, |
Junxiao Shi | 5200904 | 2018-09-10 12:33:56 +0000 | [diff] [blame] | 161 | const std::function<void(RibUpdateResult)>& done) |
| 162 | { |
| 163 | m_rib.beginApplyUpdate(update, |
| 164 | [=] { |
Davide Pesavento | 21e24f9 | 2025-01-10 22:22:43 -0500 | [diff] [blame] | 165 | NFD_LOG_DEBUG(update << " -> OK"); |
Davide Pesavento | a745025 | 2025-01-12 00:20:01 -0500 | [diff] [blame^] | 166 | if (done) { |
| 167 | done(RibUpdateResult::OK); |
| 168 | } |
Junxiao Shi | 5200904 | 2018-09-10 12:33:56 +0000 | [diff] [blame] | 169 | }, |
| 170 | [=] (uint32_t code, const std::string& error) { |
Davide Pesavento | 21e24f9 | 2025-01-10 22:22:43 -0500 | [diff] [blame] | 171 | NFD_LOG_DEBUG(update << " -> error " << code << ": " << error); |
Junxiao Shi | 5200904 | 2018-09-10 12:33:56 +0000 | [diff] [blame] | 172 | |
| 173 | // Since the FIB rejected the update, clean up invalid routes |
| 174 | scheduleActiveFaceFetch(1_s); |
| 175 | |
Davide Pesavento | a745025 | 2025-01-12 00:20:01 -0500 | [diff] [blame^] | 176 | if (done) { |
| 177 | done(RibUpdateResult::ERROR); |
| 178 | } |
Junxiao Shi | 5200904 | 2018-09-10 12:33:56 +0000 | [diff] [blame] | 179 | }); |
Yanbiao Li | cf0db02 | 2016-01-29 00:54:25 -0800 | [diff] [blame] | 180 | } |
| 181 | |
| 182 | void |
Yanbiao Li | cf0db02 | 2016-01-29 00:54:25 -0800 | [diff] [blame] | 183 | RibManager::registerTopPrefix(const Name& topPrefix) |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 184 | { |
Junxiao Shi | 5200904 | 2018-09-10 12:33:56 +0000 | [diff] [blame] | 185 | // add FIB nexthop |
Yanbiao Li | cf0db02 | 2016-01-29 00:54:25 -0800 | [diff] [blame] | 186 | m_nfdController.start<ndn::nfd::FibAddNextHopCommand>( |
Davide Pesavento | 21e24f9 | 2025-01-10 22:22:43 -0500 | [diff] [blame] | 187 | ControlParameters().setName(Name(topPrefix).append(MGMT_MODULE_NAME)).setFaceId(0), |
Junxiao Shi | 5200904 | 2018-09-10 12:33:56 +0000 | [diff] [blame] | 188 | [=] (const ControlParameters& res) { |
Davide Pesavento | 21e24f9 | 2025-01-10 22:22:43 -0500 | [diff] [blame] | 189 | NFD_LOG_DEBUG("Successfully registered " << topPrefix << " with the forwarder"); |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 190 | |
Junxiao Shi | 5200904 | 2018-09-10 12:33:56 +0000 | [diff] [blame] | 191 | // Routes must be inserted into the RIB so route flags can be applied |
| 192 | Route route; |
| 193 | route.faceId = res.getFaceId(); |
| 194 | route.origin = ndn::nfd::ROUTE_ORIGIN_APP; |
| 195 | route.flags = ndn::nfd::ROUTE_FLAG_CHILD_INHERIT; |
| 196 | |
| 197 | m_rib.insert(topPrefix, route); |
Junxiao Shi | 5200904 | 2018-09-10 12:33:56 +0000 | [diff] [blame] | 198 | }, |
| 199 | [=] (const ControlResponse& res) { |
Davide Pesavento | 21e24f9 | 2025-01-10 22:22:43 -0500 | [diff] [blame] | 200 | NDN_THROW(Error("Could not add FIB entry " + topPrefix.toUri() + " (error " + |
| 201 | std::to_string(res.getCode()) + ": " + res.getText() + ")")); |
Junxiao Shi | 5200904 | 2018-09-10 12:33:56 +0000 | [diff] [blame] | 202 | }); |
| 203 | |
| 204 | // add top prefix to the dispatcher without prefix registration |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 205 | m_dispatcher.addTopPrefix(topPrefix, false); |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 206 | } |
| 207 | |
Davide Pesavento | 21e24f9 | 2025-01-10 22:22:43 -0500 | [diff] [blame] | 208 | static uint64_t |
| 209 | getIncomingFaceId(const Interest& request) |
| 210 | { |
| 211 | auto incomingFaceIdTag = request.getTag<lp::IncomingFaceIdTag>(); |
| 212 | // NDNLPv2 says "application MUST be prepared to receive a packet without IncomingFaceId field", |
| 213 | // but it's fine to assert IncomingFaceId is available, because InternalFace lives inside NFD |
| 214 | // and is initialized synchronously with IncomingFaceId field enabled. |
| 215 | BOOST_ASSERT(incomingFaceIdTag != nullptr); |
| 216 | return incomingFaceIdTag->get(); |
| 217 | } |
| 218 | |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 219 | void |
Davide Pesavento | ae43030 | 2023-05-11 01:42:46 -0400 | [diff] [blame] | 220 | RibManager::registerEntry(const Interest& interest, ControlParameters parameters, |
Davide Pesavento | 45c1f6a | 2025-01-01 19:30:30 -0500 | [diff] [blame] | 221 | const CommandContinuation& done) |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 222 | { |
Davide Pesavento | 2cae8ca | 2019-04-18 20:48:05 -0400 | [diff] [blame] | 223 | if (parameters.getName().size() > Fib::getMaxDepth()) { |
Davide Pesavento | 2c9d2ca | 2024-01-27 16:36:51 -0500 | [diff] [blame] | 224 | done(ControlResponse(414, "Route prefix cannot exceed " + std::to_string(Fib::getMaxDepth()) + |
Junxiao Shi | 7530635 | 2018-02-01 21:59:44 +0000 | [diff] [blame] | 225 | " components")); |
| 226 | return; |
| 227 | } |
| 228 | |
Davide Pesavento | 21e24f9 | 2025-01-10 22:22:43 -0500 | [diff] [blame] | 229 | if (parameters.getFaceId() == 0) { // self registration |
| 230 | parameters.setFaceId(getIncomingFaceId(interest)); |
| 231 | } |
Vince Lehman | 76c751c | 2014-11-18 17:36:38 -0600 | [diff] [blame] | 232 | |
| 233 | // Respond since command is valid and authorized |
Davide Pesavento | 21e24f9 | 2025-01-10 22:22:43 -0500 | [diff] [blame] | 234 | done(ControlResponse(200, "OK").setBody(parameters.wireEncode())); |
Alexander Afanasyev | fb1c808 | 2014-07-17 15:16:15 -0700 | [diff] [blame] | 235 | |
Vince Lehman | 218be0a | 2015-01-15 17:25:20 -0600 | [diff] [blame] | 236 | Route route; |
| 237 | route.faceId = parameters.getFaceId(); |
| 238 | route.origin = parameters.getOrigin(); |
| 239 | route.cost = parameters.getCost(); |
| 240 | route.flags = parameters.getFlags(); |
Syed Obaid | 3313a37 | 2014-07-01 01:31:33 -0500 | [diff] [blame] | 241 | |
Davide Pesavento | a745025 | 2025-01-12 00:20:01 -0500 | [diff] [blame^] | 242 | auto now = time::steady_clock::now(); |
Alexander Afanasyev | f67cf08 | 2014-07-18 16:47:29 -0700 | [diff] [blame] | 243 | if (parameters.hasExpirationPeriod() && |
Nick Gordon | 9fcf123 | 2017-03-10 22:30:20 +0000 | [diff] [blame] | 244 | parameters.getExpirationPeriod() != time::milliseconds::max()) { |
Davide Pesavento | a745025 | 2025-01-12 00:20:01 -0500 | [diff] [blame^] | 245 | route.expires = now + parameters.getExpirationPeriod(); |
Vince Lehman | 76c751c | 2014-11-18 17:36:38 -0600 | [diff] [blame] | 246 | } |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 247 | |
Davide Pesavento | a745025 | 2025-01-12 00:20:01 -0500 | [diff] [blame^] | 248 | addRoute(parameters.getName(), std::move(route), now); |
Vince Lehman | 281ded7 | 2014-08-21 12:17:08 -0500 | [diff] [blame] | 249 | } |
| 250 | |
| 251 | void |
Davide Pesavento | ae43030 | 2023-05-11 01:42:46 -0400 | [diff] [blame] | 252 | RibManager::unregisterEntry(const Interest& interest, ControlParameters parameters, |
Davide Pesavento | 45c1f6a | 2025-01-01 19:30:30 -0500 | [diff] [blame] | 253 | const CommandContinuation& done) |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 254 | { |
Davide Pesavento | 21e24f9 | 2025-01-10 22:22:43 -0500 | [diff] [blame] | 255 | if (parameters.getFaceId() == 0) { // self unregistration |
| 256 | parameters.setFaceId(getIncomingFaceId(interest)); |
| 257 | } |
Vince Lehman | 76c751c | 2014-11-18 17:36:38 -0600 | [diff] [blame] | 258 | |
| 259 | // Respond since command is valid and authorized |
Davide Pesavento | 21e24f9 | 2025-01-10 22:22:43 -0500 | [diff] [blame] | 260 | done(ControlResponse(200, "OK").setBody(parameters.wireEncode())); |
Alexander Afanasyev | fb1c808 | 2014-07-17 15:16:15 -0700 | [diff] [blame] | 261 | |
Vince Lehman | 218be0a | 2015-01-15 17:25:20 -0600 | [diff] [blame] | 262 | Route route; |
| 263 | route.faceId = parameters.getFaceId(); |
| 264 | route.origin = parameters.getOrigin(); |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 265 | |
Davide Pesavento | a745025 | 2025-01-12 00:20:01 -0500 | [diff] [blame^] | 266 | NFD_LOG_INFO("Removing route " << parameters.getName() << |
| 267 | " nexthop=" << route.faceId << " origin=" << route.origin); |
| 268 | |
| 269 | beginRibUpdate({rib::RibUpdate::UNREGISTER, parameters.getName(), route}, nullptr); |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 270 | } |
| 271 | |
| 272 | void |
jaczhi | b065768 | 2025-01-08 23:01:45 -0800 | [diff] [blame] | 273 | RibManager::announceEntry(const Interest& interest, const ndn::nfd::RibAnnounceParameters& parameters, |
| 274 | const CommandContinuation& done) |
| 275 | { |
| 276 | const auto& announcement = parameters.getPrefixAnnouncement(); |
Davide Pesavento | 21e24f9 | 2025-01-10 22:22:43 -0500 | [diff] [blame] | 277 | const auto& name = announcement.getAnnouncedName(); |
| 278 | if (name.size() > Fib::getMaxDepth()) { |
jaczhi | b065768 | 2025-01-08 23:01:45 -0800 | [diff] [blame] | 279 | done(ControlResponse(414, "Route prefix cannot exceed " + std::to_string(Fib::getMaxDepth()) + |
| 280 | " components")); |
| 281 | return; |
| 282 | } |
| 283 | |
Davide Pesavento | a745025 | 2025-01-12 00:20:01 -0500 | [diff] [blame^] | 284 | auto inFaceId = getIncomingFaceId(interest); |
jaczhi | b065768 | 2025-01-08 23:01:45 -0800 | [diff] [blame] | 285 | |
Davide Pesavento | 21e24f9 | 2025-01-10 22:22:43 -0500 | [diff] [blame] | 286 | NDN_LOG_TRACE("Validating announcement " << announcement); |
jaczhi | b065768 | 2025-01-08 23:01:45 -0800 | [diff] [blame] | 287 | BOOST_ASSERT(announcement.getData()); |
| 288 | m_paValidator.validate(*announcement.getData(), |
Davide Pesavento | a745025 | 2025-01-12 00:20:01 -0500 | [diff] [blame^] | 289 | [=] (const Data&) { |
| 290 | auto now = time::steady_clock::now(); |
| 291 | Route route(announcement, inFaceId); |
| 292 | |
| 293 | // Prepare parameters for response |
| 294 | ControlParameters responseParams; |
| 295 | responseParams |
| 296 | .setName(announcement.getAnnouncedName()) |
| 297 | .setFaceId(route.faceId) |
| 298 | .setOrigin(route.origin) |
| 299 | .setCost(route.cost) |
| 300 | .setFlags(route.flags) |
| 301 | .setExpirationPeriod(time::duration_cast<time::milliseconds>(route.annExpires - now)); |
| 302 | |
jaczhi | b065768 | 2025-01-08 23:01:45 -0800 | [diff] [blame] | 303 | // Respond since command is valid and authorized |
Davide Pesavento | 21e24f9 | 2025-01-10 22:22:43 -0500 | [diff] [blame] | 304 | done(ControlResponse(200, "OK").setBody(responseParams.wireEncode())); |
Davide Pesavento | a745025 | 2025-01-12 00:20:01 -0500 | [diff] [blame^] | 305 | addRoute(announcement.getAnnouncedName(), std::move(route), now); |
jaczhi | b065768 | 2025-01-08 23:01:45 -0800 | [diff] [blame] | 306 | }, |
Davide Pesavento | 21e24f9 | 2025-01-10 22:22:43 -0500 | [diff] [blame] | 307 | [=] (const Data&, const ndn::security::ValidationError& err) { |
| 308 | NDN_LOG_DEBUG("announce " << name << " -> " << err); |
| 309 | done(ControlResponse(403, "Prefix announcement rejected: " + |
| 310 | boost::lexical_cast<std::string>(err.getCode()))); |
| 311 | }); |
jaczhi | b065768 | 2025-01-08 23:01:45 -0800 | [diff] [blame] | 312 | } |
| 313 | |
| 314 | void |
Davide Pesavento | a745025 | 2025-01-12 00:20:01 -0500 | [diff] [blame^] | 315 | RibManager::listEntries(ndn::mgmt::StatusDatasetContext& context) const |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 316 | { |
Junxiao Shi | 3f21e58 | 2017-05-29 15:26:32 +0000 | [diff] [blame] | 317 | auto now = time::steady_clock::now(); |
| 318 | for (const auto& kv : m_rib) { |
Davide Pesavento | 8a05c7f | 2019-02-28 02:26:19 -0500 | [diff] [blame] | 319 | const rib::RibEntry& entry = *kv.second; |
Junxiao Shi | 3f21e58 | 2017-05-29 15:26:32 +0000 | [diff] [blame] | 320 | ndn::nfd::RibEntry item; |
| 321 | item.setName(entry.getName()); |
| 322 | for (const Route& route : entry.getRoutes()) { |
| 323 | ndn::nfd::Route r; |
| 324 | r.setFaceId(route.faceId); |
| 325 | r.setOrigin(route.origin); |
| 326 | r.setCost(route.cost); |
| 327 | r.setFlags(route.flags); |
| 328 | if (route.expires) { |
| 329 | r.setExpirationPeriod(time::duration_cast<time::milliseconds>(*route.expires - now)); |
| 330 | } |
| 331 | item.addRoute(r); |
| 332 | } |
| 333 | context.append(item.wireEncode()); |
Vince Lehman | 76c751c | 2014-11-18 17:36:38 -0600 | [diff] [blame] | 334 | } |
Yanbiao Li | cf0db02 | 2016-01-29 00:54:25 -0800 | [diff] [blame] | 335 | context.end(); |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 336 | } |
| 337 | |
Junxiao Shi | 2173840 | 2016-08-19 19:48:00 +0000 | [diff] [blame] | 338 | ndn::mgmt::Authorization |
Davide Pesavento | 412c982 | 2021-07-02 00:21:05 -0400 | [diff] [blame] | 339 | RibManager::makeAuthorization(const std::string&) |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 340 | { |
Junxiao Shi | 2173840 | 2016-08-19 19:48:00 +0000 | [diff] [blame] | 341 | return [this] (const Name& prefix, const Interest& interest, |
Davide Pesavento | 45c1f6a | 2025-01-01 19:30:30 -0500 | [diff] [blame] | 342 | const ndn::mgmt::ControlParametersBase* params, |
Junxiao Shi | 2173840 | 2016-08-19 19:48:00 +0000 | [diff] [blame] | 343 | const ndn::mgmt::AcceptContinuation& accept, |
| 344 | const ndn::mgmt::RejectContinuation& reject) { |
| 345 | BOOST_ASSERT(params != nullptr); |
jaczhi | b065768 | 2025-01-08 23:01:45 -0800 | [diff] [blame] | 346 | BOOST_ASSERT(typeid(*params) == typeid(ndn::nfd::ControlParameters) || |
| 347 | typeid(*params) == typeid(ndn::nfd::RibAnnounceParameters)); |
Junxiao Shi | f4cfed1 | 2018-08-22 23:26:29 +0000 | [diff] [blame] | 348 | BOOST_ASSERT(prefix == LOCALHOST_TOP_PREFIX || prefix == LOCALHOP_TOP_PREFIX); |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 349 | |
Davide Pesavento | 5a89769 | 2019-10-31 01:28:43 -0400 | [diff] [blame] | 350 | auto& validator = prefix == LOCALHOST_TOP_PREFIX ? m_localhostValidator : m_localhopValidator; |
Junxiao Shi | 2173840 | 2016-08-19 19:48:00 +0000 | [diff] [blame] | 351 | validator.validate(interest, |
Davide Pesavento | 6d6f207 | 2022-09-12 23:08:34 -0400 | [diff] [blame] | 352 | [&interest, accept] (auto&&...) { accept(extractSigner(interest)); }, |
Davide Pesavento | 412c982 | 2021-07-02 00:21:05 -0400 | [diff] [blame] | 353 | [reject] (auto&&...) { reject(ndn::mgmt::RejectReply::STATUS403); }); |
Junxiao Shi | 2173840 | 2016-08-19 19:48:00 +0000 | [diff] [blame] | 354 | }; |
Vince Lehman | 26b215c | 2014-08-17 15:00:41 -0500 | [diff] [blame] | 355 | } |
| 356 | |
Junxiao Shi | 5ba7dfc | 2018-09-26 14:24:05 +0000 | [diff] [blame] | 357 | std::ostream& |
| 358 | operator<<(std::ostream& os, RibManager::SlAnnounceResult res) |
| 359 | { |
| 360 | switch (res) { |
Davide Pesavento | 5a89769 | 2019-10-31 01:28:43 -0400 | [diff] [blame] | 361 | case RibManager::SlAnnounceResult::OK: |
| 362 | return os << "OK"; |
| 363 | case RibManager::SlAnnounceResult::ERROR: |
| 364 | return os << "ERROR"; |
| 365 | case RibManager::SlAnnounceResult::VALIDATION_FAILURE: |
| 366 | return os << "VALIDATION_FAILURE"; |
| 367 | case RibManager::SlAnnounceResult::EXPIRED: |
| 368 | return os << "EXPIRED"; |
| 369 | case RibManager::SlAnnounceResult::NOT_FOUND: |
| 370 | return os << "NOT_FOUND"; |
Junxiao Shi | 5ba7dfc | 2018-09-26 14:24:05 +0000 | [diff] [blame] | 371 | } |
Davide Pesavento | 5a89769 | 2019-10-31 01:28:43 -0400 | [diff] [blame] | 372 | NDN_THROW(std::invalid_argument("Unknown SlAnnounceResult")); |
Junxiao Shi | 5ba7dfc | 2018-09-26 14:24:05 +0000 | [diff] [blame] | 373 | } |
| 374 | |
| 375 | RibManager::SlAnnounceResult |
| 376 | RibManager::getSlAnnounceResultFromRibUpdateResult(RibUpdateResult r) |
| 377 | { |
| 378 | switch (r) { |
| 379 | case RibUpdateResult::OK: |
| 380 | return SlAnnounceResult::OK; |
| 381 | case RibUpdateResult::ERROR: |
| 382 | return SlAnnounceResult::ERROR; |
| 383 | case RibUpdateResult::EXPIRED: |
| 384 | return SlAnnounceResult::EXPIRED; |
Junxiao Shi | 5ba7dfc | 2018-09-26 14:24:05 +0000 | [diff] [blame] | 385 | } |
Davide Pesavento | 5a89769 | 2019-10-31 01:28:43 -0400 | [diff] [blame] | 386 | NDN_CXX_UNREACHABLE; |
Junxiao Shi | 5ba7dfc | 2018-09-26 14:24:05 +0000 | [diff] [blame] | 387 | } |
| 388 | |
| 389 | void |
| 390 | RibManager::slAnnounce(const ndn::PrefixAnnouncement& pa, uint64_t faceId, |
| 391 | time::milliseconds maxLifetime, const SlAnnounceCallback& cb) |
| 392 | { |
| 393 | BOOST_ASSERT(pa.getData()); |
| 394 | |
Teng Liang | 18c2b29 | 2019-10-18 14:31:04 -0700 | [diff] [blame] | 395 | m_paValidator.validate(*pa.getData(), |
Junxiao Shi | 5ba7dfc | 2018-09-26 14:24:05 +0000 | [diff] [blame] | 396 | [=] (const Data&) { |
Davide Pesavento | a745025 | 2025-01-12 00:20:01 -0500 | [diff] [blame^] | 397 | auto now = time::steady_clock::now(); |
Junxiao Shi | 5ba7dfc | 2018-09-26 14:24:05 +0000 | [diff] [blame] | 398 | Route route(pa, faceId); |
Davide Pesavento | a745025 | 2025-01-12 00:20:01 -0500 | [diff] [blame^] | 399 | route.expires = std::min(route.annExpires, now + maxLifetime); |
| 400 | addRoute(pa.getAnnouncedName(), std::move(route), now, [=] (RibUpdateResult ribRes) { |
| 401 | auto res = getSlAnnounceResultFromRibUpdateResult(ribRes); |
| 402 | NFD_LOG_INFO("slAnnounce " << pa.getAnnouncedName() << " " << faceId << " -> " << res); |
| 403 | cb(res); |
| 404 | }); |
Junxiao Shi | 5ba7dfc | 2018-09-26 14:24:05 +0000 | [diff] [blame] | 405 | }, |
Davide Pesavento | 21e24f9 | 2025-01-10 22:22:43 -0500 | [diff] [blame] | 406 | [=] (const Data&, const ndn::security::ValidationError& err) { |
Teng Liang | a4e6ec3 | 2018-10-21 09:25:00 -0700 | [diff] [blame] | 407 | NFD_LOG_INFO("slAnnounce " << pa.getAnnouncedName() << " " << faceId << |
Davide Pesavento | 21e24f9 | 2025-01-10 22:22:43 -0500 | [diff] [blame] | 408 | " -> validation error: " << err); |
Junxiao Shi | 5ba7dfc | 2018-09-26 14:24:05 +0000 | [diff] [blame] | 409 | cb(SlAnnounceResult::VALIDATION_FAILURE); |
Davide Pesavento | 21e24f9 | 2025-01-10 22:22:43 -0500 | [diff] [blame] | 410 | }); |
Junxiao Shi | 5ba7dfc | 2018-09-26 14:24:05 +0000 | [diff] [blame] | 411 | } |
| 412 | |
| 413 | void |
| 414 | RibManager::slRenew(const Name& name, uint64_t faceId, time::milliseconds maxLifetime, |
| 415 | const SlAnnounceCallback& cb) |
| 416 | { |
| 417 | Route routeQuery; |
| 418 | routeQuery.faceId = faceId; |
| 419 | routeQuery.origin = ndn::nfd::ROUTE_ORIGIN_PREFIXANN; |
Teng Liang | a4e6ec3 | 2018-10-21 09:25:00 -0700 | [diff] [blame] | 420 | Route* oldRoute = m_rib.findLongestPrefix(name, routeQuery); |
| 421 | |
Junxiao Shi | 5ba7dfc | 2018-09-26 14:24:05 +0000 | [diff] [blame] | 422 | if (oldRoute == nullptr || !oldRoute->announcement) { |
Davide Pesavento | 21e24f9 | 2025-01-10 22:22:43 -0500 | [diff] [blame] | 423 | NFD_LOG_DEBUG("slRenew " << name << " " << faceId << " -> not found"); |
Junxiao Shi | 5ba7dfc | 2018-09-26 14:24:05 +0000 | [diff] [blame] | 424 | return cb(SlAnnounceResult::NOT_FOUND); |
| 425 | } |
| 426 | |
Davide Pesavento | a745025 | 2025-01-12 00:20:01 -0500 | [diff] [blame^] | 427 | auto now = time::steady_clock::now(); |
| 428 | Name routeName = oldRoute->announcement->getAnnouncedName(); |
Junxiao Shi | 5ba7dfc | 2018-09-26 14:24:05 +0000 | [diff] [blame] | 429 | Route route = *oldRoute; |
Davide Pesavento | a745025 | 2025-01-12 00:20:01 -0500 | [diff] [blame^] | 430 | route.expires = std::min(route.annExpires, now + maxLifetime); |
| 431 | |
| 432 | addRoute(routeName, std::move(route), now, [=] (RibUpdateResult ribRes) { |
| 433 | auto res = getSlAnnounceResultFromRibUpdateResult(ribRes); |
| 434 | NFD_LOG_INFO("slRenew " << name << " " << faceId << " -> " << res << " " << routeName); |
| 435 | cb(res); |
| 436 | }); |
Junxiao Shi | 5ba7dfc | 2018-09-26 14:24:05 +0000 | [diff] [blame] | 437 | } |
| 438 | |
| 439 | void |
| 440 | RibManager::slFindAnn(const Name& name, const SlFindAnnCallback& cb) const |
| 441 | { |
Davide Pesavento | 8a05c7f | 2019-02-28 02:26:19 -0500 | [diff] [blame] | 442 | shared_ptr<rib::RibEntry> entry; |
Junxiao Shi | 5ba7dfc | 2018-09-26 14:24:05 +0000 | [diff] [blame] | 443 | auto exactMatch = m_rib.find(name); |
| 444 | if (exactMatch != m_rib.end()) { |
| 445 | entry = exactMatch->second; |
| 446 | } |
| 447 | else { |
| 448 | entry = m_rib.findParent(name); |
| 449 | } |
| 450 | if (entry == nullptr) { |
Davide Pesavento | b7bfcb9 | 2022-05-22 23:55:23 -0400 | [diff] [blame] | 451 | return cb(std::nullopt); |
Junxiao Shi | 5ba7dfc | 2018-09-26 14:24:05 +0000 | [diff] [blame] | 452 | } |
| 453 | |
| 454 | auto pa = entry->getPrefixAnnouncement(); |
| 455 | pa.toData(m_keyChain); |
| 456 | cb(pa); |
| 457 | } |
| 458 | |
Vince Lehman | 26b215c | 2014-08-17 15:00:41 -0500 | [diff] [blame] | 459 | void |
Vince Lehman | cd613c5 | 2014-07-30 14:34:49 -0500 | [diff] [blame] | 460 | RibManager::fetchActiveFaces() |
| 461 | { |
| 462 | NFD_LOG_DEBUG("Fetching active faces"); |
| 463 | |
Weiwei Liu | 6e21cdb | 2016-09-29 15:16:23 -0700 | [diff] [blame] | 464 | m_nfdController.fetch<ndn::nfd::FaceDataset>( |
Davide Pesavento | ae43030 | 2023-05-11 01:42:46 -0400 | [diff] [blame] | 465 | [this] (auto&&... args) { removeInvalidFaces(std::forward<decltype(args)>(args)...); }, |
Davide Pesavento | 21e24f9 | 2025-01-10 22:22:43 -0500 | [diff] [blame] | 466 | [this] (uint32_t code, const std::string& reason) { |
| 467 | NFD_LOG_WARN("Failed to fetch face dataset (error " << code << ": " << reason << ")"); |
| 468 | scheduleActiveFaceFetch(ACTIVE_FACE_FETCH_INTERVAL); |
| 469 | }); |
Vince Lehman | cd613c5 | 2014-07-30 14:34:49 -0500 | [diff] [blame] | 470 | } |
| 471 | |
| 472 | void |
Davide Pesavento | 21e24f9 | 2025-01-10 22:22:43 -0500 | [diff] [blame] | 473 | RibManager::scheduleActiveFaceFetch(time::seconds timeToWait) |
Yanbiao Li | cf0db02 | 2016-01-29 00:54:25 -0800 | [diff] [blame] | 474 | { |
Davide Pesavento | 0a71dd3 | 2019-03-17 20:36:18 -0400 | [diff] [blame] | 475 | m_activeFaceFetchEvent = getScheduler().schedule(timeToWait, [this] { fetchActiveFaces(); }); |
Yanbiao Li | cf0db02 | 2016-01-29 00:54:25 -0800 | [diff] [blame] | 476 | } |
| 477 | |
| 478 | void |
Weiwei Liu | 6e21cdb | 2016-09-29 15:16:23 -0700 | [diff] [blame] | 479 | RibManager::removeInvalidFaces(const std::vector<ndn::nfd::FaceStatus>& activeFaces) |
Vince Lehman | cd613c5 | 2014-07-30 14:34:49 -0500 | [diff] [blame] | 480 | { |
Vince Lehman | 26b215c | 2014-08-17 15:00:41 -0500 | [diff] [blame] | 481 | NFD_LOG_DEBUG("Checking for invalid face registrations"); |
Vince Lehman | cd613c5 | 2014-07-30 14:34:49 -0500 | [diff] [blame] | 482 | |
Davide Pesavento | 5d64263 | 2023-10-03 00:36:08 -0400 | [diff] [blame] | 483 | std::set<uint64_t> activeIds; |
Davide Pesavento | d396b61 | 2017-02-20 22:11:50 -0500 | [diff] [blame] | 484 | for (const auto& faceStatus : activeFaces) { |
Davide Pesavento | 5d64263 | 2023-10-03 00:36:08 -0400 | [diff] [blame] | 485 | activeIds.insert(faceStatus.getFaceId()); |
Junxiao Shi | 78926c9 | 2015-02-28 22:56:06 -0700 | [diff] [blame] | 486 | } |
Davide Pesavento | 5d64263 | 2023-10-03 00:36:08 -0400 | [diff] [blame] | 487 | boost::asio::defer(getGlobalIoService(), |
| 488 | [this, active = std::move(activeIds)] { m_rib.beginRemoveFailedFaces(active); }); |
Vince Lehman | 26b215c | 2014-08-17 15:00:41 -0500 | [diff] [blame] | 489 | |
| 490 | // Reschedule the check for future clean up |
| 491 | scheduleActiveFaceFetch(ACTIVE_FACE_FETCH_INTERVAL); |
Vince Lehman | cd613c5 | 2014-07-30 14:34:49 -0500 | [diff] [blame] | 492 | } |
| 493 | |
| 494 | void |
Davide Pesavento | d396b61 | 2017-02-20 22:11:50 -0500 | [diff] [blame] | 495 | RibManager::onNotification(const ndn::nfd::FaceEventNotification& notification) |
Vince Lehman | cd613c5 | 2014-07-30 14:34:49 -0500 | [diff] [blame] | 496 | { |
Davide Pesavento | 21e24f9 | 2025-01-10 22:22:43 -0500 | [diff] [blame] | 497 | NFD_LOG_TRACE("Received notification " << notification); |
Yanbiao Li | cf0db02 | 2016-01-29 00:54:25 -0800 | [diff] [blame] | 498 | |
| 499 | if (notification.getKind() == ndn::nfd::FACE_EVENT_DESTROYED) { |
Davide Pesavento | 5d64263 | 2023-10-03 00:36:08 -0400 | [diff] [blame] | 500 | boost::asio::defer(getGlobalIoService(), |
| 501 | [this, id = notification.getFaceId()] { m_rib.beginRemoveFace(id); }); |
Yanbiao Li | cf0db02 | 2016-01-29 00:54:25 -0800 | [diff] [blame] | 502 | } |
| 503 | } |
| 504 | |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 505 | } // namespace nfd |