• No results found

Creating an Echo Request

4.4 The Echo Protocol

4.4.5 Creating an Echo Request

struct timespec{

time t tv sec, /* seconds */

long tv nsec /* and nanoseconds */

};

Figure 4.8: The POSIX timeval and timespec structures

should at least present a timeval structure, which has a maximum resolution of one microsecond; more recent systems have a timespec structure with a resolution of one nanosecond. The definitions of the timeval and timespec structures are pre-sented in figure 4.8. Recall that the space reserved for a timestamp in an IPMP path record shown in figure 4.6 is 48 bits. The simplest method of generating an IPMP timestamp in this situation is to use the low-order 16 bits of the tv sec field and the low-order 32 bits of the tv usec or tv nsec field. Third, the node may choose to use some other clock, such as that used to serialise incoming packets. One example of using such a clock is to divide the serialisation clock by 8, in order for the clock’s accuracy to be able to measure delay per-byte, as discussed in section 3.3.4.

4.4.5 Creating an Echo Request

An application running on a source host is responsible for creating and initialis-ing an echo request packet and sendinitialis-ing it to a destination host. The nature of the measurement is set by the source host, and is reflected in how the echo request is constructed. The characteristics that can be controlled are:

• the size of the echo probe;

• which hops on the path may insert path records;

• how routers and middle-boxes should queue the probe;

• and if the packet is a one-way probe or an echo exchange.

Proto

TTL Flow 255 0x00 0x00 0x00

0x00

TTL Flow 255 0x00 0x00 0x00

0x00

#0Path RecordEcho Path RecordPath Record

0 Faux Res.

Type 0x81 6 0x00

Res.Res.Res.

Figure 4.9: Creating an IPMP echo request packet

The source host is required to initialise the space reserved for path records so that intermediate nodes can determine if they should insert a path record. The source host does this by initialising all bytes reserved for path records to zero, except for those that correspond to the TTL field in each path record. In the simplest case where the source host would like to collect path records from all intermediate nodes on the path that support IPMP, it pre-initialises every path record’s TTL field to be the same TTL it sets in the IP header, so that the TTL test will succeed on all IPMP capable intermediate nodes and they will each insert a path record.

Figure 4.9 shows the layout of a complete IPMP echo request probe encapsu-lated in IPv4, alongside an initialised echo request probe. As indicated by the IP length field, this particular probe is 1500 bytes in size; the first 68 bytes and last 4 bytes of this packet are shown. The source host allocates a packet buffer and ini-tialises the source and destination IP addresses, sets the IP TTL field to 255, and sets the IP protocol type to the value assigned to IPMP. The source host also sets the Don’t Fragment (DF) bit in the IP header so that the packet is prevented from being fragmented at any point in the path, as the entire echo probe is required when inserting a path record. So that processing an IPMP echo probe is as simple as possible, particularly on routers which may process IP options out of the fast path, it is recommended that an echo probe does not include any IP options, unless the effect of including IP options is of interest. The IPMP echo header begins imme-diately after the IP header. The version of IPMP described in this thesis is version one. The IPMP type field is set to 0x81, which corresponds to an echo request, according to figure 4.5. The faux IP protocol, faux source port, and faux destination port correspond to an HTTP packet. The IPMP-ID number is 0x3245, which corre-sponds to the low-order 16 bits of the process ID of the application which created the probe. The sequence number is set to zero, as this is the first echo request sent to the particular destination with this IPMP-ID.

In this example, the source host inserts the first path record so it has a convenient record of when the probe was sent. The ‘S’ bit is set, indicating that the path record space has been used. The flow counter field is set to zero as it is the first packet sent from the host. In this example, the host forms an IPMP timestamp from a clock

with nanosecond resolution; the first 16 bits represent the number of seconds since midnight, while the second 32 bits hold the fractional portion of the timestamp. The IP address in the path record is the same as the source address in the IP header.

The rest of the pre-initialised space for path records is initialised to zero, except for the TTL fields, which are set to 255 so that all intermediate nodes will insert a path record if they can. Finally, the path record pointer is set to 24, which corre-sponds to the offset of the first byte of the second path record from the first byte of the IPMP header.