LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Error on Tcl when add misbehavior node in aodv ns2 (https://www.linuxquestions.org/questions/linux-networking-3/error-on-tcl-when-add-misbehavior-node-in-aodv-ns2-4175425473/)

D4SH_SI4 09-03-2012 03:31 PM

Error on Tcl when add misbehavior node in aodv ns2
 
hi
I do modification according http://www.elmurod.net/index.php/200...-node-in-aodv/ for adding malicios node to aodv bud I have problem when run tcl file and in the above site in comments some solution has been proposed bud it's not work for my jab, please help me it's important for me
tanx

error :
Starting Simulation...
ns: _o54 hacker:
(_o54 cmd line 1)
invoked from within
"_o54 cmd hacker"
invoked from within
"catch "$self cmd $args" ret"
invoked from within
"if [catch "$self cmd $args" ret] {
set cls [$self info class]
global errorInfo
set savedInfo $errorInfo
error "error when calling class $cls: $args" $..."
(procedure "_o54" line 2)
(SplitObject unknown line 2)
invoked from within
"_o54 hacker"



************* and my tcl code:
# Copyright (c) 1997 Regents of the University of California.
# All rights reserved.
#
# 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.
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed by the Computer Systems
# Engineering Group at Lawrence Berkeley Laboratory.
# 4. Neither the name of the University nor of the Laboratory may be used
# to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 THE REGENTS 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.
#
# simple-wireless.tcl
# A simple example for wireless simulation

# ======================================================================
# Define options
# ======================================================================
set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;# radio-propagation model
set val(netif) Phy/WirelessPhy ;# network interface type
set val(mac) Mac/802_11 ;# MAC type
set val(ifq) Queue/DropTail/PriQueue ;# interface queue type
set val(ll) LL ;# link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(ifqlen) 50 ;# max packet in ifq
set val(nn) 5 ;# number of mobilenodes
set val(rp) AODV ;# routing protocol
set val(x) 500 ;
set val(y) 500 ;
# ======================================================================
# Main Program
# ======================================================================


#
# Initialize Global Variables
#
set ns_ [new Simulator]
#$ns_ use-newtrace


set tracefd [open aaa.tr w]
$ns_ trace-all $tracefd

set nf [open aaa.nam w]
#$ns_ namtrace-all $nf
$ns_ namtrace-all-wireless $nf $val(x) $val(y)




# set up topography object
set topo [new Topography]

$topo load_flatgrid $val(x) $val(y)

#
# Create God
#
create-god $val(nn)


set chan_ [new $val(chan)]
#
# Create the specified number of mobilenodes [$val(nn)] and "attach" them
# to the channel.
# Here two nodes are created : node(0) and node(1)

# configure node

$ns_ node-config -adhocRouting $val(rp) \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(ant) \
-propType $val(prop) \
-phyType $val(netif) \
-channelType $val(chan) \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF \
-movementTrace ON

for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns_ node]
$node_($i) random-motion 0 ;# disable random motion
$ns_ initial_node_pos $node_($i) 20
}
$ns_ at 0.0 "[$node_(2) set ragent_] hacker"
#
# Provide initial (X,Y, for now Z=0) co-ordinates for mobilenodes
#
$node_(0) set X_ 5.0
$node_(0) set Y_ 2.0
$node_(0) set Z_ 0.0

$node_(1) set X_ 80.0
$node_(1) set Y_ 2.0
$node_(1) set Z_ 0.0

$node_(2) set X_ 120.0
$node_(2) set Y_ 10.0
$node_(2) set Z_ 0.0

$node_(3) set X_ 160.0
$node_(3) set Y_ 0.0
$node_(3) set Z_ 0.0

$node_(4) set X_ 50.0
$node_(4) set Y_ 20.0
$node_(4) set Z_ 0.0


#
# Now produce some simple node movements
# Node_(1) starts to move towards node_(0)
#
#$ns_ at 50.0 "$node_(1) setdest 25.0 20.0 15.0"
#$ns_ at 10.0 "$node_(0) setdest 20.0 18.0 1.0"

# Node_(1) then starts to move away from node_(0)
#$ns_ at 100.0 "$node_(1) setdest 490.0 480.0 15.0"

# Setup traffic flow between nodes
# TCP connections between node_(0) and node_(4)

set tcp [new Agent/TCP]
$tcp set class_ 2
set sink [new Agent/TCPSink]
$ns_ attach-agent $node_(0) $tcp
$ns_ attach-agent $node_(4) $sink
$ns_ connect $tcp $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns_ at 10.0 "$ftp start"

#
# Tell nodes when the simulation ends
#
for {set i 0} {$i < $val(nn) } {incr i} {
$ns_ at 150.0 "$node_($i) reset";
}


$ns_ at 150.0 "stop"
$ns_ at 150.01 "puts \"NS EXITING...\" ; $ns_ halt"
proc stop {} {
global ns_ tracefd nf
$ns_ flush-trace

close $tracefd
close $nf
}

puts "Starting Simulation..."
$ns_ run

amissan 05-05-2013 01:15 PM

I have the same error can you help me

knudfl 05-05-2013 03:11 PM

# 2, @amissan : Please do not quote complete posts.

Hit the 'Edit' button, and edit the post #2 quotation
to contain your error only.

Don't know what the "hacker" in line 111 is about.
But when line 111 is commented with a hash mark (#) : No errors:
Code:

# $ns_ at 0.0 "[$node_(2) set ragent_] hacker"
EDIT : Found some hints about "hacker"
http://durgeshkshirsagar.blogspot.dk...on-in-ns2.html
http://research.ijcaonline.org/volum...pxc3879133.pdf

-

amissan 05-06-2013 05:41 AM

Thank you for help when I put # it becomes a comment so it does not have effect
I tried with this http://durgeshkshirsagar.blogspot.fr...76006043534132
but still the same error

knudfl 05-23-2013 05:34 AM

# 4 . A different way of adding "malicious":

http://www.linuxquestions.org/questi...332/page2.html
>>> posts #20, #21.

Works OK, ns-2.35, with the aodv.cc + aodv.h from post #20.
I.e. : $ ns aodv-m.tcl : OK, $ ns maodv_802_15_4.tcl : OK.

P.S. : I asked @rah12345 where he got the files / the modification information.
And so far no answer.

PPS : The tcl file from post #1 works fairly OK : Creates 'aaa.nam' 10MB, 'aaa.tr' 8MB.

-

knudfl 06-28-2013 12:57 AM

# 3 .

About "ragent hacker", please also see post # 21 here
http://www.linuxquestions.org/questi...332/page2.html


All times are GMT -5. The time now is 06:51 AM.