[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] DSDV possible code bug and my fix



I recently found a possible problem in DSDV code from ns-2.1b7 and daily
snapshot,  which may leads to infinite loop on handling packets. The bug
lies when an agent attempts to update its own cache from neighbor agent's
periodic update(DSDV_Agent::processUpdate). The algorithm attempts to send
out all queued packets which originally had no route to destination and now
has.  However, it seems it does so even the neighbor has a older sequence
number info and therefore should be safely ignored. This is so bad because
the code will wait till the queue is cleaned, and while bad routed packets
will finally back into same queue, this is never done. ASSERT on line 166
may possibly fail as well.

a possible patch looks like this
==============================================
--- dsdv/dsdv.cc.old   Thu Feb  1 17:50:16  2001
+++ dsdv/dsdv.cc       Thu Feb  1 17:50:36  2001
@@ -787,2 +787,5 @@
       // see if we can send off any packets we've got queued
+      prte = table_->GetEntry (rte.dst);
+      assert(prte);
+      bcopy(prte, &rte, sizeof(rte));
       if (rte.q && rte.metric != BIG)
==============================================

Please verify and correct me on any mistakes.

Yi-an Huang
North Carolina State University