<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes" tocompact="yes" tocdepth="3" tocindent="yes" symrefs="yes" sortrefs="no" comments="yes" inline="yes" compact="yes" subcompact="no"?>
<rfc category="exp" docName="draft-ietf-manet-olsrv2-dat-metric-06" ipr="trust200902">
	<front>
		<title abbrev="Directional airtime metric for OLSRv2">Packet Sequence Number based directional airtime metric for OLSRv2</title>
		<author initials="H.R." surname="Rogge" fullname="Henning Rogge">
			<organization>Fraunhofer FKIE</organization>
			<address>
				<email>henning.rogge@fkie.fraunhofer.de</email>
				<uri>http://www.fkie.fraunhofer.de</uri>
			</address>
		</author>
		<author initials="E.B." surname="Baccelli" fullname="Emmanuel Baccelli">
			<organization>INRIA</organization>
			<address>
				<email>Emmanuel.Baccelli@inria.fr</email>
				<uri>http://www.emmanuelbaccelli.org/</uri>
			</address>
		</author>
		<date month="July" year="2015"/>
		<area>Routing Area</area>
		<workgroup>MANET</workgroup>
		<keyword>metric</keyword>
		<keyword>ad hoc network</keyword>
		<keyword>MANET</keyword>
		<keyword>routing</keyword>
		<keyword>IP networks</keyword>
		<keyword>OLSR</keyword>
		<keyword>ETT</keyword>
		<keyword>ETX</keyword>
		<keyword>Funkfeuer</keyword>
		<abstract>
			<t>This document specifies an directional airtime link metric for usage in OLSRv2.</t>
		</abstract>
	</front>

	<middle>
		<section anchor="introduction" title="Introduction">
			<t>One of the major shortcomings of OLSR <xref target="RFC3626"/> is the lack of a granular link cost metric between OLSR routers. Operational experience with OLSR networks gathered since the publication of OLSR has revealed that wireless networks links can have highly variable and heterogeneous properties. This makes a hopcount metric insufficient for effective OLSR routing.</t>
			<t>Based on this experience, OLSRv2 <xref target="RFC7181"/> integrates the concept of link metrics directly into the core specification of the routing protocol. The OLSRv2 routing metric is an external process, it can be any kind of dimensionless additive cost function which reports to the OLSRv2 protocol.</t>
			<t>Since 2004 the OLSR.org <xref target="OLSR.org"/> implementation of OLSR included an Estimated Transmission Count (ETX) metric <xref target="MOBICOM04"/> as a proprietary extension. While this metric is not perfect, it proved to be sufficient for a long time for Community Mesh Networks (<xref target="olsrorg_history"/>). But the increasing maximum data rate of IEEE 802.11 made the ETX metric less efficient than in the past, which is one reason to move to a different metric.</t>
			<t>This document describes a Directional Airtime routing metric for OLSRv2, a successor of the ETX-derived OLSR.org routing metric for OLSR. It takes both the loss rate and the link speed into account to provide a more accurate picture of the links within the network.</t>
			<t>This experimental draft will allow OLSRv2 deployments with a metric defined by the IETF Manet group. It enables easier interoperability tests between implementations and will also deliver an useful baseline to compare other metrics to.</t>
		</section>

		<section anchor="terminology" title="Terminology">
			<t>The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL NOT','SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'NOT RECOMMENDED', 'MAY', and 'OPTIONAL' in this document are to be interpreted as described in <xref target="RFC2119"/>.</t>
			<t>The terminology introduced in <xref target="RFC5444"/>, <xref target="RFC7181"/> and <xref target="RFC6130"/>, including the terms "packet", "message" and "TLV" are to be interpreted as described therein.</t>
			<t>Additionally, this document uses the following terminology and notational conventions:
			<list style="hanging">
				<t hangText="QUEUE"> - a first in, first out queue of integers.</t>
				<t hangText="QUEUE[TAIL]"> - the most recent element in the queue.</t>
				<t hangText="add(QUEUE, value)"> - adds a new element to the TAIL of the queue.</t>
				<t hangText="remove(QUEUE)"> - removes the HEAD element of the queue</t>
				<t hangText="sum(QUEUE)"> - an operation which returns the sum of all elements in a QUEUE.</t>
				<t hangText="diff_seqno(new, old)"> - an operation which returns the positive distance between two elements of the circular sequence number space defined in section 5.1 of <xref target="RFC5444"/>. Its value is either (new - old) if this result is positive, or else its value is (new - old + 65536).</t>
				<t hangText="MAX(a,b)"> - the maximum of a and b.</t>
				<t hangText="UNDEFINED">- a value not in the normal value range of a variable.</t>
				<t hangText="airtime">- the time a transmitted packet blocks the link layer, e.g., a wireless link.</t>
				<t hangText="ETX">- Expected Transmission Count, a link metric proportional to the number of transmissions to successfully send an IP packet over a link.</t>
				<t hangText="ETT">- Estimated Travel Time, a link metric proportional to the amount of airtime needed to transmit an IP packet over a link, not considering layer-2 overhead created by preamble, backoff time and queuing.</t>
				<t hangText="DAT">- Directional Airtime Metric, the link metric described in this document, which is a directional variant of ETT. It does not take reverse path loss into account.</t>
			</list></t>
		</section>

		<section anchor="applicable" title="Applicability Statement">
			<t>The Directional Airtime Metric was designed and tested in wireless IEEE 802.11 <xref target="RFC7181"/>  networks. These networks employ link layer retransmission to increase the delivery probability and multiple unicast data rates.</t>
			<t>As specified in <xref target="RFC7181"/> the metric calculates only the incoming link cost. It does neither calculate the outgoing metric, nor does it decide the link status (heard, symmetric, lost).</t>
			<t>The metric works both for nodes which can send/receive <xref target="RFC5444"/> packet sequence numbers and such which do not have this capability. In the absence of such sequence numbers the metric calculates the packet loss based on <xref target="RFC6130"/> HELLO message timeouts.</t>
			<t>The metric must learn about the unicast data rate towards each one-hop neighbor from an external process, either by configuration or by an external measurement process. This measurement could be done by gathering cross-layer data from the operating system or an external daemon like DLEP <xref target="DLEP"/>, but also by indirect layer-3 measurements like packet-pair.</t>
			<t>The metric uses <xref target="RFC5444"/> multicast control traffic to determine the link packet loss. The administrator should take care that link layer multicast transmission do not not have a higher reception probability than the slowest unicast transmission. It might, for example in 802.11g, be necessary to increase the data-rate of the multicast transmissions, e.g. set the multicast data-rate to 6 MBit/s.</t>
			<t>The metric can only handle a certain range of packet loss and unicast data-rate. The maximum packet loss that can be encoded into the metric a loss of 7 of 8 packets, without link layer retransmissions. The unicast data-rate that can be encoded by this metric can be between 1 kBit/s and 2 GBit/s. This metric has been designed for data-rates of 1 MBit/s and hundreds of MBit/s.</t>
		</section>

		<section anchor="datmetric" title="Directional Airtime Metric Rationale">
			<t>The Directional Airtime Metric has been inspired by the publications on the ETX <xref target="MOBICOM03"/> and ETT <xref target="MOBICOM04"/> metric, but  differs from both of these in several ways.</t>
			<t>Instead of measuring the combined loss probability of a bidirectional transmission of a packet over a link in both directions, the Directional Airtime Metric measures the incoming loss rate and integrates the incoming linkspeed into the metric cost. There are multiple reasons for this decision:
			<list style="symbols">
				<t>OLSRv2 <xref target="RFC7181"/> defines the link metric as directional costs between routers.</t>
				<t>Not all link layer implementations use acknowledgement mechanisms. Most link layer implementations who do use them use less airtime and a more robust modulation for the acknowledgement than the data transmission, which makes it more likely for the data transmission to be disrupted compared to the acknowledgement.</t>
				<t>Incoming packet loss and linkspeed can be measured locally, symmetric link loss would need an additional signaling TLV in the <xref target="RFC6130"/> HELLO and would delay metric calculation by up to one HELLO interval.</t>
			</list></t>
			<t>The Directional Airtime Metric does not integrate the packet size into the link cost. Doing so is not feasible in most link-state routing protocol implementations. The routing decision of most operation systems don't take packet size into account. Multiplying all link costs of a topology with the size of a data-plane packet would never change the dijkstra result anyways.</t>
			<t>The queue based packet loss estimator has been tested extensively in the OLSR.org ETX implementation, see <xref target="olsrorg_history"/>. The output is the average of the packet loss over a configured time period.</t>
			<t>The metric normally measures the loss of a link by tracking the incoming <xref target="RFC5444"/> packet sequence numbers. Without these packet sequence numbers, the metric does calculate the loss of the link based of received and lost <xref target="RFC5444"/> HELLO messages. It uses the incoming HELLO interval time (or if not present, the validity time) to decide when a HELLO is lost.</t>
			<t>When a neighbor router resets, its packet sequence number might jump to a random value. The metric tries to detect jumps in the packet sequence number and removes them from the data set, because the already gathered link loss data should still be valid. The link loss data is only removed from memory when a Link times out completely and its Link Set tuple is removed from the database.</t>
		</section>

		<section anchor="functioning" title="Metric Functioning &amp; Overview">
			<t>The Directional Airtime Metric is calculated for each link set entry, as defined in <xref target="RFC6130"/> section 7.1.</t>
			<t>The metric processes two kinds of data into the metric value, namely packet loss rate and link-speed.  The link-speed is taken from an external process not defined in this document. The current packet loss rate is defined in this document by keeping track of packet reception and packet loss events. It could also be calculated by an external process with a compatible output.</t>
			<t>Multiple incoming packet loss/reception events must be combined into a loss rate to get a smooth metric. Experiments with exponential weighted moving average (EWMA) lead to a highly fluctuating or a slow converging metric (or both). To get a smoother and more controllable metric result, this metric uses two fixed length queues to measure and average the incoming packet events, one queue for received packets and one for the estimated number of packets sent by the other side of the link.</t>
			<t>Because the rate of incoming packets is not uniform over time, the queue contains a number of counters, each representing a fixed time interval. Incoming packet loss and packet reception event are accumulated in the current queue element until a timer adds a new empty counter to both queues and remove the oldest counter from both.</t>
			<t>In addition to the packet loss stored in the queue, this metric uses a timer to detect a total link-loss. For every <xref target="RFC5444"/> HELLO interval in which the metric received no packet from a neighbor, it scales the number of received packets in the queue based on the total time interval the queue represents compared to the total time of the lost HELLO intervals.</t>
			<t>The average packet loss ratio is calculated as the sum of the 'total packets' counters divided by the sum of the 'packets received' counters. This value is then divided through the current link-speed and then scaled into the range of metrics allowed for OLSRv2.</t>
			<t>The metric value is then used as L_in_metric of the Link Set (as defined in section 8.1. of <xref target="RFC7181"/>).</t>
		</section>

		<section anchor="parameter" title="Protocol Parameters">
			<t>This specification defines two constants, agreement on which is required, from all the OLSRv2 routers participating in the same deployment. Two routers which use different values for these constants will not be able to generate metric values which can be correctly interpreted by both. These constants are:
			<list style="hanging">
				<t hangText="DAT_MEMORY_LENGTH">- Queue length for averaging packet loss. All received and lost packets within the queue are used to calculate the cost of the link.</t>
				<t hangText="DAT_REFRESH_INTERVAL">- interval in seconds between two metric recalculations as described in <xref target="metric_recalc"/>. This value SHOULD be smaller than a typical HELLO interval.</t>
				<t hangText="DAT_HELLO_TIMEOUT_FACTOR">- multiplier relative to the HELLO_INTERVAL (see <xref target="RFC6130"/> Section 5.3.1) after which the DAT metric considers a HELLO as lost.</t>
				<t hangText="DAT_SEQNO_RESTART_DETECTION">- threshold in number of missing packets (based on received packet sequence numbers) at which point the router considers the neighbor has restarted. This parameter is only used for packet sequence number based loss estimation. This number MUST be larger than DAT_MAXIMUM_LOSS.</t>
			</list></t>
			
			<section title="Recommended Values">
				<t>The proposed values of the protocol parameters are for Community Mesh Networks, which mostly use immobile routers. Using this metric for mobile networks might require shorter DAT_REFRESH_INTERVAL and/or DAT_MEMORY_LENGTH.
				<list style="hanging">
					<t hangText="DAT_MEMORY_LENGTH">:= 64</t>
					<t hangText="DAT_REFRESH_INTERVAL">:= 1</t>
					<t hangText="DAT_HELLO_TIMEOUT_FACTOR">:= 1.2</t>
					<t hangText="DAT_SEQNO_RESTART_DETECTION">:= 256</t>
				</list></t>
			</section>
		</section>

		<section anchor="constants" title="Protocol Constants">
                    <t>This specification defines the following constants, which define the range of metric values that can be encoded by the DAT metric (see <xref target="table_constants"/>). They cannot be changed without making the metric outputs incomparable and should only be changed for MANET's with a very slow or very fast linklayer.
			<list style="hanging">
				<t hangText="DAT_MAXIMUM_LOSS">- Fraction of the loss rate used in this routing metric. Loss rate will be between 0/DAT_MAXIMUM_LOSS and (DAT_MAXIMUM_LOSS-1)/DAT_MAXIMUM_LOSS.</t>
				<t hangText="DAT_MINIMUM_BITRATE">- Minimal bit-rate in Bit/s used by this routing metric.</t>
			</list></t>
                
                        <texttable anchor="table_constants" title="DAT Protocol Constants">
                                <ttcol align='center'>Name</ttcol>
                                <ttcol align='center'>Value</ttcol>
                                <c>DAT_MAXIMUM_LOSS</c>
                                <c>8</c>
                                <c>DAT_MINIMUM_BITRATE</c>
                                <c>1000</c>
                        </texttable>
		</section>
		<section anchor="infobase" title="Data Structures">
			<t>This specification extends the Link Set of the Interface Information Base, as defined in <xref target="RFC6130"/> section 7.1, by the adding the following elements to each link tuple:
			<list style="hanging">
				<t hangText="L_DAT_received"> is a QUEUE with DAT_MEMORY_LENGTH integer elements. Each entry contains the number of successfully received packets within an interval of DAT_REFRESH_INTERVAL.</t>
				<t hangText="L_DAT_total"> is a QUEUE with DAT_MEMORY_LENGTH integer elements. Each entry contains the estimated number of packets transmitted by the neighbor, based on the received packet sequence numbers within an interval of DAT_REFRESH_INTERVAL.</t>
				<t hangText="L_DAT_packet_time"> is the time when the next RFC5444 packet should have arrived.</t>
				<t hangText="L_DAT_hello_interval"> is the interval between two hello messages of the links neighbor as signaled by the INTERVAL_TIME TLV <xref target="RFC5497"/> of NHDP messages <xref target="RFC6130"/>.</t>
				<t hangText="L_DAT_lost_packet_intervals"> is the estimated number of HELLO intervals from this neighbor the metric has not received a single packet.</t>
				<t hangText="L_DAT_rx_bitrate"> is the current bitrate of incoming unicast traffic for this neighbor.</t>
				<t hangText="L_DAT_last_pkt_seqno"> is the last received packet sequence number received from this link.</t>
			</list></t>

			<t>Methods to obtain the value of L_DAT_rx_bitrate are out of the scope of this specification. Such methods may include static configuration via a configuration file or dynamic measurement through mechanisms described in a separate specification (e.g. <xref target="DLEP"/>).  Any Link tuple with L_status = HEARD or L_status = SYMMETRIC MUST have a specified value of L_DAT_rx_bitrate if it is to be used by this routing metric.</t>
			
			<t>This specification updates the L_in_metric field of the Link Set of the Interface Information Base, as defined in section 8.1. of <xref target="RFC7181"/>)</t>
			
			<section title="Initial Values">
				<t>When generating a new tuple in the Link Set, as defined in <xref target="RFC6130"/> section 12.5 bullet 3, the values of the elements specified in <xref target="infobase"/> are set as follows:
				<list style="symbols">
					<t>L_DAT_received := 0, ..., 0. The queue always has DAT_MEMORY_LENGTH elements.</t>
					<t>L_DAT_total := 0, ..., 0. The queue always has DAT_MEMORY_LENGTH elements.</t>
					<t>L_DAT_packet_time := EXPIRED (no earlier RFC5444 packet received).</t>
					<t>L_DAT_hello_interval := UNDEFINED (no earlier NHDP HELLO received).</t>
					<t>L_DAT_lost_packet_intervals := 0 (no HELLO interval without packets).</t>
					<t>L_DAT_last_pkt_seqno := UNDEFINED (no earlier RFC5444 packet with sequence number received).</t>
				</list></t>
			</section>
		</section>

		<section title="Packets and Messages">
			<t>This section describes the necessary changes of <xref target="RFC7181"/> implementations with DAT metric for the processing and modification of incoming and outgoing <xref target="RFC5444"/> data.</t>
			<section title="Definitions">
				<t>For the purpose of this section, note the following definitions:
				<list style="symbols">
					<t>"pkt_seqno" is defined as the <xref target="RFC5444"/> packet sequence number of the received packet.</t>
					<t>"interval_time" is the time encoded in the INTERVAL_TIME message TLV of a received <xref target="RFC6130"/> HELLO message.</t>
					<t>"validity_time" is the time encoded in the VALIDITY_TIME message TLV of a received <xref target="RFC6130"/> HELLO message.</t>
				</list></t>
			</section>

			<section title="Requirements for using DAT metric in OLSRv2 implementations">
				<t>An implementation of OLSRv2 using the metric specified by this document SHOULD include the following parts into its <xref target="RFC5444"/> output:
				<list style="symbols">
					<t>an INTERVAL_TIME message TLV in each HELLO message, as defined in <xref target="RFC6130"/> section 4.3.2.</t>
					<t>an interface specific packet sequence number as defined in <xref target="RFC5444"/> section 5.1 which is incremented by 1 for each outgoing <xref target="RFC5444"/> packet on the interface.</t>
				</list></t>
			</section>

			<section title="Link Loss Data Gathering">
				<t>For each incoming <xref target="RFC5444"/> packet, additional processing SHOULD be carried out after the packet messages have been processed as specified in <xref target="RFC6130"/> and <xref target="RFC7181"/>.</t>
				<t><xref target="RFC5444"/> packets without packet sequence number MUST NOT be processed in this way by this metric.</t>
				<t>The router updates the Link Set Tuple corresponding to the originator of the packet:
				<list style="numbers">
					<t>If L_DAT_last_pkt_seqno = UNDEFINED, then:
					<list style="numbers">
						<t>L_DAT_received[TAIL] := 1.</t>
						<t>L_DAT_total[TAIL] := 1.</t>
					</list></t>
					<t>Otherwise:
					<list style="numbers">
						<t>L_DAT_received[TAIL] := L_DAT_received[TAIL] + 1.</t>
						<t>diff := seq_diff(pkt_seqno, L_DAT_last_pkt_seqno).</t>
						<t>If diff &gt; DAT_SEQNO_RESTART_DETECTION, then:
						<list style="numbers">
							<t>diff := 1.</t>
						</list></t>
						<t>L_DAT_total[TAIL] := L_DAT_total[TAIL] + diff.</t>
					</list></t>
					<t>L_DAT_last_pkt_seqno := pkt_seqno.</t>
					<t>If L_DAT_hello_interval != UNDEFINED, then:
					<list style="numbers">
						<t>L_DAT_packet_time := current time + (L_DAT_hello_interval * DAT_HELLO_TIMEOUT_FACTOR).</t>
					</list></t>
					<t>L_DAT_lost_packet_intervals := 0.</t>
				</list></t>
			</section>

			<section title="HELLO Message Processing">
				<t>For each incoming HELLO Message, after it has been processed as defined in <xref target="RFC6130"/> section 12, the Link Set Tuple corresponding to the incoming HELLO message MUST be updated.
				<list style="numbers">
					<t>If the HELLO message contains an INTERVAL_TIME message TLV, then:
					<list style="numbers">
						<t>L_DAT_hello_interval := interval_time.</t>
					</list></t>
					<t>Otherwise:
					<list style="numbers">
						<t>L_DAT_hello_interval := validity_time.</t>
					</list></t>
					<t>If L_DAT_last_pkt_seqno = UNDEFINED, then:
					<list style="numbers">
						<t>L_DAT_received[TAIL] := L_DAT_received[TAIL] + 1.</t>
						<t>L_DAT_total[TAIL] := L_DAT_total[TAIL] + 1.</t>
						<t>L_DAT_packet_time := current time + (L_DAT_hello_interval * DAT_HELLO_TIMEOUT_FACTOR).</t>
					</list></t>
				</list></t>
			</section>
		</section>

		<section title="Timer Event Handling">
			<t>In addition to changes in the <xref target="RFC5444"/> processing/generation code, the DAT metric also uses two timer events.</t>
			
			<section title="Packet Timeout Processing">
				<t>When L_DAT_packet_time has timed out, the following step MUST be done:
				<list style="numbers">
					<t>If L_DAT_last_pkt_seqno = UNDEFINED, then:
					<list style="numbers">
						<t>L_DAT_total[TAIL] := L_DAT_total[TAIL] + 1.</t>
					</list></t>
					<t>Otherwise:
					<list style="numbers">
						<t>L_DAT_lost_packet_intervals := L_DAT_lost_packet_intervals + 1.</t>
					</list></t>
					<t>L_DAT_packet_time := L_DAT_packet_time + L_DAT_hello_interval.</t>
				</list></t>
			</section>

			<section anchor="metric_recalc" title="Metric Update">
				<t>Once every DAT_REFRESH_INTERVAL, all L_in_metric values in all Link Set entries MUST be recalculated:
				<list style="numbers">
					<t>sum_received := sum(L_DAT_received).</t>
					<t>sum_total := sum(L_DAT_total).</t>
					<t>If L_DAT_hello_interval != UNDEFINED and L_DAT_lost_packet_intervals &gt; 0, then:
					<list style="numbers">
						<t>lost_time_proportion := L_DAT_hello_interval * L_DAT_lost_packet_intervals / DAT_MEMORY_LENGTH.</t>
						<t>sum_received := sum_received * MAX ( 0, 1 - lost_time_proportion);</t>
					</list></t>
					<t>If sum_received &lt; 1, then:
					<list style="numbers">
						<t>L_in_metric := MAXIMUM_METRIC, as defined in <xref target="RFC7181"/> section 5.6.1.</t>
					</list></t>
					<t>Otherwise:
					<list style="numbers">
						<t>loss := sum_total / sum_received.</t>

						<t>If loss &gt; DAT_MAXIMUM_LOSS, then:
						<list style="numbers">
							<t>loss := DAT_MAXIMUM_LOSS.</t>
						</list></t>
						
						<t>bitrate := L_DAT_rx_bitrate.</t>
						<t>If bitrate &lt; DAT_MINIMUM_BITRATE, then:
						<list style="numbers">
							<t>bitrate := DAT_MINIMUM_BITRATE.</t>
						</list></t>
						
						<t>L_in_metric := (2^24 / DAT_MAXIMUM_LOSS) * loss / (bitrate / DAT_MINIMUM_BITRATE).</t>
					</list></t>
					
					<t>remove(L_DAT_total)</t>
					<t>add(L_DAT_total, 0)</t>
					
					<t>remove(L_DAT_received)</t>
					<t>add(L_DAT_received, 0)</t>
				</list></t>
			</section>
		</section>
		
		<section title="IANA Considerations">
			<t>This document contains no actions for IANA.</t>
		</section>

		<section anchor="security" title="Security Considerations">
			<t>Artificial manipulation of metrics values can drastically alter network performance. In particular, advertising a higher L_in_metric value may decrease the amount of incoming traffic, while advertising lower L_in_metric may increase the amount of incoming traffic. By artificially increasing or decreasing the L_in_metric values it advertises, a rogue router may thus attract or repulse data traffic. A rogue router may then potentially degrade data throughput by not forwarding data as it should or redirecting traffic into routing loops or bad links.</t>
			<t>An attacker might also inject packets with incorrect packet level sequence numbers, pretending to be somebody else. This attack can be prevented by the true originator of the RFC5444 packets by adding a <xref target="RFC7182"/> ICV Packet TLV and TIMESTAMP Packet TLV to each packet. This allows the receiver to drop all incoming packets which have a forged packet source, both packets generated by the attacker or replayed packets. The signature scheme described in <xref target="RFC7183"/> does not protect the additional sequence number of the DAT metric because it does only sign the RFC5444 messages, not the RFC5444 packet header.</t>
		</section>
		
		<section anchor="acknowledgements" title="Acknowledgements">
			<t>The authors would like to acknowledge the network administrators from <xref target="FREIFUNK">Freifunk Berlin</xref> and <xref target="FUNKFEUER">Funkfeuer Vienna</xref> for endless hours of testing and suggestions to improve the quality of the original ETX metric for the OLSR.org routing daemon.</t>
			<t>This effort/activity is supported by the European Community Framework Program 7 within the Future Internet Research and Experimentation Initiative (FIRE), Community Networks Testbed for the Future Internet (<xref target="CONFINE"/>), contract FP7-288535.</t>
			<t>The authors would like to gratefully acknowledge the following people for intense technical discussions, early reviews and comments on the specification and its components (listed alphabetically):
			Teco Boot (Infinity Networks),
			Juliusz Chroboczek (PPS, University of Paris 7),
			Thomas Clausen,
			Christopher Dearlove (BAE Systems Advanced Technology Centre),
			Ulrich Herberg (Fujitsu Laboratories of America),
			Markus Kittenberger (Funkfeuer Vienna), 
			Joseph Macker (Naval Research Laboratory),
                        Fabian Nack and
			Stan Ratliff (Cisco Systems).
			</t>
		</section>
	</middle>
	<back>
		<references title="Normative References">
			<reference anchor="RFC2119">
				<front>
					<title abbrev="RFC2119">Key words for use in RFCs to Indicate Requirement Levels</title>
					<author initials="S." surname="Bradner" fullname="Scott Bradner">
						<organization abbrev="HU">Harvard University</organization>
					</author>
					<date month="March" year="1997"/>
				</front>
				<seriesInfo name="RFC" value="2119"/>
				<seriesInfo name="BCP" value="14"/>
			</reference>
			<reference anchor="RFC3626">
				<front>
					<title abbrev="RFC3626">Optimized Link State Routing Protocol</title>
					<author initials="T.H." surname="Clausen" fullname="Thomas Heide Clausen">
						<organization abbrev="INRIA">Project Hipercom, INRIA Rocquencourt, France</organization>
					</author>
					<author initials="P." surname="Jacquet" fullname="P. Jacquet">
						<organization abbrev="INRIA">Project Hipercom, INRIA Rocquencourt, France</organization>
					</author>
					<date month="October" year="2003"/>
				</front>
				<seriesInfo name="RFC" value="3626"/>
			</reference>
			<reference anchor="RFC5444">
				<front>
					<title>Generalized Mobile Ad Hoc Network (MANET) Packet/Message Format</title>
					<author initials="T.H." surname="Clausen" fullname="Thomas Heide Clausen">
						<organization abbrev="X">Ecole Polytechnique, France</organization>
					</author>
					<author initials="C." surname="Dearlove" fullname="C. Dearlove">
						<organization>BAE Systems</organization>
					</author>
					<author initials="J." surname="Dean" fullname="J. Dean">
						<organization abbrev="NRL">Naval Research Laboratory</organization>
					</author>
					<author initials="C." surname="Adjih" fullname="C. Adjih">
						<organization abbrev="INRIA">INRIA Rocquencourt</organization>
					</author>
					<date month="February" year="2009"/>
				</front>
				<seriesInfo name="RFC" value="5444"/>
			</reference>
			<reference anchor="RFC5497">
				<front>
					<title>Representing Multi-Value Time in Mobile Ad Hoc Networks (MANETs)</title>
					<author initials="T.H." surname="Clausen" fullname="Thomas Heide Clausen">
						<organization abbrev="X">Ecole Polytechnique, France</organization>
					</author>
					<author initials="C." surname="Dearlove" fullname="C. Dearlove">
						<organization>BAE Systems</organization>
					</author>
					<date month="March" year="2009"/>
				</front>
				<seriesInfo name="RFC" value="5497"/>
			</reference>
			<reference anchor="RFC6130">
				<front>
					<title>Mobile Ad Hoc Network (MANET) Neighborhood Discovery Protocol (NHDP)</title>
					<author initials="T.H." surname="Clausen" fullname="Thomas Heide Clausen">
						<organization abbrev="LIX">Ecole Polytechnique, France</organization>
					</author>
					<author initials="C." surname="Dearlove" fullname="C. Dearlove">
						<organization abbrev="INRIA">BAE Systems</organization>
					</author>
					<author initials="J." surname="Dean" fullname="J. Dean">
						<organization abbrev="NRL">Naval Research Laboratory</organization>
					</author>
					<date month="April" year="2011"/>
				</front>
				<seriesInfo name="RFC" value="6130"/>
			</reference>
			<reference anchor="RFC7181">
				<front>
					<title>The Optimized Link State Routing Protocol version 2</title>
					<author initials="T.H." surname="Clausen" fullname="Thomas Heide Clausen">
						<organization abbrev="X">Ecole Polytechnique, France</organization>
					</author>
					<author initials="P." surname="Jacquet" fullname="P. Jacquet">
						<organization abbrev="INRIA">Project Hipercom, INRIA Rocquencourt, France</organization>
					</author>
					<author initials="C." surname="Dearlove" fullname="C. Dearlove">
						<organization abbrev="INRIA">BAE Systems</organization>
					</author>
					<date month="April" year="2014"/>
				</front>
				<seriesInfo name="RFC" value="7181"/>
			</reference>
			<reference anchor="RFC7182">
				<front>
					<title>Integrity Check Value and Timestamp TLV Definitions for Mobile Ad Hoc Networks (MANETs)</title>
					<author initials="U.H." surname="Ulrich" fullname="Ulrich Herberg">
						<organization abbrev="X">Fujitsu Laboratories of America</organization>
					</author>
					<author initials="T.H." surname="Clausen" fullname="Thomas Heide Clausen">
						<organization abbrev="LIX">Ecole Polytechnique, France</organization>
					</author>
					<author initials="C." surname="Dearlove" fullname="C. Dearlove">
						<organization abbrev="INRIA">BAE Systems</organization>
					</author>
					<date month="April" year="2014"/>
				</front>
				<seriesInfo name="RFC" value="7182"/>
			</reference>
			<reference anchor="RFC7183">
				<front>
					<title>Integrity Protection for the Neighborhood Discovery Protocol (NHDP) and Optimized Link State Routing Protocol Version 2 (OLSRv2)</title>
					<author initials="U.H." surname="Ulrich" fullname="Ulrich Herberg">
						<organization abbrev="X">Fujitsu Laboratories of America</organization>
					</author>
					<author initials="C." surname="Dearlove" fullname="C. Dearlove">
						<organization abbrev="INRIA">BAE Systems</organization>
					</author>
					<author initials="T.H." surname="Clausen" fullname="Thomas Heide Clausen">
						<organization abbrev="LIX">Ecole Polytechnique, France</organization>
					</author>
					<date month="April" year="2014"/>
				</front>
				<seriesInfo name="RFC" value="7183"/>
			</reference>
		</references>
		<references title="Informative References">
			<reference anchor="CONFINE" target="http://www.confine-project.eu">
				<front>
					<title>Community Networks Testbed for the Future Internet (CONFINE)</title>
					<author/>
					<date year="2013"/>
				</front>
			</reference>
			<reference anchor="DLEP">
				<front>
					<title>Dynamic Link Exchange Protocol (DLEP)</title>
					<author initials="S.R." surname="Ratliff" fullname="S. Ratliff">
						<organization abbrev="X">Cisco</organization>
					</author>
					<author initials="B.B." surname="Berry" fullname="Bo Berry">
						<organization abbrev="X">Cisco</organization>
					</author>
					<author initials="G.H." surname="Harrison" fullname="Greg Harrison">
						<organization abbrev="X">Cisco</organization>
					</author>
					<author initials="S.J." surname="Jury" fullname="Shawn Jury">
						<organization abbrev="X">NetApp</organization>
					</author>
					<author initials="D.S." surname="Satterwhite" fullname="Darryl Satterwhite">
						<organization abbrev="X">Broadcom</organization>
					</author>
					<date month="March" year="2013"/>
				</front>
				<seriesInfo name="draft-ietf-manet-dlep-04" value=""/>
			</reference>
			<reference anchor="MOBICOM03">
				<front>
					<title>A High-Throughput Path Metric for Multi-Hop Wireless Routing</title>
					<author initials="D." surname="De Couto" fullname="D. De Couto">
						<organization abbrev=""/>
					</author>
					<author initials="D." surname="Aguayo" fullname="D. Aguayo">
						<organization abbrev=""/>
					</author>
					<author initials="J." surname="Bicket" fullname="J. Bicket">
						<organization abbrev=""/>
					</author>
					<author initials="R." surname="Morris" fullname="R. Morris">
						<organization abbrev=""/>
					</author>
					<date year="2003"/>
				</front>
				<seriesInfo name="Proceedings of the MOBICOM Conference" value=""/>
			</reference>
			<reference anchor="MOBICOM04">
				<front>
					<title>Routing in Multi-Radio, Multi-Hop Wireless Mesh Networks</title>
					  
					<author initials="D." surname="Richard" fullname="Richard Draves">
						<organization abbrev=""/>
					</author>
					<author initials="P." surname="Jitendra" fullname="Jitendra Padhye">
						<organization abbrev=""/>
					</author>
					<author initials="Z." surname="Brian" fullname="Brian Zill">
						<organization abbrev=""/>
					</author>
					<date year="2004"/>
				</front>
				<seriesInfo name="Proceedings of the MOBICOM Conference" value=""/>
			</reference>
			<reference anchor="OLSR.org" target="http://www.olsr.org/">
				<front>
					<title>The OLSR.org OLSR routing daemon</title>
					<author/>
					<date year="2013"/>
				</front>
			</reference>
			<reference anchor="FREIFUNK" target="http://www.freifunk.net">
				<front>
					<title>Freifunk Wireless Community Networks</title>
					<author/>
					<date year="2013"/>
				</front>
			</reference>
			<reference anchor="FUNKFEUER" target="http://www.funkfeuer.at">
				<front>
					<title>Austria Wireless Community Network</title>
					<author/>
					<date year="2013"/>
				</front>
			</reference>
		</references>
		<section anchor="olsrorg_history" title="OLSR.org metric history">
			<t>The Funkfeuer <xref target="FUNKFEUER"/> and Freifunk networks <xref target="FREIFUNK"/> are OLSR-based <xref target="RFC3626"/> or B.A.T.M.A.N. based wireless community networks with hundreds of routers in permanent operation. The Vienna Funkfeuer network in Austria, for instance, consists of 400 routers (around 600 routes) covering the whole city of Vienna and beyond, spanning roughly 40km in diameter. It has been in operation since 2003 and supplies its users with Internet access. A particularity of the Vienna Funkfeuer network is that it manages to provide Internet access through a city wide, large scale Wi-Fi MANET, with just a single Internet uplink.</t>
			<t>Operational experience of the OLSR project <xref target="OLSR.org"/> with these networks have revealed that the use of hop-count as routing metric leads to unsatisfactory network performance. Experiments with the ETX metric <xref target="MOBICOM03"/> were therefore undertaken in parallel in the Berlin Freifunk network as well as in the Vienna Funkfeuer network in 2004, and found satisfactory, i.e., sufficiently easy to implement and providing sufficiently good performance. This metric has now been in operational use in these networks for several years. </t>
			<t>The ETX metric of a link is the estimated number of transmissions required to successfully send a packet (each packet equal to or smaller than MTU) over that link, until a link layer acknowledgement is received. The ETX metric is additive, i.e., the ETX metric of a path is the sum of the ETX metrics for each link on this path.</t>
			<t>While the ETX metric delivers a reasonable performance, it doesn't handle well networks with heterogeneous links that have different bitrates. Since every wireless link, when using ETX metric, is characterized only by its packet loss ratio, the ETX metric prefers long-ranged links with low bitrate (with low loss ratios) over short-ranged links with high bitrate (with higher but reasonable loss ratios). Such conditions, when they occur, can degrade the performance of a network considerably by not taking advantage of higher capacity links.</t>
			<t>Because of this the OLSR.org project has implemented the Directional Airtime Metric for OLSRv2, which has been inspired  by the Estimated Travel Time (ETT) metric <xref target="MOBICOM04"/>. This metric uses an unidirectional packet loss, but also takes the bitrate into account to create a more accurate description of the relative costs or capabilities of OLSRv2 links.</t>
		</section>
		<section anchor="linkspeed_stabilization" title="Linkspeed stabilization">
			<t>The DAT metric describes how to generate a reasonable stable packet loss value from incoming packet reception/loss events, the source of the linkspeed used in this document is considered an external process.</t>
			<t>In the presence of a layer-2 technology with variable linkspeed it is likely that the raw linkspeed will be fluctuating too fast to be useful for the DAT metric.</t>
			<t>The amount of stabilization necessary for the linkspeed depends on the implementation of the mac-layer, especially the rate control algorithm.</t>
			<t>Experiments with the Linux 802.11 wifi stack have shown that a simple Median filter over a series of raw linkspeed measurements can smooth the calculated value without introducing intermediate linkspeed values you would get by using averaging or an exponential weighted moving average.</t>
		</section>
                <section anchor="packetloss_hysteresis" title="Packet loss hysteresis">
                        <t>While the DAT metric use a sliding window to calculate a reasonable stable frame loss, the implementation might choose to integrate an additional hysteresis to prevent the metric flapping between two values.</t>
                        <t>In Section <xref target="metric_recalc"/> DAT caluclates a fractional loss rate. The fraction of ‘loss := sum_total / sum_received’ may result in minor fluctuations in the advertised L_in_metric due to minimal changes in sum_total or sum_received which can cause undesirable protocol churn.</t>
                        <t>A hysteresis function applied to the fraction could reduce the amount of changes in the loss rate and help to stabilize the metric output.</t>
                </section>
                <section anchor="example_metric_values" title="Example DAT values">
                        <t>The DAT metric value can be expressed in terms of link speed (bit/s) or used airtime (s). When using the default protocol constants (see <xref target="constants"/>), DAT encodes link speeds between 119 bit/s and 2 Gbit/s.</t>
                        
                        <t>Table <xref target="link_metric_example"/> contains a few examples for metric values and their meaning as a link speed:</t>
                        
                        <texttable anchor="link_metric_example" title="DAT link cost examples">
                                <ttcol align='center'>Metric</ttcol>
                                <ttcol align='center'>bit/s</ttcol>
                                <c>MINIMUM_METRIC (1)</c>
                                <c>2 Gbit/s</c>
                                <c>MAXIMUM_METRIC (16776960)</c>
                                <c>119 bit/s</c>
                                <c>2000</c>
                                <c>1 Mbit/s</c>
                        </texttable>
                    
                        <t>A path metric value could also be expressed as a link speed, but this would be unintuitive and difficult to understand. An easier way to transform a path metric value into a textual representation is to divide it by the hopcount of the path and express the path cost as average link speed together with the hopcount (see <xref target="path_metric_example"/>).</t>
                        
                        <texttable anchor="path_metric_example" title="DAT link cost examples">
                                <ttcol align='center'>Metric</ttcol>
                                <ttcol align='center'>hops</ttcol>
                                <ttcol align='center'>average bit/s</ttcol>
                                <c>4</c>
                                <c>2</c>
                                <c>1 Gbit/s</c>
                                <c>4000000</c>
                                <c>6</c>
                                <c>3 kbit/s</c>
                        </texttable>
                </section>
	</back>
</rfc>
