PUD: add forgotten check for deduplication use in downlink path
authorFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 6 Mar 2012 12:34:05 +0000 (13:34 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 6 Mar 2012 13:17:15 +0000 (14:17 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/pud/src/pud.c

index 63c5c34..55a2fda 100644 (file)
@@ -184,6 +184,7 @@ static void packetReceivedFromDownlink(int skfd, void *data __attribute__ ((unus
                ssize_t rxIndex = 0;
                struct sockaddr sender;
                socklen_t senderSize = sizeof(sender);
+               bool addedToDedup = false;
 
                /* Receive the captured Ethernet frame */
                memset(&sender, 0, senderSize);
@@ -254,7 +255,12 @@ static void packetReceivedFromDownlink(int skfd, void *data __attribute__ ((unus
                        /* we now have a position update (olsrMessage) of a certain length
                         * (length). this needs to be transmitted over OLSR and on the LAN */
 
-                       if (!isInDeDupList(&deDupList, olsrMessage)) {
+                       if (likely(getUseDeDup()) && !isInDeDupList(&deDupList, olsrMessage)) {
+                               addToDeDup(&deDupList, olsrMessage);
+                               addedToDedup = true;
+                       }
+
+                       if (likely(addedToDedup) || unlikely(!getUseDeDup())) {
                                /* send out over OLSR interfaces */
                                int r;
                                struct interface *ifn;