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

Re: [ns] cbr rate



On Mon, 7 Jan 2002, Lloyd Wood wrote:

> looking in  ~ns/cbr_traffic.cc
>
> void CBR_Traffic::init()
> {
>         // compute inter-packet interval
>         interval_ = (double)(size_ << 3)/(double)rate_;
> [..]
>
> double CBR_Traffic::next_interval(int& size)
> {
>         // Recompute interval in case rate_ or size_ has changes
>         interval_ = (double)(size_ << 3)/(double)rate_;
> [..]
>
> so division by zero does... what? depends on the compiler? And once
> you've set a rate of zero you can't schedule another event, so your at
> 6 command (which I think would take effect the next time CBR fired off
> a packet scheduled at the old rate) then doesn't do anything.
>
> There's a lot of division by rate_ or rtt_ in the code that really
> needs to be some function protecting against division by zero.

and negative numbers. If a negative interval leads to 'Scheduler
going backwards' warning...

L.

in my next amazing feat, I'll probably find some buffer overflow.

> And
> some sort of supend/reawaken functionality is needed; setting rate 0
> really says 'suspend until something touches this object', but you
> don't have an obvious way of touching the object and forcing an event
> AFAIK.

<[email protected]>PGP<http://www.ee.surrey.ac.uk/Personal/L.Wood/>