Obamp Data Message Sequence Numbers are now checked how described in Chapter
authorSaverio Proto <zioproto@gmail.com>
Tue, 10 Nov 2009 16:45:38 +0000 (17:45 +0100)
committerHenning Rogge <hrogge@googlemail.com>
Mon, 16 Nov 2009 17:55:02 +0000 (18:55 +0100)
19 of RFC rfc3626, so wrap around is handled ok, and no messages are discarded
when overflow of the counter occurs

lib/obamp/src/obamp.c

index c7b0fbf..0b6138f 100644 (file)
@@ -779,16 +779,22 @@ CheckDupData(char *buffer)
 
       if (memcmp(&tmp->neighbor_ip_addr.v4, &data_msg->router_id, sizeof(struct in_addr)) == 0) {
 
-
+       OLSR_DEBUG(LOG_PLUGINS, "Processing Data Packet %d - Last seen was %d",data_msg->SequenceNumber, tmp->DataSeqNumber);
+       
         if (tmp->DataSeqNumber == 0) {  //First packet received from this host
           tmp->DataSeqNumber = data_msg->SequenceNumber;
           return 1;
         }
-        if (data_msg->SequenceNumber < tmp->DataSeqNumber) {
 
+       if ( ((data_msg->SequenceNumber > tmp->DataSeqNumber) && ((data_msg->SequenceNumber - tmp->DataSeqNumber ) <= 127)) || ((tmp->DataSeqNumber > data_msg->SequenceNumber) && ((tmp->DataSeqNumber - data_msg->SequenceNumber) > 127 ))) //data_msg->SequenceNumber > tmp->DataSeqNumber
+       {
+       tmp->DataSeqNumber = data_msg->SequenceNumber;
+       return 1;
+       }
+       else{
           OLSR_DEBUG(LOG_PLUGINS, "DISCARDING DUP PACKET");
           return 0;
-        }
+       }
       }
     }
   }