ns:_o40 malicious:(_o40 cmd line 1)从" _o40 cmd恶意"内部调用从内部调用" catch" $ self cmd $ args" RET"

时间:2018-02-07 06:24:22

标签: tcl ns2 jenkins-2

  

我正在使用NS2.35模拟无线传感器网络,但是出现错误   num_nodes设置为2       初始化列表xListHead       开始模拟......       ns:_o40恶意:           (_o40 cmd第1行)           从内部调用       " _o40 cmd恶意"           从内部调用       " catch" $ self cmd $ args" RET"           从内部调用       "如果[catch" $ self cmd $ args" ret] {       设置cls [$ self info class]       全局错误信息       set savedInfo $ errorInfo       错误"调用类$ cls时出错:$ args" $ ..."           (程序" _o40"第2行)           (SplitObject未知行2)           从内部调用       " o40恶意"        当我在3.2" [$ node($ id)设置ragent ]恶意"添加$ ns时,会收到此错误。       在此处输入代码           set val(chan)Channel / WirelessChannel; #Channel Type       set val(prop)Propagation / TwoRayGround; #radio-propagation       set val(netif)Phy / WirelessPhy;       设置val(mac)Mac / 802_11; #MAC类型       set val(ifq)Queue / DropTail / PriQueue; #interface queue type       set val(ll)LL; #link layer type       set val(ant)Antenna / OmniAntenna;#天线模型       set val(ifqlen)50; ifq中的#max数据包       set val(nn)2; #mount ofmobilenodes       set val(rp)AODV;#routing protocol       设val(x)500       设定val(y)500       设置ns_ [新模拟器]       设置tracefd [open malicious.tr w]       $ ns_ trace-all $ tracefd

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

set topo       [new Topography]

$topo load_flatgrid $val(x) $val(y)
create-god $val(nn)
set chan_1_ [new $val(chan)]
set chan_2_ [new $val(chan)]
$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) \
        -topoInstance $topo \
        -agentTrace ON \
        -routerTrace ON \
        -macTrace ON \
        -movementTrace OFF \
        -channel $chan_1_ 

set node_(0) [$ns_ node]
set node_(1) [$ns_ node]
$ns_ at 1.0 "[$node_(1) set ragent_] malicious"
$node_(0) random-motion 0
$node_(1) random-motion 0

$node_(0) set X_ 5.0
$node_(0) set Y_ 2.0
$node_(0) set Z_ 0.0

$node_(1) set X_ 8.0
$node_(1) set Y_ 5.0
$node_(1) set Z_ 0.0

#
# Now produce some simple node movements
# Node_(1) starts to move towards node_(0)
#
$ns_ at 3.0 "$node_(1) setdest 50.0 40.0 25.0"
$ns_ at 3.0 "$node_(0) setdest 48.0 38.0 5.0"

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

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

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

#
# Tell nodes when the simulation ends
#
for {set i 0} {$i < $val(nn) } {incr i} {
    $ns_ at 30.0 "$node_($i) reset";
}
$ns_ at 30.0 "stop"
$ns_ at 30.01 "puts \"NS EXITING...\" ; $ns_ halt"
proc stop {} {
    global ns_ tracefd nametrace
    $ns_ flush-trace
    close $tracefd
    exec nam malicious.nam &
    exit 0
}

puts "Starting Simulation..."
$ns_ run

1 个答案:

答案 0 :(得分:0)

您的上述模拟......

set val(chan) Channel/WirelessChannel ;#Channel Type 
set val(prop) Propagation/TwoRayGround ;# radio-propagation 
set val(netif) Phy/WirelessPhy ; 
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) 2 ;# number ofmobilenodes 
set val(rp) AODV ;# routing protocol 
set val(x) 500 
set val(y) 500 

set ns_ [new Simulator] 
set tracefd [open malicious.tr w] 
$ns_ trace-all $tracefd
.
.
.
$ns_ at 1.0 "[$node_(1) set ragent_] malicious"

...非常接近Xuan Chen的经典“malicious.tcl”副本(参见aodv-malicious-examples-04.17.tar.gz https://drive.google.com/file/d/0B7S255p3kFXNRVBTU2JOUnpKclk/view?usp=sharing

   Xuan Chen,USC / ISI,2000年7月21日

# $ns_ at 0.0 "[$node_(1) set ragent_] malicious"
$ns_ at 0.0 "[$node_(1) set ragent_] hacker"

错误......

  

ns:_o40恶意:       (_o40 cmd第1行)

...可能会在两种情况下发生: 1. 没有“aodv-malicious”添加到你的ns-2.35。 2。使用了错误的定义:在最常用的修补程序中,aodv-malicious_ns235.patch 恶意设置为hacker(在aodv.cc中)。这意味着模拟脚本中的设置必须是......

$ns_ at 1.0 "[$node_(1) set ragent_] hacker"

(错误的其他原因:您可能只是使用命令$ ns malicious.tcl的可执行文件'ns'的错误副本。)

测试您的文件:$ ns235-malicious K2-malicious.tcl→创建文件malicious.nam 25.3kB,malicious.tr 15kB。 NAM:OK动画。 “malicious.tr”:数据包到达→→$ awk -f tess-Packets.awk malicious.tr https://drive.google.com/file/d/1t9aU5p0m5RxGEaLaL04pjKWHTj59fG4P/view?usp=sharing→前25个awk脚本。

aodv-malicious_ns235.patch https://drive.google.com/file/d/0B7S255p3kFXNU0VNbUtIWlJpRk0/view?usp=sharing

所有~300 ns2补丁https://drive.google.com/drive/folders/0B7S255p3kFXNZ2lWZDBRSW40Q00?usp=sharing

所有~2500次模拟https://drive.google.com/drive/folders/0B7S255p3kFXNSmRYb2lGcDRUdWs?usp=sharing