From 47686967896eb53c49d81dc87452052ded7f2d3d Mon Sep 17 00:00:00 2001 From: Henning Rogge Date: Sat, 5 Sep 2009 10:20:16 +0200 Subject: [PATCH] Fix bug in ext_fpm I introduced two months ago. Add some debug output for lq_multiplier --- src/cfgparser/olsrd_conf.c | 11 +++++++++++ src/link_set.c | 4 ++++ src/lq_plugin_default_fpm.c | 21 +++------------------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/cfgparser/olsrd_conf.c b/src/cfgparser/olsrd_conf.c index 420b57db..e4becd1e 100644 --- a/src/cfgparser/olsrd_conf.c +++ b/src/cfgparser/olsrd_conf.c @@ -289,6 +289,8 @@ olsrd_sanity_check_cnf(struct olsrd_config *cnf) /* Interfaces */ while (in) { + struct olsr_lq_mult *mult; + io = in->cnf; if (in->name == NULL || !strlen(in->name)) { @@ -341,6 +343,15 @@ olsrd_sanity_check_cnf(struct olsrd_config *cnf) return -1; } + for (mult = io->lq_mult; mult; mult=mult->next) { + if (mult->value > LINK_LOSS_MULTIPLIER) { + struct ipaddr_str buf; + + fprintf(stderr, "Bad Linkquality multiplier ('%s' on IP %s: %0.2f)\n", + in->name, olsr_ip_to_string(&buf, &mult->addr), (float)mult->value / (float)LINK_LOSS_MULTIPLIER); + return -1; + } + } in = in->next; } diff --git a/src/link_set.c b/src/link_set.c index e71d0713..9ff8fea9 100644 --- a/src/link_set.c +++ b/src/link_set.c @@ -287,6 +287,7 @@ set_loss_link_multiplier(struct link_entry *entry) struct olsr_lq_mult *mult; uint32_t val = 0; union olsr_ip_addr null_addr; + struct ipaddr_str buf; /* find the interface for the link */ inter = if_ifwithaddr(&entry->local_iface_addr); @@ -320,6 +321,9 @@ set_loss_link_multiplier(struct link_entry *entry) /* store the multiplier */ entry->loss_link_multiplier = val; + + OLSR_PRINTF(1, "Set linkloss multiplier for %s on %s to %d\n", + olsr_ip_to_string(&buf, &entry->neighbor_iface_addr), cfg_inter->name, val); } /* diff --git a/src/lq_plugin_default_fpm.c b/src/lq_plugin_default_fpm.c index b7ba13ed..c5cfb8eb 100644 --- a/src/lq_plugin_default_fpm.c +++ b/src/lq_plugin_default_fpm.c @@ -156,25 +156,11 @@ olsr_linkcost default_lq_packet_loss_worker_fpm(struct link_entry *link __attribute__ ((unused)), void *ptr, bool lost) { struct default_lq_fpm *tlq = ptr; -// uint32_t alpha_old = aging_factor_old; -// uint32_t alpha_new = aging_factor_new; + uint32_t alpha_old = aging_factor_old; + uint32_t alpha_new = aging_factor_new; -// uint32_t value; - // fpm link_loss_factor = fpmidiv(itofpm(link->loss_link_multiplier), 65536); + uint32_t value; - if (lost) { - if (tlq->valueLq > 4) { - tlq->valueLq-=4; - } - } - else { - if (tlq->valueLq < 255-4) { - tlq->valueLq+=4; - } - } - - return default_lq_calc_cost_fpm(ptr); -#if 0 if (tlq->quickstart < LQ_QUICKSTART_STEPS) { alpha_new = aging_quickstart_new; alpha_old = aging_quickstart_old; @@ -194,7 +180,6 @@ default_lq_packet_loss_worker_fpm(struct link_entry *link __attribute__ ((unused tlq->valueLq = (value * 255 + LQ_FPM_INTERNAL_MULTIPLIER - 1) / LQ_FPM_INTERNAL_MULTIPLIER; return default_lq_calc_cost_fpm(ptr); -#endif } void -- 2.20.1