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

On overriding the unknown-flow handler



I'm providing my own unknown-flow handler for a particular link in my model,
working up from a very simple handler to ensure things are running.

What I've got so far:
=============

set myClass [new CBQClass]
$myClass setparams none   0  1.0  auto  0  1  0.0

set topcl [new Classifier/Hash/Fid 33]

$topcl proc unknown-flow { src dst flowid } {
    global bw link myClass
    global xmtq ns

    set fdesc [new QueueMonitor/ED/Flow]
    $fdesc set src_ $src
    $fdesc set dst_ $dst
    $fdesc set flowid_ $flowid

    puts $bw [list $fdesc [$fdesc set src_] [$fdesc set dst_] [$fdesc set
flowid_]]; flush $bw

    set dsamp [new Samples]
    $fdesc set-delay-samples $dsamp

    set slot [$self installNext $fdesc]
    $self set-hash auto $src $dst $flowid $slot

    set q [new Queue/DropTail]
    $myClass install-queue $q
}


set r1 [$ns node]
set r2 [$ns node]

set rcv [$ns simplex-link $r1 $r2 1.544Mb 20ms DropTail]
set xmt [$ns simplex-link $r2 $r1 1.544Mb 20ms CBQ '' $topcl]

set xmtfm [new QueueMonitor/ED/Flowmon]
$xmtfm classifier $topcl

set link [$ns link $r2 $r1]
set xmtq [new Queue/CBQ]
$myClass install-queue $xmtq

$link insert $myClass

======================

The model runs, but the trace indicates that 'packets' are lost on the $r2 ->
$r1 link: the one that I'm processing.  Setting 'topcl' to SrcDestFid had the
same results, as did setting the 2nd and 3rd args to set-hash to zero, so the
hash table itself doesn't seem to be the problem.

Is there something missing in my unknown-flow procedure that prevents $r2 from
learning that $r1 is the next node in the path for these flows?

Or is there some more correct way for me to get my unknown-flow handler to be
called?  The additional arguments into the "set xmt .. CBQ" command was the
only way I found that would get the link to use my classifier.  When I didn't
provide the last arguments, the simulation would end on not finding the
unknown-flow procedure.

This in ns-2.1b6 on Red Hat Linux 6.1 (2.2.12-20 kernel).
Thanks in advance.