Fix TSCH_AUTOSELECT_TIME_SOURCE to work with 2-byte addresses and with the new nbr_table_add_lladdr interface

This commit is contained in:
Simon Duquennoy 2016-06-10 20:57:58 +02:00
parent 809883e632
commit 63565b109d
1 changed files with 4 additions and 3 deletions

View File

@ -45,6 +45,7 @@
#include "net/netstack.h" #include "net/netstack.h"
#include "net/packetbuf.h" #include "net/packetbuf.h"
#include "net/queuebuf.h" #include "net/queuebuf.h"
#include "net/nbr-table.h"
#include "net/mac/framer-802154.h" #include "net/mac/framer-802154.h"
#include "net/mac/tsch/tsch.h" #include "net/mac/tsch/tsch.h"
#include "net/mac/tsch/tsch-slot-operation.h" #include "net/mac/tsch/tsch-slot-operation.h"
@ -282,13 +283,13 @@ eb_input(struct input_packet *current_input)
#if TSCH_AUTOSELECT_TIME_SOURCE #if TSCH_AUTOSELECT_TIME_SOURCE
if(!tsch_is_coordinator) { if(!tsch_is_coordinator) {
/* Maintain EB received counter for every neighbor */ /* Maintain EB received counter for every neighbor */
struct eb_stat *stat = (struct eb_stat *)nbr_table_get_from_lladdr(eb_stats, &frame.src_addr); struct eb_stat *stat = (struct eb_stat *)nbr_table_get_from_lladdr(eb_stats, (linkaddr_t *)&frame.src_addr);
if(stat == NULL) { if(stat == NULL) {
stat = (struct eb_stat *)nbr_table_add_lladdr(eb_stats, &frame.src_addr); stat = (struct eb_stat *)nbr_table_add_lladdr(eb_stats, (linkaddr_t *)&frame.src_addr, NBR_TABLE_REASON_MAC, NULL);
} }
if(stat != NULL) { if(stat != NULL) {
stat->rx_count++; stat->rx_count++;
stat->jp = eb_ies.join_priority; stat->jp = eb_ies.ie_join_priority;
best_neighbor_eb_count = MAX(best_neighbor_eb_count, stat->rx_count); best_neighbor_eb_count = MAX(best_neighbor_eb_count, stat->rx_count);
} }
/* Select best time source */ /* Select best time source */