idnits 2.17.1 draft-ietf-babel-rfc6126bis-10.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 (June 7, 2019) is 1784 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: December 9, 2019 June 7, 2019 8 The Babel Routing Protocol 9 draft-ietf-babel-rfc6126bis-10 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 December 9, 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 F.12. Changes since draft-ietf-babel-rfc6126bis-09 . . . . . . 61 109 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 61 111 1. Introduction 113 Babel is a loop-avoiding distance-vector routing protocol that is 114 designed to be robust and efficient both in networks using prefix- 115 based routing and in networks using flat routing ("mesh networks"), 116 and both in relatively stable wired networks and in highly dynamic 117 wireless networks. 119 1.1. Features 121 The main property that makes Babel suitable for unstable networks is 122 that, unlike naive distance-vector routing protocols [RIP], it 123 strongly limits the frequency and duration of routing pathologies 124 such as routing loops and black-holes during reconvergence. Even 125 after a mobility event is detected, a Babel network usually remains 126 loop-free. Babel then quickly reconverges to a configuration that 127 preserves the loop-freedom and connectedness of the network, but is 128 not necessarily optimal; in many cases, this operation requires no 129 packet exchanges at all. Babel then slowly converges, in a time on 130 the scale of minutes, to an optimal configuration. This is achieved 131 by using sequenced routes, a technique pioneered by Destination- 132 Sequenced Distance-Vector routing [DSDV]. 134 More precisely, Babel has the following properties: 136 o when every prefix is originated by at most one router, Babel never 137 suffers from routing loops; 139 o when a single prefix is originated by multiple routers, Babel may 140 occasionally create a transient routing loop for this particular 141 prefix; this loop disappears in a time proportional to its 142 diameter, and never again (up to an arbitrary garbage-collection 143 (GC) time) will the routers involved participate in a routing loop 144 for the same prefix; 146 o assuming bounded packet loss rates, any routing black-holes that 147 may appear after a mobility event are corrected in a time at most 148 proportional to the network's diameter. 150 Babel has provisions for link quality estimation and for fairly 151 arbitrary metrics. When configured suitably, Babel can implement 152 shortest-path routing, or it may use a metric based, for example, on 153 measured packet loss. 155 Babel nodes will successfully establish an association even when they 156 are configured with different parameters. For example, a mobile node 157 that is low on battery may choose to use larger time constants (hello 158 and update intervals, etc.) than a node that has access to wall 159 power. Conversely, a node that detects high levels of mobility may 160 choose to use smaller time constants. The ability to build such 161 heterogeneous networks makes Babel particularly adapted to the 162 unmanaged and wireless environment. 164 Finally, Babel is a hybrid routing protocol, in the sense that it can 165 carry routes for multiple network-layer protocols (IPv4 and IPv6), 166 whichever protocol the Babel packets are themselves being carried 167 over. 169 1.2. Limitations 171 Babel has two limitations that make it unsuitable for use in some 172 environments. First, Babel relies on periodic routing table updates 173 rather than using a reliable transport; hence, in large, stable 174 networks it generates more traffic than protocols that only send 175 updates when the network topology changes. In such networks, 176 protocols such as OSPF [OSPF], IS-IS [IS-IS], or the Enhanced 177 Interior Gateway Routing Protocol (EIGRP) [EIGRP] might be more 178 suitable. 180 Second, unless the optional algorithm described in Section 3.5.5 is 181 implemented, Babel does impose a hold time when a prefix is 182 retracted. While this hold time does not apply to the exact prefix 183 being retracted, and hence does not prevent fast reconvergence should 184 it become available again, it does apply to any shorter prefix that 185 covers it. This may make those implementations of Babel that do not 186 implement the optional algorithm described in Section 3.5.5 187 unsuitable for use in networks that implement automatic prefix 188 aggregation. 190 1.3. Specification of Requirements 192 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 193 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 194 "OPTIONAL" in this document are to be interpreted as described in BCP 195 14 [RFC2119] [RFC8174] when, and only when, they appear in all 196 capitals, as shown here. 198 2. Conceptual Description of the Protocol 200 Babel is a loop-avoiding distance vector protocol: it is based on the 201 Bellman-Ford protocol, just like the venerable RIP [RIP], but 202 includes a number of refinements that either prevent loop formation 203 altogether, or ensure that a loop disappears in a timely manner and 204 doesn't form again. 206 Conceptually, Bellman-Ford is executed in parallel for every source 207 of routing information (destination of data traffic). In the 208 following discussion, we fix a source S; the reader will recall that 209 the same algorithm is executed for all sources. 211 2.1. Costs, Metrics and Neighbourship 213 For every pair of neighbouring nodes A and B, Babel computes an 214 abstract value known as the cost of the link from A to B, written 215 C(A, B). Given a route between any two (not necessarily 216 neighbouring) nodes, the metric of the route is the sum of the costs 217 of all the links along the route. The goal of the routing algorithm 218 is to compute, for every source S, the tree of routes of lowest 219 metric to S. 221 Costs and metrics need not be integers. In general, they can be 222 values in any algebra that satisfies two fairly general conditions 223 (Section 3.5.2). 225 A Babel node periodically sends Hello messages to all of its 226 neighbours; it also periodically sends an IHU ("I Heard You") message 227 to every neighbour from which it has recently heard a Hello. From 228 the information derived from Hello and IHU messages received from its 229 neighbour B, a node A computes the cost C(A, B) of the link from A to 230 B. 232 2.2. The Bellman-Ford Algorithm 234 Every node A maintains two pieces of data: its estimated distance to 235 S, written D(A), and its next-hop router to S, written NH(A). 236 Initially, D(S) = 0, D(A) is infinite, and NH(A) is undefined. 238 Periodically, every node B sends to all of its neighbours a route 239 update, a message containing D(B). When a neighbour A of B receives 240 the route update, it checks whether B is its selected next hop; if 241 that is the case, then NH(A) is set to B, and D(A) is set to C(A, B) 242 + D(B). If that is not the case, then A compares C(A, B) + D(B) to 243 its current value of D(A). If that value is smaller, meaning that 244 the received update advertises a route that is better than the 245 currently selected route, then NH(A) is set to B, and D(A) is set to 246 C(A, B) + D(B). 248 A number of refinements to this algorithm are possible, and are used 249 by Babel. In particular, convergence speed may be increased by 250 sending unscheduled "triggered updates" whenever a major change in 251 the topology is detected, in addition to the regular, scheduled 252 updates. Additionally, a node may maintain a number of alternate 253 routes, which are being advertised by neighbours other than its 254 selected neighbour, and which can be used immediately if the selected 255 route were to fail. 257 2.3. Transient Loops in Bellman-Ford 259 It is well known that a naive application of Bellman-Ford to 260 distributed routing can cause transient loops after a topology 261 change. Consider for example the following topology: 263 B 264 1 /| 265 1 / | 266 S --- A |1 267 \ | 268 1 \| 269 C 271 After convergence, D(B) = D(C) = 2, with NH(B) = NH(C) = A. 273 Suppose now that the link between S and A fails: 275 B 276 1 /| 277 / | 278 S A |1 279 \ | 280 1 \| 281 C 283 When it detects the failure of the link, A switches its next hop to B 284 (which is still advertising a route to S with metric 2), and 285 advertises a metric equal to 3, and then advertises a new route with 286 metric 3. This process of nodes changing selected neighbours and 287 increasing their metric continues until the advertised metric reaches 288 "infinity", a value larger than all the metrics that the routing 289 protocol is able to carry. 291 2.4. Feasibility Conditions 293 Bellman-Ford is a very robust algorithm: its convergence properties 294 are preserved when routers delay route acquisition or when they 295 discard some updates. Babel routers discard received route 296 announcements unless they can prove that accepting them cannot 297 possibly cause a routing loop. 299 More formally, we define a condition over route announcements, known 300 as the "feasibility condition", that guarantees the absence of 301 routing loops whenever all routers ignore route updates that do not 302 satisfy the feasibility condition. In effect, this makes Bellman- 303 Ford into a family of routing algorithms, parameterised by the 304 feasibility condition. 306 Many different feasibility conditions are possible. For example, BGP 307 can be modelled as being a distance-vector protocol with a (rather 308 drastic) feasibility condition: a routing update is only accepted 309 when the receiving node's AS number is not included in the update's 310 AS-Path attribute (note that BGP's feasibility condition does not 311 ensure the absence of transient "micro-loops" during reconvergence). 313 Another simple feasibility condition, used in the Destination- 314 Sequenced Distance-Vector (DSDV) routing protocol [DSDV] and in the 315 Ad hoc On-Demand Distance Vector (AODV) protocol, stems from the 316 following observation: a routing loop can only arise after a router 317 has switched to a route with a larger metric than the route that it 318 had previously selected. Hence, one could decide that a route is 319 feasible only when its metric at the local node would be no larger 320 than the metric of the currently selected route, i.e., an 321 announcement carrying a metric D(B) is accepted by A when C(A, B) + 322 D(B) <= D(A). If all routers obey this constraint, then the metric 323 at every router is nonincreasing, and the following invariant is 324 always preserved: if A has selected B as its successor, then D(B) < 325 D(A), which implies that the forwarding graph is loop-free. 327 Babel uses a slightly more refined feasibility condition, derived 328 from EIGRP [DUAL]. Given a router A, define the feasibility distance 329 of A, written FD(A), as the smallest metric that A has ever 330 advertised for S to any of its neighbours. An update sent by a 331 neighbour B of A is feasible when the metric D(B) advertised by B is 332 strictly smaller than A's feasibility distance, i.e., when D(B) < 333 FD(A). 335 It is easy to see that this latter condition is no more restrictive 336 than DSDV-feasibility. Suppose that node A obeys DSDV-feasibility; 337 then D(A) is nonincreasing, hence at all times D(A) <= FD(A). 338 Suppose now that A receives a DSDV-feasible update that advertises a 339 metric D(B). Since the update is DSDV-feasible, C(A, B) + D(B) <= 340 D(A), hence D(B) < D(A), and since D(A) <= FD(A), D(B) < FD(A). 342 To see that it is strictly less restrictive, consider the following 343 diagram, where A has selected the route through B, and D(A) = FD(A) = 344 2. Since D(C) = 1 < FD(A), the alternate route through C is feasible 345 for A, although its metric C(A, C) + D(C) = 5 is larger than that of 346 the currently selected route: 348 B 349 1 / \ 1 350 / \ 351 S A 352 \ / 353 1 \ / 4 354 C 356 To show that this feasibility condition still guarantees loop- 357 freedom, recall that at the time when A accepts an update from B, the 358 metric D(B) announced by B is no smaller than FD(B); since it is 359 smaller than FD(A), at that point in time FD(B) < FD(A). Since this 360 property is preserved when A sends updates, it remains true at all 361 times, which ensures that the forwarding graph has no loops. 363 2.5. Solving Starvation: Sequencing Routes 365 Obviously, the feasibility conditions defined above cause starvation 366 when a router runs out of feasible routes. Consider the following 367 diagram, where both A and B have selected the direct route to S: 369 A 370 1 /| D(A) = 1 371 / | FD(A) = 1 372 S |1 373 \ | D(B) = 2 374 2 \| FD(B) = 2 375 B 377 Suppose now that the link between A and S breaks: 379 A 380 | 381 | FD(A) = 1 382 S |1 383 \ | D(B) = 2 384 2 \| FD(B) = 2 385 B 387 The only route available from A to S, the one that goes through B, is 388 not feasible: A suffers from spurious starvation. At that point, the 389 whole subtree suffering from starvation must be reset, which is 390 essentially what EIGRP does when it performs a global synchronisation 391 of all the routers in the starving subtree (the "active" phase of 392 EIGRP). 394 Babel reacts to starvation in a less drastic manner, by using 395 sequenced routes, a technique introduced by DSDV and adopted by AODV. 396 In addition to a metric, every route carries a sequence number, a 397 nondecreasing integer that is propagated unchanged through the 398 network and is only ever incremented by the source; a pair (s, m), 399 where s is a sequence number and m a metric, is called a distance. 401 A received update is feasible when either it is more recent than the 402 feasibility distance maintained by the receiving node, or it is 403 equally recent and the metric is strictly smaller. More formally, if 404 FD(A) = (s, m), then an update carrying the distance (s', m') is 405 feasible when either s' > s, or s = s' and m' < m. 407 Assuming the sequence number of S is 137, the diagram above becomes: 409 A 410 | 411 | FD(A) = (137, 1) 412 S |1 413 \ | D(B) = (137, 2) 414 2 \| FD(B) = (137, 2) 415 B 417 After S increases its sequence number, and the new sequence number is 418 propagated to B, we have: 420 A 421 | 422 | FD(A) = (137, 1) 423 S |1 424 \ | D(B) = (138, 2) 425 2 \| FD(B) = (138, 2) 426 B 428 at which point the route through B becomes feasible again. 430 Note that while sequence numbers are used for determining 431 feasibility, they are not used in route selection: a node ignores the 432 sequence number when selecting the best route to a given destination 433 (Section 3.6). Doing otherwise would cause route oscillation while a 434 sequence number propagates through the network, and might even cause 435 persistent blackholes with some exotic metrics. 437 2.6. Requests 439 In DSDV, the sequence number of a source is increased periodically. 440 A route becomes feasible again after the source increases its 441 sequence number, and the new sequence number is propagated through 442 the network, which may, in general, require a significant amount of 443 time. 445 Babel takes a different approach. When a node detects that it is 446 suffering from a potentially spurious starvation, it sends an 447 explicit request to the source for a new sequence number. This 448 request is forwarded hop by hop to the source, with no regard to the 449 feasibility condition. Upon receiving the request, the source 450 increases its sequence number and broadcasts an update, which is 451 forwarded to the requesting node. 453 Note that after a change in network topology not all such requests 454 will, in general, reach the source, as some will be sent over links 455 that are now broken. However, if the network is still connected, 456 then at least one among the nodes suffering from spurious starvation 457 has an (unfeasible) route to the source; hence, in the absence of 458 packet loss, at least one such request will reach the source. 459 (Resending requests a small number of times compensates for packet 460 loss.) 462 Since requests are forwarded with no regard to the feasibility 463 condition, they may, in general, be caught in a forwarding loop; this 464 is avoided by having nodes perform duplicate detection for the 465 requests that they forward. 467 2.7. Multiple Routers 469 The above discussion assumes that each prefix is originated by a 470 single router. In real networks, however, it is often necessary to 471 have a single prefix originated by multiple routers: for example, the 472 default route will be originated by all of the edge routers of a 473 routing domain. 475 Since synchronising sequence numbers between distinct routers is 476 problematic, Babel treats routes for the same prefix as distinct 477 entities when they are originated by different routers: every route 478 announcement carries the router-id of its originating router, and 479 feasibility distances are not maintained per prefix, but per source, 480 where a source is a pair of a router-id and a prefix. In effect, 481 Babel guarantees loop-freedom for the forwarding graph to every 482 source; since the union of multiple acyclic graphs is not in general 483 acyclic, Babel does not in general guarantee loop-freedom when a 484 prefix is originated by multiple routers, but any loops will be 485 broken in a time at most proportional to the diameter of the loop -- 486 as soon as an update has "gone around" the routing loop. 488 Consider for example the following topology, where A has selected the 489 default route through S, and B has selected the one through S': 491 1 1 1 492 ::/0 -- S --- A --- B --- S' -- ::/0 494 Suppose that both default routes fail at the same time; then nothing 495 prevents A from switching to B, and B simultaneously switching to A. 496 However, as soon as A has successfully advertised the new route to B, 497 the route through A will become unfeasible for B. Conversely, as 498 soon as B will have advertised the route through A, the route through 499 B will become unfeasible for A. 501 In effect, the routing loop disappears at the latest when routing 502 information has gone around the loop. Since this process can be 503 delayed by lost packets, Babel makes certain efforts to ensure that 504 updates are sent reliably after a router-id change (Section 3.7.2). 506 Additionally, after the routers have advertised the two routes, both 507 sources will be in their source tables, which will prevent them from 508 ever again participating in a routing loop involving routes from S 509 and S' (up to the source GC time, which, available memory permitting, 510 can be set to arbitrarily large values). 512 2.8. Overlapping Prefixes 514 In the above discussion, we have assumed that all prefixes are 515 disjoint, as is the case in flat ("mesh") routing. In practice, 516 however, prefixes may overlap: for example, the default route 517 overlaps with all of the routes present in the network. 519 After a route fails, it is not correct in general to switch to a 520 route that subsumes the failed route. Consider for example the 521 following configuration: 523 1 1 524 ::/0 -- A --- B --- C 526 Suppose that node C fails. If B forwards packets destined to C by 527 following the default route, a routing loop will form, and persist 528 until A learns of B's retraction of the direct route to C. B avoids 529 this pitfall by installing an "unreachable" route after a route is 530 retracted; this route is maintained until it can be guaranteed that 531 the former route has been retracted by all of B's neighbours 532 (Section 3.5.5). 534 3. Protocol Operation 536 Every Babel speaker is assigned a router-id, which is an arbitrary 537 string of 8 octets that is assumed unique across the routing domain. 538 For example, router-ids could be assigned randomly, or they could be 539 derived from a link-layer address. (The protocol encoding is 540 slightly more compact when router-ids are assigned in the same manner 541 as the IPv6 layer assigns host IDs.) 543 3.1. Message Transmission and Reception 545 Babel protocol packets are sent in the body of a UDP datagram (as 546 described in Section 4 below). Each Babel packet consists of zero or 547 more TLVs. Most TLVs may contain sub-TLVs. 549 The source address of a Babel packet is always a unicast address, 550 link-local in the case of IPv6. Babel packets may be sent to a well- 551 known (link-local) multicast address or to a (link-local) unicast 552 address. In normal operation, a Babel speaker sends both multicast 553 and unicast packets to its neighbours. 555 With the exception of acknowledgments, all Babel TLVs can be sent to 556 either unicast or multicast addresses, and their semantics does not 557 depend on whether the destination is a unicast or a multicast 558 address. Hence, a Babel speaker does not need to determine the 559 destination address of a packet that it receives in order to 560 interpret it. 562 A moderate amount of jitter may be applied to packets sent by a Babel 563 speaker: outgoing TLVs are buffered and SHOULD be sent with a small 564 random delay. This is done for two purposes: it avoids 565 synchronisation of multiple Babel speakers across a network [JITTER], 566 and it allows for the aggregation of multiple TLVs into a single 567 packet. 569 The exact delay and amount of jitter applied to a packet depends on 570 whether it contains any urgent TLVs. Acknowledgment TLVs MUST be 571 sent before the deadline specified in the corresponding request. The 572 particular class of updates specified in Section 3.7.2 MUST be sent 573 in a timely manner. The particular class of request and update TLVs 574 specified in Section 3.8.2 SHOULD be sent in a timely manner. 576 3.2. Data Structures 578 In this section, we give a description of the data structures that 579 every Babel speaker maintains. This description is conceptual: a 580 Babel speaker may use different data structures as long as the 581 resulting protocol is the same as the one described in this document. 582 For example, rather than maintaining a single table containing both 583 selected and unselected (fallback) routes, as described in 584 Section 3.2.6 below, an actual implementation would probably use two 585 tables, one with selected routes and one with fallback routes. 587 3.2.1. Sequence number arithmetic 589 Sequence numbers (seqnos) appear in a number of Babel data 590 structures, and they are interpreted as integers modulo 2^16. For 591 the purposes of this document, arithmetic on sequence numbers is 592 defined as follows. 594 Given a seqno s and an integer n, the sum of s and n is defined by 596 s + n (modulo 2^16) = (s + n) MOD 2^16 598 or, equivalently, 600 s + n (modulo 2^16) = (s + n) AND 65535 602 where MOD is the modulo operation yielding a non-negative integer and 603 AND is the bitwise conjunction operation. 605 Given two sequence numbers s and s', the relation s is less than s' 606 (s < s') is defined by 608 s < s' (modulo 2^16) when 0 < ((s' - s) MOD 2^16) < 32768 610 or equivalently 612 s < s' (modulo 2^16) when s /= s' and ((s' - s) AND 32768) = 0. 614 3.2.2. Node Sequence Number 616 A node's sequence number is a 16-bit integer that is included in 617 route updates sent for routes originated by this node. 619 A node increments its sequence number (modulo 2^16) whenever it 620 receives a request for a new sequence number (Section 3.8.1.2). A 621 node SHOULD NOT increment its sequence number (seqno) spontaneously, 622 since increasing seqnos makes it less likely that other nodes will 623 have feasible alternate routes when their selected routes fail. 625 3.2.3. The Interface Table 627 The interface table contains the list of interfaces on which the node 628 speaks the Babel protocol. Every interface table entry contains the 629 interface's outgoing Multicast Hello seqno, a 16-bit integer that is 630 sent with each Multicast Hello TLV on this interface and is 631 incremented (modulo 2^16) whenever a Multicast Hello is sent. (Note 632 that an interface's Multicast Hello seqno is unrelated to the node's 633 seqno.) 635 There are two timers associated with each interface table entry -- 636 the multicast hello timer, which governs the sending of scheduled 637 Multicast Hello and IHU packets, and the update timer, which governs 638 the sending of periodic route updates. 640 3.2.4. The Neighbour Table 642 The neighbour table contains the list of all neighbouring interfaces 643 from which a Babel packet has been recently received. The neighbour 644 table is indexed by pairs of the form (interface, address), and every 645 neighbour table entry contains the following data: 647 o the local node's interface over which this neighbour is reachable; 649 o the address of the neighbouring interface; 651 o a history of recently received Multicast Hello packets from this 652 neighbour; this can, for example, be a sequence of n bits, for 653 some small value n, indicating which of the n hellos most recently 654 sent by this neighbour have been received by the local node; 656 o a history of recently received Unicast Hello packets from this 657 neighbour; 659 o the "transmission cost" value from the last IHU packet received 660 from this neighbour, or FFFF hexadecimal (infinity) if the IHU 661 hold timer for this neighbour has expired; 663 o the expected incoming Multicast Hello sequence number for this 664 neighbour, an integer modulo 2^16. 666 o the expected incoming Unicast Hello sequence number for this 667 neighbour, an integer modulo 2^16. 669 o the outgoing Unicast Hello sequence number for this neighbour, an 670 integer modulo 2^16 that is sent with each Unicast Hello TLV to 671 this neighbour and is incremented (modulo 2^16) whenever a Unicast 672 Hello is sent. (Note that the outgoing Unicast Hello seqno for a 673 neighbour is distinct from the interface's outgoing Multicast 674 Hello seqno.) 676 There are three timers associated with each neighbour entry -- the 677 multicast hello timer, which is initialised from the interval value 678 carried by scheduled Multicast Hello TLVs, the unicast hello timer, 679 which is initialised from the interval value carried by scheduled 680 Unicast Hello TLVs, and the IHU timer, which is initialised to a 681 small multiple of the interval carried in IHU TLVs. 683 Note that the neighbour table is indexed by IP addresses, not by 684 router-ids: neighbourship is a relationship between interfaces, not 685 between nodes. Therefore, two nodes with multiple interfaces can 686 participate in multiple neighbourship relationships, a situation that 687 can notably arise when wireless nodes with multiple radios are 688 involved. 690 3.2.5. The Source Table 692 The source table is used to record feasibility distances. It is 693 indexed by triples of the form (prefix, plen, router-id), and every 694 source table entry contains the following data: 696 o the prefix (prefix, plen), where plen is the prefix length, that 697 this entry applies to; 699 o the router-id of a router originating this prefix; 701 o a pair (seqno, metric), this source's feasibility distance. 703 There is one timer associated with each entry in the source table -- 704 the source garbage-collection timer. It is initialised to a time on 705 the order of minutes and reset as specified in Section 3.7.3. 707 3.2.6. The Route Table 709 The route table contains the routes known to this node. It is 710 indexed by triples of the form (prefix, plen, neighbour), and every 711 route table entry contains the following data: 713 o the source (prefix, plen, router-id) for which this route is 714 advertised; 716 o the neighbour that advertised this route; 718 o the metric with which this route was advertised by the neighbour, 719 or FFFF hexadecimal (infinity) for a recently retracted route; 721 o the sequence number with which this route was advertised; 723 o the next-hop address of this route; 725 o a boolean flag indicating whether this route is selected, i.e., 726 whether it is currently being used for forwarding and is being 727 advertised. 729 There is one timer associated with each route table entry -- the 730 route expiry timer. It is initialised and reset as specified in 731 Section 3.5.4. 733 Note that there are two distinct (seqno, metric) pairs associated to 734 each route: the route's distance, which is stored in the route table, 735 and the feasibility distance, stored in the source table and shared 736 between all routes with the same source. 738 3.2.7. The Table of Pending Seqno Requests 740 The table of pending seqno requests contains a list of seqno requests 741 that the local node has sent (either because they have been 742 originated locally, or because they were forwarded) and to which no 743 reply has been received yet. This table is indexed by triples of the 744 form (prefix, plen, router-id), and every entry in this table 745 contains the following data: 747 o the prefix, plen, router-id, and seqno being requested; 749 o the neighbour, if any, on behalf of which we are forwarding this 750 request; 752 o a small integer indicating the number of times that this request 753 will be resent if it remains unsatisfied. 755 There is one timer associated with each pending seqno request; it 756 governs both the resending of requests and their expiry. 758 3.3. Acknowledgments and acknowledgment requests 760 A Babel speaker may request that a neighbour receiving a given packet 761 reply with an explicit acknowledgment within a given time. While the 762 use of acknowledgment requests is optional, every Babel speaker MUST 763 be able to reply to such a request. 765 An acknowledgment MUST be sent to a unicast destination. On the 766 other hand, acknowledgment requests may be sent to either unicast or 767 multicast destinations, in which case they request an acknowledgment 768 from all of the receiving nodes. 770 When to request acknowledgments is a matter of local policy; the 771 simplest strategy is to never request acknowledgments and to rely on 772 periodic updates to ensure that any reachable routes are eventually 773 propagated throughout the routing domain. In order to improve 774 convergence speed and reduce the amount of control traffic, 775 acknowledgment requests MAY be used in order to reliably send urgent 776 updates (Section 3.7.2) and retractions (Section 3.5.5), especially 777 when the number of neighbours on a given interface is small. Since 778 Babel is designed to deal gracefully with packet loss on unreliable 779 media, sending all packets with acknowledgment requests is not 780 necessary, and NOT RECOMMENDED, as the acknowledgments cause 781 additional traffic and may force additional Address Resolution 782 Protocol (ARP) or Neighbour Discovery (ND) exchanges. 784 3.4. Neighbour Acquisition 786 Neighbour acquisition is the process by which a Babel node discovers 787 the set of neighbours heard over each of its interfaces and 788 ascertains bidirectional reachability. On unreliable media, 789 neighbour acquisition additionally provides some statistics that may 790 be useful for link quality computation. 792 Before it can exchange routing information with a neighbour, a Babel 793 node MUST create an entry for that neighbour in the neighbour table. 794 When to do that is implementation-specific; suitable strategies 795 include creating an entry when any Babel packet is received, or 796 creating an entry when a Hello TLV is parsed. Similarly, in order to 797 conserve system resources, an implementation SHOULD discard an entry 798 when it has been unused for long enough; suitable strategies include 799 dropping the neighbour after a timeout, and dropping a neighbour when 800 the associated Hello histories become empty (see Appendix A.2). 802 3.4.1. Reverse Reachability Detection 804 Every Babel node sends Hello TLVs to its neighbours to indicate that 805 it is alive, at regular or irregular intervals. Each Hello TLV 806 carries an increasing (modulo 2^16) sequence number and an upper 807 bound on the time interval until the next Hello of the same type (see 808 below). If the time interval is set to 0, then the Hello TLV does 809 not establish a new promise: the deadline carried by the previous 810 Hello of the same type still applies to the next Hello (if the most 811 recent scheduled Hello of the right kind was received at time t0 and 812 carried interval i, then the previous promise of sending another 813 Hello before time t0 + i still holds). We say that a Hello is 814 "scheduled" if it carries a non-zero interval, and "unscheduled" 815 otherwise. 817 There are two kinds of Hellos: Multicast Hellos, which use a per- 818 interface Hello counter (the Multicast Hello seqno), and Unicast 819 Hellos, which use a per-neighbour counter (the Unicast Hello seqno). 820 A Multicast Hello with a given seqno MUST be sent to all neighbours 821 on a given interface, either by sending it to a multicast address or 822 by sending it to one unicast address per neighbour (hence, the term 823 "Multicast Hello" is a slight misnomer). A Unicast Hello carrying a 824 given seqno should normally be sent to just one neighbour (over 825 unicast), since the sequence numbers of different neighbours are not 826 in general synchronised. 828 Multicast Hellos sent over multicast can be used for neighbour 829 discovery; hence, a node SHOULD send periodic (scheduled) Multicast 830 Hellos unless neighbour discovery is performed by means outside of 831 the Babel protocol. A node MAY send Unicast Hellos or unscheduled 832 Hellos of either kind for any reason, such as reducing the amount of 833 multicast traffic or improving reliability on link technologies with 834 poor support for link-layer multicast. 836 A node MAY send a scheduled Hello ahead of time. A node MAY change 837 its scheduled Hello interval. The Hello interval MAY be decreased at 838 any time; it MAY be increased immediately before sending a Hello TLV, 839 but SHOULD NOT be increased at other times. (Equivalently, a node 840 SHOULD send a scheduled Hello immediately after increasing its Hello 841 interval.) 843 How to deal with received Hello TLVs and what statistics to maintain 844 are considered local implementation matters; typically, a node will 845 maintain some sort of history of recently received Hellos. An 846 example of a suitable algorithm is described in Appendix A.1. 848 After receiving a Hello, or determining that it has missed one, the 849 node recomputes the association's cost (Section 3.4.3) and runs the 850 route selection procedure (Section 3.6). 852 3.4.2. Bidirectional Reachability Detection 854 In order to establish bidirectional reachability, every node sends 855 periodic IHU ("I Heard You") TLVs to each of its neighbours. Since 856 IHUs carry an explicit interval value, they MAY be sent less often 857 than Hellos in order to reduce the amount of routing traffic in dense 858 networks; in particular, they SHOULD be sent less often than Hellos 859 over links with little packet loss. While IHUs are conceptually 860 unicast, they MAY be sent to a multicast address in order to avoid an 861 ARP or Neighbour Discovery exchange and to aggregate multiple IHUs 862 into a single packet. 864 In addition to the periodic IHUs, a node MAY, at any time, send an 865 unscheduled IHU packet. It MAY also, at any time, decrease its IHU 866 interval, and it MAY increase its IHU interval immediately before 867 sending an IHU, but SHOULD NOT increase it at any other time. 868 (Equivalently, a node SHOULD send an extra IHU immediately after 869 increasing its Hello interval.) 871 Every IHU TLV contains two pieces of data: the link's rxcost 872 (reception cost) from the sender's perspective, used by the neighbour 873 for computing link costs (Section 3.4.3), and the interval between 874 periodic IHU packets. A node receiving an IHU sets the value of the 875 txcost (transmission cost) maintained in the neighbour table to the 876 value contained in the IHU, and resets the IHU timer associated to 877 this neighbour to a small multiple of the interval value received in 878 the IHU. When a neighbour's IHU timer expires, the neighbour's 879 txcost is set to infinity. 881 After updating a neighbour's txcost, the receiving node recomputes 882 the neighbour's cost (Section 3.4.3) and runs the route selection 883 procedure (Section 3.6). 885 3.4.3. Cost Computation 887 A neighbourship association's link cost is computed from the values 888 maintained in the neighbour table: the statistics kept in the 889 neighbour table about the reception of Hellos, and the txcost 890 computed from received IHU packets. 892 For every neighbour, a Babel node computes a value known as this 893 neighbour's rxcost. This value is usually derived from the Hello 894 history, which may be combined with other data, such as statistics 895 maintained by the link layer. The rxcost is sent to a neighbour in 896 each IHU. 898 Since nodes do not necessarily send periodic Unicast Hellos but do 899 usually send periodic Multicast Hellos (Section 3.4.1), a node SHOULD 900 use an algorithm that yields a finite rxcost when only Multicast 901 Hellos are received, unless interoperability with nodes that only 902 send Multicast Hellos is not required. 904 How the txcost and rxcost are combined in order to compute a link's 905 cost is a matter of local policy; as far as Babel's correctness is 906 concerned, only the following conditions MUST be satisfied: 908 o the cost is strictly positive; 910 o if no Hello TLVs of either kind were received recently, then the 911 cost is infinite; 913 o if the txcost is infinite, then the cost is infinite. 915 Note that while this document does not constrain cost computation any 916 further, not all cost computation strategies will give good results. 917 See Appendix A.2 for examples of strategies for computing a link's 918 cost that are known to work well in practice. 920 3.5. Routing Table Maintenance 922 Conceptually, a Babel update is a quintuple (prefix, plen, router-id, 923 seqno, metric), where (prefix, plen) is the prefix for which a route 924 is being advertised, router-id is the router-id of the router 925 originating this update, seqno is a nondecreasing (modulo 2^16) 926 integer that carries the originating router seqno, and metric is the 927 announced metric. 929 Before being accepted, an update is checked against the feasibility 930 condition (Section 3.5.1), which ensures that the route does not 931 create a routing loop. If the feasibility condition is not 932 satisfied, the update is either ignored or prevents the route from 933 being selected, as described in Section 3.5.4. If the feasibility 934 condition is satisfied, then the update cannot possibly cause a 935 routing loop. 937 3.5.1. The Feasibility Condition 939 The feasibility condition is applied to all received updates. The 940 feasibility condition compares the metric in the received update with 941 the metrics of the updates previously sent by the receiving node; 942 updates that fail the feasibility condition, and therefore have 943 metrics large enough to cause a routing loop, are either ignored or 944 prevent the resulting route from being selected. 946 A feasibility distance is a pair (seqno, metric), where seqno is an 947 integer modulo 2^16 and metric is a positive integer. Feasibility 948 distances are compared lexicographically, with the first component 949 inverted: we say that a distance (seqno, metric) is strictly better 950 than a distance (seqno', metric'), written 952 (seqno, metric) < (seqno', metric') 954 when 956 seqno > seqno' or (seqno = seqno' and metric < metric') 958 where sequence numbers are compared modulo 2^16. 960 Given a source (prefix, plen, router-id), a node's feasibility 961 distance for this source is the minimum, according to the ordering 962 defined above, of the distances of all the finite updates ever sent 963 by this particular node for the prefix (prefix, plen) and the given 964 router-id. Feasibility distances are maintained in the source table, 965 the exact procedure is given in Section 3.7.3. 967 A received update is feasible when either it is a retraction (its 968 metric is FFFF hexadecimal), or the advertised distance is strictly 969 better, in the sense defined above, than the feasibility distance for 970 the corresponding source. More precisely, a route advertisement 971 carrying the quintuple (prefix, plen, router-id, seqno, metric) is 972 feasible if one of the following conditions holds: 974 o metric is infinite; or 976 o no entry exists in the source table indexed by (prefix, plen, 977 router-id); or 979 o an entry (prefix, plen, router-id, seqno', metric') exists in the 980 source table, and either 982 * seqno' < seqno or 984 * seqno = seqno' and metric < metric'. 986 Note that the feasibility condition considers the metric advertised 987 by the neighbour, not the route's metric; hence, a fluctuation in a 988 neighbour's cost cannot render a selected route unfeasible. Note 989 further that retractions (updates with infinite metric) are always 990 feasible, since they cannot possibly cause a routing loop. 992 3.5.2. Metric Computation 994 A route's metric is computed from the metric advertised by the 995 neighbour and the neighbour's link cost. Just like cost computation, 996 metric computation is considered a local policy matter; as far as 997 Babel is concerned, the function M(c, m) used for computing a metric 998 from a locally computed link cost and the metric advertised by a 999 neighbour MUST only satisfy the following conditions: 1001 o if c is infinite, then M(c, m) is infinite; 1003 o M is strictly monotonic: M(c, m) > m. 1005 Additionally, the metric SHOULD satisfy the following condition: 1007 o M is left-distributive: if m <= m', then M(c, m) <= M(c, m'). 1009 Note that while strict monotonicity is essential to the integrity of 1010 the network (persistent routing loops may arise if it is not 1011 satisfied), left distributivity is not: if it is not satisfied, Babel 1012 will still converge to a loop-free configuration, but might not reach 1013 a global optimum (in fact, a global optimum may not even exist). 1015 As with cost computation, not all strategies for computing route 1016 metrics will give good results. In particular, some metrics are more 1017 likely than others to lead to routing instabilities (route flapping). 1018 In Appendix A.3, we give a number of examples of strictly monotonic, 1019 left-distributive routing metrics that are known to work well in 1020 practice. 1022 3.5.3. Encoding of Updates 1024 In a large network, the bulk of Babel traffic consists of route 1025 updates; hence, some care has been given to encoding them 1026 efficiently. An Update TLV itself only contains the prefix, seqno, 1027 and metric, while the next hop is derived either from the network- 1028 layer source address of the packet or from an explicit Next Hop TLV 1029 in the same packet. The router-id is derived from a separate Router- 1030 Id TLV in the same packet, which optimises the case when multiple 1031 updates are sent with the same router-id. 1033 Additionally, a prefix of the advertised prefix can be omitted in an 1034 Update TLV, in which case it is copied from a previous Update TLV in 1035 the same packet -- this is known as address compression 1036 (Section 4.6.9). 1038 Finally, as a special optimisation for the case when a router-id 1039 coincides with the interface-id part of an IPv6 address, the router- 1040 id can optionally be derived from the low-order bits of the 1041 advertised prefix. 1043 The encoding of updates is described in detail in Section 4.6. 1045 3.5.4. Route Acquisition 1047 When a Babel node receives an update (prefix, plen, router-id, seqno, 1048 metric) from a neighbour neigh with a link cost value equal to cost, 1049 it checks whether it already has a route table entry indexed by 1050 (prefix, plen, neigh). 1052 If no such entry exists: 1054 o if the update is unfeasible, it MAY be ignored; 1056 o if the metric is infinite (the update is a retraction of a route 1057 we do not know about), the update is ignored; 1059 o otherwise, a new entry is created in the route table, indexed by 1060 (prefix, plen, neigh), with source equal to (prefix, plen, router- 1061 id), seqno equal to seqno and an advertised metric equal to the 1062 metric carried by the update. 1064 If such an entry exists: 1066 o if the entry is currently selected, the update is unfeasible, and 1067 the router-id of the update is equal to the router-id of the 1068 entry, then the update MAY be ignored; 1070 o otherwise, the entry's sequence number, advertised metric, metric, 1071 and router-id are updated and, if the advertised metric is not 1072 infinite, the route's expiry timer is reset to a small multiple of 1073 the Interval value included in the update. If the update is 1074 unfeasible, then the (now unfeasible) entry MUST be immediately 1075 unselected. If the update caused the router-id of the entry to 1076 change, an update (possibly a retraction) MUST be sent in a timely 1077 manner (see Section 3.7.2). 1079 Note that the route table may contain unfeasible routes, either 1080 because they were created by an unfeasible update or due to a metric 1081 fluctuation. Such routes are never selected, since they are not 1082 known to be loop-free; should all the feasible routes become 1083 unusable, however, the unfeasible routes can be made feasible and 1084 therefore possible to select by sending requests along them (see 1085 Section 3.8.2). 1087 When a route's expiry timer triggers, the behaviour depends on 1088 whether the route's metric is finite. If the metric is finite, it is 1089 set to infinity and the expiry timer is reset. If the metric is 1090 already infinite, the route is flushed from the route table. 1092 After the route table is updated, the route selection procedure 1093 (Section 3.6) is run. 1095 3.5.5. Hold Time 1097 When a prefix P is retracted, because all routes are unfeasible or 1098 have an infinite metric (whether due to the expiry timer or to other 1099 reasons), and a shorter prefix P' that covers P is reachable, P' 1100 cannot in general be used for routing packets destined to P without 1101 running the risk of creating a routing loop (Section 2.8). 1103 To avoid this issue, whenever a prefix P is retracted, a route table 1104 entry with infinite metric is maintained as described in 1105 Section 3.5.4 above. As long as this entry is maintained, packets 1106 destined to an address within P MUST NOT be forwarded by following a 1107 route for a shorter prefix. This entry is removed as soon as a 1108 finite-metric update for prefix P is received and the resulting route 1109 selected. If no such update is forthcoming, the infinite metric 1110 entry SHOULD be maintained at least until it is guaranteed that no 1111 neighbour has selected the current node as next-hop for prefix P. 1112 This can be achieved by either: 1114 o waiting until the route's expiry timer has expired 1115 (Section 3.5.4); 1117 o sending a retraction with an acknowledgment request (Section 3.3) 1118 to every reachable neighbour that has not explicitly retracted 1119 prefix P and waiting for all acknowledgments. 1121 The former option is simpler and ensures that at that point, any 1122 routes for prefix P pointing at the current node have expired. 1123 However, since the expiry time can be as high as a few minutes, doing 1124 that prevents automatic aggregation by creating spurious black-holes 1125 for aggregated routes. The latter option is RECOMMENDED as it 1126 dramatically reduces the time for which a prefix is unreachable in 1127 the presence of aggregated routes. 1129 3.6. Route Selection 1131 Route selection is the process by which a single route for a given 1132 prefix is selected to be used for forwarding packets and to be re- 1133 advertised to a node's neighbours. 1135 Babel is designed to allow flexible route selection policies. As far 1136 as the protocol's correctness is concerned, the route selection 1137 policy MUST only satisfy the following properties: 1139 o a route with infinite metric (a retracted route) is never 1140 selected; 1142 o an unfeasible route is never selected. 1144 Note, however, that Babel does not naturally guarantee the stability 1145 of routing, and configuring conflicting route selection policies on 1146 different routers may lead to persistent route oscillation. 1148 Route selection is a difficult problem, since a good route selection 1149 policy needs to take into account multiple mutually contradictory 1150 criteria; in roughly decreasing order of importance, these are: 1152 o routes with a small metric should be preferred to routes with a 1153 large metric; 1155 o switching router-ids should be avoided; 1157 o routes through stable neighbours should be preferred to routes 1158 through unstable ones; 1160 o stable routes should be preferred to unstable ones; 1162 o switching next hops should be avoided. 1164 Route selection MUST NOT take seqnos into account: a route MUST NOT 1165 be preferred just because it carries a higher (more recent) seqno. 1166 Doing otherwise would cause route oscillation while a new seqno 1167 propagates through the network, possibly following multiple paths of 1168 different latency, and might even create persistent blackholes if the 1169 metric being used is not left-distributive Section 3.5.2. 1171 A simple but useful strategy is to choose the feasible route with the 1172 smallest metric, with a small amount of hysteresis applied to avoid 1173 switching router-ids too often. 1175 After the route selection procedure is run, triggered updates 1176 (Section 3.7.2) and requests (Section 3.8.2) are sent. 1178 3.7. Sending Updates 1180 A Babel speaker advertises to its neighbours its set of selected 1181 routes. Normally, this is done by sending one or more multicast 1182 packets containing Update TLVs on all of its connected interfaces; 1183 however, on link technologies where multicast is significantly more 1184 expensive than unicast, a node MAY choose to send multiple copies of 1185 updates in unicast packets, especially when the number of neighbours 1186 is small. 1188 Additionally, in order to ensure that any black-holes are reliably 1189 cleared in a timely manner, a Babel node sends retractions (updates 1190 with an infinite metric) for any recently retracted prefixes. 1192 If an update is for a route injected into the Babel domain by the 1193 local node (e.g., it carries the address of a local interface, the 1194 prefix of a directly attached network, or a prefix redistributed from 1195 a different routing protocol), the router-id is set to the local 1196 node's router-id, the metric is set to some arbitrary finite value 1197 (typically 0), and the seqno is set to the local router's sequence 1198 number. 1200 If an update is for a route learned from another Babel speaker, the 1201 router-id and sequence number are copied from the route table entry, 1202 and the metric is computed as specified in Section 3.5.2. 1204 3.7.1. Periodic Updates 1206 Every Babel speaker periodically advertises all of its selected 1207 routes on all of its interfaces, including any recently retracted 1208 routes. Since Babel doesn't suffer from routing loops (there is no 1209 "counting to infinity") and relies heavily on triggered updates 1210 (Section 3.7.2), this full dump only needs to happen infrequently. 1212 3.7.2. Triggered Updates 1214 In addition to periodic routing updates, a Babel speaker sends 1215 unscheduled, or triggered, updates in order to inform its neighbours 1216 of a significant change in the network topology. 1218 A change of router-id for the selected route to a given prefix may be 1219 indicative of a routing loop in formation; hence, a node MUST send a 1220 triggered update in a timely manner whenever it changes the selected 1221 router-id for a given destination. Additionally, it SHOULD make a 1222 reasonable attempt at ensuring that all reachable neighbours receive 1223 this update. 1225 There are two strategies for ensuring that. If the number of 1226 neighbours is small, then it is reasonable to send the update 1227 together with an acknowledgment request; the update is resent until 1228 all neighbours have acknowledged the packet, up to some number of 1229 times. If the number of neighbours is large, however, requesting 1230 acknowledgments from all of them might cause a non-negligible amount 1231 of network traffic; in that case, it may be preferable to simply 1232 repeat the update some reasonable number of times (say, 5 for 1233 wireless and 2 for wired links). 1235 A route retraction is somewhat less worrying: if the route retraction 1236 doesn't reach all neighbours, a black-hole might be created, which, 1237 unlike a routing loop, does not endanger the integrity of the 1238 network. When a route is retracted, a node SHOULD send a triggered 1239 update and SHOULD make a reasonable attempt at ensuring that all 1240 neighbours receive this retraction. 1242 Finally, a node MAY send a triggered update when the metric for a 1243 given prefix changes in a significant manner, due to a received 1244 update, because a link's cost has changed, or because a different 1245 next hop has been selected. A node SHOULD NOT send triggered updates 1246 for other reasons, such as when there is a minor fluctuation in a 1247 route's metric, when the selected next hop changes, or to propagate a 1248 new sequence number (except to satisfy a request, as specified in 1249 Section 3.8). 1251 3.7.3. Maintaining Feasibility Distances 1253 Before sending an update (prefix, plen, router-id, seqno, metric) 1254 with finite metric (i.e., not a route retraction), a Babel node 1255 updates the feasibility distance maintained in the source table. 1256 This is done as follows. 1258 If no entry indexed by (prefix, plen, router-id) exists in the source 1259 table, then one is created with value (prefix, plen, router-id, 1260 seqno, metric). 1262 If an entry (prefix, plen, router-id, seqno', metric') exists, then 1263 it is updated as follows: 1265 o if seqno > seqno', then seqno' := seqno, metric' := metric; 1267 o if seqno = seqno' and metric' > metric, then metric' := metric; 1269 o otherwise, nothing needs to be done. 1271 The garbage-collection timer for the entry is then reset. Note that 1272 the feasibility distance is not updated and the garbage-collection 1273 timer is not reset when a retraction (an update with infinite metric) 1274 is sent. 1276 When the garbage-collection timer expires, the entry is removed from 1277 the source table. 1279 3.7.4. Split Horizon 1281 When running over a transitive, symmetric link technology, e.g., a 1282 point-to-point link or a wired LAN technology such as Ethernet, a 1283 Babel node SHOULD use an optimisation known as split horizon. When 1284 split horizon is used on a given interface, a routing update for 1285 prefix P is not sent on the particular interface over which the 1286 selected route towards prefix P was learnt. 1288 Split horizon SHOULD NOT be applied to an interface unless the 1289 interface is known to be symmetric and transitive; in particular, 1290 split horizon is not applicable to decentralised wireless link 1291 technologies (e.g., IEEE 802.11 in ad hoc mode) when routing updates 1292 are sent over multicast. 1294 3.8. Explicit Requests 1296 In normal operation, a node's route table is populated by the regular 1297 and triggered updates sent by its neighbours. Under some 1298 circumstances, however, a node sends explicit requests in order to 1299 cause a resynchronisation with the source after a mobility event or 1300 to prevent a route from spuriously expiring. 1302 The Babel protocol provides two kinds of explicit requests: route 1303 requests, which simply request an update for a given prefix, and 1304 seqno requests, which request an update for a given prefix with a 1305 specific sequence number. The former are never forwarded; the latter 1306 are forwarded if they cannot be satisfied by the receiver. 1308 3.8.1. Handling Requests 1310 Upon receiving a request, a node either forwards the request or sends 1311 an update in reply to the request, as described in the following 1312 sections. If this causes an update to be sent, the update is either 1313 sent to a multicast address on the interface on which the request was 1314 received, or to the unicast address of the neighbour that sent the 1315 request. 1317 The exact behaviour is different for route requests and seqno 1318 requests. 1320 3.8.1.1. Route Requests 1322 When a node receives a route request for a given prefix, it checks 1323 its route table for a selected route to this exact prefix. If such a 1324 route exists, it MUST send an update (over unicast or over 1325 multicast); if such a route does not exist, it MUST send a retraction 1326 for that prefix. 1328 When a node receives a wildcard route request, it SHOULD send a full 1329 route table dump. Full route dumps MAY be rate-limited, especially 1330 if they are sent over multicast. 1332 3.8.1.2. Seqno Requests 1334 When a node receives a seqno request for a given router-id and 1335 sequence number, it checks whether its route table contains a 1336 selected entry for that prefix. If a selected route for the given 1337 prefix exists, it has finite metric, and either the router-ids are 1338 different or the router-ids are equal and the entry's sequence number 1339 is no smaller (modulo 2^16) than the requested sequence number, the 1340 node MUST send an update for the given prefix. If the router-ids 1341 match but the requested seqno is larger (modulo 2^16) than the route 1342 entry's, the node compares the router-id against its own router-id. 1343 If the router-id is its own, then it increases its sequence number by 1344 1 (modulo 2^16) and sends an update. A node MUST NOT increase its 1345 sequence number by more than 1 in response to a seqno request. 1347 Otherwise, if the requested router-id is not its own, the received 1348 request's hop count is 2 or more, and the node is advertising the 1349 prefix to its neighbours, the node selects a neighbour to forward the 1350 request to as follows: 1352 o if the node has one or more feasible routes toward the requested 1353 prefix with a next hop that is not the requesting node, then the 1354 node MUST forward the request to the next hop of one such route; 1356 o otherwise, if the node has one or more (not necessarily feasible) 1357 routes to the requested prefix with a next hop that is not the 1358 requesting node, then the node SHOULD forward the request to the 1359 next hop of one such route. 1361 In order to actually forward the request, the node decrements the hop 1362 count and sends the request in a unicast packet destined to the 1363 selected neighbour. 1365 A node SHOULD maintain a list of recently forwarded seqno requests 1366 and forward the reply (an update with a seqno sufficiently large to 1367 satisfy the request) in a timely manner. A node SHOULD compare every 1368 incoming seqno request against its list of recently forwarded seqno 1369 requests and avoid forwarding it if it is redundant (i.e., if it has 1370 recently sent a request with the same prefix, router-id and a seqno 1371 that is not smaller modulo 2^16). 1373 Since the request-forwarding mechanism does not necessarily obey the 1374 feasibility condition, it may get caught in routing loops; hence, 1375 requests carry a hop count to limit the time during which they remain 1376 in the network. However, since requests are only ever forwarded as 1377 unicast packets, the initial hop count need not be kept particularly 1378 low, and performing an expanding horizon search is not necessary. A 1379 single request MUST NOT be duplicated: it MUST NOT be forwarded to a 1380 multicast address, and it MUST NOT be forwarded to multiple 1381 neighbours. However, if a seqno request is resent by its originator, 1382 the subsequent copies MAY be forwarded to a different neighbour than 1383 the initial one. 1385 3.8.2. Sending Requests 1387 A Babel node MAY send a route or seqno request at any time, to a 1388 multicast or a unicast address; there is only one case when 1389 originating requests is required (Section 3.8.2.1). 1391 3.8.2.1. Avoiding Starvation 1393 When a route is retracted or expires, a Babel node usually switches 1394 to another feasible route for the same prefix. It may be the case, 1395 however, that no such routes are available. 1397 A node that has lost all feasible routes to a given destination but 1398 still has unexpired unfeasible routes to that destination MUST send a 1399 seqno request; if it doesn't have any such routes, it MAY still send 1400 a seqno request. The router-id of the request is set to the router- 1401 id of the route that it has just lost, and the requested seqno is the 1402 value contained in the source table plus 1. 1404 If the node has any (unfeasible) routes to the requested destination, 1405 then it MUST send the request to at least one of the next-hop 1406 neighbours that advertised these routes, and SHOULD send it to all of 1407 them; in any case, it MAY send the request to any other neighbours, 1408 whether they advertise a route to the requested destination or not. 1409 A simple implementation strategy is therefore to unconditionally 1410 multicast the request over all interfaces. 1412 Similar requests will be sent by other nodes that are affected by the 1413 route's loss. If the network is still connected, and assuming no 1414 packet loss, then at least one of these requests will be forwarded to 1415 the source, resulting in a route being advertised with a new sequence 1416 number. (Due to duplicate suppression, only a small number of such 1417 requests will actually reach the source.) 1419 In order to compensate for packet loss, a node SHOULD repeat such a 1420 request a small number of times if no route becomes feasible within a 1421 short time. In the presence of heavy packet loss, however, all such 1422 requests might be lost; in that case, the mechanism in the next 1423 section will eventually ensure that a new seqno is received. 1425 3.8.2.2. Dealing with Unfeasible Updates 1427 When a route's metric increases, a node might receive an unfeasible 1428 update for a route that it has currently selected. As specified in 1429 Section 3.5.1, the receiving node will either ignore the update or 1430 unselect the route. 1432 In order to keep routes from spuriously expiring because they have 1433 become unfeasible, a node SHOULD send a unicast seqno request when it 1434 receives an unfeasible update for a route that is currently selected. 1435 The requested sequence number is computed from the source table as in 1436 Section 3.8.2.1 above. 1438 Additionally, since metric computation does not necessarily coincide 1439 with the delay in propagating updates, a node might receive an 1440 unfeasible update from a currently unselected neighbour that is 1441 preferable to the currently selected route (e.g., because it has a 1442 much smaller metric); in that case, the node SHOULD send a unicast 1443 seqno request to the neighbour that advertised the preferable update. 1445 3.8.2.3. Preventing Routes from Expiring 1447 In normal operation, a route's expiry timer never triggers: since a 1448 route's hold time is computed from an explicit interval included in 1449 Update TLVs, a new update (possibly a retraction) should arrive in 1450 time to prevent a route from expiring. 1452 In the presence of packet loss, however, it may be the case that no 1453 update is successfully received for an extended period of time, 1454 causing a route to expire. In order to avoid such spurious expiry, 1455 shortly before a selected route expires, a Babel node SHOULD send a 1456 unicast route request to the neighbour that advertised this route; 1457 since nodes always send either updates or retractions in response to 1458 non-wildcard route requests (Section 3.8.1.1), this will usually 1459 result in the route being either refreshed or retracted. 1461 3.8.2.4. Acquiring New Neighbours 1463 In order to speed up convergence after a mobility event, a node MAY 1464 send a unicast wildcard request after acquiring a new neighbour. 1465 Additionally, a node MAY send a small number of multicast wildcard 1466 requests shortly after booting. Note however that doing that 1467 carelessly can cause serious congestion when a whole network is 1468 rebooted, especially on link layers with high per-packet overhead 1469 (e.g., IEEE 802.11). 1471 4. Protocol Encoding 1473 A Babel packet is sent as the body of a UDP datagram, with network- 1474 layer hop count set to 1, destined to a well-known multicast address 1475 or to a unicast address, over IPv4 or IPv6; in the case of IPv6, 1476 these addresses are link-local. Both the source and destination UDP 1477 port are set to a well-known port number. A Babel packet MUST be 1478 silently ignored unless its source address is either a link-local 1479 IPv6 address or an IPv4 address belonging to the local network, and 1480 its source port is the well-known Babel port. It MAY be silently 1481 ignored if its destination address is a global IPv6 address. 1483 In order to minimise the number of packets being sent while avoiding 1484 lower-layer fragmentation, a Babel node SHOULD attempt to maximise 1485 the size of the packets it sends, up to the outgoing interface's MTU 1486 adjusted for lower-layer headers (28 octets for UDP over IPv4, 48 1487 octets for UDP over IPv6). It MUST NOT send packets larger than the 1488 attached interface's MTU adjusted for lower-layer headers or 512 1489 octets, whichever is larger, but not exceeding 2^16 - 1 adjusted for 1490 lower-layer headers. Every Babel speaker MUST be able to receive 1491 packets that are as large as any attached interface's MTU adjusted 1492 for lower-layer headers or 512 octets, whichever is larger. Babel 1493 packets MUST NOT be sent in IPv6 Jumbograms. 1495 In order to avoid global synchronisation of a Babel network and to 1496 aggregate multiple TLVs into large packets, a Babel node SHOULD 1497 buffer every TLV and delay sending a packet by a small, randomly 1498 chosen delay [JITTER]. In order to allow accurate computation of 1499 packet loss rates, this delay MUST NOT be larger than half the 1500 advertised Hello interval. 1502 4.1. Data Types 1504 4.1.1. Interval 1506 Relative times are carried as 16-bit values specifying a number of 1507 centiseconds (hundredths of a second). This allows times up to 1508 roughly 11 minutes with a granularity of 10ms, which should cover all 1509 reasonable applications of Babel. 1511 4.1.2. Router-Id 1513 A router-id is an arbitrary 8-octet value. A router-id MUST NOT 1514 consist of either all zeroes or all ones. 1516 4.1.3. Address 1518 Since the bulk of the protocol is taken by addresses, multiple ways 1519 of encoding addresses are defined. Additionally, a common subnet 1520 prefix may be omitted when multiple addresses are sent in a single 1521 packet -- this is known as address compression (Section 4.6.9). 1523 Address encodings: 1525 o AE 0: wildcard address. The value is 0 octets long. 1527 o AE 1: IPv4 address. Compression is allowed. 4 octets or less. 1529 o AE 2: IPv6 address. Compression is allowed. 16 octets or less. 1531 o AE 3: link-local IPv6 address. Compression is not allowed. The 1532 value is 8 octets long, a prefix of fe80::/64 is implied. 1534 The address family associated to an address encoding is either IPv4 1535 or IPv6; it is undefined for AE 0, IPv4 for AE 1, and IPv6 for AEs 2 1536 and 3. 1538 4.1.4. Prefixes 1540 A network prefix is encoded just like a network address, but it is 1541 stored in the smallest number of octets that are enough to hold the 1542 significant bits (up to the prefix length). 1544 4.2. Packet Format 1546 A Babel packet consists of a 4-octet header, followed by a sequence 1547 of TLVs (the packet body), optionally followed by a second sequence 1548 of TLVs (the packet trailer). 1550 0 1 2 3 1551 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 1552 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1553 | Magic | Version | Body length | 1554 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1555 | Packet Body ... 1556 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- 1557 | Packet Trailer... 1558 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- 1560 Fields : 1562 Magic The arbitrary but carefully chosen value 42 (decimal); 1563 packets with a first octet different from 42 MUST be 1564 silently ignored. 1566 Version This document specifies version 2 of the Babel protocol. 1567 Packets with a second octet different from 2 MUST be 1568 silently ignored. 1570 Body length The length in octets of the body following the packet 1571 header (excluding the Magic, Version and Body length 1572 fields, and excluding the packet trailer). 1574 Packet Body The packet body; a sequence of TLVs. 1576 Packet Trailer The packet trailer; another sequence of TLVs. 1578 The packet body and trailer are both sequences of TLVs. The packet 1579 body is the normal place to store TLVs; the packet trailer only 1580 contains specialised TLVs that do not need to be protected by 1581 cryptographic security mechanisms. When parsing the trailer, the 1582 receiver MUST ignore any TLV unless its definition explicitly states 1583 that it is allowed to appear there. Among the TLVs defined in this 1584 document, only Pad1 and PadN are allowed in the trailer; since these 1585 TLVs are ignored in any case, an implementation MAY silently ignore 1586 the packet trailer without even parsing it, unless it implements at 1587 least one extension that defines TLVs that are allowed to appear in 1588 the trailer. 1590 4.3. TLV Format 1592 With the exception of Pad1, all TLVs have the following structure: 1594 0 1 2 3 1595 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 1596 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1597 | Type | Length | Payload... 1598 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- 1600 Fields : 1602 Type The type of the TLV. 1604 Length The length of the body, exclusive of the Type and Length 1605 fields. If the body is longer than the expected length of 1606 a given type of TLV, any extra data MUST be silently 1607 ignored. 1609 Payload The TLV payload, which consists of a body and, for selected 1610 TLV types, an optional list of sub-TLVs. 1612 TLVs with an unknown type value MUST be silently ignored. 1614 4.4. Sub-TLV Format 1616 Every TLV carries an explicit length in its header; however, most 1617 TLVs are self-terminating, in the sense that it is possible to 1618 determine the length of the body without reference to the explicit 1619 Length field. If a TLV has a self-terminating format, then it MAY 1620 allow a sequence of sub-TLVs to follow the body. 1622 Sub-TLVs have the same structure as TLVs. With the exception of 1623 PAD1, all TLVs have the following structure: 1625 0 1 2 3 1626 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 1627 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1628 | Type | Length | Body... 1629 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- 1631 Fields : 1633 Type The type of the sub-TLV. 1635 Length The length of the body, in octets, exclusive of the Type 1636 and Length fields. 1638 Body The sub-TLV body, the interpretation of which depends on 1639 both the type of the sub-TLV and the type of the TLV within 1640 which it is embedded. 1642 The most-significant bit of the sub-TLV, called the mandatory bit, 1643 indicates how to handle unknown sub-TLVs. If the mandatory bit is 1644 not set, then an unknown sub-TLV MUST be silently ignored, and the 1645 rest of the TLV processed normally. If the mandatory bit is set, 1646 then the whole enclosing TLV MUST be silently ignored (except for 1647 updating the parser state by a Router-Id, Next-Hop or Update TLV, see 1648 Section 4.6.7, Section 4.6.8, and Section 4.6.9). 1650 4.5. Parser state 1652 Babel uses a stateful parser: a TLV may refer to data from a previous 1653 TLV. The parser state consists of the following pieces of data: 1655 o for each address encoding that allows compression, the current 1656 default prefix; this is undefined at the start of the packet, and 1657 is updated by each Update TLV with the Prefix flag set 1658 (Section 4.6.9); 1660 o for each address family (IPv4 or IPv6), the current next-hop; this 1661 is the source address of the enclosing packet for the matching 1662 address family at the start of a packet, and is updated by each 1663 Next-Hop TLV (Section 4.6.8); 1665 o the current router-id; this is undefined at the start of the 1666 packet, and is updated by each Router-ID TLV (Section 4.6.7) and 1667 by each Update TLV with Router-Id flag set. 1669 Since the parser state is separate from the bulk of Babel's state, 1670 and since for correct parsing it must be identical across 1671 implementations, it is updated before checking for mandatory TLVs: 1672 parsing a TLV MUST update the parser state even if the TLV is 1673 otherwise ignored due to an unknown mandatory sub-TLV. 1675 None of the TLVs that modify the parser state are allowed in the 1676 packet trailer; hence, an implementation may choose to use a 1677 dedicated stateless parser to parse the packet trailer. 1679 4.6. Details of Specific TLVs 1681 4.6.1. Pad1 1683 0 1684 0 1 2 3 4 5 6 7 1685 +-+-+-+-+-+-+-+-+ 1686 | Type = 0 | 1687 +-+-+-+-+-+-+-+-+ 1689 Fields : 1691 Type Set to 0 to indicate a Pad1 TLV. 1693 This TLV is silently ignored on reception. It is allowed in the 1694 packet trailer. 1696 4.6.2. PadN 1698 0 1 2 3 1699 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 1700 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1701 | Type = 1 | Length | MBZ... 1702 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- 1704 Fields : 1706 Type Set to 1 to indicate a PadN TLV. 1708 Length The length of the body, exclusive of the Type and Length 1709 fields. 1711 MBZ Set to 0 on transmission. 1713 This TLV is silently ignored on reception. It is allowed in the 1714 packet trailer. 1716 4.6.3. Acknowledgment Request 1718 0 1 2 3 1719 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 1720 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1721 | Type = 2 | Length | Reserved | 1722 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1723 | Nonce | Interval | 1724 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1726 This TLV requests that the receiver send an Acknowledgment TLV within 1727 the number of centiseconds specified by the Interval field. 1729 Fields : 1731 Type Set to 2 to indicate an Acknowledgment Request TLV. 1733 Length The length of the body, exclusive of the Type and Length 1734 fields. 1736 Reserved Sent as 0 and MUST be ignored on reception. 1738 Nonce An arbitrary value that will be echoed in the receiver's 1739 Acknowledgment TLV. 1741 Interval A time interval in centiseconds after which the sender will 1742 assume that this packet has been lost. This MUST NOT be 0. 1743 The receiver MUST send an Acknowledgment TLV before this 1744 time has elapsed (with a margin allowing for propagation 1745 time). 1747 This TLV is self-terminating, and allows sub-TLVs. 1749 4.6.4. Acknowledgment 1750 0 1 2 3 1751 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 1752 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1753 | Type = 3 | Length | Nonce | 1754 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1756 This TLV is sent by a node upon receiving an Acknowledgment Request. 1758 Fields : 1760 Type Set to 3 to indicate an Acknowledgment TLV. 1762 Length The length of the body, exclusive of the Type and Length 1763 fields. 1765 Nonce Set to the Nonce value of the Acknowledgment Request that 1766 prompted this Acknowledgment. 1768 Since nonce values are not globally unique, this TLV MUST be sent to 1769 a unicast address. 1771 This TLV is self-terminating, and allows sub-TLVs. 1773 4.6.5. Hello 1775 0 1 2 3 1776 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 1777 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1778 | Type = 4 | Length | Flags | 1779 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1780 | Seqno | Interval | 1781 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1783 This TLV is used for neighbour discovery and for determining a 1784 neighbour's reception cost. 1786 Fields : 1788 Type Set to 4 to indicate a Hello TLV. 1790 Length The length of the body, exclusive of the Type and Length 1791 fields. 1793 Flags The individual bits of this field specify special handling 1794 of this TLV (see below). 1796 Seqno If the Unicast flag is set, this is the value of the 1797 sending node's outgoing Unicast Hello seqno for this 1798 neighbour. Otherwise, it is the sending node's outgoing 1799 Multicast Hello seqno for this interface. 1801 Interval If non-zero, this is an upper bound, expressed in 1802 centiseconds, on the time after which the sending node will 1803 send a new scheduled Hello TLV with the same setting of the 1804 Unicast flag. If this is 0, then this Hello represents an 1805 unscheduled Hello, and doesn't carry any new information 1806 about times at which Hellos are sent. 1808 The Flags field is interpreted as follows: 1810 0 1 1811 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 1812 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1813 |U|X|X|X|X|X|X|X|X|X|X|X|X|X|X|X| 1814 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1816 o U (Unicast) flag (8000 hexadecimal): if set, then this Hello 1817 represents a Unicast Hello, otherwise it represents a Multicast 1818 Hello; 1820 o X: all other bits MUST be sent as 0 and silently ignored on 1821 reception. 1823 Every time a Hello is sent, the corresponding seqno counter MUST be 1824 incremented. Since there is a single seqno counter for all the 1825 Multicast Hellos sent by a given node over a given interface, if the 1826 Unicast flag is not set, this TLV MUST be sent to all neighbors on 1827 this link, which can be achieved by sending to a multicast 1828 destination, or by sending multiple packets to the unicast addresses 1829 of all reachable neighbours. Conversely, if the Unicast flag is set, 1830 this TLV MUST be sent to a single neighbour, which can achieved by 1831 sending to a unicast destination. In order to avoid large 1832 discontinuities in link quality, multiple Hello TLVs SHOULD NOT be 1833 sent in the same packet. 1835 This TLV is self-terminating, and allows sub-TLVs. 1837 4.6.6. IHU 1838 0 1 2 3 1839 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 1840 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1841 | Type = 5 | Length | AE | Reserved | 1842 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1843 | Rxcost | Interval | 1844 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1845 | Address... 1846 +-+-+-+-+-+-+-+-+-+-+-+- 1848 An IHU ("I Heard You") TLV is used for confirming bidirectional 1849 reachability and carrying a link's transmission cost. 1851 Fields : 1853 Type Set to 5 to indicate an IHU TLV. 1855 Length The length of the body, exclusive of the Type and Length 1856 fields. 1858 AE The encoding of the Address field. This should be 1 or 3 1859 in most cases. As an optimisation, it MAY be 0 if the TLV 1860 is sent to a unicast address, if the association is over a 1861 point-to-point link, or when bidirectional reachability is 1862 ascertained by means outside of the Babel protocol. 1864 Reserved Sent as 0 and MUST be ignored on reception. 1866 Rxcost The rxcost according to the sending node of the interface 1867 whose address is specified in the Address field. The value 1868 FFFF hexadecimal (infinity) indicates that this interface 1869 is unreachable. 1871 Interval An upper bound, expressed in centiseconds, on the time 1872 after which the sending node will send a new IHU; this MUST 1873 NOT be 0. The receiving node will use this value in order 1874 to compute a hold time for this symmetric association. 1876 Address The address of the destination node, in the format 1877 specified by the AE field. Address compression is not 1878 allowed. 1880 Conceptually, an IHU is destined to a single neighbour. However, IHU 1881 TLVs contain an explicit destination address, and MAY be sent to a 1882 multicast address, as this allows aggregation of IHUs destined to 1883 distinct neighbours into a single packet and avoids the need for an 1884 ARP or Neighbour Discovery exchange when a neighbour is not being 1885 used for data traffic. 1887 IHU TLVs with an unknown value in the AE field MUST be silently 1888 ignored. 1890 This TLV is self-terminating, and allows sub-TLVs. 1892 4.6.7. Router-Id 1894 0 1 2 3 1895 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 1896 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1897 | Type = 6 | Length | Reserved | 1898 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1899 | | 1900 + Router-Id + 1901 | | 1902 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1904 A Router-Id TLV establishes a router-id that is implied by subsequent 1905 Update TLVs. This TLV sets the router-id even if it is otherwise 1906 ignored due to an unknown mandatory sub-TLV. 1908 Fields : 1910 Type Set to 6 to indicate a Router-Id TLV. 1912 Length The length of the body, exclusive of the Type and Length 1913 fields. 1915 Reserved Sent as 0 and MUST be ignored on reception. 1917 Router-Id The router-id for routes advertised in subsequent Update 1918 TLVs. This MUST NOT consist of all zeroes or all ones. 1920 This TLV is self-terminating, and allows sub-TLVs. 1922 4.6.8. Next Hop 1924 0 1 2 3 1925 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 1926 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1927 | Type = 7 | Length | AE | Reserved | 1928 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1929 | Next hop... 1930 +-+-+-+-+-+-+-+-+-+-+-+- 1932 A Next Hop TLV establishes a next-hop address for a given address 1933 family (IPv4 or IPv6) that is implied in subsequent Update TLVs. 1935 This TLV sets up the next-hop for subsequent Update TLVs even if it 1936 is otherwise ignored due to an unknown mandatory sub-TLV. 1938 Fields : 1940 Type Set to 7 to indicate a Next Hop TLV. 1942 Length The length of the body, exclusive of the Type and Length 1943 fields. 1945 AE The encoding of the Address field. This SHOULD be 1 (IPv4) 1946 or 3 (link-local IPv6), and MUST NOT be 0. 1948 Reserved Sent as 0 and MUST be ignored on reception. 1950 Next hop The next-hop address advertised by subsequent Update TLVs, 1951 for this address family. 1953 When the address family matches the network-layer protocol that this 1954 packet is transported over, a Next Hop TLV is not needed: in the 1955 absence of a Next Hop TLV in a given address family, the next hop 1956 address is taken to be the source address of the packet. 1958 Next Hop TLVs with an unknown value for the AE field MUST be silently 1959 ignored. 1961 This TLV is self-terminating, and allows sub-TLVs. 1963 4.6.9. Update 1965 0 1 2 3 1966 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 1967 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1968 | Type = 8 | Length | AE | Flags | 1969 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1970 | Plen | Omitted | Interval | 1971 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1972 | Seqno | Metric | 1973 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1974 | Prefix... 1975 +-+-+-+-+-+-+-+-+-+-+-+- 1977 An Update TLV advertises or retracts a route. As an optimisation, it 1978 can optionally have the side effect of establishing a new implied 1979 router-id and a new default prefix. 1981 Fields : 1983 Type Set to 8 to indicate an Update TLV. 1985 Length The length of the body, exclusive of the Type and Length 1986 fields. 1988 AE The encoding of the Prefix field. 1990 Flags The individual bits of this field specify special handling 1991 of this TLV (see below). 1993 Plen The length of the advertised prefix. 1995 Omitted The number of octets that have been omitted at the 1996 beginning of the advertised prefix and that should be taken 1997 from a preceding Update TLV in the same address family with 1998 the Prefix flag set. 2000 Interval An upper bound, expressed in centiseconds, on the time 2001 after which the sending node will send a new update for 2002 this prefix. This MUST NOT be 0. The receiving node will 2003 use this value to compute a hold time for the route table 2004 entry. The value FFFF hexadecimal (infinity) expresses 2005 that this announcement will not be repeated unless a 2006 request is received (Section 3.8.2.3). 2008 Seqno The originator's sequence number for this update. 2010 Metric The sender's metric for this route. The value FFFF 2011 hexadecimal (infinity) means that this is a route 2012 retraction. 2014 Prefix The prefix being advertised. This field's size is 2015 (Plen/8 - Omitted) rounded upwards. 2017 The Flags field is interpreted as follows: 2019 0 1 2 3 4 5 6 7 2020 +-+-+-+-+-+-+-+-+ 2021 |P|R|X|X|X|X|X|X| 2022 +-+-+-+-+-+-+-+-+ 2024 o P (Prefix) flag (80 hexadecimal): if set, then this Update 2025 establishes a new default prefix for subsequent Update TLVs with a 2026 matching address encoding within the same packet, even if this TLV 2027 is otherwise ignored due to an unknown mandatory sub-TLV; 2029 o R (Router-Id) flag (40 hexadecimal): if set, then this TLV 2030 establishes a new default router-id for this TLV and subsequent 2031 Update TLVs in the same packet, even if this TLV is otherwise 2032 ignored due to an unknown mandatory sub-TLV. This router-id is 2033 computed from the first address of the advertised prefix as 2034 follows: 2036 * if the length of the address is 8 octets or more, then the new 2037 router-id is taken from the 8 last octets of the address; 2039 * if the length of the address is smaller than 8 octets, then the 2040 new router-id consists of the required number of zero octets 2041 followed by the address, i.e., the address is stored on the 2042 right of the router-id. For example, for an IPv4 address, the 2043 router-id consists of 4 octets of zeroes followed by the IPv4 2044 address. 2046 o X: all other bits MUST be sent as 0 and silently ignored on 2047 reception. 2049 The prefix being advertised by an Update TLV is computed as follows: 2051 o the first Omitted octets of the prefix are taken from the previous 2052 Update TLV with the Prefix flag set and the same address encoding, 2053 even if it was ignored due to an unknown mandatory sub-TLV; 2055 o the next (Plen/8 - Omitted) rounded upwards octets are taken from 2056 the Prefix field; 2058 o the remaining octets are set to 0. If AE is 3 (link-local IPv6), 2059 Omitted MUST be 0) 2061 If the Metric field is finite, the router-id of the originating node 2062 for this announcement is taken from the prefix advertised by this 2063 Update if the Router-Id flag is set, computed as described above. 2064 Otherwise, it is taken either from the preceding Router-Id packet, or 2065 the preceding Update packet with the Router-Id flag set, whichever 2066 comes last, even if that TLV is otherwise ignored due to an unknown 2067 mandatory sub-TLV. 2069 The next-hop address for this update is taken from the last preceding 2070 Next Hop TLV with a matching address family (IPv4 or IPv6) in the 2071 same packet even if it was otherwise ignored due to an unknown 2072 mandatory sub-TLV; if no such TLV exists, it is taken from the 2073 network-layer source address of this packet. 2075 If the metric field is FFFF hexadecimal, this TLV specifies a 2076 retraction. In that case, the router-id, next-hop and seqno are not 2077 used. AE MAY then be 0, in which case this Update retracts all of 2078 the routes previously advertised by the sending interface. If the 2079 metric is finite, AE MUST NOT be 0. If the metric is infinite and AE 2080 is 0, Plen and Omitted MUST both be 0. 2082 Update TLVs with an unknown value in the AE field MUST be silently 2083 ignored. 2085 This TLV is self-terminating, and allows sub-TLVs. 2087 4.6.10. Route Request 2089 0 1 2 3 2090 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 2091 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2092 | Type = 9 | Length | AE | Plen | 2093 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2094 | Prefix... 2095 +-+-+-+-+-+-+-+-+-+-+-+- 2097 A Route Request TLV prompts the receiver to send an update for a 2098 given prefix, or a full route table dump. 2100 Fields : 2102 Type Set to 9 to indicate a Route Request TLV. 2104 Length The length of the body, exclusive of the Type and Length 2105 fields. 2107 AE The encoding of the Prefix field. The value 0 specifies 2108 that this is a request for a full route table dump (a 2109 wildcard request). 2111 Plen The length of the requested prefix. 2113 Prefix The prefix being requested. This field's size is Plen/8 2114 rounded upwards. 2116 A Request TLV prompts the receiver to send an update message 2117 (possibly a retraction) for the prefix specified by the AE, Plen, and 2118 Prefix fields, or a full dump of its route table if AE is 0 (in which 2119 case Plen MUST be 0 and Prefix is of length 0). 2121 This TLV is self-terminating, and allows sub-TLVs. 2123 4.6.11. Seqno Request 2125 0 1 2 3 2126 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 2127 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2128 | Type = 10 | Length | AE | Plen | 2129 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2130 | Seqno | Hop Count | Reserved | 2131 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2132 | | 2133 + Router-Id + 2134 | | 2135 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2136 | Prefix... 2137 +-+-+-+-+-+-+-+-+-+-+ 2139 A Seqno Request TLV prompts the receiver to send an Update for a 2140 given prefix with a given sequence number, or to forward the request 2141 further if it cannot be satisfied locally. 2143 Fields : 2145 Type Set to 10 to indicate a Seqno Request TLV. 2147 Length The length of the body, exclusive of the Type and Length 2148 fields. 2150 AE The encoding of the Prefix field. This MUST NOT be 0. 2152 Plen The length of the requested prefix. 2154 Seqno The sequence number that is being requested. 2156 Hop Count The maximum number of times that this TLV may be forwarded, 2157 plus 1. This MUST NOT be 0. 2159 Reserved Sent as 0 and MUST be ignored on reception. 2161 Router-Id The Router-Id that is being requested. This MUST NOT 2162 consist of all zeroes or all ones. 2164 Prefix The prefix being requested. This field's size is Plen/8 2165 rounded upwards. 2167 A Seqno Request TLV prompts the receiving node to send a finite- 2168 metric Update for the prefix specified by the AE, Plen, and Prefix 2169 fields, with either a router-id different from what is specified by 2170 the Router-Id field, or a Seqno no less (modulo 2^16) than what is 2171 specified by the Seqno field. If this request cannot be satisfied 2172 locally, then it is forwarded according to the rules set out in 2173 Section 3.8.1.2. 2175 While a Seqno Request MAY be sent to a multicast address, it MUST NOT 2176 be forwarded to a multicast address and MUST NOT be forwarded to more 2177 than one neighbour. A request MUST NOT be forwarded if its Hop Count 2178 field is 1. 2180 This TLV is self-terminating, and allows sub-TLVs. 2182 4.7. Details of specific sub-TLVs 2184 4.7.1. Pad1 2186 0 1 2 3 4 5 6 7 2187 +-+-+-+-+-+-+-+-+ 2188 | Type = 0 | 2189 +-+-+-+-+-+-+-+-+ 2191 Fields : 2193 Type Set to 0 to indicate a Pad1 sub-TLV. 2195 This sub-TLV is silently ignored on reception. It is allowed within 2196 any TLV that allows sub-TLVs. 2198 4.7.2. PadN 2200 0 1 2 3 2201 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 2202 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2203 | Type = 1 | Length | MBZ... 2204 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- 2206 Fields : 2208 Type Set to 1 to indicate a PadN sub-TLV. 2210 Length The length of the body, in octets, exclusive of the Type 2211 and Length fields. 2213 MBZ Set to 0 on transmission. 2215 This sub-TLV is silently ignored on reception. It is allowed within 2216 any TLV that allows sub-TLVs. 2218 5. IANA Considerations 2220 IANA has registered the UDP port number 6696, called "babel", for use 2221 by the Babel protocol. 2223 IANA has registered the IPv6 multicast group ff02::1:6 and the IPv4 2224 multicast group 224.0.0.111 for use by the Babel protocol. 2226 IANA has created a registry called "Babel TLV Types". The values in 2227 this registry are not changed by this specification. 2229 IANA has created a registry called "Babel sub-TLV Types". Due to the 2230 addition of a Mandatory bit to the Babel protocol, the values in the 2231 "Babel sub-TLV Types" registry are amended as follows: 2233 +---------+-----------------------------------------+---------------+ 2234 | Type | Name | Reference | 2235 +---------+-----------------------------------------+---------------+ 2236 | 0 | Pad1 | this document | 2237 | | | | 2238 | 1 | PadN | this document | 2239 | | | | 2240 | 112-126 | Reserved for Experimental Use | this document | 2241 | | | | 2242 | 127 | Reserved for expansion of the type | this document | 2243 | | space | | 2244 | | | | 2245 | 240-254 | Reserved for Experimental Use | this document | 2246 | | | | 2247 | 255 | Reserved for expansion of the type | this document | 2248 | | space | | 2249 +---------+-----------------------------------------+---------------+ 2251 Existing assignments in the "Babel sub-TLV Types" registry in the 2252 range 2 to 111 are not changed by this specification. The values 224 2253 through 239, previously reserved for Experimental Use, are now 2254 unassigned. 2256 IANA has created a registry called "Babel Flags Values". IANA is 2257 instructed to rename this registry to "Babel Update Flags Values", 2258 with its contents unchanged. 2260 IANA is instructed to create a new registry called "Babel Hello Flags 2261 Values". The allocation policy for this registry is Specification 2262 Required [RFC8126]. The initial values in this registry are as 2263 follows: 2265 +------+------------+---------------+ 2266 | Bit | Name | Reference | 2267 +------+------------+---------------+ 2268 | 0 | Unicast | this document | 2269 | | | | 2270 | 1-15 | Unassigned | | 2271 +------+------------+---------------+ 2273 IANA is instructed to replace all references to RFCs 6126 and 7557 in 2274 all of the registries mentioned above by references to this document. 2276 6. Security Considerations 2278 As defined in this document, Babel is a completely insecure protocol. 2279 Any attacker can misdirect data traffic by advertising routes with a 2280 low metric or a high seqno. This issue can be solved either by a 2281 lower-layer security mechanism (e.g., link-layer security or IPsec), 2282 or by deploying a suitable authentication mechanism within Babel 2283 itself. There are currently two such mechanisms: Babel over DTLS 2284 [BABEL-DTLS] and HMAC-based authentication [BABEL-HMAC]. Both 2285 mechanisms ensure integrity of messages and prevent message replay, 2286 but only DTLS supports asymmetric keying and message confidentiality. 2287 HMAC is simpler and does not depend on DTLS, and therefore its use is 2288 RECOMMENDED whenever both mechanisms are applicable. 2290 The information that a Babel node announces to the whole routing 2291 domain is often sufficient to determine a mobile node's physical 2292 location with reasonable precision. The privacy issues that this 2293 causes can be mitigated somewhat by using randomly chosen router-ids 2294 and randomly chosen IP addresses, and changing them periodically. 2296 When carried over IPv6, Babel packets are ignored unless they are 2297 sent from a link-local IPv6 address; since routers don't forward 2298 link-local IPv6 packets, this provides protection against spoofed 2299 Babel packets being sent from the global Internet. No such natural 2300 protection exists when Babel packets are carried over IPv4. 2302 7. Acknowledgments 2304 A number of people have contributed text and ideas to this 2305 specification. The authors are particularly indebted to Matthieu 2306 Boutier, Gwendoline Chouasne, Margaret Cullen, Donald Eastlake, Toke 2307 Hoiland-Jorgensen, Joao Sobrinho and Martin Vigoureux. Earlier 2308 versions of this document greatly benefited from the input of Joel 2309 Halpern. The address compression technique was inspired by 2310 [PACKETBB]. 2312 8. References 2314 8.1. Normative References 2316 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2317 Requirement Levels", BCP 14, RFC 2119, 2318 DOI 10.17487/RFC2119, March 1997. 2320 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2321 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 2322 May 2017. 2324 8.2. Informative References 2326 [BABEL-DTLS] 2327 Decimo, A., Schinazi, D., and J. Chroboczek, "Babel 2328 Routing Protocol over Datagram Transport Layer Security", 2329 Internet Draft draft-ietf-babel-dtls-04, February 2019. 2331 [BABEL-HMAC] 2332 Do, C., Kolodziejak, W., and J. Chroboczek, "HMAC 2333 authentication for the Babel routing protocol", Internet 2334 Draft draft-ietf-babel-hmac-04, March 2019. 2336 [DSDV] Perkins, C. and P. Bhagwat, "Highly Dynamic Destination- 2337 Sequenced Distance-Vector Routing (DSDV) for Mobile 2338 Computers", ACM SIGCOMM'94 Conference on Communications 2339 Architectures, Protocols and Applications 234-244, 1994. 2341 [DUAL] Garcia Luna Aceves, J., "Loop-Free Routing Using Diffusing 2342 Computations", IEEE/ACM Transactions on Networking 1:1, 2343 February 1993. 2345 [EIGRP] Albrightson, B., Garcia Luna Aceves, J., and J. Boyle, 2346 "EIGRP -- a Fast Routing Protocol Based on Distance 2347 Vectors", Proc. Interop 94, 1994. 2349 [ETX] De Couto, D., Aguayo, D., Bicket, J., and R. Morris, "A 2350 high-throughput path metric for multi-hop wireless 2351 networks", Proc. MobiCom 2003, 2003. 2353 [IS-IS] "Information technology -- Telecommunications and 2354 information exchange between systems -- Intermediate 2355 System to Intermediate System intra-domain routeing 2356 information exchange protocol for use in conjunction with 2357 the protocol for providing the connectionless-mode network 2358 service (ISO 8473)", ISO/IEC 10589:2002, 2002. 2360 [JITTER] Floyd, S. and V. Jacobson, "The synchronization of 2361 periodic routing messages", IEEE/ACM Transactions on 2362 Networking 2, 2, 122-136, April 1994. 2364 [OSPF] Moy, J., "OSPF Version 2", RFC 2328, April 1998. 2366 [PACKETBB] 2367 Clausen, T., Dearlove, C., Dean, J., and C. Adjih, 2368 "Generalized Mobile Ad Hoc Network (MANET) Packet/Message 2369 Format", RFC 5444, February 2009. 2371 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 2372 Writing an IANA Considerations Section in RFCs", BCP 26, 2373 RFC 8126, June 2017. 2375 [RIP] Malkin, G., "RIP Version 2", RFC 2453, November 1998. 2377 Appendix A. Cost and Metric Computation 2379 The strategy for computing link costs and route metrics is a local 2380 matter; Babel itself only requires that it comply with the conditions 2381 given in Section 3.4.3 and Section 3.5.2. Different nodes may use 2382 different strategies in a single network and may use different 2383 strategies on different interface types. This section describes the 2384 strategies used by the sample implementation of Babel. 2386 The sample implementation of Babel sends periodic Multicast Hellos, 2387 and never sends Unicast Hellos. It maintains statistics about the 2388 last 16 received Hello TLVs of each kind (Appendix A.1), computes 2389 costs by using the 2-out-of-3 strategy (Appendix A.2.1) on wired 2390 links, and ETX (Appendix A.2.2) on wireless links. It uses an 2391 additive algebra for metric computation (Appendix A.3.1). 2393 A.1. Maintaining Hello History 2395 For each neighbour, the sample implementation of Babel maintains two 2396 sets of Hello history, one for each kind of Hello, and an expected 2397 sequence number, one for Multicast and one for Unicast Hellos. Each 2398 Hello history is a vector of 16 bits, where a 1 value represents a 2399 received Hello, and a 0 value a missed Hello. For each kind of 2400 Hello, the expected sequence number, written ne, is the sequence 2401 number that is expected to be carried by the next received Hello from 2402 this neighbour. 2404 Whenever it receives a Hello packet of a given kind from a neighbour, 2405 a node compares the received sequence number nr for that kind of 2406 Hello with its expected sequence number ne. Depending on the outcome 2407 of this comparison, one of the following actions is taken: 2409 o if the two differ by more than 16 (modulo 2^16), then the sending 2410 node has probably rebooted and lost its sequence number; the whole 2411 associated neighbour table entry is flushed and a new one is 2412 created; 2414 o otherwise, if the received nr is smaller (modulo 2^16) than the 2415 expected sequence number ne, then the sending node has increased 2416 its Hello interval without us noticing; the receiving node removes 2417 the last (ne - nr) entries from this neighbour's Hello history (we 2418 "undo history"); 2420 o otherwise, if nr is larger (modulo 2^16) than ne, then the sending 2421 node has decreased its Hello interval, and some Hellos were lost; 2422 the receiving node adds (nr - ne) 0 bits to the Hello history (we 2423 "fast-forward"). 2425 The receiving node then appends a 1 bit to the Hello history and sets 2426 ne to (nr + 1). If the Interval field of the received Hello is not 2427 zero, it resets the neighbour's hello timer to 1.5 times the 2428 advertised Interval (the extra margin allows for delay due to 2429 jitter). 2431 Whenever either Hello timer associated to a neighbour expires, the 2432 local node adds a 0 bit to this neighbour's Hello history, and 2433 increments the expected Hello number. If both Hello histories are 2434 empty (they contain 0 bits only), the neighbour entry is flushed; 2435 otherwise, the relevant hello timer is reset to the value advertised 2436 in the last Hello of that kind received from this neighbour (no extra 2437 margin is necessary in this case, since jitter was already taken into 2438 account when computing the timeout that has just expired). 2440 A.2. Cost Computation 2442 This section discusses how to compute costs based on Hello history. 2444 A.2.1. k-out-of-j 2446 K-out-of-j link sensing is suitable for wired links that are either 2447 up, in which case they only occasionally drop a packet, or down, in 2448 which case they drop all packets. 2450 The k-out-of-j strategy is parameterised by two small integers k and 2451 j, such that 0 < k <= j, and the nominal link cost, a constant K >= 2452 1. A node keeps a history of the last j hellos; if k or more of 2453 those have been correctly received, the link is assumed to be up, and 2454 the rxcost is set to K; otherwise, the link is assumed to be down, 2455 and the rxcost is set to infinity. 2457 Since Babel supports two kinds of Hellos, a Babel node performs k- 2458 out-of-j twice for each neighbour, once on the Unicast and once on 2459 the Multicast Hello history. If either of the instances of k-out- 2460 of-j indicates that the link is up, then the link is assumed to be 2461 up, and the rxcost is set to K; if both instances indicate that the 2462 link is down, then the link is assumed to be down, and the rxcost is 2463 set to infinity. In other words, the resulting rxcost is the minimum 2464 of the rxcosts yielded by the two instances of k-out-of-j link 2465 sensing. 2467 The cost of a link performing k-out-of-j link sensing is defined as 2468 follows: 2470 o cost = FFFF hexadecimal if rxcost = FFFF hexadecimal; 2472 o cost = txcost otherwise. 2474 A.2.2. ETX 2476 Unlike wired links, which are bimodal (either up or down), wireless 2477 links exhibit continuous variation of the link quality. Naive 2478 application of hop-count routing in networks that use wireless links 2479 for transit tends to select long, lossy links in preference to 2480 shorter, lossless links, which can dramatically reduce throughput. 2481 For that reason, a routing protocol designed to support wireless 2482 links must perform some form of link-quality estimation. 2484 ETX [ETX] is a simple link-quality estimation algorithm that is 2485 designed to work well with the IEEE 802.11 MAC. By default, the 2486 IEEE 802.11 MAC performs ARQ and rate adaptation on unicast frames, 2487 but not on multicast frames, which are sent at a fixed rate with no 2488 ARQ; therefore, measuring the loss rate of multicast frames yields a 2489 useful estimate of a link's quality. 2491 A node performing ETX link quality estimation uses a neighbour's 2492 Multicast Hello history to compute an estimate, written beta, of the 2493 probability that a Hello TLV is successfully received. Beta can be 2494 computed as the fraction of 1 bits within a small number (say, 6) of 2495 the most recent entries in the Multicast Hello history, or it can be 2496 an exponential average, or some combination of both approaches. 2498 Let alpha be MIN(1, 256/txcost), an estimate of the probability of 2499 successfully sending a Hello TLV. The cost is then computed by 2501 cost = 256/(alpha * beta) 2503 or, equivalently, 2504 cost = (MAX(txcost, 256) * rxcost) / 256. 2506 Since the IEEE 802.11 MAC performs ARQ on unicast frames, unicast 2507 frames do not provide a useful measure of link quality, and therefore 2508 ETX ignores the Unicast Hello history. Thus, a node performing ETX 2509 link-quality estimation will not route through neighbouring nodes 2510 unless they send periodic Multicast Hellos (possibly in addition to 2511 Unicast Hellos). 2513 A.3. Metric Computation 2515 As described in Section 3.5.2, the metric advertised by a neighbour 2516 is combined with the link cost to yield a metric. 2518 A.3.1. Additive Metrics 2520 The simplest approach for obtaining a monotonic, left-distributive 2521 metric is to define the metric of a route as the sum of the costs of 2522 the component links. More formally, if a neighbour advertises a 2523 route with metric m over a link with cost c, then the resulting route 2524 has metric M(c, m) = c + m. 2526 A multiplicative metric can be converted into an additive one by 2527 taking the logarithm (in some suitable base) of the link costs. 2529 A.3.2. External Sources of Willingness 2531 A node may want to vary its willingness to forward packets by taking 2532 into account information that is external to the Babel protocol, such 2533 as the monetary cost of a link, the node's battery status, CPU load, 2534 etc. This can be done by adding to every route's metric a value k 2535 that depends on the external data. For example, if a battery-powered 2536 node receives an update with metric m over a link with cost c, it 2537 might compute a metric M(c, m) = k + c + m, where k depends on the 2538 battery status. 2540 In order to preserve strict monotonicity (Section 3.5.2), the value k 2541 must be greater than -c. 2543 Appendix B. Constants 2545 The choice of time constants is a trade-off between fast detection of 2546 mobility events and protocol overhead. Two implementations of Babel 2547 with different time constants will interoperate, although the 2548 resulting convergence time will most likely be dictated by the slower 2549 of the two. 2551 Experience with the sample implementation of Babel indicates that the 2552 Hello interval is the most important time constant: a mobility event 2553 is detected within 1.5 to 3 Hello intervals. Due to Babel's reliance 2554 on triggered updates and explicit requests, the Update interval only 2555 has an effect on the time it takes for accurate metrics to be 2556 propagated after variations in link costs too small to trigger an 2557 unscheduled update or in the presence of packet loss. 2559 At the time of writing, the sample implementation of Babel uses the 2560 following default values: 2562 Multicast Hello Interval: 4 seconds. 2564 IHU Interval: the advertised IHU interval is always 3 times the 2565 Multicast Hello interval. IHUs are actually sent with each Hello 2566 on lossy links (as determined from the Hello history), but only 2567 with every third Multicast Hello on lossless links. 2569 Unicast Hello Interval: the sample implementation never sends 2570 scheduled Unicast Hellos; 2572 Update Interval: 4 times the Multicast Hello interval. 2574 IHU Hold Time: 3.5 times the advertised IHU interval. 2576 Route Expiry Time: 3.5 times the advertised update interval. 2578 Source GC time: 3 minutes. 2580 Request timeout: initially 2 seconds, doubled every time a request 2581 is resent, up to a maximum of three times. 2583 The amount of jitter applied to a packet depends on whether it 2584 contains any urgent TLVs or not (Section 3.1). Urgent triggered 2585 updates and urgent requests are delayed by no more than 200ms; 2586 acknowledgments, by no more than the associated deadline; and other 2587 TLVs by no more than one-half the Multicast Hello interval. 2589 Appendix C. Considerations for protocol extensions 2591 Babel is an extensible protocol, and this document defines a number 2592 of mechanisms that can be used to extend the protocol in a backwards 2593 compatible manner: 2595 o increasing the version number in the packet header; 2597 o defining new TLVs; 2598 o defining new sub-TLVs (with or without the mandatory bit set); 2600 o defining new AEs; 2602 o using the packet trailer. 2604 This appendix is intended to guide designers of protocol extensions 2605 in chosing a particular encoding. 2607 The version number in the Babel header should only be increased if 2608 the new version is not backwards compatible with the original 2609 protocol. 2611 In many cases, an extension could be implemented either by defining a 2612 new TLV, or by adding a new sub-TLV to an existing TLV. For example, 2613 an extension whose purpose is to attach additional data to route 2614 updates can be implemented either by creating a new "enriched" Update 2615 TLV, by adding a non-mandatory sub-TLV to the Update TLV, or by 2616 adding a mandatory sub-TLV. 2618 The various encodings are treated differently by implementations that 2619 do not understand the extension. In the case of a new TLV or of a 2620 sub-TLV with the mandatory bit set, the whole TLV is ignored by 2621 implementations that do not implement the extension, while in the 2622 case of a non-mandatory sub-TLV, the TLV is parsed and acted upon, 2623 and only the unknown sub-TLV is silently ignored. Therefore, a non- 2624 mandatory sub-TLV should be used by extensions that extend the Update 2625 in a compatible manner (the extension data may be silently ignored), 2626 while a mandatory sub-TLV or a new TLV must be used by extensions 2627 that make incompatible extensions to the meaning of the TLV (the 2628 whole TLV must be thrown away if the extension data is not 2629 understood). 2631 Experience shows that the need for additional data tends to crop up 2632 in the most unexpected places. Hence, it is recommended that 2633 extensions that define new TLVs should make them self-terminating, 2634 and allow attaching sub-TLVs to them. 2636 Adding a new AE is essentially equivalent to adding a new TLV: Update 2637 TLVs with an unknown AE are ignored, just like unknown TLVs. 2638 However, adding a new AE is more involved than adding a new TLV, 2639 since it creates a new set of compression state. Additionally, since 2640 the Next Hop TLV creates state specific to a given address family, as 2641 opposed to a given AE, a new AE for a previously defined address 2642 family must not be used in the Next Hop TLV if backwards 2643 compatibility is required. A similar issue arises with Update TLVs 2644 with unknown AEs establishing a new router-id (due to the Router-Id 2645 flag being set). Therefore, defining new AEs must be done with care 2646 if compatibility with unextended implementations is required. 2648 The packet trailer is intended to carry cryptographic signatures that 2649 only cover the packet body; storing the cryptographic signatures in 2650 the packet trailer avoids clearing the signature before computing a 2651 hash of the packet body, and makes it possible to check a 2652 cryptographic signature before running the full, stateful TLV parser. 2653 Hence, only TLVs that don't need to be protected by cryptographic 2654 security protocols should be allowed in the packet trailer. Any such 2655 TLVs should be easy to parse, and in particular should not require 2656 stateful parsing. 2658 Appendix D. Stub Implementations 2660 Babel is a fairly economic protocol. Updates take between 12 and 40 2661 octets per destination, depending on the address family and how 2662 successful compression is; in a double-stack flat network, an average 2663 of less than 24 octets per update is typical. The route table 2664 occupies about 35 octets per IPv6 entry. To put these values into 2665 perspective, a single full-size Ethernet frame can carry some 65 2666 route updates, and a megabyte of memory can contain a 20000-entry 2667 route table and the associated source table. 2669 Babel is also a reasonably simple protocol. The sample 2670 implementation consists of less than 12 000 lines of C code, and it 2671 compiles to less than 120 kB of text on a 32-bit CISC architecture; 2672 about half of this figure is due to protocol extensions and user- 2673 interface code. 2675 Nonetheless, in some very constrained environments, such as PDAs, 2676 microwave ovens, or abacuses, it may be desirable to have subset 2677 implementations of the protocol. 2679 There are many different definitions of a stub router, but for the 2680 needs of this section a stub implementation of Babel is one that 2681 announces one or more directly attached prefixes into a Babel network 2682 but doesn't reannounce any routes that it has learnt from its 2683 neighbours. It may either maintain a full routing table, or simply 2684 select a default gateway amongst any one of its neighbours that 2685 announces a default route. Since a stub implementation never 2686 forwards packets except from or to directly attached links, it cannot 2687 possibly participate in a routing loop, and hence it need not 2688 evaluate the feasibility condition or maintain a source table. 2690 No matter how primitive, a stub implementation MUST parse sub-TLVs 2691 attached to any TLVs that it understands and check the mandatory bit. 2692 It MUST answer acknowledgment requests and MUST participate in the 2693 Hello/IHU protocol. It MUST also be able to reply to seqno requests 2694 for routes that it announces and SHOULD be able to reply to route 2695 requests. 2697 Experience shows that an IPv6-only stub implementation of Babel can 2698 be written in less than 1000 lines of C code and compile to 13 kB of 2699 text on 32-bit CISC architecture. 2701 Appendix E. Software Availability 2703 The sample implementation of Babel is available from 2704 . 2706 Appendix F. Changes from previous versions 2708 F.1. Changes since RFC 6126 2710 o Changed UDP port number to 6696. 2712 o Consistently use router-id rather than id. 2714 o Clarified that the source garbage collection timer is reset after 2715 sending an update even if the entry was not modified. 2717 o In section "Seqno Requests", fixed an erroneous "route request". 2719 o In the description of the Seqno Request TLV, added the description 2720 of the Router-Id field. 2722 o Made router-ids all-0 and all-1 forbidden. 2724 F.2. Changes since draft-ietf-babel-rfc6126bis-00 2726 o Added security considerations. 2728 F.3. Changes since draft-ietf-babel-rfc6126bis-01 2730 o Integrated the format of sub-TLVs. 2732 o Mentioned for each TLV whether it supports sub-TLVs. 2734 o Added Appendix C. 2736 o Added a mandatory bit in sub-TLVs. 2738 o Changed compression state to be per-AF rather than per-AE. 2740 o Added implementation hint for the routing table. 2742 o Clarified how router-ids are computed when bit 0x40 is set in 2743 Updates. 2745 o Relaxed the conditions for sending requests, and tightened the 2746 conditions for forwarding requests. 2748 o Clarified that neighbours should be acquired at some point, but it 2749 doesn't matter when. 2751 F.4. Changes since draft-ietf-babel-rfc6126bis-02 2753 o Added Unicast Hellos. 2755 o Added unscheduled (interval-less) Hellos. 2757 o Changed Appendix A to consider Unicast and unscheduled Hellos. 2759 o Changed Appendix B to agree with the reference implementation. 2761 o Added optional algorithm to avoid the hold time. 2763 o Changed the table of pending seqno requests to be indexed by 2764 router-id in addition to prefixes. 2766 o Relaxed the route acquisition algorithm. 2768 o Replaced minimal implementations by stub implementations. 2770 o Added acknowledgments section. 2772 F.5. Changes since draft-ietf-babel-rfc6126bis-03 2774 o Clarified that all the data structures are conceptual. 2776 o Made sending and receiving Multicast Hellos a SHOULD, avoids 2777 expressing any opinion about Unicast Hellos. 2779 o Removed opinion about Multicast vs. Unicast Hellos (Appendix A.4). 2781 o Made hold-time into a SHOULD rather than MUST. 2783 o Clarified that Seqno Requests are for a finite-metric Update. 2785 o Clarified that sub-TLVs Pad1 and PadN are allowed within any TLV 2786 that allows sub-TLVs. 2788 o Updated IANA Considerations. 2790 o Updated Security Considerations. 2792 o Renamed routing table back to route table. 2794 o Made buffering outgoing updates a SHOULD. 2796 o Weakened advice to use modified EUI-64 in router-ids. 2798 o Added information about sending requests to Appendix B. 2800 o A number of minor wording changes and clarifications. 2802 F.6. Changes since draft-ietf-babel-rfc6126bis-03 2804 Minor editorial changes. 2806 F.7. Changes since draft-ietf-babel-rfc6126bis-04 2808 o Renamed isotonicity to left-distributivity. 2810 o Minor clarifications to unicast hellos. 2812 o Updated requirements boilerplate to RFC 8174. 2814 o Minor editorial changes. 2816 F.8. Changes since draft-ietf-babel-rfc6126bis-05 2818 o Added information about the packet trailer, now that it is used by 2819 draft-ietf-babel-hmac. 2821 F.9. Changes since draft-ietf-babel-rfc6126bis-06 2823 o Added references to security documents. 2825 F.10. Changes since draft-ietf-babel-rfc6126bis-07 2827 o Added list of obsoleted drafts to the abstract. 2829 o Updated references. 2831 F.11. Changes since draft-ietf-babel-rfc6126bis-08 2833 o Added recommendation that route selection should not take seqnos 2834 into account. 2836 F.12. Changes since draft-ietf-babel-rfc6126bis-09 2838 o Editorial changes only. 2840 Authors' Addresses 2842 Juliusz Chroboczek 2843 IRIF, University of Paris-Diderot 2844 Case 7014 2845 75205 Paris Cedex 13 2846 France 2848 Email: jch@irif.fr 2850 David Schinazi 2851 Google LLC 2852 1600 Amphitheatre Parkway 2853 Mountain View, California 94043 2854 USA 2856 Email: dschinazi.ietf@gmail.com