idnits 2.17.1 draft-ietf-babel-rfc6126bis-09.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- == There are 1 instance of lines with multicast IPv4 addresses in the document. If these are generic example addresses, they should be changed to use the 233.252.0.x range defined in RFC 5771 -- The draft header indicates that this document obsoletes RFC7557, but the abstract doesn't seem to mention this, which it should. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (May 7, 2019) is 1808 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Outdated reference: A later version (-10) exists of draft-ietf-babel-dtls-04 == Outdated reference: A later version (-12) exists of draft-ietf-babel-hmac-04 Summary: 0 errors (**), 0 flaws (~~), 4 warnings (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group J. Chroboczek 3 Internet-Draft IRIF, University of Paris-Diderot 4 Obsoletes: 6126,7557 (if approved) D. Schinazi 5 Intended status: Standards Track Google LLC 6 Expires: November 8, 2019 May 7, 2019 8 The Babel Routing Protocol 9 draft-ietf-babel-rfc6126bis-09 11 Abstract 13 Babel is a loop-avoiding distance-vector routing protocol that is 14 robust and efficient both in ordinary wired networks and in wireless 15 mesh networks. This document describes the Babel routing protocol, 16 and obsoletes RFCs 6126 and 7557. 18 Status of This Memo 20 This Internet-Draft is submitted in full conformance with the 21 provisions of BCP 78 and BCP 79. 23 Internet-Drafts are working documents of the Internet Engineering 24 Task Force (IETF). Note that other groups may also distribute 25 working documents as Internet-Drafts. The list of current Internet- 26 Drafts is at https://datatracker.ietf.org/drafts/current/. 28 Internet-Drafts are draft documents valid for a maximum of six months 29 and may be updated, replaced, or obsoleted by other documents at any 30 time. It is inappropriate to use Internet-Drafts as reference 31 material or to cite them other than as "work in progress." 33 This Internet-Draft will expire on November 8, 2019. 35 Copyright Notice 37 Copyright (c) 2019 IETF Trust and the persons identified as the 38 document authors. All rights reserved. 40 This document is subject to BCP 78 and the IETF Trust's Legal 41 Provisions Relating to IETF Documents 42 (https://trustee.ietf.org/license-info) in effect on the date of 43 publication of this document. Please review these documents 44 carefully, as they describe your rights and restrictions with respect 45 to this document. Code Components extracted from this document must 46 include Simplified BSD License text as described in Section 4.e of 47 the Trust Legal Provisions and are provided without warranty as 48 described in the Simplified BSD License. 50 Table of Contents 52 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 53 1.1. Features . . . . . . . . . . . . . . . . . . . . . . . . 3 54 1.2. Limitations . . . . . . . . . . . . . . . . . . . . . . . 4 55 1.3. Specification of Requirements . . . . . . . . . . . . . . 5 56 2. Conceptual Description of the Protocol . . . . . . . . . . . 5 57 2.1. Costs, Metrics and Neighbourship . . . . . . . . . . . . 5 58 2.2. The Bellman-Ford Algorithm . . . . . . . . . . . . . . . 5 59 2.3. Transient Loops in Bellman-Ford . . . . . . . . . . . . . 6 60 2.4. Feasibility Conditions . . . . . . . . . . . . . . . . . 7 61 2.5. Solving Starvation: Sequencing Routes . . . . . . . . . . 8 62 2.6. Requests . . . . . . . . . . . . . . . . . . . . . . . . 10 63 2.7. Multiple Routers . . . . . . . . . . . . . . . . . . . . 10 64 2.8. Overlapping Prefixes . . . . . . . . . . . . . . . . . . 11 65 3. Protocol Operation . . . . . . . . . . . . . . . . . . . . . 12 66 3.1. Message Transmission and Reception . . . . . . . . . . . 12 67 3.2. Data Structures . . . . . . . . . . . . . . . . . . . . . 13 68 3.3. Acknowledgments and acknowledgment requests . . . . . . . 17 69 3.4. Neighbour Acquisition . . . . . . . . . . . . . . . . . . 17 70 3.5. Routing Table Maintenance . . . . . . . . . . . . . . . . 20 71 3.6. Route Selection . . . . . . . . . . . . . . . . . . . . . 24 72 3.7. Sending Updates . . . . . . . . . . . . . . . . . . . . . 25 73 3.8. Explicit Requests . . . . . . . . . . . . . . . . . . . . 28 74 4. Protocol Encoding . . . . . . . . . . . . . . . . . . . . . . 32 75 4.1. Data Types . . . . . . . . . . . . . . . . . . . . . . . 32 76 4.2. Packet Format . . . . . . . . . . . . . . . . . . . . . . 33 77 4.3. TLV Format . . . . . . . . . . . . . . . . . . . . . . . 34 78 4.4. Sub-TLV Format . . . . . . . . . . . . . . . . . . . . . 35 79 4.5. Parser state . . . . . . . . . . . . . . . . . . . . . . 35 80 4.6. Details of Specific TLVs . . . . . . . . . . . . . . . . 36 81 4.7. Details of specific sub-TLVs . . . . . . . . . . . . . . 47 82 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 48 83 6. Security Considerations . . . . . . . . . . . . . . . . . . . 49 84 7. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 49 85 8. References . . . . . . . . . . . . . . . . . . . . . . . . . 50 86 8.1. Normative References . . . . . . . . . . . . . . . . . . 50 87 8.2. Informative References . . . . . . . . . . . . . . . . . 50 88 Appendix A. Cost and Metric Computation . . . . . . . . . . . . 51 89 A.1. Maintaining Hello History . . . . . . . . . . . . . . . . 51 90 A.2. Cost Computation . . . . . . . . . . . . . . . . . . . . 52 91 A.3. Metric Computation . . . . . . . . . . . . . . . . . . . 54 92 Appendix B. Constants . . . . . . . . . . . . . . . . . . . . . 54 93 Appendix C. Considerations for protocol extensions . . . . . . . 55 94 Appendix D. Stub Implementations . . . . . . . . . . . . . . . . 57 95 Appendix E. Software Availability . . . . . . . . . . . . . . . 58 96 Appendix F. Changes from previous versions . . . . . . . . . . . 58 97 F.1. Changes since RFC 6126 . . . . . . . . . . . . . . . . . 58 98 F.2. Changes since draft-ietf-babel-rfc6126bis-00 . . . . . . 58 99 F.3. Changes since draft-ietf-babel-rfc6126bis-01 . . . . . . 58 100 F.4. Changes since draft-ietf-babel-rfc6126bis-02 . . . . . . 59 101 F.5. Changes since draft-ietf-babel-rfc6126bis-03 . . . . . . 59 102 F.6. Changes since draft-ietf-babel-rfc6126bis-03 . . . . . . 60 103 F.7. Changes since draft-ietf-babel-rfc6126bis-04 . . . . . . 60 104 F.8. Changes since draft-ietf-babel-rfc6126bis-05 . . . . . . 60 105 F.9. Changes since draft-ietf-babel-rfc6126bis-06 . . . . . . 60 106 F.10. Changes since draft-ietf-babel-rfc6126bis-07 . . . . . . 60 107 F.11. Changes since draft-ietf-babel-rfc6126bis-08 . . . . . . 60 108 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 61 110 1. Introduction 112 Babel is a loop-avoiding distance-vector routing protocol that is 113 designed to be robust and efficient both in networks using prefix- 114 based routing and in networks using flat routing ("mesh networks"), 115 and both in relatively stable wired networks and in highly dynamic 116 wireless networks. 118 1.1. Features 120 The main property that makes Babel suitable for unstable networks is 121 that, unlike naive distance-vector routing protocols [RIP], it 122 strongly limits the frequency and duration of routing pathologies 123 such as routing loops and black-holes during reconvergence. Even 124 after a mobility event is detected, a Babel network usually remains 125 loop-free. Babel then quickly reconverges to a configuration that 126 preserves the loop-freedom and connectedness of the network, but is 127 not necessarily optimal; in many cases, this operation requires no 128 packet exchanges at all. Babel then slowly converges, in a time on 129 the scale of minutes, to an optimal configuration. This is achieved 130 by using sequenced routes, a technique pioneered by Destination- 131 Sequenced Distance-Vector routing [DSDV]. 133 More precisely, Babel has the following properties: 135 o when every prefix is originated by at most one router, Babel never 136 suffers from routing loops; 138 o when a single prefix is originated by multiple routers, Babel may 139 occasionally create a transient routing loop for this particular 140 prefix; this loop disappears in a time proportional to its 141 diameter, and never again (up to an arbitrary garbage-collection 142 (GC) time) will the routers involved participate in a routing loop 143 for the same prefix; 145 o assuming bounded packet loss rates, any routing black-holes that 146 may appear after a mobility event are corrected in a time at most 147 proportional to the network's diameter. 149 Babel has provisions for link quality estimation and for fairly 150 arbitrary metrics. When configured suitably, Babel can implement 151 shortest-path routing, or it may use a metric based, for example, on 152 measured packet loss. 154 Babel nodes will successfully establish an association even when they 155 are configured with different parameters. For example, a mobile node 156 that is low on battery may choose to use larger time constants (hello 157 and update intervals, etc.) than a node that has access to wall 158 power. Conversely, a node that detects high levels of mobility may 159 choose to use smaller time constants. The ability to build such 160 heterogeneous networks makes Babel particularly adapted to the 161 unmanaged and wireless environment. 163 Finally, Babel is a hybrid routing protocol, in the sense that it can 164 carry routes for multiple network-layer protocols (IPv4 and IPv6), 165 whichever protocol the Babel packets are themselves being carried 166 over. 168 1.2. Limitations 170 Babel has two limitations that make it unsuitable for use in some 171 environments. First, Babel relies on periodic routing table updates 172 rather than using a reliable transport; hence, in large, stable 173 networks it generates more traffic than protocols that only send 174 updates when the network topology changes. In such networks, 175 protocols such as OSPF [OSPF], IS-IS [IS-IS], or the Enhanced 176 Interior Gateway Routing Protocol (EIGRP) [EIGRP] might be more 177 suitable. 179 Second, unless the optional algorithm described in Section 3.5.5 is 180 implemented, Babel does impose a hold time when a prefix is 181 retracted. While this hold time does not apply to the exact prefix 182 being retracted, and hence does not prevent fast reconvergence should 183 it become available again, it does apply to any shorter prefix that 184 covers it. This may make those implementations of Babel that do not 185 implement the optional algorithm described in Section 3.5.5 186 unsuitable for use in networks that implement automatic prefix 187 aggregation. 189 1.3. Specification of Requirements 191 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 192 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 193 "OPTIONAL" in this document are to be interpreted as described in BCP 194 14 [RFC2119] [RFC8174] when, and only when, they appear in all 195 capitals, as shown here. 197 2. Conceptual Description of the Protocol 199 Babel is a loop-avoiding distance vector protocol: it is based on the 200 Bellman-Ford protocol, just like the venerable RIP [RIP], but 201 includes a number of refinements that either prevent loop formation 202 altogether, or ensure that a loop disappears in a timely manner and 203 doesn't form again. 205 Conceptually, Bellman-Ford is executed in parallel for every source 206 of routing information (destination of data traffic). In the 207 following discussion, we fix a source S; the reader will recall that 208 the same algorithm is executed for all sources. 210 2.1. Costs, Metrics and Neighbourship 212 For every pair of neighbouring nodes A and B, Babel computes an 213 abstract value known as the cost of the link from A to B., written 214 C(A, B). Given a route between any two (not necessarily 215 neighbouring) nodes, the metric of the route is the sum of the costs 216 of all the edges along the route. The goal of the routing algorithm 217 is to compute, for every source S, the tree of routes of lowest 218 metric to S. 220 Costs and metrics need not be integers. In general, they can be 221 values in any algebra that satisfies two fairly general conditions 222 (Section 3.5.2). 224 A Babel node periodically sends Hello messages to all of its 225 neighbours; it also periodically sends an IHU ("I Heard You") message 226 to every neighbour from which it has recently heard a Hello. From 227 the information derived from Hello and IHU messages received from its 228 neighbour B, a node A computes the cost C(A, B) of the link from A to 229 B. 231 2.2. The Bellman-Ford Algorithm 233 Every node A maintains two pieces of data: its estimated distance to 234 S, written D(A), and its next-hop router to S, written NH(A). 235 Initially, D(S) = 0, D(A) is infinite, and NH(A) is undefined. 237 Periodically, every node B sends to all of its neighbours a route 238 update, a message containing D(B). When a neighbour A of B receives 239 the route update, it checks whether B is its selected next hop; if 240 that is the case, then NH(A) is set to B, and D(A) is set to C(A, B) 241 + D(B). If that is not the case, then A compares C(A, B) + D(B) to 242 its current value of D(A). If that value is smaller, meaning that 243 the received update advertises a route that is better than the 244 currently selected route, then NH(A) is set to B, and D(A) is set to 245 C(A, B) + D(B). 247 A number of refinements to this algorithm are possible, and are used 248 by Babel. In particular, convergence speed may be increased by 249 sending unscheduled "triggered updates" whenever a major change in 250 the topology is detected, in addition to the regular, scheduled 251 updates. Additionally, a node may maintain a number of alternate 252 routes, which are being advertised by neighbours other than its 253 selected neighbour, and which can be used immediately if the selected 254 route were to fail. 256 2.3. Transient Loops in Bellman-Ford 258 It is well known that a naive application of Bellman-Ford to 259 distributed routing can cause transient loops after a topology 260 change. Consider for example the following topology: 262 B 263 1 /| 264 1 / | 265 S --- A |1 266 \ | 267 1 \| 268 C 270 After convergence, D(B) = D(C) = 2, with NH(B) = NH(C) = A. 272 Suppose now that the link between S and A fails: 274 B 275 1 /| 276 / | 277 S A |1 278 \ | 279 1 \| 280 C 282 When it detects the failure of the link, A switches its next hop to B 283 (which is still advertising a route to S with metric 2), and 284 advertises a metric equal to 3, and then advertises a new route with 285 metric 3. This process of nodes changing selected neighbours and 286 increasing their metric continues until the advertised metric reaches 287 "infinity", a value larger than all the metrics that the routing 288 protocol is able to carry. 290 2.4. Feasibility Conditions 292 Bellman-Ford is a very robust algorithm: its convergence properties 293 are preserved when routers delay route acquisition or when they 294 discard some updates. Babel routers discard received route 295 announcements unless they can prove that accepting them cannot 296 possibly cause a routing loop. 298 More formally, we define a condition over route announcements, known 299 as the "feasibility condition", that guarantees the absence of 300 routing loops whenever all routers ignore route updates that do not 301 satisfy the feasibility condition. In effect, this makes Bellman- 302 Ford into a family of routing algorithms, parameterised by the 303 feasibility condition. 305 Many different feasibility conditions are possible. For example, BGP 306 can be modelled as being a distance-vector protocol with a (rather 307 drastic) feasibility condition: a routing update is only accepted 308 when the receiving node's AS number is not included in the update's 309 AS-Path attribute (note that BGP's feasibility condition does not 310 ensure the absence of transient "micro-loops" during reconvergence). 312 Another simple feasibility condition, used in the Destination- 313 Sequenced Distance-Vector (DSDV) routing protocol [DSDV] and in the 314 Ad hoc On-Demand Distance Vector (AODV) protocol, stems from the 315 following observation: a routing loop can only arise after a router 316 has switched to a route with a larger metric than the route that it 317 had previously selected. Hence, one could decide that a route is 318 feasible only when its metric at the local node would be no larger 319 than the metric of the currently selected route, i.e., an 320 announcement carrying a metric D(B) is accepted by A when C(A, B) + 321 D(B) <= D(A). If all routers obey this constraint, then the metric 322 at every router is nonincreasing, and the following invariant is 323 always preserved: if A has selected B as its successor, then D(B) < 324 D(A), which implies that the forwarding graph is loop-free. 326 Babel uses a slightly more refined feasibility condition, derived 327 from EIGRP [DUAL]. Given a router A, define the feasibility distance 328 of A, written FD(A), as the smallest metric that A has ever 329 advertised for S to any of its neighbours. An update sent by a 330 neighbour B of A is feasible when the metric D(B) advertised by B is 331 strictly smaller than A's feasibility distance, i.e., when D(B) < 332 FD(A). 334 It is easy to see that this latter condition is no more restrictive 335 than DSDV-feasibility. Suppose that node A obeys DSDV-feasibility; 336 then D(A) is nonincreasing, hence at all times D(A) <= FD(A). 337 Suppose now that A receives a DSDV-feasible update that advertises a 338 metric D(B). Since the update is DSDV-feasible, C(A, B) + D(B) <= 339 D(A), hence D(B) < D(A), and since D(A) <= FD(A), D(B) < FD(A). 341 To see that it is strictly less restrictive, consider the following 342 diagram, where A has selected the route through B, and D(A) = FD(A) = 343 2. Since D(C) = 1 < FD(A), the alternate route through C is feasible 344 for A, although its metric C(A, C) + D(C) = 5 is larger than that of 345 the currently selected route: 347 B 348 1 / \ 1 349 / \ 350 S A 351 \ / 352 1 \ / 4 353 C 355 To show that this feasibility condition still guarantees loop- 356 freedom, recall that at the time when A accepts an update from B, the 357 metric D(B) announced by B is no smaller than FD(B); since it is 358 smaller than FD(A), at that point in time FD(B) < FD(A). Since this 359 property is preserved when A sends updates, it remains true at all 360 times, which ensures that the forwarding graph has no loops. 362 2.5. Solving Starvation: Sequencing Routes 364 Obviously, the feasibility conditions defined above cause starvation 365 when a router runs out of feasible routes. Consider the following 366 diagram, where both A and B have selected the direct route to S: 368 A 369 1 /| D(A) = 1 370 / | FD(A) = 1 371 S |1 372 \ | D(B) = 2 373 2 \| FD(B) = 2 374 B 376 Suppose now that the link between A and S breaks: 378 A 379 | 380 | FD(A) = 1 381 S |1 382 \ | D(B) = 2 383 2 \| FD(B) = 2 384 B 386 The only route available from A to S, the one that goes through B, is 387 not feasible: A suffers from spurious starvation. At that point, the 388 whole subtree suffering from starvation must be reset, which is 389 essentially what EIGRP does when it performs a global synchronisation 390 of all the routers in the sarving subtree (the "active" phase of 391 EIGRP). 393 Babel reacts to starvation in a less drastic manner, by using 394 sequenced routes, a technique introduced by DSDV and adopted by AODV. 395 In addition to a metric, every route carries a sequence number, a 396 nondecreasing integer that is propagated unchanged through the 397 network and is only ever incremented by the source; a pair (s, m), 398 where s is a sequence number and m a metric, is called a distance. 400 A received update is feasible when either it is more recent than the 401 feasibility distance maintained by the receiving node, or it is 402 equally recent and the metric is strictly smaller. More formally, if 403 FD(A) = (s, m), then an update carrying the distance (s', m') is 404 feasible when either s' > s, or s = s' and m' < m. 406 Assuming the sequence number of S is 137, the diagram above becomes: 408 A 409 | 410 | FD(A) = (137, 1) 411 S |1 412 \ | D(B) = (137, 2) 413 2 \| FD(B) = (137, 2) 414 B 416 After S increases its sequence number, and the new sequence number is 417 propagated to B, we have: 419 A 420 | 421 | FD(A) = (137, 1) 422 S |1 423 \ | D(B) = (138, 2) 424 2 \| FD(B) = (138, 2) 425 B 427 at which point the route through B becomes feasible again. 429 Note that while sequence numbers are used for determining 430 feasibility, they are not used in route selection: a node ignores the 431 sequence number when selecting the best route to a given destination 432 (Section 3.6). Doing otherwise would cause route oscillation while a 433 seqno propagates through the network, and might even cause persistent 434 blackholes with some exotic metrics. 436 2.6. Requests 438 In DSDV, the sequence number of a source is increased periodically. 439 A route becomes feasible again after the source increases its 440 sequence number, and the new sequence number is propagated through 441 the network, which may, in general, require a significant amount of 442 time. 444 Babel takes a different approach. When a node detects that it is 445 suffering from a potentially spurious starvation, it sends an 446 explicit request to the source for a new sequence number. This 447 request is forwarded hop by hop to the source, with no regard to the 448 feasibility condition. Upon receiving the request, the source 449 increases its sequence number and broadcasts an update, which is 450 forwarded to the requesting node. 452 Note that after a change in network topology not all such requests 453 will, in general, reach the source, as some will be sent over links 454 that are now broken. However, if the network is still connected, 455 then at least one among the nodes suffering from spurious starvation 456 has an (unfeasible) route to the source; hence, in the absence of 457 packet loss, at least one such request will reach the source. 458 (Resending requests a small number of times compensates for packet 459 loss.) 461 Since requests are forwarded with no regard to the feasibility 462 condition, they may, in general, be caught in a forwarding loop; this 463 is avoided by having nodes perform duplicate detection for the 464 requests that they forward. 466 2.7. Multiple Routers 468 The above discussion assumes that every prefix is originated by a 469 single router. In real networks, however, it is often necessary to 470 have a single prefix originated by multiple routers: for example, the 471 default route will be originated by all of the edge routers of a 472 routing domain. 474 Since synchronising sequence numbers between distinct routers is 475 problematic, Babel treats routes for the same prefix as distinct 476 entities when they are originated by different routers: every route 477 announcement carries the router-id of its originating router, and 478 feasibility distances are not maintained per prefix, but per source, 479 where a source is a pair of a router-id and a prefix. In effect, 480 Babel guarantees loop-freedom for the forwarding graph to every 481 source; since the union of multiple acyclic graphs is not in general 482 acyclic, Babel does not in general guarantee loop-freedom when a 483 prefix is originated by multiple routers, but any loops will be 484 broken in a time at most proportional to the diameter of the loop -- 485 as soon as an update has "gone around" the routing loop. 487 Consider for example the following topology, where A has selected the 488 default route through S, and B has selected the one through S': 490 1 1 1 491 ::/0 -- S --- A --- B --- S' -- ::/0 493 Suppose that both default routes fail at the same time; then nothing 494 prevents A from switching to B, and B simultaneously switching to A. 495 However, as soon as A has successfully advertised the new route to B, 496 the route through A will become unfeasible for B. Conversely, as 497 soon as B will have advertised the route through A, the route through 498 B will become unfeasible for A. 500 In effect, the routing loop disappears at the latest when routing 501 information has gone around the loop. Since this process can be 502 delayed by lost packets, Babel makes certain efforts to ensure that 503 updates are sent reliably after a router-id change (Section 3.7.2). 505 Additionally, after the routers have advertised the two routes, both 506 sources will be in their source tables, which will prevent them from 507 ever again participating in a routing loop involving routes from S 508 and S' (up to the source GC time, which, available memory permitting, 509 can be set to arbitrarily large values). 511 2.8. Overlapping Prefixes 513 In the above discussion, we have assumed that all prefixes are 514 disjoint, as is the case in flat ("mesh") routing. In practice, 515 however, prefixes may overlap: for example, the default route 516 overlaps with all of the routes present in the network. 518 After a route fails, it is not correct in general to switch to a 519 route that subsumes the failed route. Consider for example the 520 following configuration: 522 1 1 523 ::/0 -- A --- B --- C 525 Suppose that node C fails. If B forwards packets destined to C by 526 following the default route, a routing loop will form, and persist 527 until A learns of B's retraction of the direct route to C. B avoids 528 this pitfall by installing an "unreachable" route after a route is 529 retracted; this route is maintained until it can be guaranteed that 530 the former route has been retracted by all of B's neighbours 531 (Section 3.5.5). 533 3. Protocol Operation 535 Every Babel speaker is assigned a router-id, which is an arbitrary 536 string of 8 octets that is assumed unique across the routing domain. 537 For example, routers-ids could be assigned randomly, or they could 538 derived from a link-layer address. (The protocol encoding is 539 slightly more compact when router-ids are assigned in the same manner 540 as the IPv6 layer assigns host IDs.) 542 3.1. Message Transmission and Reception 544 Babel protocol packets are sent in the body of a UDP datagram (as 545 described in Section 4 below). Each Babel packet consists of zero or 546 more TLVs. Most TLVs may contain sub-TLVs. 548 The source address of a Babel packet is always a unicast address, 549 link-local in the case of IPv6. Babel packets may be sent to a well- 550 known (link-local) multicast address or to a (link-local) unicast 551 address. In normal operation, a Babel speaker sends both multicast 552 and unicast packets to its neighbours. 554 With the exception of Hello TLVs and acknowledgments, all Babel TLVs 555 can be sent to either unicast or multicast addresses, and their 556 semantics does not depend on whether the destination is a unicast or 557 a multicast address. Hence, a Babel speaker does not need to 558 determine the destination address of a packet that it receives in 559 order to interpret it. 561 A moderate amount of jitter may be applied to packets sent by a Babel 562 speaker: outgoing TLVs are buffered and SHOULD be sent with a small 563 random delay. This is done for two purposes: it avoids 564 synchronisation of multiple Babel speakers across a network [JITTER], 565 and it allows for the aggregation of multiple TLVs into a single 566 packet. 568 The exact delay and amount of jitter applied to a packet depends on 569 whether it contains any urgent TLVs. Acknowledgment TLVs MUST be 570 sent before the deadline specified in the corresponding request. The 571 particular class of updates specified in Section 3.7.2 MUST be sent 572 in a timely manner. The particular class of request and update TLVs 573 specified in Section 3.8.2 SHOULD be sent in a timely manner. 575 3.2. Data Structures 577 In this section, we give a description of the data structures that 578 every Babel speaker maintains. This description is conceptual: a 579 Babel speaker may use different data structures as long as the 580 resulting protocol is the same as the one described in this document. 581 For example, rather than maintaining a single table containing both 582 selected and unselected (fallback) routes, as described in 583 Section 3.2.6 belong, an actual implementation would probably use two 584 tables, one with selected routes and one with fallback routes. 586 3.2.1. Sequence number arithmetic 588 Sequence numbers (seqnos) appear in a number of Babel data 589 structures, and they are interpreted as integers modulo 2^16. For 590 the purposes of this document, arithmetic on sequence numbers is 591 defined as follows. 593 Given a seqno s and an integer n, the sum of s and n is defined by 595 s + n (modulo 2^16) = (s + n) MOD 2^16 597 or, equivalently, 599 s + n (modulo 2^16) = (s + n) AND 65535 601 where MOD is the modulo operation yielding a non-negative integer and 602 AND is the bitwise conjunction operation. 604 Given two sequence numbers s and s', the relation s is less than s' 605 (s < s') is defined by 607 s < s' (modulo 2^16) when 0 < ((s' - s) MOD 2^16) < 32768 609 or equivalently 611 s < s' (modulo 2^16) when s /= s' and ((s' - s) AND 32768) = 0. 613 3.2.2. Node Sequence Number 615 A node's sequence number is a 16-bit integer that is included in 616 route updates sent for routes originated by this node. 618 A node increments its sequence number (modulo 2^16) whenever it 619 receives a request for a new sequence number (Section 3.8.1.2). A 620 node SHOULD NOT increment its sequence number (seqno) spontaneously, 621 since increasing seqnos makes it less likely that other nodes will 622 have feasible alternate routes when their selected routes fail. 624 3.2.3. The Interface Table 626 The interface table contains the list of interfaces on which the node 627 speaks the Babel protocol. Every interface table entry contains the 628 interface's outgoing Multicast Hello seqno, a 16-bit integer that is 629 sent with each Multicast Hello TLV on this interface and is 630 incremented (modulo 2^16) whenever a Multicast Hello is sent. (Note 631 that an interface's Multicast Hello seqno is unrelated to the node's 632 seqno.) 634 There are two timers associated with each interface table entry -- 635 the multicast hello timer, which governs the sending of scheduled 636 Multicast Hello and IHU packets, and the update timer, which governs 637 the sending of periodic route updates. 639 3.2.4. The Neighbour Table 641 The neighbour table contains the list of all neighbouring interfaces 642 from which a Babel packet has been recently received. The neighbour 643 table is indexed by pairs of the form (interface, address), and every 644 neighbour table entry contains the following data: 646 o the local node's interface over which this neighbour is reachable; 648 o the address of the neighbouring interface; 650 o a history of recently received Multicast Hello packets from this 651 neighbour; this can, for example, be a sequence of n bits, for 652 some small value n, indicating which of the n hellos most recently 653 sent by this neighbour have been received by the local node; 655 o a history of recently received Unicast Hello packets from this 656 neighbour; 658 o the "transmission cost" value from the last IHU packet received 659 from this neighbour, or FFFF hexadecimal (infinity) if the IHU 660 hold timer for this neighbour has expired; 662 o the neighbour's expected incoming Multicast Hello sequence number, 663 an integer modulo 2^16. 665 o the neighbour's expected incoming Unicast Hello sequence number, 666 an integer modulo 2^16. 668 o the neighbour's outgoing Unicast Hello sequence number, an integer 669 modulo 2^16 that is sent with each Unicast Hello TLV to this 670 neighbour and is incremented (modulo 2^16) whenever a Unicast 671 Hello is sent. (Note that a neighbour's outgoing Unicast Hello 672 seqno is distinct from the interface's outgoing Multicast Hello 673 seqno.) 675 There are three timers associated with each neighbour entry -- the 676 multicast hello timer, which is initialised from the interval value 677 carried by scheduled Multicast Hello TLVs, the unicast hello timer, 678 which is initialised from the interval value carried by scheduled 679 Unicast Hello TLVs, and the IHU timer, which is initialised to a 680 small multiple of the interval carried in IHU TLVs. 682 Note that the neighbour table is indexed by IP addresses, not by 683 router-ids: neighbourship is a relationship between interfaces, not 684 between nodes. Therefore, two nodes with multiple interfaces can 685 participate in multiple neighbourship relationships, a situation that 686 can notably arise when wireless nodes with multiple radios are 687 involved. 689 3.2.5. The Source Table 691 The source table is used to record feasibility distances. It is 692 indexed by triples of the form (prefix, plen, router-id), and every 693 source table entry contains the following data: 695 o the prefix (prefix, plen), where plen is the prefix length, that 696 this entry applies to; 698 o the router-id of a router originating this prefix; 700 o a pair (seqno, metric), this source's feasibility distance. 702 There is one timer associated with each entry in the source table -- 703 the source garbage-collection timer. It is initialised to a time on 704 the order of minutes and reset as specified in Section 3.7.3. 706 3.2.6. The Route Table 708 The route table contains the routes known to this node. It is 709 indexed by triples of the form (prefix, plen, neighbour), and every 710 route table entry contains the following data: 712 o the source (prefix, plen, router-id) for which this route is 713 advertised; 715 o the neighbour that advertised this route; 717 o the metric with which this route was advertised by the neighbour, 718 or FFFF hexadecimal (infinity) for a recently retracted route; 720 o the sequence number with which this route was advertised; 722 o the next-hop address of this route; 724 o a boolean flag indicating whether this route is selected, i.e., 725 whether it is currently being used for forwarding and is being 726 advertised. 728 There is one timer associated with each route table entry -- the 729 route expiry timer. It is initialised and reset as specified in 730 Section 3.5.4. 732 Note that there are two distinct (seqno, metric) pairs associated to 733 each route: the route's distance, which is stored in the route table, 734 and the feasibility distance, stored in the source table and shared 735 between all routes with the same source. 737 3.2.7. The Table of Pending Seqno Requests 739 The table of pending seqno requests contains a list of seqno requests 740 that the local node has sent (either because they have been 741 originated locally, or because they were forwarded) and to which no 742 reply has been received yet. This table is indexed by triples of the 743 form (prefix, plen, router-id), and every entry in this table 744 contains the following data: 746 o the prefix, router-id, and seqno being requested; 748 o the neighbour, if any, on behalf of which we are forwarding this 749 request; 751 o a small integer indicating the number of times that this request 752 will be resent if it remains unsatisfied. 754 There is one timer associated with each pending seqno request; it 755 governs both the resending of requests and their expiry. 757 3.3. Acknowledgments and acknowledgment requests 759 A Babel speaker may request that a neighbour receiving a given packet 760 reply with an explicit acknowledgment within a given time. While the 761 use of acknowledgment requests is optional, every Babel speaker MUST 762 be able to reply to such a request. 764 An acknowledgment MUST be sent to a unicast destination. On the 765 other hand, acknowledgment requests may be sent to either unicast or 766 multicast destinations, in which case they request an acknowledgment 767 from all of the receiving nodes. 769 When to request acknowledgments is a matter of local policy; the 770 simplest strategy is to never request acknowledgments and to rely on 771 periodic updates to ensure that any reachable routes are eventually 772 propagated throughout the routing domain. In order to improve 773 convergence speed and reduce the amount of control traffic, 774 acknowledgment requests MAY be used in order to reliably send urgent 775 updates (Section 3.7.2) and retractions (Section 3.5.5), especially 776 when the number of neighbours on a given interface is small. Since 777 Babel is designed to deal gracefully with packet loss on unreliable 778 media, sending all packets with acknowledgment requests is not 779 necessary, and NOT RECOMMENDED, as the acknowledgments cause 780 additional traffic and may force additional Address Resolution 781 Protocol (ARP) or Neighbour Discovery (ND) exchanges. 783 3.4. Neighbour Acquisition 785 Neighbour acquisition is the process by which a Babel node discovers 786 the set of neighbours heard over each of its interfaces and 787 ascertains bidirectional reachability. On unreliable media, 788 neighbour acquisition additionally provides some statistics that may 789 be useful for link quality computation. 791 Before it can exchange routing information with a neighbour, a Babel 792 node MUST create an entry for that neighbour in the neighbour table. 793 When to do that is implementation-specific; suitable strategies 794 include creating an entry when any Babel packet is received, or 795 creating an entry when a Hello TLV is parsed. Similarly, in order to 796 conserve system resources, an implementation SHOULD discard an entry 797 when it has been unused for long enough; suitable strategies include 798 dropping the neighbour after a timeout, and dropping a neighbour when 799 the associated Hello histories become empty (see Appendix A.2). 801 3.4.1. Reverse Reachability Detection 803 Every Babel node sends Hello TLVs to its neighbours to indicate that 804 it is alive, at regular or irregular intervals. Each Hello TLV 805 carries an increasing (modulo 2^16) sequence number and an upper 806 bound on the time interval until the next Hello of the same type (see 807 below). If the time interval is set to 0, then the Hello TLV does 808 not establish a new promise: the deadline carried by the previous 809 Hello of the same type still applies to the next Hello (if the most 810 recent scheduled Hello of the right kind was received at time t0 and 811 carried interval i, then the previous promise of sending another 812 Hello before time t0 + i still holds). We say that a Hello is 813 "scheduled" if it carries a non-zero interval, and "unscheduled" 814 otherwise. 816 There are two kinds of Hellos: Multicast Hellos, which use a per- 817 interface Hello counter (the Multicast Hello seqno), and Unicast 818 Hellos, which use a per-neighbour counter (the Multicast Hello 819 seqno). A Multicast Hello with a given seqno MUST be sent to all 820 neighbours on a given interface, either by sending it to a multicast 821 address or by sending it to one unicast address per neighbour (hence, 822 the term "Multicast Hello" is a slight misnomer). A Unicast Hello 823 carrying a given seqno should normally be sent to just one neighbour 824 (over unicast), since the sequence numbers of different neighbours 825 are not in general synchronised. 827 Multicast Hellos sent over multicast can be used for neighbour 828 discovery; hence, a node SHOULD send periodic (scheduled) Multicast 829 Hellos unless neighbour discovery is performed by means outside of 830 the Babel protocol. A node MAY send Unicast Hellos or unscheduled 831 Hellos of either kind for any reason, such as reducing the amount of 832 multicast traffic or improving reliability on link technologies with 833 poor support for link-layer multicast. 835 A node MAY send a scheduled Hello ahead of time. A node MAY change 836 its scheduled Hello interval. The Hello interval MAY be decreased at 837 any time; it MAY be increased immediately before sending a Hello TLV, 838 but SHOULD NOT be increased at other times. (Equivalently, a node 839 SHOULD send a scheduled Hello immediately after increasing its Hello 840 interval.) 842 How to deal with received Hello TLVs and what statistics to maintain 843 are considered local implementation matters; typically, a node will 844 maintain some sort of history of recently received Hellos. An 845 example of a suitable algorithm is described in Appendix A.1. 847 After receiving a Hello, or determining that it has missed one, the 848 node recomputes the association's cost (Section 3.4.3) and runs the 849 route selection procedure (Section 3.6). 851 3.4.2. Bidirectional Reachability Detection 853 In order to establish bidirectional reachability, every node sends 854 periodic IHU ("I Heard You") TLVs to each of its neighbours. Since 855 IHUs carry an explicit interval value, they MAY be sent less often 856 than Hellos in order to reduce the amount of routing traffic in dense 857 networks; in particular, they SHOULD be sent less often than Hellos 858 over links with little packet loss. While IHUs are conceptually 859 unicast, they MAY be sent to a multicast address in order to avoid an 860 ARP or Neighbour Discovery exchange and to aggregate multiple IHUs 861 into a single packet. 863 In addition to the periodic IHUs, a node MAY, at any time, send an 864 unscheduled IHU packet. It MAY also, at any time, decrease its IHU 865 interval, and it MAY increase its IHU interval immediately before 866 sending an IHU, but SHOULD NOT increase it at any other time. 867 (Equivalently, a node SHOULD send an extra IHU immediately after 868 increasing its Hello interval.) 870 Every IHU TLV contains two pieces of data: the link's rxcost 871 (reception cost) from the sender's perspective, used by the neighbour 872 for computing link costs (Section 3.4.3), and the interval between 873 periodic IHU packets. A node receiving an IHU sets the value of the 874 txcost (transmission cost) maintained in the neighbour table to the 875 value contained in the IHU, and resets the IHU timer associated to 876 this neighbour to a small multiple of the interval value received in 877 the IHU. When a neighbour's IHU timer expires, the neighbour's 878 txcost is set to infinity. 880 After updating a neighbour's txcost, the receiving node recomputes 881 the neighbour's cost (Section 3.4.3) and runs the route selection 882 procedure (Section 3.6). 884 3.4.3. Cost Computation 886 A neighbourship association's link cost is computed from the values 887 maintained in the neighbour table: the statistics kept in the 888 neighbour table about the reception of Hellos, and the txcost 889 computed from received IHU packets. 891 For every neighbour, a Babel node computes a value known as this 892 neighbour's rxcost. This value is usually derived from the Hello 893 history, which may be combined with other data, such as statistics 894 maintained by the link layer. The rxcost is sent to a neighbour in 895 each IHU. 897 Since nodes do not necessarily send periodic Unicast Hellos but do 898 usually send periodic Multicast Hellos (Section 3.4.1), a node SHOULD 899 use an algorithm that yields a finite rxcost when only Multicast 900 Hellos are received, unless interoperability with nodes that only 901 send Multicast Hellos is not required. 903 How the txcost and rxcost are combined in order to compute a link's 904 cost is a matter of local policy; as far as Babel's correctness is 905 concerned, only the following conditions MUST be satisfied: 907 o the cost is strictly positive; 909 o if no Hello TLVs of either kind were received recently, then the 910 cost is infinite; 912 o if the txcost is infinite, then the cost is infinite. 914 Note that while this document does not constrain cost computation any 915 further, not all cost computation strategies will give good results. 916 See Appendix A.2 for examples of strategies for computing a link's 917 cost that are known to work well in practice. 919 3.5. Routing Table Maintenance 921 Conceptually, a Babel update is a quintuple (prefix, plen, router-id, 922 seqno, metric), where (prefix, plen) is the prefix for which a route 923 is being advertised, router-id is the router-id of the router 924 originating this update, seqno is a nondecreasing (modulo 2^16) 925 integer that carries the originating router seqno, and metric is the 926 announced metric. 928 Before being accepted, an update is checked against the feasibility 929 condition (Section 3.5.1), which ensures that the route does not 930 create a routing loop. If the feasibility condition is not 931 satisfied, the update is either ignored or prevents the route from 932 being selected, as described in Section 3.5.4. If the feasibility 933 condition is satisfied, then the update cannot possibly cause a 934 routing loop. 936 3.5.1. The Feasibility Condition 938 The feasibility condition is applied to all received updates. The 939 feasibility condition compares the metric in the received update with 940 the metrics of the updates previously sent by the receiving node; 941 updates that fail the feasibility condition, and therefore have 942 metrics large enough to cause a routing loop, are either ignored or 943 prevent the resulting route from being selected. 945 A feasibility distance is a pair (seqno, metric), where seqno is an 946 integer modulo 2^16 and metric is a positive integer. Feasibility 947 distances are compared lexicographically, with the first component 948 inverted: we say that a distance (seqno, metric) is strictly better 949 than a distance (seqno', metric'), written 951 (seqno, metric) < (seqno', metric') 953 when 955 seqno > seqno' or (seqno = seqno' and metric < metric') 957 where sequence numbers are compared modulo 2^16. 959 Given a source (prefix, plen, router-id), a node's feasibility 960 distance for this source is the minimum, according to the ordering 961 defined above, of the distances of all the finite updates ever sent 962 by this particular node for the prefix (prefix, plen) and the given 963 router-id. Feasibility distances are maintained in the source table, 964 the exact procedure is given in Section 3.7.3. 966 A received update is feasible when either it is a retraction (its 967 metric is FFFF hexadecimal), or the advertised distance is strictly 968 better, in the sense defined above, than the feasibility distance for 969 the corresponding source. More precisely, a route advertisement 970 carrying the quintuple (prefix, plen, router-id, seqno, metric) is 971 feasible if one of the following conditions holds: 973 o metric is infinite; or 975 o no entry exists in the source table indexed by (prefix, plen, 976 router-id); or 978 o an entry (prefix, plen, router-id, seqno', metric') exists in the 979 source table, and either 981 * seqno' < seqno or 983 * seqno = seqno' and metric < metric'. 985 Note that the feasibility condition considers the metric advertised 986 by the neighbour, not the route's metric; hence, a fluctuation in a 987 neighbour's cost cannot render a selected route unfeasible. Note 988 further that retractions (updates with infinite metric) are always 989 feasible, since they cannot possibly cause a routing loop. 991 3.5.2. Metric Computation 993 A route's metric is computed from the metric advertised by the 994 neighbour and the neighbour's link cost. Just like cost computation, 995 metric computation is considered a local policy matter; as far as 996 Babel is concerned, the function M(c, m) used for computing a metric 997 from a locally computed link cost and the metric advertised by a 998 neighbour MUST only satisfy the following conditions: 1000 o if c is infinite, then M(c, m) is infinite; 1002 o M is strictly monotonic: M(c, m) > m. 1004 Additionally, the metric SHOULD satisfy the following condition: 1006 o M is left-distributive: if m <= m', then M(c, m) <= M(c, m'). 1008 Note that while strict monotonicity is essential to the integrity of 1009 the network (persistent routing loops may arise if it is not 1010 satisfied), left distributivity is not: if it is not satisfied, Babel 1011 will still converge to a loop-free configuration, but might not reach 1012 a global optimum (in fact, a global optimum may not even exist). 1014 As with cost computation, not all strategies for computing route 1015 metrics will give good results. In particular, some metrics are more 1016 likely than others to lead to routing instabilities (route flapping). 1017 In Appendix A.3, we give a number of examples of strictly monotonic, 1018 left-distributive routing metrics that are known to work well in 1019 practice. 1021 3.5.3. Encoding of Updates 1023 In a large network, the bulk of Babel traffic consists of route 1024 updates; hence, some care has been given to encoding them 1025 efficiently. An Update TLV itself only contains the prefix, seqno, 1026 and metric, while the next hop is derived either from the network- 1027 layer source address of the packet or from an explicit Next Hop TLV 1028 in the same packet. The router-id is derived from a separate Router- 1029 Id TLV in the same packet, which optimises the case when multiple 1030 updates are sent with the same router-id. 1032 Additionally, a prefix of the advertised prefix can be omitted in an 1033 Update TLV, in which case it is copied from a previous Update TLV in 1034 the same packet -- this is known as address compression 1035 (Section 4.6.9). 1037 Finally, as a special optimisation for the case when a router-id 1038 coincides with the interface-id part of an IPv6 address, the router- 1039 id can optionally be derived from the low-order bits of the 1040 advertised prefix. 1042 The encoding of updates is described in detail in Section 4.6. 1044 3.5.4. Route Acquisition 1046 When a Babel node receives an update (prefix, plen, router-id, seqno, 1047 metric) from a neighbour neigh with a link cost value equal to cost, 1048 it checks whether it already has a route table entry indexed by 1049 (prefix, plen, neigh). 1051 If no such entry exists: 1053 o if the update is unfeasible, it MAY be ignored; 1055 o if the metric is infinite (the update is a retraction of a route 1056 we do not know about), the update is ignored; 1058 o otherwise, a new entry is created in the route table, indexed by 1059 (prefix, plen, neigh), with source equal to (prefix, plen, router- 1060 id), seqno equal to seqno and an advertised metric equal to the 1061 metric carried by the update. 1063 If such an entry exists: 1065 o if the entry is currently selected, the update is unfeasible, and 1066 the router-id of the update is equal to the router-id of the 1067 entry, then the update MAY be ignored; 1069 o otherwise, the entry's sequence number, advertised metric, metric, 1070 and router-id are updated and, if the advertised metric is not 1071 infinite, the route's expiry timer is reset to a small multiple of 1072 the Interval value included in the update. If the update is 1073 unfeasible, then the (now unfeasible) entry MUST be immediately 1074 unselected. If the update caused the router-id of the entry to 1075 change, an update (possibly a retraction) MUST be sent in a timely 1076 manner (see Section 3.7.2). 1078 Note that the route table may contain unfeasible routes, either 1079 because they were created by an unfeasible update or due to a metric 1080 fluctuation. Such routes are never selected, since they are not 1081 known to be loop-free; should all the feasible routes become 1082 unusable, however, the unfeasible routes can be made feasible and 1083 therefore possible to select by sending requests along them (see 1084 Section 3.8.2). 1086 When a route's expiry timer triggers, the behaviour depends on 1087 whether the route's metric is finite. If the metric is finite, it is 1088 set to infinity and the expiry timer is reset. If the metric is 1089 already infinite, the route is flushed from the route table. 1091 After the route table is updated, the route selection procedure 1092 (Section 3.6) is run. 1094 3.5.5. Hold Time 1096 When a prefix P is retracted, because all routes are unfeasible or 1097 have an infinite metric (whether due to the expiry timer or to other 1098 reasons), and a shorter prefix P' that covers P is reachable, P' 1099 cannot in general be used for routing packets destined to P without 1100 running the risk of creating a routing loop (Section 2.8). 1102 To avoid this issue, whenever a prefix P is retracted, a route table 1103 entry with infinite metric is maintained as described in 1104 Section 3.5.4 above. As long as this entry is maintained, packets 1105 destined to an address within P MUST NOT be forwarded by following a 1106 route for a shorter prefix. This entry is removed as soon as a 1107 finite-metric update for prefix P is received and the resulting route 1108 selected. If no such update is forthcoming, the infinite metric 1109 entry SHOULD be maintained at least until it is guaranteed that no 1110 neighbour has selected the current node as next-hop for prefix P. 1111 This can be achieved by either: 1113 o waiting until the route's expiry timer has expired 1114 (Section 3.5.4); 1116 o sending a retraction with an acknowledgment request (Section 3.3) 1117 to every reachable neighbour that has not explicitly retracted 1118 prefix P and waiting for all acknowledgments. 1120 The former option is simpler and ensures that at that point, any 1121 routes for prefix P pointing at the current node have expired. 1122 However, since the expiry time can be as high as a few minutes, doing 1123 that prevents automatic aggregation by creating spurious black-holes 1124 for aggregated routes. The latter option is RECOMMENDED as it 1125 dramatically reduces the time for which a prefix is unreachable in 1126 the presence of aggregated routes. 1128 3.6. Route Selection 1130 Route selection is the process by which a single route for a given 1131 prefix is selected to be used for forwarding packets and to be re- 1132 advertised to a node's neighbours. 1134 Babel is designed to allow flexible route selection policies. As far 1135 as the protocol's correctness is concerned, the route selection 1136 policy MUST only satisfy the following properties: 1138 o a route with infinite metric (a retracted route) is never 1139 selected; 1141 o an unfeasible route is never selected. 1143 Note, however, that Babel does not naturally guarantee the stability 1144 of routing, and configuring conflicting route selection policies on 1145 different routers may lead to persistent route oscillation. 1147 Route selection is a difficult problem, since a good route selection 1148 policy needs to take into account multiple mutually contradictory 1149 criteria; in roughly decreasing order of importance, these are: 1151 o routes with a small metric should be preferred to routes with a 1152 large metric; 1154 o switching router-ids should be avoided; 1156 o routes through stable neighbours should be preferred to routes 1157 through unstable ones; 1159 o stable routes should be preferred to unstable ones; 1161 o switching next hops should be avoided. 1163 Route selection MUST NOT take seqnos into account: a route MUST NOT 1164 be preferred just because it carries a higher (more recent) seqno. 1165 Doing otherwise would cause route oscillation while a new seqno 1166 propagates through the network, possibly following multiple paths of 1167 different latency, and might even create persistent blackholes if the 1168 metric being used is not left-distributive Section 3.5.2. 1170 A simple but useful strategy is to choose the feasible route with the 1171 smallest metric, with a small amount of hysteresis applied to avoid 1172 switching router-ids too often. 1174 After the route selection procedure is run, triggered updates 1175 (Section 3.7.2) and requests (Section 3.8.2) are sent. 1177 3.7. Sending Updates 1179 A Babel speaker advertises to its neighbours its set of selected 1180 routes. Normally, this is done by sending one or more multicast 1181 packets containing Update TLVs on all of its connected interfaces; 1182 however, on link technologies where multicast is significantly more 1183 expensive than unicast, a node MAY choose to send multiple copies of 1184 updates in unicast packets, especially when the number of neighbours 1185 is small. 1187 Additionally, in order to ensure that any black-holes are reliably 1188 cleared in a timely manner, a Babel node sends retractions (updates 1189 with an infinite metric) for any recently retracted prefixes. 1191 If an update is for a route injected into the Babel domain by the 1192 local node (e.g., it carries the address of a local interface, the 1193 prefix of a directly attached network, or a prefix redistributed from 1194 a different routing protocol), the router-id is set to the local 1195 node's router-id, the metric is set to some arbitrary finite value 1196 (typically 0), and the seqno is set to the local router's sequence 1197 number. 1199 If an update is for a route learned from another Babel speaker, the 1200 router-id and sequence number are copied from the route table entry, 1201 and the metric is computed as specified in Section 3.5.2. 1203 3.7.1. Periodic Updates 1205 Every Babel speaker periodically advertises all of its selected 1206 routes on all of its interfaces, including any recently retracted 1207 routes. Since Babel doesn't suffer from routing loops (there is no 1208 "counting to infinity") and relies heavily on triggered updates 1209 (Section 3.7.2), this full dump only needs to happen infrequently. 1211 3.7.2. Triggered Updates 1213 In addition to periodic routing updates, a Babel speaker sends 1214 unscheduled, or triggered, updates in order to inform its neighbours 1215 of a significant change in the network topology. 1217 A change of router-id for the selected route to a given prefix may be 1218 indicative of a routing loop in formation; hence, a node MUST send a 1219 triggered update in a timely manner whenever it changes the selected 1220 router-id for a given destination. Additionally, it SHOULD make a 1221 reasonable attempt at ensuring that all reachable neighbours receive 1222 this update. 1224 There are two strategies for ensuring that. If the number of 1225 neighbours is small, then it is reasonable to send the update 1226 together with an acknowledgment request; the update is resent until 1227 all neighbours have acknowledged the packet, up to some number of 1228 times. If the number of neighbours is large, however, requesting 1229 acknowledgments from all of them might cause a non-negligible amount 1230 of network traffic; in that case, it may be preferable to simply 1231 repeat the update some reasonable number of times (say, 5 for 1232 wireless and 2 for wired links). 1234 A route retraction is somewhat less worrying: if the route retraction 1235 doesn't reach all neighbours, a black-hole might be created, which, 1236 unlike a routing loop, does not endanger the integrity of the 1237 network. When a route is retracted, a node SHOULD send a triggered 1238 update and SHOULD make a reasonable attempt at ensuring that all 1239 neighbours receive this retraction. 1241 Finally, a node MAY send a triggered update when the metric for a 1242 given prefix changes in a significant manner, due to a received 1243 update, because a link's cost has changed, or because a different 1244 next hop has been selected. A node SHOULD NOT send triggered updates 1245 for other reasons, such as when there is a minor fluctuation in a 1246 route's metric, when the selected next hop changes, or to propagate a 1247 new sequence number (except to satisfy a request, as specified in 1248 Section 3.8). 1250 3.7.3. Maintaining Feasibility Distances 1252 Before sending an update (prefix, plen, router-id, seqno, metric) 1253 with finite metric (i.e., not a route retraction), a Babel node 1254 updates the feasibility distance maintained in the source table. 1255 This is done as follows. 1257 If no entry indexed by (prefix, plen, router-id) exists in the source 1258 table, then one is created with value (prefix, plen, router-id, 1259 seqno, metric). 1261 If an entry (prefix, plen, router-id, seqno', metric') exists, then 1262 it is updated as follows: 1264 o if seqno > seqno', then seqno' := seqno, metric' := metric; 1266 o if seqno = seqno' and metric' > metric, then metric' := metric; 1268 o otherwise, nothing needs to be done. 1270 The garbage-collection timer for the entry is then reset. Note that 1271 the feasibility distance is not updated and the garbage-collection 1272 timer is not reset when a retraction (an update with infinite metric) 1273 is sent. 1275 When the garbage-collection timer expires, the entry is removed from 1276 the source table. 1278 3.7.4. Split Horizon 1280 When running over a transitive, symmetric link technology, e.g., a 1281 point-to-point link or a wired LAN technology such as Ethernet, a 1282 Babel node SHOULD use an optimisation known as split horizon. When 1283 split horizon is used on a given interface, a routing update for 1284 prefix P is not sent on the particular interface over which the 1285 selected route towards prefix P was learnt. 1287 Split horizon SHOULD NOT be applied to an interface unless the 1288 interface is known to be symmetric and transitive; in particular, 1289 split horizon is not applicable to decentralised wireless link 1290 technologies (e.g., IEEE 802.11 in ad hoc mode) when routing updates 1291 are sent over multicast. 1293 3.8. Explicit Requests 1295 In normal operation, a node's route table is populated by the regular 1296 and triggered updates sent by its neighbours. Under some 1297 circumstances, however, a node sends explicit requests in order to 1298 cause a resynchronisation with the source after a mobility event or 1299 to prevent a route from spuriously expiring. 1301 The Babel protocol provides two kinds of explicit requests: route 1302 requests, which simply request an update for a given prefix, and 1303 seqno requests, which request an update for a given prefix with a 1304 specific sequence number. The former are never forwarded; the latter 1305 are forwarded if they cannot be satisfied by the receiver. 1307 3.8.1. Handling Requests 1309 Upon receiving a request, a node either forwards the request or sends 1310 an update in reply to the request, as described in the following 1311 sections. If this causes an update to be sent, the update is either 1312 sent to a multicast address on the interface on which the request was 1313 received, or to the unicast address of the neighbour that sent the 1314 request. 1316 The exact behaviour is different for route requests and seqno 1317 requests. 1319 3.8.1.1. Route Requests 1321 When a node receives a route request for a given prefix, it checks 1322 its route table for a selected route to this exact prefix. If such a 1323 route exists, it MUST send an update (over unicast or over 1324 multicast); if such a route does not exist, it MUST send a retraction 1325 for that prefix. 1327 When a node receives a wildcard route request, it SHOULD send a full 1328 route table dump. Full route dumps MAY be rate-limited, especially 1329 if they are sent over multicast. 1331 3.8.1.2. Seqno Requests 1333 When a node receives a seqno request for a given router-id and 1334 sequence number, it checks whether its route table contains a 1335 selected entry for that prefix. If a selected route for the given 1336 prefix exists, it has finite metric, and either the router-ids are 1337 different or the router-ids are equal and the entry's sequence number 1338 is no smaller (modulo 2^16) than the requested sequence number, the 1339 node MUST send an update for the given prefix. If the router-ids 1340 match but the requested seqno is larger (modulo 2^16) than the route 1341 entry's, the node compares the router-id against its own router-id. 1342 If the router-id is its own, then it increases its sequence number by 1343 1 (modulo 2^16) and sends an update. A node MUST NOT increase its 1344 sequence number by more than 1 in response to a seqno request. 1346 Otherwise, if the requested router-id is not its own, the received 1347 request's hop count is 2 or more, and the node is advertising the 1348 prefix to its neighbours, the node selects a neighbour to forward the 1349 request to as follows: 1351 o if the node has one or more feasible routes toward the requested 1352 prefix with a next hop that is not the requesting node, then the 1353 node MUST forward the request to the next hop of one such route; 1355 o otherwise, if the node has one or more (not necessarily feasible) 1356 routes to the requested prefix with a next hop that is not the 1357 requesting node, then the node SHOULD forward the request to the 1358 next hop of one such route. 1360 In order to actually forward the request, the node decrements the hop 1361 count and sends the request in a unicast packet destined to the 1362 selected neighbour. 1364 A node SHOULD maintain a list of recently forwarded seqno requests 1365 and forward the reply (an update with a seqno sufficiently large to 1366 satisfy the request) in a timely manner. A node SHOULD compare every 1367 incoming seqno request against its list of recently forwarded seqno 1368 requests and avoid forwarding it if it is redundant (i.e., if it has 1369 recently sent a request with the same prefix, router-id and a seqno 1370 that is not smaller modulo 2^16). 1372 Since the request-forwarding mechanism does not necessarily obey the 1373 feasibility condition, it may get caught in routing loops; hence, 1374 requests carry a hop count to limit the time during which they remain 1375 in the network. However, since requests are only ever forwarded as 1376 unicast packets, the initial hop count need not be kept particularly 1377 low, and performing an expanding horizon search is not necessary. A 1378 single request MUST NOT be duplicated: it MUST NOT be forwarded to a 1379 multicast address, and it MUST NOT be forwarded to multiple 1380 neighbours. However, if a seqno request is resent by its originator, 1381 the subsequent copies MAY be forwarded to a different neighbour than 1382 the initial one. 1384 3.8.2. Sending Requests 1386 A Babel node MAY send a route or seqno request at any time, to a 1387 multicast or a unicast address; there is only one case when 1388 originating requests is required (Section 3.8.2.1). 1390 3.8.2.1. Avoiding Starvation 1392 When a route is retracted or expires, a Babel node usually switches 1393 to another feasible route for the same prefix. It may be the case, 1394 however, that no such routes are available. 1396 A node that has lost all feasible routes to a given destination but 1397 still has unexpired unfeasible routes to that destination MUST send a 1398 seqno request; if it doesn't have any such routes, it MAY still send 1399 a seqno request. The router-id of the request is set to the router- 1400 id of the route that it has just lost, and the requested seqno is the 1401 value contained in the source table plus 1. 1403 If the node has any (unfeasible) routes to the requested destination, 1404 then it MUST send the request to at least one of the next-hop 1405 neighbours that advertised these routes, and SHOULD send it to all of 1406 them; in any case, it MAY send the request to any other neighbours, 1407 whether they advertise a route to the requested destination or not. 1408 A simple implementation strategy is therefore to unconditionally 1409 multicast the request over all interfaces. 1411 Similar requests will be sent by other nodes that are affected by the 1412 route's loss. If the network is still connected, and assuming no 1413 packet loss, then at least one of these requests will be forwarded to 1414 the source, resulting in a route being advertised with a new sequence 1415 number. (Due to duplicate suppression, only a small number of such 1416 requests will actually reach the source.) 1418 In order to compensate for packet loss, a node SHOULD repeat such a 1419 request a small number of times if no route becomes feasible within a 1420 short time. In the presence of heavy packet loss, however, all such 1421 requests might be lost; in that case, the mechanism in the next 1422 section will eventually ensure that a new seqno is received. 1424 3.8.2.2. Dealing with Unfeasible Updates 1426 When a route's metric increases, a node might receive an unfeasible 1427 update for a route that it has currently selected. As specified in 1428 Section 3.5.1, the receiving node will either ignore the update or 1429 unselect the route. 1431 In order to keep routes from spuriously expiring because they have 1432 become unfeasible, a node SHOULD send a unicast seqno request when it 1433 receives an unfeasible update for a route that is currently selected. 1434 The requested sequence number is computed from the source table as in 1435 Section 3.8.2.1 above. 1437 Additionally, since metric computation does not necessarily coincide 1438 with the delay in propagating updates, a node might receive an 1439 unfeasible update from a currently unselected neighbour that is 1440 preferable to the currently selected route (e.g., because it has a 1441 much smaller metric); in that case, the node SHOULD send a unicast 1442 seqno request to the neighbour that advertised the preferable update. 1444 3.8.2.3. Preventing Routes from Expiring 1446 In normal operation, a route's expiry timer never triggers: since a 1447 route's hold time is computed from an explicit interval included in 1448 Update TLVs, a new update (possibly a retraction) should arrive in 1449 time to prevent a route from expiring. 1451 In the presence of packet loss, however, it may be the case that no 1452 update is successfully received for an extended period of time, 1453 causing a route to expire. In order to avoid such spurious expiry, 1454 shortly before a selected route expires, a Babel node SHOULD send a 1455 unicast route request to the neighbour that advertised this route; 1456 since nodes always send either updates or retractions in response to 1457 non-wildcard route requests (Section 3.8.1.1), this will usually 1458 result in the route being either refreshed or retracted. 1460 3.8.2.4. Acquiring New Neighbours 1462 In order to speed up convergence after a mobility event, a node MAY 1463 send a unicast wildcard request after acquiring a new neighbour. 1464 Additionally, a node MAY send a small number of multicast wildcard 1465 requests shortly after booting. Note however that doing that 1466 carelessly can cause serious congestion when a whole network is 1467 rebooted, especially on link layers with high per-packet overhead 1468 (e.g., IEEE 802.11). 1470 4. Protocol Encoding 1472 A Babel packet is sent as the body of a UDP datagram, with network- 1473 layer hop count set to 1, destined to a well-known multicast address 1474 or to a unicast address, over IPv4 or IPv6; in the case of IPv6, 1475 these addresses are link-local. Both the source and destination UDP 1476 port are set to a well-known port number. A Babel packet MUST be 1477 silently ignored unless its source address is either a link-local 1478 IPv6 address or an IPv4 address belonging to the local network, and 1479 its source port is the well-known Babel port. It MAY be silently 1480 ignored if its destination address is a global IPv6 address. 1482 In order to minimise the number of packets being sent while avoiding 1483 lower-layer fragmentation, a Babel node SHOULD attempt to maximise 1484 the size of the packets it sends, up to the outgoing interface's MTU 1485 adjusted for lower-layer headers (28 octets for UDP over IPv4, 48 1486 octets for UDP over IPv6). It MUST NOT send packets larger than the 1487 attached interface's MTU adjusted for lower-layer headers or 512 1488 octets, whichever is larger, but not exceeding 2^16 - 1 adjusted for 1489 lower-layer headers. Every Babel speaker MUST be able to receive 1490 packets that are as large as any attached interface's MTU adjusted 1491 for lower-layer headers or 512 octets, whichever is larger. Babel 1492 packets MUST NOT be sent in IPv6 Jumbograms. 1494 In order to avoid global synchronisation of a Babel network and to 1495 aggregate multiple TLVs into large packets, a Babel node SHOULD 1496 buffer every TLV and delay sending a packet by a small, randomly 1497 chosen delay [JITTER]. In order to allow accurate computation of 1498 packet loss rates, this delay MUST NOT be larger than half the 1499 advertised Hello interval. 1501 4.1. Data Types 1503 4.1.1. Interval 1505 Relative times are carried as 16-bit values specifying a number of 1506 centiseconds (hundredths of a second). This allows times up to 1507 roughly 11 minutes with a granularity of 10ms, which should cover all 1508 reasonable applications of Babel. 1510 4.1.2. Router-Id 1512 A router-id is an arbitrary 8-octet value. A router-id MUST NOT 1513 consist of either all zeroes or all ones. 1515 4.1.3. Address 1517 Since the bulk of the protocol is taken by addresses, multiple ways 1518 of encoding addresses are defined. Additionally, a common subnet 1519 prefix may be omitted when multiple addresses are sent in a single 1520 packet -- this is known as address compression (Section 4.6.9). 1522 Address encodings: 1524 o AE 0: wildcard address. The value is 0 octets long. 1526 o AE 1: IPv4 address. Compression is allowed. 4 octets or less. 1528 o AE 2: IPv6 address. Compression is allowed. 16 octets or less. 1530 o AE 3: link-local IPv6 address. Compression is not allowed. The 1531 value is 8 octets long, a prefix of fe80::/64 is implied. 1533 The address family associated to an address encoding is either IPv4 1534 or IPv6; it is undefined for AE 0, IPv4 for AE 1, and IPv6 for AEs 2 1535 and 3. 1537 4.1.4. Prefixes 1539 A network prefix is encoded just like a network address, but it is 1540 stored in the smallest number of octets that are enough to hold the 1541 significant bits (up to the prefix length). 1543 4.2. Packet Format 1545 A Babel packet consists of a 4-octet header, followed by a sequence 1546 of TLVs (the packet body), optionally followed by a second sequence 1547 of TLVs (the packet trailer). 1549 0 1 2 3 1550 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1551 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1552 | Magic | Version | Body length | 1553 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1554 | Packet Body ... 1555 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- 1556 | Packet Trailer... 1557 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- 1559 Fields : 1561 Magic The arbitrary but carefully chosen value 42 (decimal); 1562 packets with a first octet different from 42 MUST be 1563 silently ignored. 1565 Version This document specifies version 2 of the Babel protocol. 1566 Packets with a second octet different from 2 MUST be 1567 silently ignored. 1569 Body length The length in octets of the body following the packet 1570 header (excluding the Magic, Version and Body length 1571 fields, and excluding the packet trailer). 1573 Packet Body The packet body; a sequence of TLVs. 1575 Packet Trailer The packet trailer; another sequence of TLVs. 1577 The packet body and trailer are both sequences of TLVs. The packet 1578 body is the normal place to store TLVs; the packet trailer only 1579 contains specialised TLVs that do not need to be protected by 1580 cryptographic security mechanisms. When parsing the trailer, the 1581 receiver MUST ignore any TLV unless its definition explicitly states 1582 that it is allowed to appear there. Among the TLVs defined in this 1583 document, only Pad1 and PadN are allowed in the trailer; since these 1584 TLVs are ignored in any case, an implementation MAY silently ignore 1585 the packet trailer without even parsing it, unless it implements at 1586 least one extension that defines TLVs that are allowed to appear in 1587 the trailer. 1589 4.3. TLV Format 1591 With the exception of Pad1, all TLVs have the following structure: 1593 0 1 2 3 1594 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1595 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1596 | Type | Length | Payload... 1597 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- 1599 Fields : 1601 Type The type of the TLV. 1603 Length The length of the body, exclusive of the Type and Length 1604 fields. If the body is longer than the expected length of 1605 a given type of TLV, any extra data MUST be silently 1606 ignored. 1608 Payload The TLV payload, which consists of a body and, for selected 1609 TLV types, an optional list of sub-TLVs. 1611 TLVs with an unknown type value MUST be silently ignored. 1613 4.4. Sub-TLV Format 1615 Every TLV carries an explicit length in its header; however, most 1616 TLVs are self-terminating, in the sense that it is possible to 1617 determine the length of the body without reference to the explicit 1618 Length field. If a TLV has a self-terminating format, then it MAY 1619 allow a sequence of sub-TLVs to follow the body. 1621 Sub-TLVs have the same structure as TLVs. With the exception of 1622 PAD1, all TLVs have the following structure: 1624 0 1 2 3 1625 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1626 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1627 | Type | Length | Body... 1628 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- 1630 Fields : 1632 Type The type of the sub-TLV. 1634 Length The length of the body, in octets, exclusive of the Type 1635 and Length fields. 1637 Body The sub-TLV body, the interpretation of which depends on 1638 both the type of the sub-TLV and the type of the TLV within 1639 which it is embedded. 1641 The most-significant bit of the sub-TLV, called the mandatory bit, 1642 indicates how to handle unknown sub-TLVs. If the mandatory bit is 1643 not set, then an unknown sub-TLV MUST be silently ignored, and the 1644 rest of the TLV processed normally. If the mandatory bit is set, 1645 then the whole enclosing TLV MUST be silently ignored (except for 1646 updating the parser state by a Router-Id, Next-Hop or Update TLV, see 1647 Section 4.6.7, Section 4.6.8, and Section 4.6.9). 1649 4.5. Parser state 1651 Babel uses a stateful parser: a TLV may refer to data from a previous 1652 TLV. The parser state consists of the following pieces of data: 1654 o for each address encoding that allows compression, the current 1655 default prefix; this is undefined at the start of the packet, and 1656 is updated by each Update TLV with the Prefix flag set 1657 (Section 4.6.9); 1659 o for each address family (IPv4 or IPv6), the current next-hop; this 1660 is the source address of the enclosing packet for the matching 1661 address family at the start of a packet, and is updated by each 1662 Next-Hop TLV (Section 4.6.8); 1664 o the current router-id; this is undefined at the start of the 1665 packet, and is updated by each Router-ID TLV (Section 4.6.7) and 1666 by each Update TLV with Router-Id flag set. 1668 Since the parser state is separate from the bulk of Babel's state, 1669 and since for correct parsing it must be identical across 1670 implementations, it is updated before checking for mandatory TLVs: 1671 parsing a TLV MUST update the parser state even if the TLV is 1672 otherwise ignored due to an unknown mandatory sub-TLV. 1674 None of the TLVs that modify the parser state are allowed in the 1675 packet trailer; hence, an implementation may choose to use a 1676 dedicated stateless parser to parse the packet trailer. 1678 4.6. Details of Specific TLVs 1680 4.6.1. Pad1 1682 0 1683 0 1 2 3 4 5 6 7 1684 +-+-+-+-+-+-+-+-+ 1685 | Type = 0 | 1686 +-+-+-+-+-+-+-+-+ 1688 Fields : 1690 Type Set to 0 to indicate a Pad1 TLV. 1692 This TLV is silently ignored on reception. It is allowed in the 1693 packet trailer. 1695 4.6.2. PadN 1697 0 1 2 3 1698 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1699 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1700 | Type = 1 | Length | MBZ... 1701 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- 1703 Fields : 1705 Type Set to 1 to indicate a PadN TLV. 1707 Length The length of the body, exclusive of the Type and Length 1708 fields. 1710 MBZ Set to 0 on transmission. 1712 This TLV is silently ignored on reception. It is allowed in the 1713 packet trailer. 1715 4.6.3. Acknowledgment Request 1717 0 1 2 3 1718 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1719 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1720 | Type = 2 | Length | Reserved | 1721 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1722 | Nonce | Interval | 1723 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1725 This TLV requests that the receiver send an Acknowledgment TLV within 1726 the number of centiseconds specified by the Interval field. 1728 Fields : 1730 Type Set to 2 to indicate an Acknowledgment Request TLV. 1732 Length The length of the body, exclusive of the Type and Length 1733 fields. 1735 Reserved Sent as 0 and MUST be ignored on reception. 1737 Nonce An arbitrary value that will be echoed in the receiver's 1738 Acknowledgment TLV. 1740 Interval A time interval in centiseconds after which the sender will 1741 assume that this packet has been lost. This MUST NOT be 0. 1742 The receiver MUST send an Acknowledgment TLV before this 1743 time has elapsed (with a margin allowing for propagation 1744 time). 1746 This TLV is self-terminating, and allows sub-TLVs. 1748 4.6.4. Acknowledgment 1749 0 1 2 3 1750 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1751 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1752 | Type = 3 | Length | Nonce | 1753 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1755 This TLV is sent by a node upon receiving an Acknowledgment Request. 1757 Fields : 1759 Type Set to 3 to indicate an Acknowledgment TLV. 1761 Length The length of the body, exclusive of the Type and Length 1762 fields. 1764 Nonce Set to the Nonce value of the Acknowledgment Request that 1765 prompted this Acknowledgment. 1767 Since nonce values are not globally unique, this TLV MUST be sent to 1768 a unicast address. 1770 This TLV is self-terminating, and allows sub-TLVs. 1772 4.6.5. Hello 1774 0 1 2 3 1775 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1776 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1777 | Type = 4 | Length | Flags | 1778 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1779 | Seqno | Interval | 1780 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1782 This TLV is used for neighbour discovery and for determining a 1783 neighbour's reception cost. 1785 Fields : 1787 Type Set to 4 to indicate a Hello TLV. 1789 Length The length of the body, exclusive of the Type and Length 1790 fields. 1792 Flags The individual bits of this field specify special handling 1793 of this TLV (see below). 1795 Seqno If the Unicast flag is set, this is the value of the 1796 sending node's outgoing Unicast Hello seqno for this 1797 neighbour. Otherwise, it is the sending node's outgoing 1798 Multicast Hello seqno for this interface. 1800 Interval If non-zero, this is an upper bound, expressed in 1801 centiseconds, on the time after which the sending node will 1802 send a new scheduled Hello TLV with the same setting of the 1803 Unicast flag. If this is 0, then this Hello represents an 1804 unscheduled Hello, and doesn't carry any new information 1805 about times at which Hellos are sent. 1807 The Flags field is interpreted as follows: 1809 0 1 1810 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 1811 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1812 |U|X|X|X|X|X|X|X|X|X|X|X|X|X|X|X| 1813 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1815 o U (Unicast) flag (8000 hexadecimal): if set, then this Hello 1816 represents a Unicast Hello, otherwise it represents a Multicast 1817 Hello; 1819 o X: all other bits MUST be sent as 0 and silently ignored on 1820 reception. 1822 Every time a Hello is sent, the corresponding seqno counter MUST be 1823 incremented. Since there is a single seqno counter for all the 1824 Multicast Hellos sent by a given node over a given interface, if the 1825 Unicast flag is not set, this TLV MUST be sent to all neighbors on 1826 this link, which can be achieved by sending to a multicast 1827 destination, or by sending multiple packets to the unicast addresses 1828 of all reachable neighbours. Conversely, if the Unicast flag is set, 1829 this TLV MUST be sent to a single neighbour, which can achieved by 1830 sending to a unicast destination. In order to avoid large 1831 discontinuities in link quality, multiple Hello TLVs SHOULD NOT be 1832 sent in the same packet. 1834 This TLV is self-terminating, and allows sub-TLVs. 1836 4.6.6. IHU 1837 0 1 2 3 1838 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1839 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1840 | Type = 5 | Length | AE | Reserved | 1841 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1842 | Rxcost | Interval | 1843 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1844 | Address... 1845 +-+-+-+-+-+-+-+-+-+-+-+- 1847 An IHU ("I Heard You") TLV is used for confirming bidirectional 1848 reachability and carrying a link's transmission cost. 1850 Fields : 1852 Type Set to 5 to indicate an IHU TLV. 1854 Length The length of the body, exclusive of the Type and Length 1855 fields. 1857 AE The encoding of the Address field. This should be 1 or 3 1858 in most cases. As an optimisation, it MAY be 0 if the TLV 1859 is sent to a unicast address, if the association is over a 1860 point-to-point link, or when bidirectional reachability is 1861 ascertained by means outside of the Babel protocol. 1863 Reserved Sent as 0 and MUST be ignored on reception. 1865 Rxcost The rxcost according to the sending node of the interface 1866 whose address is specified in the Address field. The value 1867 FFFF hexadecimal (infinity) indicates that this interface 1868 is unreachable. 1870 Interval An upper bound, expressed in centiseconds, on the time 1871 after which the sending node will send a new IHU; this MUST 1872 NOT be 0. The receiving node will use this value in order 1873 to compute a hold time for this symmetric association. 1875 Address The address of the destination node, in the format 1876 specified by the AE field. Address compression is not 1877 allowed. 1879 Conceptually, an IHU is destined to a single neighbour. However, IHU 1880 TLVs contain an explicit destination address, and MAY be sent to a 1881 multicast address, as this allows aggregation of IHUs destined to 1882 distinct neighbours into a single packet and avoids the need for an 1883 ARP or Neighbour Discovery exchange when a neighbour is not being 1884 used for data traffic. 1886 IHU TLVs with an unknown value in the AE field MUST be silently 1887 ignored. 1889 This TLV is self-terminating, and allows sub-TLVs. 1891 4.6.7. Router-Id 1893 0 1 2 3 1894 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1895 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1896 | Type = 6 | Length | Reserved | 1897 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1898 | | 1899 + Router-Id + 1900 | | 1901 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1903 A Router-Id TLV establishes a router-id that is implied by subsequent 1904 Update TLVs. This TLV sets the router-id even if it is otherwise 1905 ignored due to an unknown mandatory sub-TLV. 1907 Fields : 1909 Type Set to 6 to indicate a Router-Id TLV. 1911 Length The length of the body, exclusive of the Type and Length 1912 fields. 1914 Reserved Sent as 0 and MUST be ignored on reception. 1916 Router-Id The router-id for routes advertised in subsequent Update 1917 TLVs. This MUST NOT consist of all zeroes or all ones. 1919 This TLV is self-terminating, and allows sub-TLVs. 1921 4.6.8. Next Hop 1923 0 1 2 3 1924 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1925 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1926 | Type = 7 | Length | AE | Reserved | 1927 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1928 | Next hop... 1929 +-+-+-+-+-+-+-+-+-+-+-+- 1931 A Next Hop TLV establishes a next-hop address for a given address 1932 family (IPv4 or IPv6) that is implied in subsequent Update TLVs. 1934 This TLV sets up the next-hop for subsequent Update TLVs even if it 1935 is otherwise ignored due to an unknown mandatory sub-TLV. 1937 Fields : 1939 Type Set to 7 to indicate a Next Hop TLV. 1941 Length The length of the body, exclusive of the Type and Length 1942 fields. 1944 AE The encoding of the Address field. This SHOULD be 1 (IPv4) 1945 or 3 (link-local IPv6), and MUST NOT be 0. 1947 Reserved Sent as 0 and MUST be ignored on reception. 1949 Next hop The next-hop address advertised by subsequent Update TLVs, 1950 for this address family. 1952 When the address family matches the network-layer protocol that this 1953 packet is transported over, a Next Hop TLV is not needed: in the 1954 absence of a Next Hop TLV in a given address family, the next hop 1955 address is taken to be the source address of the packet. 1957 Next Hop TLVs with an unknown value for the AE field MUST be silently 1958 ignored. 1960 This TLV is self-terminating, and allows sub-TLVs. 1962 4.6.9. Update 1964 0 1 2 3 1965 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1966 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1967 | Type = 8 | Length | AE | Flags | 1968 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1969 | Plen | Omitted | Interval | 1970 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1971 | Seqno | Metric | 1972 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1973 | Prefix... 1974 +-+-+-+-+-+-+-+-+-+-+-+- 1976 An Update TLV advertises or retracts a route. As an optimisation, it 1977 can optionally have the side effect of establishing a new implied 1978 router-id and a new default prefix. 1980 Fields : 1982 Type Set to 8 to indicate an Update TLV. 1984 Length The length of the body, exclusive of the Type and Length 1985 fields. 1987 AE The encoding of the Prefix field. 1989 Flags The individual bits of this field specify special handling 1990 of this TLV (see below). 1992 Plen The length of the advertised prefix. 1994 Omitted The number of octets that have been omitted at the 1995 beginning of the advertised prefix and that should be taken 1996 from a preceding Update TLV in the same address family with 1997 the Prefix flag set. 1999 Interval An upper bound, expressed in centiseconds, on the time 2000 after which the sending node will send a new update for 2001 this prefix. This MUST NOT be 0. The receiving node will 2002 use this value to compute a hold time for the route table 2003 entry. The value FFFF hexadecimal (infinity) expresses 2004 that this announcement will not be repeated unless a 2005 request is received (Section 3.8.2.3). 2007 Seqno The originator's sequence number for this update. 2009 Metric The sender's metric for this route. The value FFFF 2010 hexadecimal (infinity) means that this is a route 2011 retraction. 2013 Prefix The prefix being advertised. This field's size is 2014 (Plen/8 - Omitted) rounded upwards. 2016 The Flags field is interpreted as follows: 2018 0 1 2 3 4 5 6 7 2019 +-+-+-+-+-+-+-+-+ 2020 |P|R|X|X|X|X|X|X| 2021 +-+-+-+-+-+-+-+-+ 2023 o P (Prefix) flag (80 hexadecimal): if set, then this Update 2024 establishes a new default prefix for subsequent Update TLVs with a 2025 matching address encoding within the same packet, even if this TLV 2026 is otherwise ignored due to an unknown mandatory sub-TLV; 2028 o R (Router-Id) flag (40 hexadecimal): if set, then this TLV 2029 establishes a new default router-id for this TLV and subsequent 2030 Update TLVs in the same packet, even if this TLV is otherwise 2031 ignored due to an unknown mandatory sub-TLV. This router-id is 2032 computed from the first address of the advertised prefix as 2033 follows: 2035 * if the length of the address is 8 octets or more, then the new 2036 router-id is taken from the 8 last octets of the address; 2038 * if the length of the address is smaller than 8 octets, then the 2039 new router-id consists of the required number of zero octets 2040 followed by the address, i.e., the address is stored on the 2041 right of the router-id. For example, for an IPv4 address, the 2042 router-id consists of 4 octets of zeroes followed by the IPv4 2043 address. 2045 o X: all other bits MUST be sent as 0 and silently ignored on 2046 reception. 2048 The prefix being advertised by an Update TLV is computed as follows: 2050 o the first Omitted octets of the prefix are taken from the previous 2051 Update TLV with the Prefix flag set and the same address encoding, 2052 even if it was ignored due to an unknown mandatory sub-TLV; 2054 o the next (Plen/8 - Omitted) rounded upwards octets are taken from 2055 the Prefix field; 2057 o the remaining octets are set to 0. If AE is 3 (link-local IPv6), 2058 Omitted MUST be 0) 2060 If the Metric field is finite, the router-id of the originating node 2061 for this announcement is taken from the prefix advertised by this 2062 Update if the Router-Id flag is set, computed as described above. 2063 Otherwise, it is taken either from the preceding Router-Id packet, or 2064 the preceding Update packet with the Router-Id flag set, whichever 2065 comes last, even if that TLV is otherwise ignored due to an unknown 2066 mandatory sub-TLV. 2068 The next-hop address for this update is taken from the last preceding 2069 Next Hop TLV with a matching address family (IPv4 or IPv6) in the 2070 same packet even if it was otherwise ignored due to an unknown 2071 mandatory sub-TLV; if no such TLV exists, it is taken from the 2072 network-layer source address of this packet. 2074 If the metric field is FFFF hexadecimal, this TLV specifies a 2075 retraction. In that case, the router-id, next-hop and seqno are not 2076 used. AE MAY then be 0, in which case this Update retracts all of 2077 the routes previously advertised by the sending interface. If the 2078 metric is finite, AE MUST NOT be 0. If the metric is infinite and AE 2079 is 0, Plen and Omitted MUST both be 0. 2081 Update TLVs with an unknown value in the AE field MUST be silently 2082 ignored. 2084 This TLV is self-terminating, and allows sub-TLVs. 2086 4.6.10. Route Request 2088 0 1 2 3 2089 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2090 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2091 | Type = 9 | Length | AE | Plen | 2092 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2093 | Prefix... 2094 +-+-+-+-+-+-+-+-+-+-+-+- 2096 A Route Request TLV prompts the receiver to send an update for a 2097 given prefix, or a full route table dump. 2099 Fields : 2101 Type Set to 9 to indicate a Route Request TLV. 2103 Length The length of the body, exclusive of the Type and Length 2104 fields. 2106 AE The encoding of the Prefix field. The value 0 specifies 2107 that this is a request for a full route table dump (a 2108 wildcard request). 2110 Plen The length of the requested prefix. 2112 Prefix The prefix being requested. This field's size is Plen/8 2113 rounded upwards. 2115 A Request TLV prompts the receiver to send an update message 2116 (possibly a retraction) for the prefix specified by the AE, Plen, and 2117 Prefix fields, or a full dump of its route table if AE is 0 (in which 2118 case Plen MUST be 0 and Prefix is of length 0). 2120 This TLV is self-terminating, and allows sub-TLVs. 2122 4.6.11. Seqno Request 2124 0 1 2 3 2125 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2126 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2127 | Type = 10 | Length | AE | Plen | 2128 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2129 | Seqno | Hop Count | Reserved | 2130 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2131 | | 2132 + Router-Id + 2133 | | 2134 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2135 | Prefix... 2136 +-+-+-+-+-+-+-+-+-+-+ 2138 A Seqno Request TLV prompts the receiver to send an Update for a 2139 given prefix with a given sequence number, or to forward the request 2140 further if it cannot be satisfied locally. 2142 Fields : 2144 Type Set to 10 to indicate a Seqno Request message. 2146 Length The length of the body, exclusive of the Type and Length 2147 fields. 2149 AE The encoding of the Prefix field. This MUST NOT be 0. 2151 Plen The length of the requested prefix. 2153 Seqno The sequence number that is being requested. 2155 Hop Count The maximum number of times that this TLV may be forwarded, 2156 plus 1. This MUST NOT be 0. 2158 Reserved Sent as 0 and MUST be ignored on reception. 2160 Router-Id The Router-Id that is being requested. This MUST NOT 2161 consist of all zeroes or all ones. 2163 Prefix The prefix being requested. This field's size is Plen/8 2164 rounded upwards. 2166 A Seqno Request TLV prompts the receiving node to send a finite- 2167 metric Update for the prefix specified by the AE, Plen, and Prefix 2168 fields, with either a router-id different from what is specified by 2169 the Router-Id field, or a Seqno no less (modulo 2^16) than what is 2170 specified by the Seqno field. If this request cannot be satisfied 2171 locally, then it is forwarded according to the rules set out in 2172 Section 3.8.1.2. 2174 While a Seqno Request MAY be sent to a multicast address, it MUST NOT 2175 be forwarded to a multicast address and MUST NOT be forwarded to more 2176 than one neighbour. A request MUST NOT be forwarded if its Hop Count 2177 field is 1. 2179 This TLV is self-terminating, and allows sub-TLVs. 2181 4.7. Details of specific sub-TLVs 2183 4.7.1. Pad1 2185 0 1 2 3 4 5 6 7 2186 +-+-+-+-+-+-+-+-+ 2187 | Type = 0 | 2188 +-+-+-+-+-+-+-+-+ 2190 Fields : 2192 Type Set to 0 to indicate a Pad1 sub-TLV. 2194 This sub-TLV is silently ignored on reception. It is allowed within 2195 any TLV that allows sub-TLVs. 2197 4.7.2. PadN 2199 0 1 2 3 2200 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2201 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2202 | Type = 1 | Length | MBZ... 2203 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- 2205 Fields : 2207 Type Set to 1 to indicate a PadN sub-TLV. 2209 Length The length of the body, in octets, exclusive of the Type 2210 and Length fields. 2212 MBZ Set to 0 on transmission. 2214 This sub-TLV is silently ignored on reception. It is allowed within 2215 any TLV that allows sub-TLVs. 2217 5. IANA Considerations 2219 IANA has registered the UDP port number 6696, called "babel", for use 2220 by the Babel protocol. 2222 IANA has registered the IPv6 multicast group ff02::1:6 and the IPv4 2223 multicast group 224.0.0.111 for use by the Babel protocol. 2225 IANA has created a registry called "Babel TLV Types". The values in 2226 this registry are not changed by this specification. 2228 IANA has created a registry called "Babel sub-TLV Types". Due to the 2229 addition of a Mandatory bit to the Babel protocol, the values in the 2230 "Babel sub-TLV Types" registry are amended as follows: 2232 +---------+-----------------------------------------+---------------+ 2233 | Type | Name | Reference | 2234 +---------+-----------------------------------------+---------------+ 2235 | 0 | Pad1 | this document | 2236 | | | | 2237 | 1 | PadN | this document | 2238 | | | | 2239 | 112-126 | Reserved for Experimental Use | this document | 2240 | | | | 2241 | 127 | Reserved for expansion of the type | this document | 2242 | | space | | 2243 | | | | 2244 | 240-254 | Reserved for Experimental Use | this document | 2245 | | | | 2246 | 255 | Reserved for expansion of the type | this document | 2247 | | space | | 2248 +---------+-----------------------------------------+---------------+ 2250 Existing assignments in the "Babel sub-TLV Types" registry in the 2251 range 2 to 111 are not changed by this specification. The values 224 2252 through 239, previously reserved for Experimental Use, are now 2253 unassigned. 2255 IANA has created a registry called "Babel Flags Values". IANA is 2256 instructed to rename this registry to "Babel Update Flags Values", 2257 with its contents unchanged. 2259 IANA is instructed to create a new registry called "Babel Hello Flags 2260 Values". The allocation policy for this registry is Specification 2261 Required [RFC8126]. The initial values in this registry are as 2262 follows: 2264 +------+------------+---------------+ 2265 | Bit | Name | Reference | 2266 +------+------------+---------------+ 2267 | 0 | Unicast | this document | 2268 | | | | 2269 | 1-15 | Unassigned | | 2270 +------+------------+---------------+ 2272 IANA is instructed to replace all references to RFCs 6126 and 7557 in 2273 all of the registries mentioned above by references to this document. 2275 6. Security Considerations 2277 As defined in this document, Babel is a completely insecure protocol. 2278 Any attacker can misdirect data traffic by advertising routes with a 2279 low metric or a high seqno. This issue can be solved either by a 2280 lower-layer security mechanism (e.g., link-layer security or IPsec), 2281 or by deploying a suitable authentication mechanism within Babel 2282 itself. There are currently two such mechanisms: Babel over DTLS 2283 [BABEL-DTLS] and HMAC-based authentication [BABEL-HMAC]. Both 2284 mechanisms ensure integrity of messages and prevent message replay, 2285 but only DTLS supports asymmetric keying and message confidentiality. 2286 HMAC is simpler and does not depend on DTLS, and therefore its use is 2287 RECOMMENDED whenever both mechanisms are applicable. 2289 The information that a Babel node announces to the whole routing 2290 domain is often sufficient to determine a mobile node's physical 2291 location with reasonable precision. The privacy issues that this 2292 causes can be mitigated somewhat by using randomly chosen router-ids 2293 and randomly chosen IP addresses, and changing them periodically. 2295 When carried over IPv6, Babel packets are ignored unless they are 2296 sent from a link-local IPv6 address; since routers don't forward 2297 link-local IPv6 packets, this provides protection against spoofed 2298 Babel packets being sent from the global Internet. No such natural 2299 protection exists when Babel packets are carried over IPv4. 2301 7. Acknowledgments 2303 A number of people have contributed text and ideas to this 2304 specification. The authors are particularly indebted to Matthieu 2305 Boutier, Gwendoline Chouasne, Margaret Cullen, Donald Eastlake, Toke 2306 Hoiland-Jorgensen and Joao Sobrinho. Earlier versions of this 2307 document greatly benefited from the input of Joel Halpern. The 2308 address compression technique was inspired by [PACKETBB]. 2310 8. References 2312 8.1. Normative References 2314 [BABEL-DTLS] 2315 Decimo, A., Schinazi, D., and J. Chroboczek, "Babel 2316 Routing Protocol over Datagram Transport Layer Security", 2317 Internet Draft draft-ietf-babel-dtls-04, February 2019. 2319 [BABEL-HMAC] 2320 Do, C., Kolodziejak, W., and J. Chroboczek, "HMAC 2321 authentication for the Babel routing protocol", Internet 2322 Draft draft-ietf-babel-hmac-04, March 2019. 2324 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2325 Requirement Levels", BCP 14, RFC 2119, 2326 DOI 10.17487/RFC2119, March 1997. 2328 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 2329 Writing an IANA Considerations Section in RFCs", BCP 26, 2330 RFC 8126, June 2017. 2332 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2333 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 2334 May 2017. 2336 8.2. Informative References 2338 [DSDV] Perkins, C. and P. Bhagwat, "Highly Dynamic Destination- 2339 Sequenced Distance-Vector Routing (DSDV) for Mobile 2340 Computers", ACM SIGCOMM'94 Conference on Communications 2341 Architectures, Protocols and Applications 234-244, 1994. 2343 [DUAL] Garcia Luna Aceves, J., "Loop-Free Routing Using Diffusing 2344 Computations", IEEE/ACM Transactions on Networking 1:1, 2345 February 1993. 2347 [EIGRP] Albrightson, B., Garcia Luna Aceves, J., and J. Boyle, 2348 "EIGRP -- a Fast Routing Protocol Based on Distance 2349 Vectors", Proc. Interop 94, 1994. 2351 [ETX] De Couto, D., Aguayo, D., Bicket, J., and R. Morris, "A 2352 high-throughput path metric for multi-hop wireless 2353 networks", Proc. MobiCom 2003, 2003. 2355 [IS-IS] "Information technology -- Telecommunications and 2356 information exchange between systems -- Intermediate 2357 System to Intermediate System intra-domain routeing 2358 information exchange protocol for use in conjunction with 2359 the protocol for providing the connectionless-mode network 2360 service (ISO 8473)", ISO/IEC 10589:2002, 2002. 2362 [JITTER] Floyd, S. and V. Jacobson, "The synchronization of 2363 periodic routing messages", IEEE/ACM Transactions on 2364 Networking 2, 2, 122-136, April 1994. 2366 [OSPF] Moy, J., "OSPF Version 2", RFC 2328, April 1998. 2368 [PACKETBB] 2369 Clausen, T., Dearlove, C., Dean, J., and C. Adjih, 2370 "Generalized Mobile Ad Hoc Network (MANET) Packet/Message 2371 Format", RFC 5444, February 2009. 2373 [RIP] Malkin, G., "RIP Version 2", RFC 2453, November 1998. 2375 Appendix A. Cost and Metric Computation 2377 The strategy for computing link costs and route metrics is a local 2378 matter; Babel itself only requires that it comply with the conditions 2379 given in Section 3.4.3 and Section 3.5.2. Different nodes may use 2380 different strategies in a single network and may use different 2381 strategies on different interface types. This section describes the 2382 strategies used by the sample implementation of Babel. 2384 The sample implementation of Babel sends periodic Multicast Hellos, 2385 and never sends Unicast Hellos. It maintains statistics about the 2386 last 16 received Hello TLVs of each kind (Appendix A.1), computes 2387 costs by using the 2-out-of-3 strategy (Appendix A.2.1) on wired 2388 links, and ETX (Appendix A.2.2) on wireless links. It uses an 2389 additive algebra for metric computation (Appendix A.3.1). 2391 A.1. Maintaining Hello History 2393 For each neighbour, the sample implementation of Babel maintains two 2394 sets of Hello history, one for each kind of Hello, and an expected 2395 sequence number, one for Multicast and one for Unicast Hellos. Each 2396 Hello history is a vector of 16 bits, where a 1 value represents a 2397 received Hello, and a 0 value a missed Hello. For each kind of 2398 Hello, the expected sequence number, written ne, is the sequence 2399 number that is expected to be carried by the next received Hello from 2400 this neighbour. 2402 Whenever it receives a Hello packet of a given kind from a neighbour, 2403 a node compares the received sequence number nr for that kind of 2404 Hello with its expected sequence number ne. Depending on the outcome 2405 of this comparison, one of the following actions is taken: 2407 o if the two differ by more than 16 (modulo 2^16), then the sending 2408 node has probably rebooted and lost its sequence number; the whole 2409 associated neighbour table entry is flushed and a new one is 2410 created; 2412 o otherwise, if the received nr is smaller (modulo 2^16) than the 2413 expected sequence number ne, then the sending node has increased 2414 its Hello interval without us noticing; the receiving node removes 2415 the last (ne - nr) entries from this neighbour's Hello history (we 2416 "undo history"); 2418 o otherwise, if nr is larger (modulo 2^16) than ne, then the sending 2419 node has decreased its Hello interval, and some Hellos were lost; 2420 the receiving node adds (nr - ne) 0 bits to the Hello history (we 2421 "fast-forward"). 2423 The receiving node then appends a 1 bit to the Hello history and sets 2424 ne to (nr + 1). If the Interval field of the received Hello is not 2425 zero, it resets the neighbour's hello timer to 1.5 times the 2426 advertised Interval (the extra margin allows for delay due to 2427 jitter). 2429 Whenever either Hello timer associated to a neighbour expires, the 2430 local node adds a 0 bit to this neighbour's Hello history, and 2431 increments the expected Hello number. If both Hello histories are 2432 empty (they contain 0 bits only), the neighbour entry is flushed; 2433 otherwise, the relevant hello timer is reset to the value advertised 2434 in the last Hello of that kind received from this neighbour (no extra 2435 margin is necessary in this case, since jitter was already taken into 2436 account when computing the timeout that has just expired). 2438 A.2. Cost Computation 2440 This section discusses how to compute costs based on Hello history. 2442 A.2.1. k-out-of-j 2444 K-out-of-j link sensing is suitable for wired links that are either 2445 up, in which case they only occasionally drop a packet, or down, in 2446 which case they drop all packets. 2448 The k-out-of-j strategy is parameterised by two small integers k and 2449 j, such that 0 < k <= j, and the nominal link cost, a constant K >= 2450 1. A node keeps a history of the last j hellos; if k or more of 2451 those have been correctly received, the link is assumed to be up, and 2452 the rxcost is set to K; otherwise, the link is assumed to be down, 2453 and the rxcost is set to infinity. 2455 Since Babel supports two kinds of Hellos, a Babel node performs k- 2456 out-of-j twice for each neighbour, once on the Unicast and once on 2457 the Multicast Hello history. If either of the instances of k-out- 2458 of-j indicates that the link is up, then the link is assumed to be 2459 up, and the rxcost is set to K; if both instances indicate that the 2460 link is down, then the link is assumed to be down, and the rxcost is 2461 set to infinity. In other words, the resulting rxcost is the minimum 2462 of the rxcosts yielded by the two instances of k-out-of-j link 2463 sensing. 2465 The cost of a link performing k-out-of-j link sensing is defined as 2466 follows: 2468 o cost = FFFF hexadecimal if rxcost = FFFF hexadecimal; 2470 o cost = txcost otherwise. 2472 A.2.2. ETX 2474 Unlike wired links, which are bimodal (either up or down), wireless 2475 links exhibit continuous variation of the link quality. Naive 2476 application of hop-count routing in networks that use wireless links 2477 for transit tends to select long, lossy links in preference to 2478 shorter, lossless links, which can dramatically reduce throughput. 2479 For that reason, a routing protocol designed to support wireless 2480 links must perform some form of link-quality estimation. 2482 ETX [ETX] is a simple link-quality estimation algorithm that is 2483 designed to work well with the IEEE 802.11 MAC. By default, the 2484 IEEE 802.11 MAC performs ARQ and rate adaptation on unicast frames, 2485 but not on multicast frames, which are sent at a fixed rate with no 2486 ARQ; therefore, measuring the loss rate of multicast frames yields a 2487 useful estimate of a link's quality. 2489 A node performing ETX link quality estimation uses a neighbour's 2490 Multicast Hello history to compute an estimate, written beta, of the 2491 probability that a Hello TLV is successfully received. Beta can be 2492 computed as the fraction of 1 bits within a small number (say, 6) of 2493 the most recent entries in the Multicast Hello history, or it can be 2494 an exponential average, or some combination of both approaches. 2496 Let alpha be MIN(1, 256/txcost), an estimate of the probability of 2497 successfully sending a Hello TLV. The cost is then computed by 2498 cost = 256/(alpha * beta) 2500 or, equivalently, 2502 cost = (MAX(txcost, 256) * rxcost) / 256. 2504 Since the IEEE 802.11 MAC performs ARQ on unicast frames, unicast 2505 frames do not provide a useful measure of link quality, and therefore 2506 ETX ignores the Unicast Hello history. Thus, a node performing ETX 2507 link-quality estimation will not route through neighbouring nodes 2508 unless they send periodic Multicast Hellos (possibly in addition to 2509 Unicast Hellos). 2511 A.3. Metric Computation 2513 As described in Section 3.5.2, the metric advertised by a neighbour 2514 is combined with the link cost to yield a metric. 2516 A.3.1. Additive Metrics 2518 The simplest approach for obtaining a monotonic, left-distributive 2519 metric is to define the metric of a route as the sum of the costs of 2520 the component links. More formally, if a neighbour advertises a 2521 route with metric m over a link with cost c, then the resulting route 2522 has metric M(c, m) = c + m. 2524 A multiplicative metric can be converted into an additive one by 2525 taking the logarithm (in some suitable base) of the link costs. 2527 A.3.2. External Sources of Willingness 2529 A node may want to vary its willingness to forward packets by taking 2530 into account information that is external to the Babel protocol, such 2531 as the monetary cost of a link, the node's battery status, CPU load, 2532 etc. This can be done by adding to every route's metric a value k 2533 that depends on the external data. For example, if a battery-powered 2534 node receives an update with metric m over a link with cost c, it 2535 might compute a metric M(c, m) = k + c + m, where k depends on the 2536 battery status. 2538 In order to preserve strict monotonicity (Section 3.5.2), the value k 2539 must be greater than -c. 2541 Appendix B. Constants 2543 The choice of time constants is a trade-off between fast detection of 2544 mobility events and protocol overhead. Two implementations of Babel 2545 with different time constants will interoperate, although the 2546 resulting convergence time will most likely be dictated by the slower 2547 of the two. 2549 Experience with the sample implementation of Babel indicates that the 2550 Hello interval is the most important time constant: a mobility event 2551 is detected within 1.5 to 3 Hello intervals. Due to Babel's reliance 2552 on triggered updates and explicit requests, the Update interval only 2553 has an effect on the time it takes for accurate metrics to be 2554 propagated after variations in link costs too small to trigger an 2555 unscheduled update or in the presence of packet loss. 2557 At the time of writing, the sample implementation of Babel uses the 2558 following default values: 2560 Multicast Hello Interval: 4 seconds. 2562 IHU Interval: the advertised IHU interval is always 3 times the 2563 Multicast Hello interval. IHUs are actually sent with each Hello 2564 on lossy links (as determined from the Hello history), but only 2565 with every third Multicast Hello on lossless links. 2567 Unicast Hello Interval: the sample implementation never sends 2568 scheduled Unicast Hellos; 2570 Update Interval: 4 times the Multicast Hello interval. 2572 IHU Hold Time: 3.5 times the advertised IHU interval. 2574 Route Expiry Time: 3.5 times the advertised update interval. 2576 Source GC time: 3 minutes. 2578 Request timeout: initially 2 seconds, doubled every time a request 2579 is resent, up to a maximum of three times. 2581 The amount of jitter applied to a packet depends on whether it 2582 contains any urgent TLVs or not (Section 3.1). Urgent triggered 2583 updates and urgent requests are delayed by no more than 200ms; 2584 acknowledgments, by no more than the associated deadline; and other 2585 TLVs by no more than one-half the Multicast Hello interval. 2587 Appendix C. Considerations for protocol extensions 2589 Babel is an extensible protocol, and this document defines a number 2590 of mechanisms that can be used to extend the protocol in a backwards 2591 compatible manner: 2593 o increasing the version number in the packet header; 2594 o defining new TLVs; 2596 o defining new sub-TLVs (with or without the mandatory bit set); 2598 o defining new AEs; 2600 o using the packet trailer. 2602 This appendix is intended to guide designers of protocol extensions 2603 in chosing a particular encoding. 2605 The version number in the Babel header should only be increased if 2606 the new version is not backwards compatible with the original 2607 protocol. 2609 In many cases, an extension could be implemented either by defining a 2610 new TLV, or by adding a new sub-TLV to an existing TLV. For example, 2611 an extension whose purpose is to attach additional data to route 2612 updates can be implemented either by creating a new "enriched" Update 2613 TLV, by adding a non-mandatory sub-TLV to the Update TLV, or by 2614 adding a mandatory sub-TLV. 2616 The various encodings are treated differently by implementations that 2617 do not understand the extension. In the case of a new TLV or of a 2618 sub-TLV with the mandatory bit set, the whole TLV is ignored by 2619 implementations that do not implement the extension, while in the 2620 case of a non-mandatory sub-TLV, the TLV is parsed and acted upon, 2621 and only the unknown sub-TLV is silently ignored. Therefore, a non- 2622 mandatory sub-TLV should be used by extensions that extend the Update 2623 in a compatible manner (the extension data may be silently ignored), 2624 while a mandatory sub-TLV or a new TLV must be used by extensions 2625 that make incompatible extensions to the meaning of the TLV (the 2626 whole TLV must be thrown away if the extension data is not 2627 understood). 2629 Experience shows that the need for additional data tends to crop up 2630 in the most unexpected places. Hence, it is recommended that 2631 extensions that define new TLVs should make them self-terminating, 2632 and allow attaching sub-TLVs to them. 2634 Adding a new AE is essentially equivalent to adding a new TLV: Update 2635 TLVs with an unknown AE are ignored, just like unknown TLVs. 2636 However, adding a new AE is more involved than adding a new TLV, 2637 since it creates a new set of compression state. Additionally, since 2638 the Next Hop TLV creates state specific to a given address family, as 2639 opposed to a given AE, a new AE for a previously defined address 2640 family must not be used in the Next Hop TLV if backwards 2641 compatibility is required. A similar issue arises with Update TLVs 2642 with unknown AEs establishing a new router-id (due to the Router-Id 2643 flag being set). Therefore, defining new AEs must be done with care 2644 if compatibility with unextended implementations is required. 2646 The packet trailer is intended to carry cryptographic signatures that 2647 only cover the packet body; storing the cryptographic signatures in 2648 the packet trailer avoids clearing the signature before computing a 2649 hash of the packet body, and makes it possible to check a 2650 cryptographic signature before running the full, stateful TLV parser. 2651 Hence, only TLVs that don't need to be protected by cryptographic 2652 security protocols should be allowed in the packet trailer. Any such 2653 TLVs should be easy to parse, and in particular should not require 2654 stateful parsing. 2656 Appendix D. Stub Implementations 2658 Babel is a fairly economic protocol. Updates take between 12 and 40 2659 octets per destination, depending on the address family and how 2660 successful compression is; in a double-stack flat network, an average 2661 of less than 24 octets per update is typical. The route table 2662 occupies about 35 octets per IPv6 entry. To put these values into 2663 perspective, a single full-size Ethernet frame can carry some 65 2664 route updates, and a megabyte of memory can contain a 20000-entry 2665 route table and the associated source table. 2667 Babel is also a reasonably simple protocol. The sample 2668 implementation consists of less than 12 000 lines of C code, and it 2669 compiles to less than 120 kB of text on a 32-bit CISC architecture; 2670 about half of this figure is due to protocol extensions and user- 2671 interface code. 2673 Nonetheless, in some very constrained environments, such as PDAs, 2674 microwave ovens, or abacuses, it may be desirable to have subset 2675 implementations of the protocol. 2677 There are many different definitions of a stub router, but for the 2678 needs of this section a stub implementation of Babel is one that 2679 announces one or more directly attached prefixes into a Babel network 2680 but doesn't reannounce any routes that it has learnt from its 2681 neighbours. It may either maintain a full routing table, or simply 2682 select a default gateway amongst any one of its neighbours that 2683 announces a default route. Since a stub implementation never 2684 forwards packets except from or to directly attached links, it cannot 2685 possibly participate in a routing loop, and hence it need not 2686 evaluate the feasibility condition or maintain a source table. 2688 No matter how primitive, a stub implementation MUST parse sub-TLVs 2689 attached to any TLVs that it understands and check the mandatory bit. 2691 It MUST answer acknowledgment requests and MUST participate in the 2692 Hello/IHU protocol. It MUST also be able to reply to seqno requests 2693 for routes that it announces and SHOULD be able to reply to route 2694 requests. 2696 Experience shows that an IPv6-only stub implementation of Babel can 2697 be written in less than 1000 lines of C code and compile to 13 kB of 2698 text on 32-bit CISC architecture. 2700 Appendix E. Software Availability 2702 The sample implementation of Babel is available from 2703 . 2705 Appendix F. Changes from previous versions 2707 F.1. Changes since RFC 6126 2709 o Changed UDP port number to 6696. 2711 o Consistently use router-id rather than id. 2713 o Clarified that the source garbage collection timer is reset after 2714 sending an update even if the entry was not modified. 2716 o In section "Seqno Requests", fixed an erroneous "route request". 2718 o In the description of the Seqno Request TLV, added the description 2719 of the Router-Id field. 2721 o Made router-ids all-0 and all-1 forbidden. 2723 F.2. Changes since draft-ietf-babel-rfc6126bis-00 2725 o Added security considerations. 2727 F.3. Changes since draft-ietf-babel-rfc6126bis-01 2729 o Integrated the format of sub-TLVs. 2731 o Mentioned for each TLV whether it supports sub-TLVs. 2733 o Added Appendix C. 2735 o Added a mandatory bit in sub-TLVs. 2737 o Changed compression state to be per-AF rather than per-AE. 2739 o Added implementation hint for the routing table. 2741 o Clarified how router-ids are computed when bit 0x40 is set in 2742 Updates. 2744 o Relaxed the conditions for sending requests, and tightened the 2745 conditions for forwarding requests. 2747 o Clarified that neighbours should be acquired at some point, but it 2748 doesn't matter when. 2750 F.4. Changes since draft-ietf-babel-rfc6126bis-02 2752 o Added Unicast Hellos. 2754 o Added unscheduled (interval-less) Hellos. 2756 o Changed Appendix A to consider Unicast and unscheduled Hellos. 2758 o Changed Appendix B to agree with the reference implementation. 2760 o Added optional algorithm to avoid the hold time. 2762 o Changed the table of pending seqno requests to be indexed by 2763 router-id in addition to prefixes. 2765 o Relaxed the route acquisition algorithm. 2767 o Replaced minimal implementations by stub implementations. 2769 o Added acknowledgments section. 2771 F.5. Changes since draft-ietf-babel-rfc6126bis-03 2773 o Clarified that all the data structures are conceptual. 2775 o Made sending and receiving Multicast Hellos a SHOULD, avoids 2776 expressing any opinion about Unicast Hellos. 2778 o Removed opinion about Multicast vs. Unicast Hellos (Appendix A.4). 2780 o Made hold-time into a SHOULD rather than MUST. 2782 o Clarified that Seqno Requests are for a finite-metric Update. 2784 o Clarified that sub-TLVs Pad1 and PadN are allowed within any TLV 2785 that allows sub-TLVs. 2787 o Updated IANA Considerations. 2789 o Updated Security Considerations. 2791 o Renamed routing table back to route table. 2793 o Made buffering outgoing updates a SHOULD. 2795 o Weakened advice to use modified EUI-64 in router-ids. 2797 o Added information about sending requests to Appendix B. 2799 o A number of minor wording changes and clarifications. 2801 F.6. Changes since draft-ietf-babel-rfc6126bis-03 2803 Minor editorial changes. 2805 F.7. Changes since draft-ietf-babel-rfc6126bis-04 2807 o Renamed isotonicity to left-distributivity. 2809 o Minor clarifications to unicast hellos. 2811 o Updated requirements boilerplate to RFC 8174. 2813 o Minor editorial changes. 2815 F.8. Changes since draft-ietf-babel-rfc6126bis-05 2817 o Added information about the packet trailer, now that it is used by 2818 draft-ietf-babel-hmac. 2820 F.9. Changes since draft-ietf-babel-rfc6126bis-06 2822 o Added references to security documents. 2824 F.10. Changes since draft-ietf-babel-rfc6126bis-07 2826 o Added list of obsoleted drafts to the abstract. 2828 o Updated references. 2830 F.11. Changes since draft-ietf-babel-rfc6126bis-08 2832 o Added recommendation that route selection should not take seqnos 2833 into account. 2835 Authors' Addresses 2837 Juliusz Chroboczek 2838 IRIF, University of Paris-Diderot 2839 Case 7014 2840 75205 Paris Cedex 13 2841 France 2843 Email: jch@irif.fr 2845 David Schinazi 2846 Google LLC 2847 1600 Amphitheatre Parkway 2848 Mountain View, California 94043 2849 USA 2851 Email: dschinazi.ietf@gmail.com