]> git.entuzijast.net Git - imunes.git/commitdiff
Correctly handle autogeneration of MAC addresses for up to 100000
authormarko <marko>
Wed, 7 Sep 2005 15:36:39 +0000 (15:36 +0000)
committermarko <marko>
Wed, 7 Sep 2005 15:36:39 +0000 (15:36 +0000)
interfaces.  We had a bug where we would generate bogus MAC addresses
after 99-th interface would be instantiated.

Bug found by: Dario Vierra
Submitted by:
Requested by:
Reviewed by:
Approved by:
Obtained from:

exec.tcl

index 511c6bd7cb2c3980184257f28f770ea4ed651712..0a47116156b02ca59185e50cb4642c8f17928508 100755 (executable)
--- a/exec.tcl
+++ b/exec.tcl
@@ -124,7 +124,7 @@ proc createIfc {type hook} {
 
 
 proc l3node.instantiate { eid node } {
-    global mac_byte5
+    global mac_byte4 mac_byte5
     set node_id "$eid\_$node"
     nexec vimage -c $node_id
     nexec vimage $node_id hostname [getNodeName $node]
@@ -135,8 +135,12 @@ proc l3node.instantiate { eid node } {
                set ifid [createIfc eiface ether]
                nexec vimage -i $node_id $ifid $ifc
                nexec vimage $node_id ifconfig $ifc
-               set ether 40:00:aa:aa:00:$mac_byte5
+               set ether 40:00:aa:aa:$mac_byte4:$mac_byte5
                incr mac_byte5
+               if { $mac_byte5 >= 100 } {
+                   set mac_byte5 0
+                   incr mac_byte4
+               }
                nexec vimage $node_id ifconfig $ifc link $ether
            }
            ser {
@@ -189,8 +193,9 @@ proc l3node.nghook { eid node ifc } {
 proc deployCfg {} {
     global eid
     global nodes links supp_router_models
-    global mac_byte5
+    global mac_byte4 mac_byte5
 
+    set mac_byte4 0
     set mac_byte5 0
 
     set t_start [clock seconds]
@@ -210,7 +215,6 @@ proc deployCfg {} {
        [typemodel $node].instantiate $eid $node
     }
 
-    set mac 0
     foreach link $links {
        statline "Creating link $link"
        set lnode1 [lindex [linkPeers $link] 0]