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

DV and dynamic routing patch for ns-2.1b3-current




This is a patch for for some bugs I ran across in the DV and dynamic
routing code. One set of patches (first and third) fixes some of
the places where nextHop_ is assumed to contain only one node.
The second patch fixes a syntax error in the argument
parsing for dynamic routing. The fourth patch fixes an incorrect
use of "set" in the DV routing code.

Kevin


diff -u -r ns-2.1b3-current.original/tcl/lib/ns-route.tcl ns-2.1b3-current/tcl/lib/ns-route.tcl
--- ns-2.1b3-current.original/tcl/lib/ns-route.tcl      Mon Oct 20 17:54:20 1997
+++ ns-2.1b3-current/tcl/lib/ns-route.tcl       Fri Mar 13 12:35:09 1998
@@ -79,8 +79,11 @@
                        if { $i != $j } {
                                # shortened nexthop to nh, to fit add-route in
                                # a single line
-                               set nh [$r lookup $i $j]
-                               if { $nh >= 0 } {
+                               set nh_list [$r lookup $i $j]
+                               foreach nh $nh_list {
+                                       if { $nh < 0 } {
+                                               continue
+                                       }
                                        $n1 add-route $j [$link_($i:$nh) head]
                                }
                        } 
diff -u -r ns-2.1b3-current.original/tcl/rtglib/dynamics.tcl ns-2.1b3-current/tcl/rtglib/dynamics.tcl
--- ns-2.1b3-current.original/tcl/rtglib/dynamics.tcl   Tue Dec 30 17:25:36 1997
+++ ns-2.1b3-current/tcl/rtglib/dynamics.tcl    Fri Mar 13 12:31:36 1998
@@ -205,7 +205,7 @@
            set off [lindex $args 0]
            set up  [lindex $args 1]
            set dn  [lindex $args 2]
-           set fin [lindes $args 3]
+           set fin [lindex $args 3]
        }
        3 {
            set off [lindex $args 0]
diff -u -r ns-2.1b3-current.original/tcl/rtglib/route-proto.tcl ns-2.1b3-current/tcl/rtglib/route-proto.tcl
--- ns-2.1b3-current.original/tcl/rtglib/route-proto.tcl        Fri Jan 23 11:30
:52 1998
+++ ns-2.1b3-current/tcl/rtglib/route-proto.tcl Fri Mar 13 12:31:01 1998
@@ -91,7 +91,11 @@
     if {![info exists nextHop_($dest)] || $nextHop_($dest) == ""} {
        return -1
     } else {
-       return [[$nextHop_($dest) set toNode_] id]
+       set id_list {}
+       foreach node $nextHop_($dest) {
+           lappend id_list [[$node set toNode_] id]
+       }
+       return $id_list
     }
 }
 
@@ -433,7 +437,7 @@
     if { [llength $args] == 0 } {
        set nodeslist [[Simulator instance] all-nodes-list]
     } else {
-       eval "set nodeslist $args"
+       set nodeslist $args
     }
     Agent set-maxttl Agent/rtProto/DV INFINITY
     eval rtObject init-all $nodeslist