mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
aodvv2: fix check for redundant RREQ
This commit is contained in:
parent
86d44970c7
commit
02efbadc48
@ -117,7 +117,7 @@ bool rreqtable_is_redundant(struct aodvv2_packet_data *packet_data)
|
||||
{
|
||||
struct aodvv2_rreq_entry *comparable_rreq;
|
||||
timex_t now;
|
||||
bool result;
|
||||
bool result = false;
|
||||
|
||||
mutex_lock(&rreqt_mutex);
|
||||
comparable_rreq = _get_comparable_rreq(packet_data);
|
||||
@ -125,7 +125,6 @@ bool rreqtable_is_redundant(struct aodvv2_packet_data *packet_data)
|
||||
/* if there is no comparable rreq stored, add one and return false */
|
||||
if (comparable_rreq == NULL) {
|
||||
_add_rreq(packet_data);
|
||||
result = false;
|
||||
}
|
||||
else {
|
||||
int seqnum_comparison = seqnum_cmp(packet_data->origNode.seqnum, comparable_rreq->seqnum);
|
||||
@ -140,8 +139,9 @@ bool rreqtable_is_redundant(struct aodvv2_packet_data *packet_data)
|
||||
}
|
||||
|
||||
if (seqnum_comparison == 1) {
|
||||
/* Update RREQ table entry with new seqnum value */
|
||||
/* Update RREQ table entry with new seqnum and metric value */
|
||||
comparable_rreq->seqnum = packet_data->origNode.seqnum;
|
||||
comparable_rreq->metric = packet_data->origNode.metric;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -159,7 +159,6 @@ bool rreqtable_is_redundant(struct aodvv2_packet_data *packet_data)
|
||||
/* Since we've changed RREQ info, update the timestamp */
|
||||
vtimer_now(&now);
|
||||
comparable_rreq->timestamp = now;
|
||||
result = true;
|
||||
}
|
||||
|
||||
mutex_unlock(&rreqt_mutex);
|
||||
|
@ -91,6 +91,7 @@ void rreqtable_init(void);
|
||||
* Check if a RREQ is redundant, i.e. was received from another node already.
|
||||
* Behaves as described in Sections 5.7. and 7.6.
|
||||
* @param packet_data data of the RREQ in question
|
||||
* @return true if packet_data is redundant, false otherwise.
|
||||
*/
|
||||
bool rreqtable_is_redundant(struct aodvv2_packet_data *packet_data);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user