Menu

#26 Bug in LQ-Calculation (with patch)

open
core-olsrd (19)
5
2007-11-04
2007-08-16
No

Hello,

I think I've found a bug in the calculation of the link quality, which is done the following way:

1) entry->loss_link_quality =
2) (float)(entry->total_packets - entry->lost_packets) /
3) (float)(entry->loss_window_size < (2 * 4) ? entry->loss_window_size:
4) 4 * ((entry->loss_window_size / 4 - 1) * entry->total_packets + entry->loss_window_size) / entry->loss_window_size);

Please assume a perfect link for now that does not loose any packets. It should have a link quality of 1.
If we set loss_window_size to 10 (the default) and wait for a while, then total_packets will become 10, too, and lost_packets will be 0. So the numerator (line 2) will equal 10 and so should the denominator, but the denominator gives only 8, giving a link quality value of 1.25!
The reason might be, that "entry->loss_window_size / 4" is an integer division, which gives 10 / 4 = 2 and not 2.5!

Proposed solution:

Convert that integer division to a floating point division. However, I'm not quite sure, if this is correct, because I haven't fully understood the formula

Thank you
Belbo

Discussion

  • Andreas Jacobs

    Andreas Jacobs - 2007-08-16

    Patch for the bug

     
  • Andreas T�nnesen

    • assigned_to: kattemat --> bernd67
     

Log in to post a comment.

MongoDB Logo MongoDB