|
From: Wang R. <wan...@ue...> - 2009-07-08 06:19:53
|
HI, The answer is in RFC3561. According to "6.1. Maintaining Sequence Numbers", When the destination increments its sequence number, it MUST do so by treating the sequence number value as if it were an UNSIGNED NUMBER. To accomplish SEQUENCE NUMBER ROLLOVER, if the sequence number has already been assigned to be the largest possible number representable as a 32-bit unsigned integer (i.e., 4294967295), then when it is incremented it will then have a value of zero (0). On the other hand, if the sequence number currently has the value 2147483647, which is the largest possible positive integer if 2's complement arithmetic is in use with 32-bit integers, the next value will be 2147483648, which is the most negative possible integer in the same numbering system. The representation of negative numbers is not relevant to the increment of AODV sequence numbers. This is in contrast to the manner in which the result of comparing two AODV sequence numbers is to be treated (see below). In order to ascertain that information about a destination is not stale, the node compares its current numerical value for the sequence number with that obtained from the incoming AODV message. This comparison MUST be done using signed 32-bit arithmetic, this is necessary to accomplish sequence number rollover. If the result of subtracting the currently stored sequence number from the value of the incoming sequence number is less than zero, then the information related to that destination in the AODV message MUST be discarded, since that information is stale compared to the node's currently stored information. When a node's seq number rolls over to 0, its previous seq numbers are negative, when we get a positive number when we subtract a negative number from 0 which do not satisfy "If the result of subtracting the currently stored sequence number from the value of the incoming sequence number is less than zero, then the information related to that destination in the AODV message MUST be discarded.". No extra operations are required. Regards, Wang Rui From: Deepak Gopalakrishnan [mailto:Dee...@Ln...] Sent: 2009-7-7 15:14 To: aod...@li... Subject: [Aodvimpl] Sequence number doubt Hi Im trying to implement AODV algorithm and i have this doubt about sequence number. What happens when there is a roll over in the sequence number? I am not getting a clear idea of how to implement a algorithm according to what is given in the aodv RFC3561. For example, i have allocated a 8bit value for sequence number.. suppose in a intermediate node the sequence number is 254.....but at the destination, the sequence has incremented twice due to some reason....then the present sequence wud be 1... now if we compare the sequence numbers....the fresh packet will be discarded by the intermediate node.... also..if the intermediate node has updated the sequence number to 2(the case after a roll over has occured)...but receives a packet which was created before the roll over...then the node wud accept that node thinking that it has a "fresher" packet.... im totally confused.... Can anyone help me with the algorithm to tackle this roll over problem..... thanks in advance Regards, Deepak Gopalakrishnan |