Merge branch 'develop' into short-pr
This commit is contained in:
commit
67dba23b4e
|
@ -166,16 +166,6 @@ encrypt(uint8_t *state)
|
|||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
aes_128_set_padded_key(uint8_t *key, uint8_t key_len)
|
||||
{
|
||||
uint8_t block[AES_128_BLOCK_SIZE];
|
||||
|
||||
memset(block, 0, AES_128_BLOCK_SIZE);
|
||||
memcpy(block, key, key_len);
|
||||
AES_128.set_key(block);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
const struct aes_128_driver aes_128_driver = {
|
||||
set_key,
|
||||
encrypt
|
||||
|
|
|
@ -67,11 +67,6 @@ struct aes_128_driver {
|
|||
void (* encrypt)(uint8_t *plaintext_and_result);
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Pads the key with zeroes before calling AES_128.set_key
|
||||
*/
|
||||
void aes_128_set_padded_key(uint8_t *key, uint8_t key_len);
|
||||
|
||||
extern const struct aes_128_driver AES_128;
|
||||
|
||||
#endif /* AES_128_H_ */
|
||||
|
|
|
@ -70,11 +70,6 @@ typedef union {
|
|||
#endif /* LINKADDR_SIZE == 2 */
|
||||
} linkaddr_t;
|
||||
|
||||
typedef union {
|
||||
uint8_t u8[8];
|
||||
uint16_t u16[4];
|
||||
} linkaddr_extended_t;
|
||||
|
||||
/**
|
||||
* \brief Copy a link-layer address
|
||||
* \param dest The destination
|
||||
|
|
|
@ -171,7 +171,6 @@ framer_802154_setup_params(packetbuf_attr_t (*get_attr)(uint8_t type),
|
|||
#if LLSEC802154_USES_EXPLICIT_KEYS
|
||||
params->aux_hdr.security_control.key_id_mode = get_attr(PACKETBUF_ATTR_KEY_ID_MODE);
|
||||
params->aux_hdr.key_index = get_attr(PACKETBUF_ATTR_KEY_INDEX);
|
||||
params->aux_hdr.key_source.u16[0] = get_attr(PACKETBUF_ATTR_KEY_SOURCE_BYTES_0_1);
|
||||
#endif /* LLSEC802154_USES_EXPLICIT_KEYS */
|
||||
#else
|
||||
params->fcf.security_enabled = 0;
|
||||
|
@ -273,7 +272,6 @@ parse(void)
|
|||
#if LLSEC802154_USES_EXPLICIT_KEYS
|
||||
packetbuf_set_attr(PACKETBUF_ATTR_KEY_ID_MODE, frame.aux_hdr.security_control.key_id_mode);
|
||||
packetbuf_set_attr(PACKETBUF_ATTR_KEY_INDEX, frame.aux_hdr.key_index);
|
||||
packetbuf_set_attr(PACKETBUF_ATTR_KEY_SOURCE_BYTES_0_1, frame.aux_hdr.key_source.u16[0]);
|
||||
#endif /* LLSEC802154_USES_EXPLICIT_KEYS */
|
||||
}
|
||||
#endif /* LLSEC802154_USES_AUX_HEADER */
|
||||
|
|
|
@ -236,7 +236,6 @@ enum {
|
|||
#if LLSEC802154_USES_EXPLICIT_KEYS
|
||||
PACKETBUF_ATTR_KEY_ID_MODE,
|
||||
PACKETBUF_ATTR_KEY_INDEX,
|
||||
PACKETBUF_ATTR_KEY_SOURCE_BYTES_0_1,
|
||||
#endif /* LLSEC802154_USES_EXPLICIT_KEYS */
|
||||
|
||||
/* Scope 2 attributes: used between end-to-end nodes. */
|
||||
|
|
|
@ -908,6 +908,8 @@ rpl_select_parent(rpl_dag_t *dag)
|
|||
#if RPL_WITH_PROBING
|
||||
if(rpl_parent_is_fresh(best)) {
|
||||
rpl_set_preferred_parent(dag, best);
|
||||
/* Unschedule any already scheduled urgent probing */
|
||||
dag->instance->urgent_probing_target = NULL;
|
||||
} else {
|
||||
/* The best is not fresh. Look for the best fresh now. */
|
||||
rpl_parent_t *best_fresh = best_parent(dag, 1);
|
||||
|
@ -920,7 +922,7 @@ rpl_select_parent(rpl_dag_t *dag)
|
|||
}
|
||||
/* Probe the best parent shortly in order to get a fresh estimate */
|
||||
dag->instance->urgent_probing_target = best;
|
||||
rpl_schedule_probing(dag->instance);
|
||||
rpl_schedule_probing_now(dag->instance);
|
||||
}
|
||||
#else /* RPL_WITH_PROBING */
|
||||
rpl_set_preferred_parent(dag, best);
|
||||
|
|
|
@ -341,6 +341,7 @@ void rpl_schedule_dao_immediately(rpl_instance_t *);
|
|||
void rpl_schedule_unicast_dio_immediately(rpl_instance_t *instance);
|
||||
void rpl_cancel_dao(rpl_instance_t *instance);
|
||||
void rpl_schedule_probing(rpl_instance_t *instance);
|
||||
void rpl_schedule_probing_now(rpl_instance_t *instance);
|
||||
|
||||
void rpl_reset_dio_timer(rpl_instance_t *);
|
||||
void rpl_reset_periodic_timer(void);
|
||||
|
|
|
@ -380,14 +380,7 @@ rpl_schedule_unicast_dio_immediately(rpl_instance_t *instance)
|
|||
clock_time_t
|
||||
get_probing_delay(rpl_dag_t *dag)
|
||||
{
|
||||
if(dag != NULL && dag->instance != NULL
|
||||
&& dag->instance->urgent_probing_target != NULL) {
|
||||
/* Urgent probing needed (to find out if a neighbor may become preferred parent) */
|
||||
return random_rand() % (CLOCK_SECOND * 10);
|
||||
} else {
|
||||
/* Else, use normal probing interval */
|
||||
return ((RPL_PROBING_INTERVAL) / 2) + random_rand() % (RPL_PROBING_INTERVAL);
|
||||
}
|
||||
return ((RPL_PROBING_INTERVAL) / 2) + random_rand() % (RPL_PROBING_INTERVAL);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
rpl_parent_t *
|
||||
|
@ -494,7 +487,6 @@ handle_probing_timer(void *ptr)
|
|||
);
|
||||
/* Send probe, e.g. unicast DIO or DIS */
|
||||
RPL_PROBING_SEND_FUNC(instance, target_ipaddr);
|
||||
instance->urgent_probing_target = NULL;
|
||||
}
|
||||
|
||||
/* Schedule next probing */
|
||||
|
@ -511,5 +503,12 @@ rpl_schedule_probing(rpl_instance_t *instance)
|
|||
ctimer_set(&instance->probing_timer, RPL_PROBING_DELAY_FUNC(instance->current_dag),
|
||||
handle_probing_timer, instance);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
rpl_schedule_probing_now(rpl_instance_t *instance)
|
||||
{
|
||||
ctimer_set(&instance->probing_timer, random_rand() % (CLOCK_SECOND * 4),
|
||||
handle_probing_timer, instance);
|
||||
}
|
||||
#endif /* RPL_WITH_PROBING */
|
||||
/** @}*/
|
||||
|
|
|
@ -266,6 +266,11 @@ rpl_link_callback(const linkaddr_t *addr, int status, int numtx)
|
|||
if(instance->used == 1 ) {
|
||||
parent = rpl_find_parent_any_dag(instance, &ipaddr);
|
||||
if(parent != NULL) {
|
||||
/* If this is the neighbor we were probing urgently, mark urgent
|
||||
probing as done */
|
||||
if(instance->urgent_probing_target == parent) {
|
||||
instance->urgent_probing_target = NULL;
|
||||
}
|
||||
/* Trigger DAG rank recalculation. */
|
||||
PRINTF("RPL: rpl_link_callback triggering update\n");
|
||||
parent->flags |= RPL_PARENT_FLAG_UPDATED;
|
||||
|
|
|
@ -368,6 +368,8 @@ rpl_neighbor_select_best(void)
|
|||
#if RPL_WITH_PROBING
|
||||
if(best != NULL) {
|
||||
if(rpl_neighbor_is_fresh(best)) {
|
||||
/* Unschedule any already scheduled urgent probing */
|
||||
curr_instance.dag.urgent_probing_target = NULL;
|
||||
/* Return best if it is fresh */
|
||||
return best;
|
||||
} else {
|
||||
|
@ -380,7 +382,7 @@ rpl_neighbor_select_best(void)
|
|||
LOG_WARN_6ADDR(rpl_neighbor_get_ipaddr(best));
|
||||
LOG_WARN_("\n");
|
||||
curr_instance.dag.urgent_probing_target = best;
|
||||
rpl_schedule_probing();
|
||||
rpl_schedule_probing_now();
|
||||
}
|
||||
|
||||
/* The best is our preferred parent. It is not fresh but used to be,
|
||||
|
|
|
@ -342,13 +342,7 @@ handle_dao_ack_timer(void *ptr)
|
|||
clock_time_t
|
||||
get_probing_delay(void)
|
||||
{
|
||||
if(curr_instance.used && curr_instance.dag.urgent_probing_target != NULL) {
|
||||
/* Urgent probing needed (to find out if a neighbor may become preferred parent) */
|
||||
return random_rand() % (CLOCK_SECOND * 4);
|
||||
} else {
|
||||
/* Else, use normal probing interval */
|
||||
return ((RPL_PROBING_INTERVAL) / 2) + random_rand() % (RPL_PROBING_INTERVAL);
|
||||
}
|
||||
return ((RPL_PROBING_INTERVAL) / 2) + random_rand() % (RPL_PROBING_INTERVAL);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
rpl_nbr_t *
|
||||
|
@ -440,7 +434,7 @@ handle_probing_timer(void *ptr)
|
|||
);
|
||||
/* Send probe, e.g. unicast DIO or DIS */
|
||||
RPL_PROBING_SEND_FUNC(target_ipaddr);
|
||||
curr_instance.dag.urgent_probing_target = NULL;
|
||||
/* urgent_probing_target will be NULLed in the packet_sent callback */
|
||||
} else {
|
||||
LOG_INFO("no neighbor needs probing\n");
|
||||
}
|
||||
|
@ -457,6 +451,15 @@ rpl_schedule_probing(void)
|
|||
handle_probing_timer, NULL);
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
rpl_schedule_probing_now(void)
|
||||
{
|
||||
if(curr_instance.used) {
|
||||
ctimer_set(&curr_instance.dag.probing_timer,
|
||||
random_rand() % (CLOCK_SECOND * 4), handle_probing_timer, NULL);
|
||||
}
|
||||
}
|
||||
#endif /* RPL_WITH_PROBING */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/*------------------------------- Leaving-- -------------------------------- */
|
||||
|
|
|
@ -104,6 +104,11 @@ void rpl_timers_schedule_dao_ack(uip_ipaddr_t *target, uint16_t sequence);
|
|||
*/
|
||||
void rpl_schedule_probing(void);
|
||||
|
||||
/**
|
||||
* Schedule probing within a few seconds
|
||||
*/
|
||||
void rpl_schedule_probing_now(void);
|
||||
|
||||
/**
|
||||
* Schedule a state update ASAP. Useful to force an update from a context
|
||||
* where updating directly would be unsafe.
|
||||
|
|
|
@ -99,6 +99,11 @@ rpl_link_callback(const linkaddr_t *addr, int status, int numtx)
|
|||
if(curr_instance.used == 1 ) {
|
||||
rpl_nbr_t *nbr = rpl_neighbor_get_from_lladdr((uip_lladdr_t *)addr);
|
||||
if(nbr != NULL) {
|
||||
/* If this is the neighbor we were probing urgently, mark urgent
|
||||
probing as done */
|
||||
if(curr_instance.dag.urgent_probing_target == nbr) {
|
||||
curr_instance.dag.urgent_probing_target = NULL;
|
||||
}
|
||||
/* Link stats were updated, and we need to update our internal state.
|
||||
Updating from here is unsafe; postpone */
|
||||
LOG_INFO("packet sent to ");
|
||||
|
|
Loading…
Reference in New Issue