[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] target_ is NULL for linkstate routing



Hi folks,

I am trying to extend the linkstate routing code to
support WDM and some MPLS stuff. The code works in
NS2.1b6. I kept getting segmentation fault during the
process of porting the code to the latest NS. The seg
fault was invoked by the following line
target_->recv(p)
at rtProtoLS::sendMessage(...). The reason is that
target_ is NULL. I used the following simple script
(at the end, script #1) trying to figure out where I
should set target_ but failed. If I change the node
type to mpls_switch_node (script #2), then I can see
that target_ is not set. mpls_switch_node is a node I
defined. Since target_ is a member variable of class
Connector, class rtProtoLS, which is a subclass of
Connector/Agent, is not supposed to modify it, right?

Can anyone shed light on where/how I am supposed to
set target_? Thanks a lot.

Due to the huge modification I made, I can't attach
the modified NS here. Sorry about that. Below are the
two scripts I used trying to figure out the problem.

Thanks,
Sam

Script #1:
# In this script, target_ is correctly set.
set ns [new Simulator]
$ns rtproto LS

proc finish {} {
exit 0
}

set n0 [$ns node]
set n1 [$ns node]

$ns at 5.0 "finish"
$ns run


Script #2:
# In this script, target_ is NOT correctly set.
set ns [new Simulator]
$ns rtproto LS

proc finish {} {
exit 0
}

# Please note node type is different from script #1
set n0 [$ns mpls_switch_node]
set n1 [$ns mpls_switch_node]

$ns at 5.0 "finish"
$ns run


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/