Sequence numbers

Sequence numbers are used to determine the freshness of messages. At startup, the initial sequence numbers to use in message generation are initialized with random values.

The packet format used in OLSR limits the sequence numbers to a 16 bit value. This leads to the occurrence of wrap-around6.3 of sequence numbers. To prevent any problems concerning wrap-around, the RFC proposes the use of the following statement to decide if the 16 bit value S1 represents more recent information than S2. MAXVALUE is the largest possible value of the sequence number.

((S1 > S2) AND (S1 - S2 <= MAXVALUE/2)) OR ((S2 > S1) AND (S2 - S1 > MAXVALUE/2))

Thus, when comparing two messages, it is possible, even in the presence of wrap-around, to determine which message contains the most recent information. This check is available through the macro SEQNO_GREATER_THAN(s1, s2) defined in src/olsr_protocol.h.



Andreas 2004-07-29