Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i have installed ns 2.33 and added the patch mobiwan for supprting mobile ipv6. when i tried to run my tcl script , i got segmentation fault, can anybody just why we get segmentation fault when we run tcl
[code]
manju@manju-desktop:~/Desktop$ ns mytcl.tcl
num_nodes is set 7
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl (except for MobiWAN simulations)
INITIALIZE THE LIST xListHead
################################################################
# End of Simulation
################################################################
proc finish { } {
global tracef ns namf opt mobile_ cn_
puts "Simulation finished"
# Dump the Binding Update List of MN and Binding Cache of HA
[[$mobile_ set ha_] set regagent_] dump
[$cn_ set regagent_] dump
[$mobile_ set regagent_] dump
$ns flush-trace
flush $tracef
close $tracef
close $namf
#puts "running nam with $opt(namfile) ... "
#exec nam $opt(namfile) &
exit 0
}
################################################################
# Main
################################################################
proc main { } {
global opt ns TOPOM namf n tracef mobile_ cn_
# Source Files
# source set-def-options.tcl
# set BASEDIR to your own correct path
source ~/fz/ns-allinone-2.33/ns-2.33/tcl/lib/proc-mipv6-config.tcl
source ~/fz/ns-allinone-2.33/ns-2.33/tcl/lib/proc-tools.tcl
source ~/fz/ns-allinone-2.33/ns-2.33/tcl/lib/proc-topo.tcl
source ~/fz/ns-allinone-2.33/ns-2.33/tcl/lib/ns-topoman.tcl
source ~/fz/ns-allinone-2.33/ns-2.33/tcl/lib/proc-mobi-global.tcl
source ~/fz/ns-allinone-2.33/ns-2.33/tcl/lib/proc-mobi-config.tcl
source ~/fz/ns-allinone-2.33/ns-2.33/tcl/mobility/timer.tcl
set NAMF out.nam
set TRACEF out.tr
set INFOF out.info
set opt(mactrace) ON
set opt(NAM) 1
set opt(namfile) $NAMF
set opt(stop) 100
set opt(tracefile) $TRACEF
#>--------------- Extract options from command line ---------------<
#Getopt ; # Get option from the command line
#DisplayCommandLine
#>---------------------- Simulator Settings ----------------------<
set ns [new Simulator]
#>------------------------ Open trace files ----------------------<
exec rm -f $opt(tracefile)
set tracef [open $opt(tracefile) w]
#... dump the file
$ns trace-all $tracef
set namf [open $opt(namfile) w]
$ns namtrace-all $namf
#>------------- Protocol and Topology Settings -------------------<
create-my-topo
log-mn-movement_no_topo
set src [new Application/Traffic/CBR]
$src set packetSize_ 1000
$src set rate_ 100k
$src set interval_ 0.05
$src attach-agent $udp
$ns at 20.0 "$src start"
this is the tcl file i tried to run. problem is when i run nam , it starts and then suddenly stops giving segmentation fault ,
Code:
# FIRST SCENARIO WITHOUT BUFFER
# Basic Mobile IPv6 example without using ns-topoman
# Needs proc defined in file proc-mipv6-config.tcl
Agent/MIPv6/MN set bs_forwarding_ 0 ; # 1 if forwarding from previous BS
################################################################
proc log-mn-movement_no_topo { } {
global logtimer ns
Class LogTimer -superclass Timer
LogTimer instproc timeout {} {
global mobile_
$mobile_ log-movement
$self sched 1
}
set logtimer [new LogTimer]
$logtimer sched 1
}
################################################################
# Create Topology
################################################################
proc create-my-topo {} {
global ns opt topo mobile_ cn_ mnn_nodes_
# Create and define topography
set topo [new Topography]
# set prop [new $opt(prop)]
# $prop topography $topo
$topo load_flatgrid 800 800
# god is a necessary object when wireless is used
# set to a value equal to the number of mobile nodes
create-god 5
# Call node-config
$ns node-config \
-addressType hierarchical \
-agentTrace On \
-routerTrace Off\
# Set NS Addressing
AddrParams set domain_num_ 2
AddrParams set cluster_num_ {1 3}
AddrParams set nodes_num_ {1 1 2 1}
# Create Nodes
set cn_ [create-router 0.0.0]
set router_ [create-router 1.0.0]
set bs1_ [create-base-station 1.1.0 1.0.0 100 100 0]
set bs2_ [create-base-station 1.2.0 1.0.0 100 550 0]
set mobile_ [create-mobile 1.1.1 1.1.0 230 100 0 0 0.01]
# Create Links
$ns simplex-link $cn_ $router_ 10Mb 2.0ms DropTail
$ns duplex-link $router_ $bs1_ 10Mb 2.0ms DropTail
$ns duplex-link $router_ $bs2_ 10Mb 2.0ms DropTail
display_ns_addr_domain
}
################################################################
# End of Simulation
################################################################
proc finish { } {
global tracef ns namf opt mobile_ cn_
puts "Simulation finished"
# Dump the Binding Update List of MN and Binding Cache of HA
[[$mobile_ set ha_] set regagent_] dump
[$cn_ set regagent_] dump
[$mobile_ set regagent_] dump
$ns flush-trace
flush $tracef
close $tracef
close $namf
puts "running nam with $opt(namfile) ... "
#exec nam $opt(namfile) &
exit 0
}
################################################################
# Main
################################################################
proc main { } {
global opt ns TOPOM namf n tracef mobile_ cn_
# Source Files
# source set-def-options.tcl
# set home/salim to your own correct path
#source /home/manju/Desktop//ns-allinone-2.33/ns-2.33/tcl/lib/proc-mipv6-config.tcl
# source /home/manju/Desktop//ns-allinone-2.33/ns-2.33/tcl/lib/proc-tools.tcl
# source /home/manju/Desktop//ns-allinone-2.33/ns-2.33/tcl/lib/proc-topo.tcl
# source /home/manju/Desktop//ns-allinone-2.33/ns-2.33/tcl/lib/ns-topoman.tcl
# source /home/manju/Desktop//ns-allinone-2.33/ns-2.33/tcl/lib/proc-mobi-global.tcl
# source /home/manju/Desktop//ns-allinone-2.33/ns-2.33/tcl/lib/proc-mobi-config.tcl
# source /home/manju/Desktop//ns-allinone-2.33/ns-2.33/tcl/mobility/timer.tcl
source /home/manju/Desktop//ns-allinone-2.33/ns-2.33/tcl/lib/proc-mipv6-config.tcl
source /home/manju/Desktop//ns-allinone-2.33/ns-2.33/tcl/lib/proc-tools.tcl
source /home/manju/Desktop//ns-allinone-2.33/ns-2.33/tcl/lib/proc-topo.tcl
source /home/manju/Desktop//ns-allinone-2.33/ns-2.33/tcl/lib/ns-topoman.tcl
source /home/manju/Desktop//ns-allinone-2.33/ns-2.33/tcl/lib/proc-mobi-global.tcl
source /home/manju/Desktop//ns-allinone-2.33/ns-2.33/tcl/lib/proc-mobi-config.tcl
source /home/manju/Desktop//ns-allinone-2.33/ns-2.33/tcl/mobility/timer.tcl
set NAMF out.nam
set TRACEF out.tr
set INFOF out.info
set opt(mactrace) ON
set opt(NAM) 1
set opt(namfile) $NAMF
set opt(stop) 100
set opt(tracefile) $TRACEF
#>--------------- Extract options from command line ---------------<
#Getopt
; # Get option from the command line
#DisplayCommandLine
#>---------------------- Simulator Settings ----------------------<
set ns [new Simulator]
#>------------------------ Open trace files ----------------------<
exec rm -f $opt(tracefile)
set tracef [open $opt(tracefile) w]
#... dump the file
#set new trace file for wireless
$ns use-newtrace
$ns trace-all $tracef
set namf [open $opt(namfile) w]
$ns namtrace-all $namf
#>------------- Protocol and Topology Settings -------------------<
create-my-topo
log-mn-movement_no_topo
#############
set-cbr
# set-ping-int 0.1 $cn_ $mobile_ 10 $opt(stop)
#start movement to pos(x,y) with velocity v
#$ns at 10.0 "$mobile_ setdest 700 400 10"
#MN move again to BS2#####
$ns at 2.0 "$mobile_ setdest 230 500 10"
#>----------------------- Run Simulation -------------------------<
$ns at $opt(stop) "finish"
$ns run
$ns dump-topology $namf
close $namf
puts "running nam with $opt(namfile) ... "
exec nam $opt(namfile) &
}
proc set-cbr { } {
global ns cn_ mobile_
set udp [new Agent/UDP]
$ns attach-agent $cn_ $udp
set dst [new Agent/Null]
$ns attach-agent $mobile_ $dst
$ns connect $udp $dst
set src [new Application/Traffic/CBR]
$src set packetSize_ 160
$src set rate_ 64k
$src set interval_ 0.05
$src attach-agent $udp
$ns at 10.0 "$src start"
$ns at 15.0 "$src stop"
}
main
this is what i got when tried to run nam
Code:
manju@manju-desktop:~/Desktop$ nam out.nam
Segmentation fault
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511
Rep:
Post #4 manjunath11 : I edited the code to my path, and the output is
Code:
[knudfl@localhost ns-2.33]$ ./ns _mob.tcl.txt
num_nodes is set 5
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl (except for MobiWAN simulations)
INITIALIZE THE LIST xListHead
>-------------------- NS Addressing --------------------<
Domains (domain_num) : 2
Clusters (cluster_num) : 1 3
Nodes (nodes_num) : 1 1 2 1
>-------------------------------------------------------<
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5, distCST_ = 550.0
SORTING LISTS ...DONE!
26.3025 get_coa for BS 1.2.0:4198400
Simulation finished
|Binding Cache for node 1.1.0 at 100 --------------------------------------- |
|Node COA Type Info Flag Last Time Life Expire Nb|
|1.1.1 1.2.4 7 MN 1 13 91.3087 10 0 13 |
|Binding Update List for node 1.1.1 at 100 --------------------------------------- |
|Node COA Type Info Flag Last Time Life Expire Nb|
|1.1.0 1.2.4 3 HA 1 13 91.3025 10 2.68435e+08 14 |
|Base Station List for node 1.1.1 at 100 --------------------------------------- |
|Node COA Type Info Flag Last Time Life Expire Nb|
|1.2.0 1.2.4 8 BS 1 -1 99.6504 1 0 149 |
running nam with out.nam ...
But it doesn't run the 330 kB nam.out right away.
( 'nam.out' is 21,9 kB gzipped. Attached as out.nam__mob_tcl_.gz.txt ).
'nam nam.out' works. But almost freezes the OS, when the play button is used.
And the nam GUI will also close down.
May be the file is too huge for nam to handle ?
..
I have installed ns-2.33 and mobiwan patch succesfully according to Nicta web page (O.Mehani).
But when running the first, simple-mipv6.tcl script i get error regarding Agent/MIPv6/MN set bs_forwarding_ 0, as the Agent doesnt exist.
Any thoughts about this issue? Am I missing something? Some extra configurations of certain files? Or, any manual or examples of scripts using Mobiwan patch and mipv6 in ns-2.33?
Although I have changed the source paths in the script, I keep on getting this message:
invalid command name "Agent/MIPv6/MN"
while executing
"Agent/MIPv6/MN set bs_forwarding_ 0 "
(file "simple-mipv6.tcl" line 4)
My script is the same mentioned in the previous posts, with correct paths (referring where they really are like: source /home/elena/NetSim/ns-allinone-2.33/ns-2.33/tcl/mobility/timer.tcl). Thats is the only change I ve made in this simple script.
Anyway, just after pure installation of ns-2.33 on Ubuntu 9.10, I have applied
the following patch (http://www.nicta.com.au/people/mehanio/nsmisc- Mobiwan patch for ns-2.33).
And afterward a list of all files that have been patched was shown using this command (patch -p0 <ns-233-mobiwan-1.patch).
Is it the same patch mentioned in previous posts? Or am I still missing something in my configuration? :-(
I really hope I will get some help, or at least some instructions.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.