Skip to content

Instantly share code, notes, and snippets.

@avarga
Last active August 29, 2015 14:14
Show Gist options
  • Save avarga/12f0fa841bfafdbcdcaf to your computer and use it in GitHub Desktop.
Save avarga/12f0fa841bfafdbcdcaf to your computer and use it in GitHub Desktop.
From 91a488b9d6d91acf482fa5c392ebeafa12615512 Mon Sep 17 00:00:00 2001
From: Quentin VEY <vey@recherche.enac.fr>
Date: Wed, 19 Nov 2014 14:38:47 +0100
Subject: [PATCH] Fixes multiple sending of the same packet.
SOME EDITING!!!
---
.../manetrouting/aodv-uu/aodv-uu/aodv_timeout.cc | 27 +++++++++++++++-----
1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/src/networklayer/manetrouting/aodv-uu/aodv-uu/aodv_timeout.cc b/src/networklayer/manetrouting/aodv-uu/aodv-uu/aodv_timeout.cc
index 8a97171..17c449c 100644
--- a/src/networklayer/manetrouting/aodv-uu/aodv-uu/aodv_timeout.cc
+++ b/src/networklayer/manetrouting/aodv-uu/aodv-uu/aodv_timeout.cc
@@ -200,15 +200,28 @@ void NS_CLASS local_repair_timeout(void *arg)
}
else
{
- int i;
-
- for (i = 0; i < MAX_NR_INTERFACES; i++)
+ int nbInterfaces = getNumInterfaces();
+ if ( nbInterfaces )
{
- if (!DEV_NR(i).enabled)
- continue;
- aodv_socket_send((AODV_msg *) rerr, rerr_dest,
- RERR_CALC_SIZE(rerr), 1, &DEV_NR(i));
+ int i;
+ for (i = 0; i < MAX_NR_INTERFACES; i++)
+ {
+ if (!DEV_NR(i).enabled)
+ continue;
+ if (nbInterfaces > 1)
+ {
+ aodv_socket_send((AODV_msg *) rerr->dup(), rerr_dest,
+ RERR_CALC_SIZE(rerr), 1, &DEV_NR(i));
+ nbInterfaces--;
+ }
+ else
+ {
+ aodv_socket_send((AODV_msg *) rerr, rerr_dest,
+ RERR_CALC_SIZE(rerr), 1, &DEV_NR(i));
+ }
+ }
}
+ else delete rerr;
}
DEBUG(LOG_DEBUG, 0, "Sending RERR about %s to %s",
ip_to_str(rt->dest_addr), ip_to_str(rerr_dest));
--
1.7.10.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment