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

[ns] Loss of entries in the Hash Classifier: bug in NS?




Hi folks. Need some help:

I'm creating a gateway, between 802.3 and a modified CSMA/CD protocol,
which I'm testing.  I'm using the ns2.1b7 version.

I created this gateway from Node (ns-node.tcl) and I' ve changed the
classifier/hash/dest in the gateway, putting another entries, for handling
the packet forwarding. But in the middle of the simulation, the hash table
in the Gateway's classifier is corrupted, and some objects are lost.

The topology that I tested is that:

 N(0)------Gateway======S(0)

Another important point is that there is no link object between Gateway
and S(0), because I've implemented a diferent scheme of transport.

First, for the modified CSMA/CD net, I created an object GateW, which
handles all the packets, and put it in slot 0 at the classifier of the
$Gateway:

----------------
  set Classifier [$Gateway set classifier_ ]
  set slot [$Classifier installNext $GateW_]
  set encoded_dst_address [expr $slave << [AddrParams NodeShift 1]]
  $Classifier set-hash auto 0 $encoded_dst_address 0 $slot
-------------------

For the link between n0 and the gateway, I used this code below:

------------------------------------------------------
$ns duplex-link $n0 $Gateway 1MB 10ms DropTail

# Link between N(0) and Gateway
 set dst_address [$Gateway set address_] 
 set link_w_bs [$ns link $n0 $Gateway]
 set targt [$link_w_bs head]

#Add Route in the Classifier
 set Classifier [$n0 set classifier_ ]
 set slot [$Classifier installNext $targt]
 set encoded_dst_address [expr $dst_address << [AddrParams NodeShift 1]]
 $Classifier set-hash auto 0 $encoded_dst_address 0 $slot

#Link between Gateway and N(0)
 set dst_address [$n0 set address_] 
 set link_bs_w [$ns link $Gateway $n0]
 set targt [$link_bs_w head]

#Add Route in the Classifier
 set Classifier [$Gateway set classifier_ ]
 set slot [$Classifier installNext $trgt]
 set encoded_dst_address [expr $dst_address << [AddrParams NodeShift 1]]
 $Classifier set-hash auto 0 $encoded_dst_address 0 $slot

#Create a TCP agent and attach it to node n0
set tcp0 [new Agent/TCP]
$ns attach-agent $n0 $tcp0

# Create a CBR traffic source and attach it to tcp0
set cbr0 [new Application/Traffic/CBR]
$cbr0 attach-agent $tcp0

#Create a TCPSink agent (a traffic sink) and attach it to node Gateway
set sink0 [new Agent/TCPSink]
$ns attach-agent $Gateway $sink0
$ns connect $tcp0 $sink0
------------------------------------

but, when the simulation starts, one of the entries of the classifier
disapear, and the objects in the hash table are reordered:


-> Report printed in the begining of the simulation:
	Classifier of the Gateway -> _o21
		slot 0 -> _o22 -> GateW
		slot 1 -> _o54 -> Classifier/Port
		slot 2 -> _o79 -> Connector


->The error in the middle of the simulation
 
--- Classfier::no-slot{} default handler (tcl/lib/ns-lib.tcl) ---
        _o21: no target for slot -1
        _o21 type: Classifier/Hash/Dest
content dump:
classifier _o21
        0 offset
        0 shift
        2147483647 mask
        2 slots
                slot 0: _o54
                slot 2: _o79
        -1 default
---------- Finished standard no-slot{} default handler ----------


As you can see, the GateW object is dropped in the middle of the
simulation, and the Classifier's hash table is reordered.

Anyone have any idea what is happening? Is there a bug in the NS?


Best Regards,
Ricardo