puts " Interface $ifc at $node links to $peer"
if { [nodeType $peer] == "rj45" } {
-# TODO: RJ-45 nodes zasad ne podrzavamo
-# set peerifc [getNodeName $peer]
-# set ether [nexec ifconfig $peerifc | fgrep "ether " | cut -c8-]
+ # TODO: RJ45 nodes zasad ne podrzavamo
+ set peerifc [getNodeName $peer]
+ #set ether [nexec ifconfig $peerifc | grep "HWaddr " | cut -c8-]
+ set ether [nexec ifconfig $peerifc | grep $peerifc | awk {{print $5}}]
+ puts " Za RJ45 interface -> MAC(eth0) = $ether"
} else {
# vzctl ne prima ako nije properly padded
set ether 40:00:aa:aa:[format %02x $mac_byte4]:[format %02x $mac_byte5]
nexec brctl addbr $bridge
}
+ #TODO ovo bas ne radi, ne moze komunicirati sa fizickim interface-om, iako je
+ #uredno pridruzen bridge interface-u
+ #
+ #RJ45 se ponasa kao L2 device, tj. hub, samo u njega treba odmah joinati
+ #odgovarajuci fizicki interface koji je rucno upisan u gui
+
+ if { [nodeType $bridge] == "rj45" } {
+ nexec brctl addif $bridge [getNodeName $bridge]
+ puts " RJ45 emulacija, spojen na [getNodeName $bridge] na hostu."
+ }
+
#dodaje interface
nexec brctl addif $bridge $port_if
#dize bridge, interesantno ne baca error ako je bridge vec dignut
--- /dev/null
+#
+# Copyright 2005-2008 University of Zagreb, Croatia.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# This work was supported in part by Croatian Ministry of Science
+# and Technology through the research contract #IP-2003-143.
+#
+
+# $Id: rj45.tcl,v 1.13 2008/01/28 19:03:34 marko Exp $
+
+
+#****h* imunes/rj45.tcl
+# NAME
+# rj45.tcl -- defines rj45 specific procedures
+# FUNCTION
+# This module is used to define all the rj45 specific procedures.
+# NOTES
+# Procedures in this module start with the keyword rj45 and
+# end with function specific part that is the same for all the
+# node types that work on the same layer.
+#****
+
+set MODULE rj45
+
+#****f* rj45.tcl/rj45.layer
+# NAME
+# rj45.layer
+# SYNOPSIS
+# set layer [rj45.layer]
+# FUNCTION
+# Returns the layer on which the rj45 operates
+# i.e. returns LINK.
+# RESULT
+# * layer -- set to LINK
+#****
+
+proc $MODULE.layer {} {
+ return LINK
+}
+
+#****f* rj45.tcl/rj45.instantiate
+# NAME
+# rj45.instantiate
+# SYNOPSIS
+# rj45.instantiate $eid $node_id
+# FUNCTION
+# Procedure rj45.instantiate puts real interface
+# into promiscues mode.
+# INPUTS
+# * eid - experiment id
+# * node_id - id of the node (type of the node is rj45)
+#****
+
+proc $MODULE.instantiate { eid node } {
+ upvar 0 ::cf::[set ::curcfg]::ngnodemap ngnodemap
+
+ set ifname [getNodeName $node]
+ set ngnodemap($ifname) $ifname
+ # nexec vimage -i $eid $ifname $ifname
+ # nexec vimage $eid ifconfig $ifname up promisc
+}
+
+
+#****f* rj45.tcl/rj45.start
+# NAME
+# rj45.start
+# SYNOPSIS
+# rj45.start $eid $node_id
+# FUNCTION
+# Starts a new rj45. Since rj45 has no starting code,
+# this procedure does nothing.
+# INPUTS
+# * eid - experiment id
+# * node_id - id of the node (type of the node is rj45)
+#****
+proc $MODULE.start { eid node } {
+}
+
+
+#****f* rj45.tcl/rj45.shutdown
+# NAME
+# rj45.shutdown
+# SYNOPSIS
+# rj45.shutdown $eid $node_id
+# FUNCTION
+# Shutdowns a rj45. Since rj45 has no shutdown code,
+# this procedure does nothing.
+# INPUTS
+# * eid - experiment id
+# * node_id - id of the node (type of the node is rj45)
+#****
+proc $MODULE.shutdown { eid node } {
+}
+
+
+#****f* rj45.tcl/rj45.destroy
+# NAME
+# rj45.destroy
+# SYNOPSIS
+# rj45.destroy $eid $node_id
+# FUNCTION
+# Destroys a rj45 emulation interface.
+# INPUTS
+# * eid - experiment id
+# * node_id - id of the node (type of the node is rj45)
+#****
+proc $MODULE.destroy { eid node } {
+ set ifname [getNodeName $node]
+ # nexec ifconfig $ifname up -promisc
+}
+
+#****f* rj45.tcl/rj45.nghook
+# NAME
+# rj45.nghook
+# SYNOPSIS
+# rj45.nghook $eid $node_id $ifc
+# FUNCTION
+# Returns the id of the netgraph node and the netgraph
+# hook name. In this case netgraph node name correspondes
+# to the name of the physical interface.
+# INPUTS
+# * eid - experiment id
+# * node_id - node id
+# * ifc - interface name
+# RESULT
+# * nghook - the list containing netgraph node name and
+# the netraph hook name (in this case: lower).
+#****
+
+proc $MODULE.nghook { eid node ifc } {
+ set nodename [getNodeName $node]
+ return [list $nodename lower]
+}
+