summaryrefslogtreecommitdiffstats
path: root/ffd/neigh.c
diff options
context:
space:
mode:
Diffstat (limited to 'ffd/neigh.c')
-rw-r--r--ffd/neigh.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ffd/neigh.c b/ffd/neigh.c
index 6cfd5e8..9788d3f 100644
--- a/ffd/neigh.c
+++ b/ffd/neigh.c
@@ -50,6 +50,9 @@ void ffd_neigh_free_list(ffd_neigh_t *neigh) {
}
uint16_t ffd_neigh_get_rxcost(const ffd_neigh_t *neigh) {
+ if (!neigh->hello_log || !neigh->hello_interval)
+ return 0xffff;
+
int timediff = timespec_diff(&now, &neigh->last_hello)/10;
int shift = (timediff - neigh->hello_interval/2)/neigh->hello_interval;
int received = __builtin_popcount(neigh->hello_log << shift);
@@ -74,5 +77,5 @@ uint16_t ffd_neigh_get_cost(const ffd_neigh_t *neigh) {
}
void ffd_neigh_reset(ffd_iface_t *iface, ffd_neigh_t *neigh) {
- ffd_send_announce_request(iface, neigh, NULL);
+ ffd_send_announce_request(iface, neigh, FFD_NODE_ID_UNSPEC, 0, 0);
}