gluon-radv-filterd: Update originators only if one is unknown

This commit is contained in:
Jan-Philipp Litza 2016-11-26 12:52:23 +01:00
parent f963e054df
commit e3b4dc5031
No known key found for this signature in database
GPG Key ID: 1FB658053CE27196

View File

@ -3,6 +3,7 @@
#include <errno.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
@ -300,12 +301,18 @@ static void update_tqs() {
char *line = NULL;
size_t len = 0;
uint8_t tq;
bool update_originators = false;
int i;
macaddr_t mac_a, mac_b;
// reset values
// reset TQs
foreach(router, G.routers) {
router->tq = 0;
memset(router->originator, 0, sizeof(macaddr_t));
for (i = 0; i < 6; i++)
if (router->originator[i] != 0)
break;
if (i >= 6)
update_originators = true;
}
// TODO: Currently, we iterate over the whole list of routers all the
@ -314,6 +321,7 @@ static void update_tqs() {
// could abort as soon as we hit the first router with the current
// information filled in.
if (update_originators) {
// translate all router's MAC addresses to originators simultaneously
snprintf(path, PATH_MAX, TRANSTABLE_GLOBAL, G.mesh_iface);
f = fopen(path, "r");
@ -330,6 +338,7 @@ static void update_tqs() {
}
}
fclose(f);
}
// look up TQs of originators
G.max_tq = 0;