Merge branch 'release-4.1' into fix/rpl-various
This commit is contained in:
commit
2adf8544b2
@ -199,10 +199,18 @@ coap_receive(const coap_endpoint_t *src,
|
|||||||
new_offset = block_offset;
|
new_offset = block_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* call CoAP framework and check if found and allowed */
|
if(new_offset < 0) {
|
||||||
status = call_service(message, response,
|
LOG_DBG("Blockwise: block request offset overflow\n");
|
||||||
transaction->message + COAP_MAX_HEADER_SIZE,
|
coap_status_code = BAD_OPTION_4_02;
|
||||||
block_size, &new_offset);
|
coap_error_message = "BlockOutOfScope";
|
||||||
|
status = COAP_HANDLER_STATUS_CONTINUE;
|
||||||
|
} else {
|
||||||
|
/* call CoAP framework and check if found and allowed */
|
||||||
|
status = call_service(message, response,
|
||||||
|
transaction->message + COAP_MAX_HEADER_SIZE,
|
||||||
|
block_size, &new_offset);
|
||||||
|
}
|
||||||
|
|
||||||
if(status != COAP_HANDLER_STATUS_CONTINUE) {
|
if(status != COAP_HANDLER_STATUS_CONTINUE) {
|
||||||
|
|
||||||
if(coap_status_code == NO_ERROR) {
|
if(coap_status_code == NO_ERROR) {
|
||||||
|
@ -1115,13 +1115,10 @@ coap_set_header_size1(coap_message_t *coap_pkt, uint32_t size)
|
|||||||
int
|
int
|
||||||
coap_get_payload(coap_message_t *coap_pkt, const uint8_t **payload)
|
coap_get_payload(coap_message_t *coap_pkt, const uint8_t **payload)
|
||||||
{
|
{
|
||||||
if(coap_pkt->payload) {
|
if(payload != NULL) {
|
||||||
*payload = coap_pkt->payload;
|
*payload = coap_pkt->payload;
|
||||||
return coap_pkt->payload_len;
|
|
||||||
} else {
|
|
||||||
*payload = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
return coap_pkt->payload != NULL ? coap_pkt->payload_len : 0;
|
||||||
}
|
}
|
||||||
int
|
int
|
||||||
coap_set_payload(coap_message_t *coap_pkt, const void *payload, size_t length)
|
coap_set_payload(coap_message_t *coap_pkt, const void *payload, size_t length)
|
||||||
|
@ -397,9 +397,15 @@ process_dio_from_current_dag(uip_ipaddr_t *from, rpl_dio_t *dio)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the DIO sender is on an older version of the DAG, ignore it. The node
|
/* If the DIO sender is on an older version of the DAG, do not process it
|
||||||
will eventually hear the global repair and catch up. */
|
* further. The sender will eventually hear the global repair and catch up. */
|
||||||
if(rpl_lollipop_greater_than(curr_instance.dag.version, dio->version)) {
|
if(rpl_lollipop_greater_than(curr_instance.dag.version, dio->version)) {
|
||||||
|
if(dio->rank == ROOT_RANK) {
|
||||||
|
/* Before returning, if the DIO was from the root, an old DAG versions
|
||||||
|
* likely incidates a root reboot. Reset our DIO timer to make sure the
|
||||||
|
* root hears our version ASAP, and in turn triggers a global repair. */
|
||||||
|
rpl_timers_dio_reset("Heard old version from root");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -414,10 +420,12 @@ process_dio_from_current_dag(uip_ipaddr_t *from, rpl_dio_t *dio)
|
|||||||
* Must come first, as it might remove all neighbors, and we then need
|
* Must come first, as it might remove all neighbors, and we then need
|
||||||
* to re-add this source of the DIO to the neighbor table */
|
* to re-add this source of the DIO to the neighbor table */
|
||||||
if(rpl_lollipop_greater_than(dio->version, curr_instance.dag.version)) {
|
if(rpl_lollipop_greater_than(dio->version, curr_instance.dag.version)) {
|
||||||
if(curr_instance.dag.rank == ROOT_RANK) { /* The root should not hear newer versions */
|
if(curr_instance.dag.rank == ROOT_RANK) {
|
||||||
|
/* The root should not hear newer versions unless it just rebooted */
|
||||||
LOG_ERR("inconsistent DIO version (current: %u, received: %u), initiate global repair\n",
|
LOG_ERR("inconsistent DIO version (current: %u, received: %u), initiate global repair\n",
|
||||||
curr_instance.dag.version, dio->version);
|
curr_instance.dag.version, dio->version);
|
||||||
curr_instance.dag.version = dio->version; /* Update version and trigger global repair */
|
/* Update version and trigger global repair */
|
||||||
|
curr_instance.dag.version = dio->version;
|
||||||
rpl_global_repair("Inconsistent DIO version");
|
rpl_global_repair("Inconsistent DIO version");
|
||||||
} else {
|
} else {
|
||||||
LOG_WARN("new DIO version (current: %u, received: %u), apply global repair\n",
|
LOG_WARN("new DIO version (current: %u, received: %u), apply global repair\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user