From: marko Date: Mon, 7 May 2007 23:09:07 +0000 (+0000) Subject: Refactor node instatiation procedures for hub and lanswitch nodes X-Git-Url: https://git.entuzijast.net/?a=commitdiff_plain;h=52c3413341626d7b37a7d36ad4ec4e0001df4bdc;p=imunes.git Refactor node instatiation procedures for hub and lanswitch nodes to reflect recent changes in exec.tcl, as well as kernel-level differences between 4.11 and 7.0 netgraph virtualization model. Bug found by: Submitted by: Requested by: Reviewed by: Approved by: Obtained from: --- diff --git a/hub.tcl b/hub.tcl index e58ab37..584c802 100755 --- a/hub.tcl +++ b/hub.tcl @@ -1,4 +1,4 @@ -# $Id: hub.tcl,v 1.10 2007/05/07 08:43:20 ana Exp $ +# $Id: hub.tcl,v 1.11 2007/05/07 23:09:07 marko Exp $ # # Copyright 2005 University of Zagreb, Croatia. All rights reserved. # @@ -78,13 +78,13 @@ proc $MODULE.layer {} { #**** proc $MODULE.instantiate { eid node } { - catch {nexec ngctl mkpeer hub anchor anchor | tail -1} resp - foreach elem [split [lindex [split $resp "\{\}"] 1]] { - if {[string equal -length 5 $elem "id=0x"]} { - set id [string range $elem 5 end] - catch {nexec ngctl name \[$id\]: "$eid\_$node"} - } - } + global ngnodemap + + catch {exec ngctl mkpeer hub anchor anchor | tail -1} resp + catch {exec ngctl l | fgrep " Name: " | cut -c51-58 | xargs echo } nglist + set id [lindex $nglist 1] + catch {exec ngctl name \[$id\]: $eid\_$node} + set ngnodemap($eid\_$node) $eid\_$node } #****f* hub.tcl/hub.start diff --git a/lanswitch.tcl b/lanswitch.tcl index 4eed885..e879f0a 100755 --- a/lanswitch.tcl +++ b/lanswitch.tcl @@ -1,4 +1,4 @@ -# $Id: lanswitch.tcl,v 1.10 2007/05/07 08:43:20 ana Exp $ +# $Id: lanswitch.tcl,v 1.11 2007/05/07 23:09:07 marko Exp $ # # Copyright 2005 University of Zagreb, Croatia. All rights reserved. # @@ -78,13 +78,13 @@ proc $MODULE.layer {} { #**** proc $MODULE.instantiate { eid node } { - catch {nexec ngctl mkpeer bridge anchor anchor | tail -1} resp - foreach elem [split [lindex [split $resp "\{\}"] 1]] { - if {[string equal -length 5 $elem "id=0x"]} { - set id [string range $elem 5 end] - catch {nexec ngctl name \[$id\]: "$eid\_$node"} - } - } + global ngnodemap + + catch {exec ngctl mkpeer bridge anchor anchor | tail -1} resp + catch {exec ngctl l | fgrep " Name: " | cut -c51-58 | xargs echo } nglist + set id [lindex $nglist 1] + catch {exec ngctl name \[$id\]: $eid\_$node} + set ngnodemap($eid\_$node) $eid\_$node }