gluon-radv-filterd: Update originators only if one is unknown
This commit is contained in:
parent
f963e054df
commit
e3b4dc5031
@ -3,6 +3,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -300,12 +301,18 @@ static void update_tqs() {
|
|||||||
char *line = NULL;
|
char *line = NULL;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
uint8_t tq;
|
uint8_t tq;
|
||||||
|
bool update_originators = false;
|
||||||
|
int i;
|
||||||
macaddr_t mac_a, mac_b;
|
macaddr_t mac_a, mac_b;
|
||||||
|
|
||||||
// reset values
|
// reset TQs
|
||||||
foreach(router, G.routers) {
|
foreach(router, G.routers) {
|
||||||
router->tq = 0;
|
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
|
// 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
|
// could abort as soon as we hit the first router with the current
|
||||||
// information filled in.
|
// information filled in.
|
||||||
|
|
||||||
|
if (update_originators) {
|
||||||
// translate all router's MAC addresses to originators simultaneously
|
// translate all router's MAC addresses to originators simultaneously
|
||||||
snprintf(path, PATH_MAX, TRANSTABLE_GLOBAL, G.mesh_iface);
|
snprintf(path, PATH_MAX, TRANSTABLE_GLOBAL, G.mesh_iface);
|
||||||
f = fopen(path, "r");
|
f = fopen(path, "r");
|
||||||
@ -330,6 +338,7 @@ static void update_tqs() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
}
|
||||||
|
|
||||||
// look up TQs of originators
|
// look up TQs of originators
|
||||||
G.max_tq = 0;
|
G.max_tq = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user