From: marko Date: Wed, 7 Sep 2005 15:36:39 +0000 (+0000) Subject: Correctly handle autogeneration of MAC addresses for up to 100000 X-Git-Url: https://git.entuzijast.net/?a=commitdiff_plain;h=2639a9b03112829d8c671a600c495729314b71ce;p=imunes.git Correctly handle autogeneration of MAC addresses for up to 100000 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: --- diff --git a/exec.tcl b/exec.tcl index 511c6bd..0a47116 100755 --- 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]