Project

General

Profile

NDNLPv2 » History » Version 43

Teng Liang, 09/07/2018 05:11 PM

1 1 Junxiao Shi
# NDNLPv2
2 2 Alex Afanasyev
3 16 Junxiao Shi
NDNLPv2 is a link protocol for [Named Data Networking](https://named-data.net/).
4 2 Alex Afanasyev
5
## Goals
6
7
NDNLPv2 provides the following **features**:
8
9
* fragmentation and reassembly: fragment a network layer packet to fit in link MTU
10
* failure detection: rapidly detect link failure and recovery
11
* reliability: reduce packet loss
12
* integrity: prevent packet injection
13
* forwarding instruction: NACK, nexthop choice, cache control, etc
14
* packet information: for management and monitoring
15
16
NDNLPv2 is designed to be a **unified protocol** that can be used on all kinds of links, including but not limited to: UNIX sockets, Ethernet unicast/multicast, UDP unicast/multicast, TCP connections, WebSockets, etc.
17
18
NDNLPv2 protocol operates as a **link adaptation layer**; it is above link layer and below network layer.
19
Please, do not call this "layer 2.5": there is no such notion in RFC protocols.
20
21
Different links need different features, or different designs of a feature.
22 1 Junxiao Shi
NDNLPv2 ensures **all features are optional** and can be turned on or off per-link.
23 2 Alex Afanasyev
NDNLPv2 also allows different designs of a feature to be adopted per-link.
24
25 16 Junxiao Shi
NDNLPv2 deprecates and replaces: [original NDNLP (aka NDNLPv1)](https://named-data.net/publications/techreports/trlinkprotocol/), [NDNLPv1 multicast extension](https://github.com/NDN-Routing/NDNFD/blob/master/docs/NDNLP.md), [NDNLPv1-TLV](https://redmine.named-data.net/projects/nfd/wiki/NDNLP-TLV/7), [NDNLP-BFD](https://redmine.named-data.net/attachments/download/231/NDNLP-BFDSummaryReport.pdf), [NFD LocalControlHeader](https://redmine.named-data.net/projects/nfd/wiki/LocalControlHeader/25).
26 2 Alex Afanasyev
27
## NDNLP Packet Format
28
29 16 Junxiao Shi
NDNLPv2 packet adopts a Type-Length-Value (TLV) structure similar to [NDN Packet Format](https://named-data.net/doc/ndn-tlv/tlv.html).
30 2 Alex Afanasyev
31 1 Junxiao Shi
    LpPacket ::= LP-PACKET-TYPE TLV-LENGTH
32 2 Alex Afanasyev
                   LpHeaderField*
33
                   Fragment?
34
35 17 Davide Pesavento
    LpHeaderField ::= .. | Sequence
36
37
    Sequence ::= SEQUENCE-TYPE TLV-LENGTH
38
                   fixed-width unsigned integer
39
40
    Fragment ::= FRAGMENT-TYPE TLV-LENGTH
41
                   byte+
42
43 2 Alex Afanasyev
Outermost packet transmitted on a NDNLPv2 link is LpPacket.
44 16 Junxiao Shi
In addition, a host MUST also accept bare network packets (Interest and Data) on a NDNLPv2 link, which SHOULD be interpreted as an LpPacket with the bare network packet as its Fragment. However, such packets could be dropped later in processing if the link configured to require a certain NDNLPv2 feature but a field is missing.
45 2 Alex Afanasyev
46
**LpHeaderField** is a repeatable optional structure in LpHeader.
47
NDNLPv2 features MAY add new header fields by extending the definition of LpHeaderField.
48
Unless otherwise specified, the same field shall appear at most once.
49
Unless otherwise specified, fields MUST appear in the order of increasing TLV-TYPE codes.
50
51
If an incoming LpPacket contains an unknown LpHeaderField, the following rules apply:
52
53 27 Davide Pesavento
1. if the unknown field is in the range `[800, 959]` and the two least significant bits are both zero, the receiver SHOULD ignore the field and continue processing the packet;
54 2 Alex Afanasyev
2. otherwise, the receiver MUST drop the packet, but SHOULD NOT consider the link has an error.
55
56 27 Davide Pesavento
Note: if a field is recognized but the relevant feature is disabled, it's not considered "unknown".
57 2 Alex Afanasyev
58
**Sequence** contains a sequence number that is useful in multiple features.
59
This field is REQUIRED if any enabled feature is using sequence numbers, otherwise it's OPTIONAL.
60
Bit width of the sequence is determined on a per-link basis; 8-octet is recommended for today's links.
61
A host MUST generate consecutive sequence numbers for outgoing packets on the same face.
62
63
**Fragment** contains a fragment of one or more network layer packets.
64 1 Junxiao Shi
The fragmentation and reassembly feature defines how Fragment field is constructed and interpreted.
65 2 Alex Afanasyev
When fragmentation and reassembly feature is disabled, the Fragment field contains a whole network layer packet.
66 14 Davide Pesavento
Fragment is OPTIONAL; an LpPacket without Fragment is an **IDLE packet**.
67 1 Junxiao Shi
68 2 Alex Afanasyev
## Indexed Fragmentation
69
70 14 Davide Pesavento
Indexed fragmentation provides fragmentation and reassembly feature on datagram links that do not guarantee in-order delivery.
71 2 Alex Afanasyev
72
This feature defines two header fields:
73
74
    LpHeaderField ::= .. | FragIndex | FragCount
75
76
    FragIndex ::= FRAG-INDEX-TYPE TLV-LENGTH
77
                    nonNegativeInteger
78 1 Junxiao Shi
79
    FragCount ::= FRAG-COUNT-TYPE TLV-LENGTH
80 2 Alex Afanasyev
                    nonNegativeInteger
81
82 14 Davide Pesavento
The sender slices a network layer packet into one or more fragments.
83
The size of each fragment MUST be small enough so that the LpPacket carrying every fragment is below the link MTU.
84 2 Alex Afanasyev
It is RECOMMENDED that all except the last fragments have the same size.
85
86
**FragCount** field indicates the number of fragments belonging to the same network layer packet.
87
It MUST be the same in all fragments belonging to the same network layer packet.
88
89
**FragIndex** field indicates the zero-based index of the current packet.
90
It MUST be assigned consecutively for fragments belonging to the same network layer packet, starting from zero.
91
The feature is named "indexed fragmentation" because every fragment is given an index in this field.
92
93
**Sequence** field is REQUIRED when this feature is enabled.
94
Fragments belonging to the same network layer packet MUST be assigned consecutive sequence numbers, in the same order with FragIndex.
95
96
For example, a 5000-octet network layer packet may be sliced as illustrated:
97
98
    +-------------+-------------+    +-------------+-------------+
99
    | LpPacket    | Fragment    |    | LpPacket    | Fragment    |
100
    | seq=8801    |             |    | seq=8802    |             |
101
    | FragIndex=0 | [0:1400]    |    | FragIndex=1 | [1400:2800] |
102
    | FragCount=4 |             |    | FragCount=4 |             |
103
    +-------------+-------------+    +-------------+-------------+
104
105
    +-------------+-------------+    +-------------+-------------+
106 1 Junxiao Shi
    | LpPacket    | Fragment    |    | LpPacket    | Fragment    |
107 2 Alex Afanasyev
    | seq=8803    |             |    | seq=8804    |             |
108
    | FragIndex=2 | [2800:4200] |    | FragIndex=3 | [4200:5000] |
109
    | FragCount=4 |             |    | FragCount=4 |             |
110
    +-------------+-------------+    +-------------+-------------+
111 1 Junxiao Shi
112 14 Davide Pesavento
The receiver stores fragments in a *PartialMessageStore* data structure, which is a collection of PartialMessages, indexed by MessageIdentifier=Sequence-FragIndex.
113 1 Junxiao Shi
Since both Sequence and FragIndex are assigned consecutively, MessageIdentifier would be the sequence number of the first fragment of a network layer packet.
114 14 Davide Pesavento
After collecting all fragments belonging to a network layer packet, the receiver stitches them together, and delivers the complete network layer packet to the upper layer.
115 2 Alex Afanasyev
116 14 Davide Pesavento
The receiver SHOULD maintain a reassembly timer for each PartialMessage, which is reset each time a new fragment is received.
117 2 Alex Afanasyev
If this timer expires, the PartialMessage is dropped.
118 14 Davide Pesavento
The default duration of this timer is 500ms.
119 2 Alex Afanasyev
120 14 Davide Pesavento
If this feature is enabled but FragIndex is missing, it is assumed to be 0 (zero).
121
If this feature is enabled but FragCount is missing, it is assumed to be 1 (one).
122 2 Alex Afanasyev
If this feature is disabled but either header field is received, the packet MUST be dropped.
123
124 14 Davide Pesavento
Unless otherwise specified, header fields from other features MUST appear only in the first fragment.
125
If a header field appears on a subsequent fragment, it MUST be ignored, unless otherwise specified.
126 2 Alex Afanasyev
127
## Network NACK
128
129
A network NACK is a forwarding instruction from upstream to downstream that indicates the upstream is unable to satisfy an Interest.
130
131
This feature defines a header field:
132
133
    LpHeaderField ::= .. | Nack
134
135
    Nack ::= NACK-TYPE TLV-LENGTH
136
               NackReason?
137
138
    NackReason ::= NACK-REASON-TYPE TLV-LENGTH
139
                     nonNegativeInteger
140
141
**Nack** header field indicates an Interest is a NACK, and is not a normal Interest.
142
The receiver MUST NOT process the packet as an Interest.
143
144
**NackReason** element MAY be included to indicate why the NACK is transmitted.  
145
The following NackReason values are defined:
146
147
Code  | Reason       | Description
148
----- | ------------ | --------------------------------------------------------------
149
0     | None         | (reserved)
150
50    | Congestion   | there is a congestion in the link between upstream and downstream, or on the best-known path between upstream and content source
151
100   | Duplicate    | the upstream has detected a duplicate Nonce in the Interest sent by the downstream
152
150   | NoRoute      | the upstream has no path to reach a content source due to routing problem or link failure
153
154
A receiver MUST be prepared to process a NACK without a reason.  
155
If NackReason element contains an unrecognized reason, the receiver MUST treat this NACK as a NACK without reason, and MUST NOT drop the packet.
156
157
Example of NACK of an Interest for `/example` with NACK reason "Duplicate":
158
159
    +--------------------------+---------------+
160
    | LpPacket                 | Interest      |
161
    |                          | Name=/example |
162
    | +-Nack-----------------+ | Nonce=35      |
163
    | | NackReason=Duplicate | |               |
164
    | +----------------------+ |               |
165
    +--------------------------+---------------+
166
167
It's RECOMMENDED to enable this feature on every link.  
168
If this feature is disabled but Nack is received, the packet MUST be dropped.
169
170
Nack header field is permitted only on an LpPacket carrying an Interest.  
171
When Nack appears on an LpPacket carrying a network layer packet other than an Interest, the packet MUST be dropped.
172
173 13 Davide Pesavento
## Consumer-Controlled Forwarding
174 2 Alex Afanasyev
175 13 Davide Pesavento
Consumer-controlled forwarding allows a local consumer application to explicitly specify the nexthop face to forward an Interest.
176 2 Alex Afanasyev
177
This feature defines a header field:
178
179
    LpHeaderField ::= .. | NextHopFaceId
180
181
    NextHopFaceId ::= NEXT-HOP-FACE-ID-TYPE TLV-LENGTH
182
                        nonNegativeInteger
183
184
**NextHopFaceId** indicates the nexthop FaceId to which an Interest should be forwarded.
185
A local consumer application MAY add this field to an LpPacket carrying an Interest.
186
The local forwarder SHOULD follow this instruction and forward the Interest to the specified nexthop, after ContentStore lookup does not find a match.
187
188
This feature is designed to be used on local faces only.
189 1 Junxiao Shi
It SHOULD NOT be enabled on non-local faces.
190 2 Alex Afanasyev
If this feature is enabled but NextHopFaceId refers to a non-existent face, the Interest SHOULD be processed as if there is no available route.
191
If this feature is disabled but NextHopFaceId is received, the packet SHOULD be dropped, or this field MUST be ignored.
192
193
NextHopFaceId header field is permitted only on an LpPacket carrying an Interest, from an application to the forwarder.
194
When NextHopFaceId appears on an LpPacket carrying a network layer packet other than an Interest, the packet MUST be dropped.
195 16 Junxiao Shi
When NextHopFaceId appears on an LpPacket that has a Nack header field, the packet SHOULD be dropped.
196 2 Alex Afanasyev
When NextHopFaceId is received by an application from a forwarder, this field MUST be ignored.
197
198
## Local Cache Policy
199
200
Local cache policy feature allows a local producer application to instruct ContentStore on whether and how to cache a Data packet.
201
202
This feature defines a header field:
203
204
    LpHeaderField ::= .. | CachePolicy
205
206
    CachePolicy ::= CACHE-POLICY-TYPE TLV-LENGTH
207
                      CachePolicyType
208
209
    CachePolicyType ::= CACHE-POLICY-TYPE-TYPE TLV-LENGTH
210
                          nonNegativeInteger
211
212
**CachePolicy** header field gives a suggestion to the ContentStore.
213
The ContentStore MAY follow this suggestion.
214
215
**CachePolicyType** element MUST be included to indicate the suggestion.
216
The following CachePolicyType values are defined:
217
218
Code | Policy  | Description
219
-----|---------|--------------------------------
220
0    | None    | (reserved)
221
1    | NoCache | ContentStore SHOULD NOT admit the Data packet
222
223
If CachePolicyType field contains an unknown policy code, the forwarder SHOULD drop the packet.
224
225
The design places the policy code in the CachePolicyType element nested under CachePolicy, instead of having the code appear directly in CachePolicy header field, because in the future other policies that require additional arguments can be defined, and those arguments can appear as elements after CachePolicyType.
226
227
Example for a Data packet with "NoCache" policy:
228
229
    +-----------------------------+---------------+
230
    | LpPacket                    | Data          |
231
    |                             | Name=/example |
232
    | +-CachePolicy-------------+ | Content=xxxx  |
233
    | | CachePolicyType=NoCache | | Signature=xx  |
234
    | +-------------------------+ |               |
235
    +-----------------------------+---------------+
236
237
This feature is designed to be used on local faces only.
238
It SHOULD NOT be enabled on non-local faces.
239
If this feature is disabled but CachePolicy is received, this field MUST be ignored.
240
241
CachePolicy header field is permitted only on an LpPacket carrying a Data packet, from an application to the forwarder.
242
When CachePolicy header field appears on an LpPacket carrying a network layer packet other than a Data packet, the packet MUST be dropped.
243
When CachePolicy is received by an application from a forwarder, this field MUST be ignored.
244
245
## Incoming Face Indication
246
247
Incoming face indication feature allows the forwarder to inform local applications about the face on which a packet is received.
248
249
This feature defines a header field:
250
251
    LpHeaderField ::= .. | IncomingFaceId
252
253
    IncomingFaceId ::= INCOMING-FACE-ID-TYPE TLV-LENGTH
254
                         nonNegativeInteger
255
256
**IncomingFaceId** contains the FaceId from which the network layer packet is received.
257
When this feature is enabled, the forwarder SHOULD attach this field to every network layer packet going to a local application, and indicate the FaceId on which this network layer packet is received by the forwarder.
258
If a Data packet comes from the ContentStore, IncomingFaceId SHOULD contain a special FaceId that represents the ContentStore, rather than the FaceId on which this Data packet was originally received.
259
Even if this feature is enabled, the application MUST be prepared to receive a packet without IncomingFaceId field.
260
261
This feature is designed to be used on local faces only.
262
It SHOULD NOT be enabled on non-local faces.
263
264
IncomingFaceId header field is permitted only on an LpPacket from the forwarder to an application.
265
When IncomingFaceId is received by the forwarder from an application, this field MUST be ignored.
266 1 Junxiao Shi
267 6 Eric Newberry
## Congestion Marks
268 5 Eric Newberry
269 7 Anonymous
A host can signal the current congestion state to other hosts using the **CongestionMark** field. A value of 0 indicates *no congestion*; a value greater than 0 indicates some level of congestion. The exact meaning of the bits in this field is left up to the congestion control strategy in use.
270 5 Eric Newberry
271
This features defines a header field:
272 1 Junxiao Shi
273 5 Eric Newberry
    LpHeaderField ::= .. | CongestionMark
274
275 1 Junxiao Shi
    CongestionMark ::= CONGESTION-MARK-TYPE TLV-LENGTH
276 5 Eric Newberry
                         nonNegativeInteger
277
278 9 Eric Newberry
## Link Layer Reliability
279
280 10 Eric Newberry
To provide increased reliability and indicate potential congestion on a unicast link, a sender can expect frames successfully received by another host to be acknowledged.
281 9 Eric Newberry
282 11 Eric Newberry
After sending a link-layer frame (potentially fragmented, as described above), a host will expect an Ack field to be received on a frame returned in the opposite direction. This field will contain the TxSequence of the acknowledged frame. TxSequence numbers are assigned sequentially on the link, and are independent of the sequence number of the stored fragment. If the host does not receive this acknowledgement within the RTO (determined using the formula described below) and the frame has not been retransmitted more than a pre-determined number of times (the maximum number of retransmissions), the frame will be retransmitted on the link with the same sequence number, but a new TxSequence. In addition, if a configurable number of Acks (three by default) for greater TxSequences are received by the sender of the frame, the frame will be considered lost and the previously discussed retransmission logic will be followed.
283 9 Eric Newberry
284
Every time a frame is retransmitted, a notification signal (`onLoss()`) will be called to alert the forwarding strategy that the link may be congested. If a frame exceeds the maximum number of retransmissions, a different notification signal (`onGiveUp()`) will be used.
285
286 14 Davide Pesavento
To facilitate the retransmission of frames, each frame will be cached on the sender until it is acknowledged, at which point it can be deleted from the cache. The sender also keeps track of which frames were fragmented from which network-layer packet (if fragmentation occurred) and which unacknowledged TxSequences reference which transmitted frame. If one fragment of a network-layer packet exceeds the maximum number of retransmissions, the RTO timers of all fragments in the packet will be cancelled, all fragments of the packet will be deleted from the frame cache, and the entire packet will be considered lost. The sender will keep track of which sequence numbers are associated with which network-layer packets.
287 9 Eric Newberry
288 15 Eric Newberry
The receiver will extract the TxSequence of every received frame and will insert these numbers into a queue of pending Acks destined for the sender. When a frame is being transmitted in the opposite direction, any excess space under the MTU will be filled with TxSequences removed from this queue. An idle Ack timer is used to handle links that have gone idle. If a packet with a TxSequence is received and the packet has not been started, or has expired, the timer is started with a period of 5ms (or another configurable non-zero time period). Upon expiration of the timer, all Acks in the queue will be sent in IDLE packets.
289 9 Eric Newberry
290 14 Davide Pesavento
The RTO is determined using the standard TCP formula: `RTO = SRTT + 4 * RTTVAR`. The round-trip time (RTT) of a packet is measured as the difference between the time the frame was transmitted and when an Ack was received for it. Frames that have been retransmitted are not taken into account by this formula.
291 9 Eric Newberry
292 11 Eric Newberry
Multiple Ack fields can be sent in one LpPacket. If an Ack is received for an unknown TxSequence, the Ack will be ignored.
293 9 Eric Newberry
294 12 Eric Newberry
    LpHeaderField ::= .. | TxSequence | Ack
295
296
    TxSequence ::= TX-SEQUENCE-TYPE TLV-LENGTH
297
                     fixed-width unsigned integer
298 1 Junxiao Shi
299
    Ack ::= ACK-TYPE TLV-LENGTH
300 9 Eric Newberry
              fixed-width unsigned integer
301
302 1 Junxiao Shi
**Modified from "Hop-By-Hop Best Effort Link Layer Reliability in Named Data Networking" by S. Vusirikala, et al.**
303 9 Eric Newberry
304 23 Junxiao Shi
## Self-Learning Forwarding Protocol Support
305 1 Junxiao Shi
306 23 Junxiao Shi
[NDN self-learning](https://named-data.net/publications/on_broadcast-based_self-learning_ndn/) is a forwarding protocol that can automatically discover contents and forwarding paths in local area networks. This feature adds two hop-by-hop headers to support this forwarding protocol.
307 1 Junxiao Shi
308 23 Junxiao Shi
    LpHeaderField ::= .. | NonDiscovery | PrefixAnnouncement
309
310
    NonDiscovery ::= NON-DISCOVERY-TYPE TLV-LENGTH(=0)
311 1 Junxiao Shi
                       // no value
312
313 23 Junxiao Shi
    PrefixAnnouncement ::= PREFIX-ANNOUNCEMENT-TYPE TLV-LENGTH
314 34 Davide Pesavento
                             Data
315 28 Teng Liang
316 23 Junxiao Shi
Self-learning distinguishes an Interest as either "discovery" or "non-discovery". A node transmits a discovery Interest to explore new forwarding paths, or transmits a non-discovery Interest to exploit existing forwarding paths. The **NonDiscovery** field indicates an Interest is "non-discovery"; otherwise, an Interest without this field is "discovery".
317
This field can only appear on an Interest. If this field appears on a Data or a Nack, the LpPacket MUST be dropped. If the self-learning forwarding protocol support feature is disabled or the chosen forwarding strategy does not support self-learning, this field SHOULD be ignored.
318
319 43 Teng Liang
When replying to a discovery Interest, the upstream node SHOULD transmit the Data with a **PrefixAnnouncementHeader** field. This field indicates what name prefix the producer is serving, and assists the downstream node in updating its FIB. A PrefixAnnouncement contains a single Data TLV element, and the Data format follows the [[PrefixAnnouncement]] Protocol.
320 42 Davide Pesavento
321 43 Teng Liang
 
322 41 Teng Liang
This field can only appear on a Data. If this field appears on an Interest or a Nack, the LpPacket MUST be dropped. If the self-learning forwarding protocol support feature is disabled or the chosen forwarding strategy does not support self-learning, this field SHOULD be ignored.
323 22 Teng Liang
324 16 Junxiao Shi
## TLV-TYPE Number Assignments
325 2 Alex Afanasyev
326 26 Davide Pesavento
type                     | number (dec)     | number (hex)
327
-------------------------|------------------|------------------
328 25 Junxiao Shi
Fragment                 | 80               | 0x50
329
Sequence                 | 81               | 0x51
330 1 Junxiao Shi
FragIndex                | 82               | 0x52
331
FragCount                | 83               | 0x53
332 25 Junxiao Shi
HopCount (ndnSIM)        | 84               | 0x54
333 26 Davide Pesavento
PitToken (NIST, #4432)   | 98               | 0x62
334
LpPacket                 | 100              | 0x64
335 25 Junxiao Shi
Nack                     | 800              | 0x0320
336
NackReason               | 801              | 0x0321
337
NextHopFaceId            | 816              | 0x0330
338
IncomingFaceId           | 817              | 0x0331
339
CachePolicy              | 820              | 0x0334
340
CachePolicyType          | 821              | 0x0335
341
CongestionMark           | 832              | 0x0340
342
Ack                      | 836              | 0x0344
343
TxSequence               | 840              | 0x0348
344 20 Davide Pesavento
NonDiscovery             | 844              | 0x034C
345 25 Junxiao Shi
PrefixAnnouncement       | 848              | 0x0350
346 2 Alex Afanasyev
347
### Reserved Blocks
348
349 16 Junxiao Shi
Two blocks of TLV-TYPE number have been reserved by link protocols:
350 2 Alex Afanasyev
351 27 Davide Pesavento
* `[80, 100]`: 1-octet encoding
352
* `[800, 1000]`: 3-octet encoding
353 2 Alex Afanasyev
354 16 Junxiao Shi
TLV-TYPE numbers for LpHeaderField SHOULD be assigned according to the following rules:
355 2 Alex Afanasyev
356 27 Davide Pesavento
1. if the field can be safely ignored by a receiver that doesn't understand the field, pick an unused number in the range `[800, 959]` whose two least significant bits are `00`.
357
2. if the field would occur frequently, pick an unused number in the range `[81, 99]`.
358
3. otherwise, pick an unused number in the range `[800, 959]` whose two least significant bits are `01`.
359 2 Alex Afanasyev
360 16 Junxiao Shi
Note: number assignment for a TLV-TYPE nested within a LpHeaderField is not restricted by the above rules.