hi everyone,
i installed ns-2.1b8-mcast on RedHat7, it seems that i installed correctly (i
run one of the ns examples)
then i try to run ADMR protocol, i try the command from README
(http://www.monarch.cs.rice.edu/ftp/multicast/README)
./ns scripts/run.tcl -x 1200 -y 800 -nn 100 -stop 900 -tr TRACES/out.tr -mg
mcast_communication_scenarios/cbr_100_4x64_3x3x20_mcast_ns_rs -sc
movement_scenarios/scen-1200x800-100-0-20-1 -rp admr > & TRACES/sim_stdoutput
after 31 minutes it gives me segmentation fault, but when i look at TRACES
folder, there are two files, (sim_stdoutput, out.tr)
i don't know where is the problem, is it from admr.tcl file? i attache both
run.tcl and admr.tcl,
please help me, i really need it for my dessertation, but no result yet.
# File name: admr.tcl
# Last revision: May 13, 2002
# Created by: Jorjeta G. Jetcheva ([email protected])
# Copyright (c) 2002, 2003 Rice University. All Rights Reserved.
# Permission to use, copy, modify, and distribute this software and
# its documentation is hereby granted (including for commercial or
# for-profit use), provided that both the copyright notice and this
# permission notice appear in all copies of the software, derivative
# works, or modified versions, and any portions thereof, and that both
# notices appear in supporting documentation, and that credit is given
# to Rice University in all publications reporting on direct or indirect
# use of this code or its derivatives.
# ALL CODE, SOFTWARE, PROTOCOLS, AND ARCHITECTURES DEVELOPED BY THE Rice
# MONARCH PROJECT ARE EXPERIMENTAL AND ARE KNOWN TO HAVE BUGS, SOME OF
# WHICH MAY HAVE SERIOUS CONSEQUENCES. RICE PROVIDES THIS SOFTWARE OR
# OTHER INTELLECTUAL PROPERTY IN ITS ``AS IS'' CONDITION, 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 RICE UNIVERSITY 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 OR INTELLECTUAL PROPERTY,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Rice University encourages (but does not require) users of this
# software or intellectual property to return any improvements or
# extensions that they make, and to grant Rice University the rights to
# redistribute these changes without encumbrance.
# ======================================================================
# Default Script Options
# ======================================================================
set opt(rt_port) 255
set mcast_base_addr 0x8000
Agent/RTRAgent set sport_ 254
Agent/RTRAgent set dport_ 254
Agent/RTRAgent set mcast_base_address_ $mcast_base_addr
Agent/UniAgent set sport_ 255
Agent/UniAgent set dport_ 255
Agent/ADMRAgent set sport_ 255
Agent/ADMRAgent set dport_ 255
Agent/ADMRAgent set mcast_base_address_ $mcast_base_addr
Mac/802_11 set mcast_base_address_ $mcast_base_addr
Class McastNode -superclass Node/MobileNode
McastNode instproc init {args} {
global opt ns_ tracefd RouterTrace
$self instvar rtr_agent_ admr_agent_ uni_agent_ dmux_ mcast_dmux_
entry_point_
eval $self next $args ;# parent class constructor
# puts "making dmragent for node [$self id]"
set rtr_agent_ [new Agent/RTRAgent]
$rtr_agent_ ip-addr [$self id]
set uni_agent_ [new Agent/UniAgent]
$uni_agent_ ip-addr [$self id]
set admr_agent_ [new Agent/ADMRAgent]
$admr_agent_ ip-addr [$self id]
if { $RouterTrace == "ON" } {
# Recv Target
set rcvT [cmu-trace Recv "ADM" $self]
$rcvT target $rtr_agent_
set entry_point_ $rcvT
} else {
# Recv Target
set entry_point_ $rtr_agent_
}
#
# Drop Target (always on regardless of other tracing)
#
set drpT [cmu-trace Drop "ADM" $self]
$rtr_agent_ drop-target $drpT
$uni_agent_ drop-target $drpT
$admr_agent_ drop-target $drpT
#
# Log Target
#
set T [new Trace/Generic]
$T target [$ns_ set nullAgent_]
$T attach $tracefd
$T set src_ [$self id]
$rtr_agent_ log-target $T
$uni_agent_ log-target $T
$admr_agent_ log-target $T
# jj: not sure abt mask
set mcast_dmux_ [new Classifier/Addr]
$mcast_dmux_ set mask_ 0xffffffff
$mcast_dmux_ set shift_ 0
$self add-route [$self id] $mcast_dmux_
# ported: this was in MobileNode but they removed it
set dmux_ [new Classifier/Addr]
$dmux_ set mask_ 0xff
$dmux_ set shift_ 0
$self add-route [$self id] $dmux_
$rtr_agent_ target $uni_agent_
$rtr_agent_ mcast_target $admr_agent_
$uni_agent_ target $dmux_
$admr_agent_ target $mcast_dmux_
# packets to the ADMR port should be dropped, since we've
# already handled them in the ADMRAgent at the entry.
set nullAgent_ [$ns_ set nullAgent_]
$dmux_ install $opt(rt_port) $nullAgent_
$mcast_dmux_ install $opt(rt_port) $nullAgent_
# McastNodes don't use the IP addr classifier. The ADMRAgent should
# be the entry point
$self instvar classifier_
set classifier_ "mcastnode made illegal use of classifier_"
}
McastNode instproc start-rtr {} {
$self instvar rtr_agent_ admr_agent_ uni_agent_
global opt;
$rtr_agent_ startrtr
$admr_agent_ startadmr
$uni_agent_ startuni
# if {$opt(cc) == "on"} {checkcache admr_agent_} jj: commented this out
}
McastNode instproc entry {} {
$self instvar entry_point_
return $entry_point_
}
McastNode instproc add-interface {args} {
# args are expected to be of the form
# $chan $prop $tracefd_ $opt(ll) $opt(mac)
global ns_ opt RouterTrace
eval $self next $args
$self instvar admr_agent_ uni_agent_ ll_ mac_ ifq_
$admr_agent_ mac-addr [$mac_(0) id]
$uni_agent_ mac-addr [$mac_(0) id]
if { $RouterTrace == "ON" } {
# Send Target
set sndT_mcast [cmu-trace Send "ADM" $self]
set sndT_unicast [cmu-trace Send "ADM" $self]
$sndT_mcast target $ll_(0)
$sndT_unicast target $ll_(0)
$uni_agent_ add-ll $sndT_unicast $ifq_(0)
$admr_agent_ add-ll $sndT_mcast $ifq_(0)
} else {
# Send Target
$uni_agent_ add-ll $ll_(0) $ifq_(0)
$admr_agent_ add-ll $ll_(0) $ifq_(0)
}
# setup promiscuous tap into mac layer
#$admr_agent_ install-tap $mac_(0)
}
McastNode instproc reset args {
$self instvar admr_agent_ rtr_agent_ uni_agent_
eval $self next $args
$rtr_agent_ reset
$uni_agent_ reset
$admr_agent_ reset
}
# ======================================================================
proc create-mcast-mobile-node { id cid } {
global ns_ topo tracefd opt node_ nifs_
global radio_setup_ channel_ channel_mod_ nodemgr_
set node_($id) [new McastNode]
set node $node_($id)
$node random-motion 0 ;# disable random motion
$node topography $topo
# ============================================================
# connect up the channel
# XXX: need to make a better way of mapping nodes to
# channels/interfaces. - josh
# ============================================================
set nifs_ 0
$node add-interface $channel_(0) \
[new $opt(prop)] \
$opt(ll) \
$opt(mac) \
$opt(ifq) \
$opt(ifqlen) \
$opt(netif) \
$opt(ant) \
$opt(errmodel) $opt(em)
# ============================================================
# Register Node with Node Manager
# ============================================================
# $nodemgr_ register-node $node
#
# This Trace Target is used to log changes in direction
# and velocity for the mobile node and log actions of the ADMR agent
#
set T [new Trace/Generic]
$T target [$ns_ set nullAgent_]
$T attach $tracefd
$T set src_ $id
$node log-target $T
$ns_ at 0.0 "$node start-rtr"
}
#
# Attach an mcast agent to a node. Pick a port and
# bind the agent to the port number.
#
McastNode instproc mcast-attach { agent { port "" } } {
global RouterTrace AgentTrace opt
$self instvar agents_ mcast_dmux_ imep_ ll_
set id_ [$self id]
#
# assign port number (i.e., this agent receives
# traffic addressed to this host and port)
#
# jj: if you want to assign a specific port, the nports thing will
break...
lappend agents_ $agent
if { $port == "" } {
set port [$self alloc-port]
}
$agent set portID_ $port
$agent set node_ $self
$agent set addr_ $id_
$agent set sport_ $port
#
# non-routing agents
#
if { $AgentTrace == "ON" } {
#
# Send Target
#
set sndT [cmu-trace Send AGT $self]
$sndT target [$self entry]
$agent target $sndT
#
# Recv Target
#
set rcvT [cmu-trace Recv AGT $self]
$rcvT target $agent
$mcast_dmux_ install $port $rcvT
} else {
#
# Send Target
#
$agent target [$self entry]
#
# Recv Target
#
$mcast_dmux_ install $port $agent
}
}
#
# Detach an agent from a node.
#
McastNode instproc mcast-detach { agent nullagent } {
$self instvar agents_ mcast_dmux_
#
# remove agent from list
#
set k [lsearch -exact $agents_ $agent]
if { $k >= 0 } {
set agents_ [lreplace $agents_ $k $k]
}
#
# sanity -- clear out any potential linkage
#
$agent set node_ ""
$agent set addr_ 0
$agent target $nullagent
set port [$agent set portID_]
$mcast_dmux_ install $port $nullagent
}
# detach a multicast agent
McastNode instproc mcast-detach-agent { node agent } {
$self instvar nullAgent_
$node detach $agent $nullAgent_
}
# attach a mcast source to a node
McastNode instproc mcast-attach-source {node agent mcast_group_address} {
$self mcast-attach $agent $mcast_group_address
$agent set dst_addr_ $mcast_group_address
$agent set dst_port_ $mcast_group_address
}
#create a mcast connection
McastNode instproc mcast-create-source {s_type source mcast_group_address
pktClass stime} {
$self instvar admr_agent_
global ns_
set s_agent [new Agent/$s_type]
# set app [new Application/Traffic/$s_type]
# $app attach-agent $s_agent
$s_agent set fid_ $pktClass
# $ns_ attach-agent $source $s_agent
$self mcast-attach-source $source $s_agent $mcast_group_address
$ns_ at $stime "$admr_agent_ mcast-src"
return $s_agent
}
# attach a mcast sink to a node
McastNode instproc mcast-attach-sink {node agent mcast_group_address} {
$node mcast-attach $agent $mcast_group_address
}
# create a mcast group sink
McastNode instproc mcast-create-sink {s_type mcast_group_address pktClass} {
set s_agent [new Agent/$s_type] ;# jj make general?
# set app [new Application/Traffic/$s_type]
# $app attach-agent $s_agent
$s_agent set fid_ $pktClass
$self mcast-attach-sink $self $s_agent $mcast_group_address
return $s_agent
}
McastNode instproc mcast-destroy-sink {agent} {
$self mcast-detach $agent [new Agent/Null]
}
McastNode instproc join-group { s_type mcast_group src_addr pktClass } {
$self instvar admr_agent_ sink mac_
# attach an agent for the group here
$admr_agent_ join-group $mcast_group $src_addr
# $admr_agent_ join-group $mcast_group $mcast_group
set sink($mcast_group) [$self mcast-create-sink $s_type $mcast_group
$pktClass]
}
McastNode instproc leave-group {mcast_group source_addr} {
$self instvar admr_agent_ sink mac_
$admr_agent_ leave-group $mcast_group $source_addr
$self mcast-destroy-sink $sink($mcast_group)
}
McastNode instproc scale-power { factor } {
$self instvar netif_
# hack
set iface $netif_(0)
set iface_pt [$iface set Pt_]
set new_pt [expr $iface_pt*$factor]
$iface set Pt_ $new_pt
}