summaryrefslogtreecommitdiffstats
path: root/netrom
diff options
context:
space:
mode:
authorThomas Osterried <thomas@osterried.de>2013-09-15 15:58:32 +0200
committerRalf Baechle <ralf@linux-mips.org>2015-05-01 23:52:25 +0200
commitced9c30127ffb6abc0eb38506fcff26e91d27a6a (patch)
tree0282b6cdb55aa5890120b3456427ee8f81f6e6ed /netrom
parent8b893ae99f6f32470fa52a170bf4c8801a976b20 (diff)
Fix: kernel learned qualities < configured worst_qual.
First compute the node quality by remotely reported quality * best_quality) + 128) / 256; (the well known algorithm) and afterwards verify if it's < worst_qual. Signed-off-by: Thomas Osterried <thomas@osterried.de>
Diffstat (limited to 'netrom')
-rw-r--r--netrom/netromr.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/netrom/netromr.c b/netrom/netromr.c
index 9ed716f..9c1f17e 100644
--- a/netrom/netromr.c
+++ b/netrom/netromr.c
@@ -106,14 +106,14 @@ static int add_node(int s, unsigned char *buffer, struct nr_route_struct *nr_nod
return FALSE;
}
- if (best_quality < port_list[index].worst_qual) {
+ nr_node->quality = ((quality * best_quality) + 128) / 256;
+
+ if (nr_node->quality < port_list[index].worst_qual) {
if (debug && logging)
syslog(LOG_DEBUG, "netromr: add_node: quality less than worst_qual");
return FALSE;
}
- nr_node->quality = ((quality * best_quality) + 128) / 256;
-
/* log this only when logging verbosely */
if (debug > 1 && logging) {
syslog(LOG_DEBUG, "Node update: %s:%s",