Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Junxiao Shi | cbc8e94 | 2016-09-06 03:17:45 +0000 | [diff] [blame] | 3 | * Copyright (c) 2014-2016, Regents of the University of California, |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -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. |
| 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 | |
| 26 | #include "generic-link-service.hpp" |
Junxiao Shi | cbc8e94 | 2016-09-06 03:17:45 +0000 | [diff] [blame] | 27 | #include <ndn-cxx/lp/tags.hpp> |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 28 | |
| 29 | namespace nfd { |
| 30 | namespace face { |
| 31 | |
| 32 | NFD_LOG_INIT("GenericLinkService"); |
| 33 | |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 34 | GenericLinkServiceCounters::GenericLinkServiceCounters(const LpReassembler& reassembler) |
| 35 | : nReassembling(reassembler) |
| 36 | { |
| 37 | } |
| 38 | |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 39 | GenericLinkService::Options::Options() |
| 40 | : allowLocalFields(false) |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 41 | , allowFragmentation(false) |
| 42 | , allowReassembly(false) |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 43 | { |
| 44 | } |
| 45 | |
| 46 | GenericLinkService::GenericLinkService(const GenericLinkService::Options& options) |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 47 | : GenericLinkServiceCounters(m_reassembler) |
| 48 | , m_options(options) |
| 49 | , m_fragmenter(m_options.fragmenterOptions, this) |
| 50 | , m_reassembler(m_options.reassemblerOptions, this) |
| 51 | , m_lastSeqNo(-2) |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 52 | { |
Junxiao Shi | 0de23a2 | 2015-12-03 20:07:02 +0000 | [diff] [blame] | 53 | m_reassembler.beforeTimeout.connect(bind([this] { ++this->nReassemblyTimeouts; })); |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 54 | } |
| 55 | |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 56 | void |
| 57 | GenericLinkService::doSendInterest(const Interest& interest) |
| 58 | { |
| 59 | lp::Packet lpPacket(interest.wireEncode()); |
Junxiao Shi | 0de23a2 | 2015-12-03 20:07:02 +0000 | [diff] [blame] | 60 | |
Eric Newberry | ee400b5 | 2016-11-24 14:12:48 +0000 | [diff] [blame] | 61 | encodeLpFields(interest, lpPacket); |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 62 | |
Junxiao Shi | 0de23a2 | 2015-12-03 20:07:02 +0000 | [diff] [blame] | 63 | this->sendNetPacket(std::move(lpPacket)); |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | void |
| 67 | GenericLinkService::doSendData(const Data& data) |
| 68 | { |
| 69 | lp::Packet lpPacket(data.wireEncode()); |
Junxiao Shi | 0de23a2 | 2015-12-03 20:07:02 +0000 | [diff] [blame] | 70 | |
Eric Newberry | ee400b5 | 2016-11-24 14:12:48 +0000 | [diff] [blame] | 71 | encodeLpFields(data, lpPacket); |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 72 | |
Junxiao Shi | 0de23a2 | 2015-12-03 20:07:02 +0000 | [diff] [blame] | 73 | this->sendNetPacket(std::move(lpPacket)); |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 74 | } |
| 75 | |
| 76 | void |
| 77 | GenericLinkService::doSendNack(const lp::Nack& nack) |
| 78 | { |
| 79 | lp::Packet lpPacket(nack.getInterest().wireEncode()); |
| 80 | lpPacket.add<lp::NackField>(nack.getHeader()); |
Junxiao Shi | 0de23a2 | 2015-12-03 20:07:02 +0000 | [diff] [blame] | 81 | |
Eric Newberry | ee400b5 | 2016-11-24 14:12:48 +0000 | [diff] [blame] | 82 | encodeLpFields(nack, lpPacket); |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 83 | |
Junxiao Shi | 0de23a2 | 2015-12-03 20:07:02 +0000 | [diff] [blame] | 84 | this->sendNetPacket(std::move(lpPacket)); |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 85 | } |
| 86 | |
Junxiao Shi | 0de23a2 | 2015-12-03 20:07:02 +0000 | [diff] [blame] | 87 | void |
Eric Newberry | ee400b5 | 2016-11-24 14:12:48 +0000 | [diff] [blame] | 88 | GenericLinkService::encodeLpFields(const ndn::TagHost& netPkt, lp::Packet& lpPacket) |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 89 | { |
Eric Newberry | ee400b5 | 2016-11-24 14:12:48 +0000 | [diff] [blame] | 90 | if (m_options.allowLocalFields) { |
| 91 | shared_ptr<lp::IncomingFaceIdTag> incomingFaceIdTag = netPkt.getTag<lp::IncomingFaceIdTag>(); |
| 92 | if (incomingFaceIdTag != nullptr) { |
| 93 | lpPacket.add<lp::IncomingFaceIdField>(*incomingFaceIdTag); |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | shared_ptr<lp::CongestionMarkTag> congestionMarkTag = netPkt.getTag<lp::CongestionMarkTag>(); |
| 98 | if (congestionMarkTag != nullptr) { |
| 99 | lpPacket.add<lp::CongestionMarkField>(*congestionMarkTag); |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 100 | } |
Spyridon Mastorakis | d0abae3 | 2016-12-06 15:20:19 -0800 | [diff] [blame] | 101 | |
| 102 | shared_ptr<lp::HopCountTag> hopCountTag = netPkt.getTag<lp::HopCountTag>(); |
| 103 | if (hopCountTag != nullptr) { |
| 104 | lpPacket.add<lp::HopCountTagField>(*hopCountTag); |
| 105 | } |
| 106 | else { |
| 107 | lpPacket.add<lp::HopCountTagField>(0); |
| 108 | } |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 109 | } |
| 110 | |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 111 | void |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 112 | GenericLinkService::sendNetPacket(lp::Packet&& pkt) |
| 113 | { |
| 114 | std::vector<lp::Packet> frags; |
| 115 | const ssize_t mtu = this->getTransport()->getMtu(); |
| 116 | if (m_options.allowFragmentation && mtu != MTU_UNLIMITED) { |
| 117 | bool isOk = false; |
| 118 | std::tie(isOk, frags) = m_fragmenter.fragmentPacket(pkt, mtu); |
| 119 | if (!isOk) { |
| 120 | // fragmentation failed (warning is logged by LpFragmenter) |
Junxiao Shi | 0de23a2 | 2015-12-03 20:07:02 +0000 | [diff] [blame] | 121 | ++this->nFragmentationErrors; |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 122 | return; |
| 123 | } |
| 124 | } |
| 125 | else { |
| 126 | frags.push_back(pkt); |
| 127 | } |
| 128 | |
| 129 | if (frags.size() > 1) { |
| 130 | // sequence is needed only if packet is fragmented |
Junxiao Shi | 0de23a2 | 2015-12-03 20:07:02 +0000 | [diff] [blame] | 131 | this->assignSequences(frags); |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 132 | } |
| 133 | else { |
| 134 | // even if indexed fragmentation is enabled, the fragmenter should not |
| 135 | // fragment the packet if it can fit in MTU |
| 136 | BOOST_ASSERT(frags.size() > 0); |
| 137 | BOOST_ASSERT(!frags.front().has<lp::FragIndexField>()); |
| 138 | BOOST_ASSERT(!frags.front().has<lp::FragCountField>()); |
| 139 | } |
| 140 | |
| 141 | for (const lp::Packet& frag : frags) { |
| 142 | Transport::Packet tp(frag.wireEncode()); |
| 143 | if (mtu != MTU_UNLIMITED && tp.packet.size() > static_cast<size_t>(mtu)) { |
Junxiao Shi | 0de23a2 | 2015-12-03 20:07:02 +0000 | [diff] [blame] | 144 | ++this->nOutOverMtu; |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 145 | NFD_LOG_FACE_WARN("attempt to send packet over MTU limit"); |
| 146 | continue; |
| 147 | } |
Junxiao Shi | 0de23a2 | 2015-12-03 20:07:02 +0000 | [diff] [blame] | 148 | this->sendPacket(std::move(tp)); |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 149 | } |
| 150 | } |
| 151 | |
| 152 | void |
| 153 | GenericLinkService::assignSequence(lp::Packet& pkt) |
| 154 | { |
| 155 | pkt.set<lp::SequenceField>(++m_lastSeqNo); |
| 156 | } |
| 157 | |
| 158 | void |
| 159 | GenericLinkService::assignSequences(std::vector<lp::Packet>& pkts) |
| 160 | { |
| 161 | std::for_each(pkts.begin(), pkts.end(), bind(&GenericLinkService::assignSequence, this, _1)); |
| 162 | } |
| 163 | |
| 164 | void |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 165 | GenericLinkService::doReceivePacket(Transport::Packet&& packet) |
| 166 | { |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 167 | try { |
Eric Newberry | a1939ba | 2015-10-09 12:35:03 -0700 | [diff] [blame] | 168 | lp::Packet pkt(packet.packet); |
| 169 | |
| 170 | if (!pkt.has<lp::FragmentField>()) { |
| 171 | NFD_LOG_FACE_TRACE("received IDLE packet: DROP"); |
| 172 | return; |
| 173 | } |
| 174 | |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 175 | if ((pkt.has<lp::FragIndexField>() || pkt.has<lp::FragCountField>()) && |
| 176 | !m_options.allowReassembly) { |
| 177 | NFD_LOG_FACE_WARN("received fragment, but reassembly disabled: DROP"); |
Eric Newberry | a1939ba | 2015-10-09 12:35:03 -0700 | [diff] [blame] | 178 | return; |
| 179 | } |
| 180 | |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 181 | bool isReassembled = false; |
| 182 | Block netPkt; |
| 183 | lp::Packet firstPkt; |
| 184 | std::tie(isReassembled, netPkt, firstPkt) = m_reassembler.receiveFragment(packet.remoteEndpoint, |
| 185 | pkt); |
| 186 | if (isReassembled) { |
| 187 | this->decodeNetPacket(netPkt, firstPkt); |
| 188 | } |
| 189 | } |
| 190 | catch (const tlv::Error& e) { |
| 191 | ++this->nInLpInvalid; |
| 192 | NFD_LOG_FACE_WARN("packet parse error (" << e.what() << "): DROP"); |
| 193 | } |
| 194 | } |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 195 | |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 196 | void |
| 197 | GenericLinkService::decodeNetPacket(const Block& netPkt, const lp::Packet& firstPkt) |
| 198 | { |
| 199 | try { |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 200 | switch (netPkt.type()) { |
| 201 | case tlv::Interest: |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 202 | if (firstPkt.has<lp::NackField>()) { |
| 203 | this->decodeNack(netPkt, firstPkt); |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 204 | } |
| 205 | else { |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 206 | this->decodeInterest(netPkt, firstPkt); |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 207 | } |
| 208 | break; |
| 209 | case tlv::Data: |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 210 | this->decodeData(netPkt, firstPkt); |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 211 | break; |
| 212 | default: |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 213 | ++this->nInNetInvalid; |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 214 | NFD_LOG_FACE_WARN("unrecognized network-layer packet TLV-TYPE " << netPkt.type() << ": DROP"); |
| 215 | return; |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 216 | } |
| 217 | } |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 218 | catch (const tlv::Error& e) { |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 219 | ++this->nInNetInvalid; |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 220 | NFD_LOG_FACE_WARN("packet parse error (" << e.what() << "): DROP"); |
| 221 | } |
| 222 | } |
| 223 | |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 224 | void |
| 225 | GenericLinkService::decodeInterest(const Block& netPkt, const lp::Packet& firstPkt) |
| 226 | { |
| 227 | BOOST_ASSERT(netPkt.type() == tlv::Interest); |
| 228 | BOOST_ASSERT(!firstPkt.has<lp::NackField>()); |
| 229 | |
| 230 | // forwarding expects Interest to be created with make_shared |
| 231 | auto interest = make_shared<Interest>(netPkt); |
| 232 | |
Spyridon Mastorakis | d0abae3 | 2016-12-06 15:20:19 -0800 | [diff] [blame] | 233 | // Increment HopCount |
| 234 | if (firstPkt.has<lp::HopCountTagField>()) { |
| 235 | interest->setTag(make_shared<lp::HopCountTag>(firstPkt.get<lp::HopCountTagField>() + 1)); |
| 236 | } |
| 237 | |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 238 | if (firstPkt.has<lp::NextHopFaceIdField>()) { |
| 239 | if (m_options.allowLocalFields) { |
Junxiao Shi | 0de23a2 | 2015-12-03 20:07:02 +0000 | [diff] [blame] | 240 | interest->setTag(make_shared<lp::NextHopFaceIdTag>(firstPkt.get<lp::NextHopFaceIdField>())); |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 241 | } |
| 242 | else { |
| 243 | NFD_LOG_FACE_WARN("received NextHopFaceId, but local fields disabled: DROP"); |
| 244 | return; |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | if (firstPkt.has<lp::CachePolicyField>()) { |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 249 | ++this->nInNetInvalid; |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 250 | NFD_LOG_FACE_WARN("received CachePolicy with Interest: DROP"); |
| 251 | return; |
| 252 | } |
| 253 | |
| 254 | if (firstPkt.has<lp::IncomingFaceIdField>()) { |
| 255 | NFD_LOG_FACE_WARN("received IncomingFaceId: IGNORE"); |
| 256 | } |
| 257 | |
Eric Newberry | ee400b5 | 2016-11-24 14:12:48 +0000 | [diff] [blame] | 258 | if (firstPkt.has<lp::CongestionMarkField>()) { |
| 259 | interest->setTag(make_shared<lp::CongestionMarkTag>(firstPkt.get<lp::CongestionMarkField>())); |
| 260 | } |
| 261 | |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 262 | this->receiveInterest(*interest); |
| 263 | } |
| 264 | |
| 265 | void |
| 266 | GenericLinkService::decodeData(const Block& netPkt, const lp::Packet& firstPkt) |
| 267 | { |
| 268 | BOOST_ASSERT(netPkt.type() == tlv::Data); |
| 269 | |
| 270 | // forwarding expects Data to be created with make_shared |
| 271 | auto data = make_shared<Data>(netPkt); |
| 272 | |
Spyridon Mastorakis | d0abae3 | 2016-12-06 15:20:19 -0800 | [diff] [blame] | 273 | if (firstPkt.has<lp::HopCountTagField>()) { |
| 274 | data->setTag(make_shared<lp::HopCountTag>(firstPkt.get<lp::HopCountTagField>() + 1)); |
| 275 | } |
| 276 | |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 277 | if (firstPkt.has<lp::NackField>()) { |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 278 | ++this->nInNetInvalid; |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 279 | NFD_LOG_FACE_WARN("received Nack with Data: DROP"); |
| 280 | return; |
| 281 | } |
| 282 | |
| 283 | if (firstPkt.has<lp::NextHopFaceIdField>()) { |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 284 | ++this->nInNetInvalid; |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 285 | NFD_LOG_FACE_WARN("received NextHopFaceId with Data: DROP"); |
| 286 | return; |
| 287 | } |
| 288 | |
| 289 | if (firstPkt.has<lp::CachePolicyField>()) { |
| 290 | if (m_options.allowLocalFields) { |
Junxiao Shi | 0de23a2 | 2015-12-03 20:07:02 +0000 | [diff] [blame] | 291 | // In case of an invalid CachePolicyType, get<lp::CachePolicyField> will throw, |
| 292 | // so it's unnecessary to check here. |
| 293 | data->setTag(make_shared<lp::CachePolicyTag>(firstPkt.get<lp::CachePolicyField>())); |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 294 | } |
| 295 | else { |
| 296 | NFD_LOG_FACE_WARN("received CachePolicy, but local fields disabled: IGNORE"); |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | if (firstPkt.has<lp::IncomingFaceIdField>()) { |
| 301 | NFD_LOG_FACE_WARN("received IncomingFaceId: IGNORE"); |
| 302 | } |
| 303 | |
Eric Newberry | ee400b5 | 2016-11-24 14:12:48 +0000 | [diff] [blame] | 304 | if (firstPkt.has<lp::CongestionMarkField>()) { |
| 305 | data->setTag(make_shared<lp::CongestionMarkTag>(firstPkt.get<lp::CongestionMarkField>())); |
| 306 | } |
| 307 | |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 308 | this->receiveData(*data); |
| 309 | } |
| 310 | |
| 311 | void |
| 312 | GenericLinkService::decodeNack(const Block& netPkt, const lp::Packet& firstPkt) |
| 313 | { |
| 314 | BOOST_ASSERT(netPkt.type() == tlv::Interest); |
| 315 | BOOST_ASSERT(firstPkt.has<lp::NackField>()); |
| 316 | |
| 317 | lp::Nack nack((Interest(netPkt))); |
| 318 | nack.setHeader(firstPkt.get<lp::NackField>()); |
| 319 | |
| 320 | if (firstPkt.has<lp::NextHopFaceIdField>()) { |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 321 | ++this->nInNetInvalid; |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 322 | NFD_LOG_FACE_WARN("received NextHopFaceId with Nack: DROP"); |
| 323 | return; |
| 324 | } |
| 325 | |
| 326 | if (firstPkt.has<lp::CachePolicyField>()) { |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 327 | ++this->nInNetInvalid; |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 328 | NFD_LOG_FACE_WARN("received CachePolicy with Nack: DROP"); |
| 329 | return; |
| 330 | } |
| 331 | |
| 332 | if (firstPkt.has<lp::IncomingFaceIdField>()) { |
| 333 | NFD_LOG_FACE_WARN("received IncomingFaceId: IGNORE"); |
| 334 | } |
| 335 | |
Eric Newberry | ee400b5 | 2016-11-24 14:12:48 +0000 | [diff] [blame] | 336 | if (firstPkt.has<lp::CongestionMarkField>()) { |
| 337 | nack.setTag(make_shared<lp::CongestionMarkTag>(firstPkt.get<lp::CongestionMarkField>())); |
| 338 | } |
| 339 | |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 340 | this->receiveNack(nack); |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 341 | } |
| 342 | |
| 343 | } // namespace face |
| 344 | } // namespace nfd |