fixed clearing of state flag and avoid starting retransmission timer
This commit is contained in:
parent
8afe3fb9b7
commit
09c624dcd3
|
@ -106,6 +106,9 @@ void uip_ds6_notification_rm(struct uip_ds6_notification *n);
|
||||||
#define RPL_ROUTE_SET_NOPATH_RECEIVED(route) do { \
|
#define RPL_ROUTE_SET_NOPATH_RECEIVED(route) do { \
|
||||||
(route)->state.state_flags |= RPL_ROUTE_ENTRY_NOPATH_RECEIVED; \
|
(route)->state.state_flags |= RPL_ROUTE_ENTRY_NOPATH_RECEIVED; \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
#define RPL_ROUTE_CLEAR_NOPATH_RECEIVED(route) do { \
|
||||||
|
(route)->state.state_flags &= ~RPL_ROUTE_ENTRY_NOPATH_RECEIVED; \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
#define RPL_ROUTE_IS_DAO_PENDING(route) \
|
#define RPL_ROUTE_IS_DAO_PENDING(route) \
|
||||||
((route->state.state_flags & RPL_ROUTE_ENTRY_DAO_PENDING) != 0)
|
((route->state.state_flags & RPL_ROUTE_ENTRY_DAO_PENDING) != 0)
|
||||||
|
|
|
@ -201,6 +201,8 @@ ns_input(void)
|
||||||
#endif /*UIP_CONF_IPV6_CHECKS */
|
#endif /*UIP_CONF_IPV6_CHECKS */
|
||||||
nbr = uip_ds6_nbr_lookup(&UIP_IP_BUF->srcipaddr);
|
nbr = uip_ds6_nbr_lookup(&UIP_IP_BUF->srcipaddr);
|
||||||
if(nbr == NULL) {
|
if(nbr == NULL) {
|
||||||
|
uip_lladdr_t lladdr_aligned;
|
||||||
|
extract_lladdr_aligned(&lladdr_aligned);
|
||||||
uip_ds6_nbr_add(&UIP_IP_BUF->srcipaddr, &lladdr_aligned,
|
uip_ds6_nbr_add(&UIP_IP_BUF->srcipaddr, &lladdr_aligned,
|
||||||
0, NBR_STALE, NBR_TABLE_REASON_IPV6_ND, NULL);
|
0, NBR_STALE, NBR_TABLE_REASON_IPV6_ND, NULL);
|
||||||
} else {
|
} else {
|
||||||
|
@ -642,8 +644,7 @@ rs_input(void)
|
||||||
uip_ds6_nbr_t nbr_data = *nbr;
|
uip_ds6_nbr_t nbr_data = *nbr;
|
||||||
uip_ds6_nbr_rm(nbr);
|
uip_ds6_nbr_rm(nbr);
|
||||||
nbr = uip_ds6_nbr_add(&UIP_IP_BUF->srcipaddr, &lladdr_aligned,
|
nbr = uip_ds6_nbr_add(&UIP_IP_BUF->srcipaddr, &lladdr_aligned,
|
||||||
nbr = uip_ds6_nbr_add(&UIP_IP_BUF->srcipaddr, 0, NBR_STALE,
|
0, NBR_STALE, NBR_TABLE_REASON_IPV6_ND, NULL);
|
||||||
NBR_TABLE_REASON_IPV6_ND, NULL);
|
|
||||||
nbr->reachable = nbr_data.reachable;
|
nbr->reachable = nbr_data.reachable;
|
||||||
nbr->sendns = nbr_data.sendns;
|
nbr->sendns = nbr_data.sendns;
|
||||||
nbr->nscount = nbr_data.nscount;
|
nbr->nscount = nbr_data.nscount;
|
||||||
|
@ -872,8 +873,8 @@ ra_input(void)
|
||||||
if(nbr == NULL) {
|
if(nbr == NULL) {
|
||||||
uip_lladdr_t lladdr_aligned;
|
uip_lladdr_t lladdr_aligned;
|
||||||
extract_lladdr_aligned(&lladdr_aligned);
|
extract_lladdr_aligned(&lladdr_aligned);
|
||||||
nbr = uip_ds6_nbr_add(&UIP_IP_BUF->srcipaddr, &lladdr_aligned, 1,
|
nbr = uip_ds6_nbr_add(&UIP_IP_BUF->srcipaddr, &lladdr_aligned,
|
||||||
NBR_STALE, NBR_TABLE_REASON_IPV6_ND, NULL);
|
1, NBR_STALE, NBR_TABLE_REASON_IPV6_ND, NULL);
|
||||||
} else {
|
} else {
|
||||||
uip_lladdr_t *lladdr = (uip_lladdr_t *)uip_ds6_nbr_get_ll(nbr);
|
uip_lladdr_t *lladdr = (uip_lladdr_t *)uip_ds6_nbr_get_ll(nbr);
|
||||||
if(nbr->state == NBR_INCOMPLETE) {
|
if(nbr->state == NBR_INCOMPLETE) {
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
#include "net/rpl/rpl-private.h"
|
#include "net/rpl/rpl-private.h"
|
||||||
#include "net/packetbuf.h"
|
#include "net/packetbuf.h"
|
||||||
#include "net/ipv6/multicast/uip-mcast6.h"
|
#include "net/ipv6/multicast/uip-mcast6.h"
|
||||||
|
#include "random.h"
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -811,12 +812,13 @@ dao_input(void)
|
||||||
uip_icmp6_send(rpl_get_parent_ipaddr(dag->preferred_parent),
|
uip_icmp6_send(rpl_get_parent_ipaddr(dag->preferred_parent),
|
||||||
ICMP6_RPL, RPL_CODE_DAO, buffer_length);
|
ICMP6_RPL, RPL_CODE_DAO, buffer_length);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
/* independent if we remove or not - ACK the request */
|
||||||
if(flags & RPL_DAO_K_FLAG) {
|
if(flags & RPL_DAO_K_FLAG) {
|
||||||
/* indicate that we accepted the no-path DAO */
|
/* indicate that we accepted the no-path DAO */
|
||||||
dao_ack_output(instance, &dao_sender_addr, sequence,
|
dao_ack_output(instance, &dao_sender_addr, sequence,
|
||||||
RPL_DAO_ACK_UNCONDITIONAL_ACCEPT);
|
RPL_DAO_ACK_UNCONDITIONAL_ACCEPT);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
goto discard;
|
goto discard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -851,8 +853,9 @@ dao_input(void)
|
||||||
goto discard;
|
goto discard;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* State is all zeroes, set lifetime but no need for other initialization. */
|
/* set lifetime and clear NOPATH bit */
|
||||||
rep->state.lifetime = RPL_LIFETIME(instance, lifetime);
|
rep->state.lifetime = RPL_LIFETIME(instance, lifetime);
|
||||||
|
RPL_ROUTE_CLEAR_NOPATH_RECEIVED(rep);
|
||||||
|
|
||||||
#if RPL_CONF_MULTICAST
|
#if RPL_CONF_MULTICAST
|
||||||
fwd_dao:
|
fwd_dao:
|
||||||
|
@ -978,15 +981,13 @@ dao_output(rpl_parent_t *parent, uint8_t lifetime)
|
||||||
|
|
||||||
/* Sending a DAO with own prefix as target */
|
/* Sending a DAO with own prefix as target */
|
||||||
dao_output_target(parent, &prefix, lifetime);
|
dao_output_target(parent, &prefix, lifetime);
|
||||||
/* keep track of my own sending of DAO for handling ack and loss of ack */
|
|
||||||
instance->my_dao_seqno = dao_sequence;
|
|
||||||
|
|
||||||
#if RPL_WITH_DAO_ACK
|
#if RPL_WITH_DAO_ACK
|
||||||
|
/* keep track of my own sending of DAO for handling ack and loss of ack */
|
||||||
|
if(lifetime != RPL_ZERO_LIFETIME) {
|
||||||
|
instance->my_dao_seqno = dao_sequence;
|
||||||
instance->my_dao_transmissions = 1;
|
instance->my_dao_transmissions = 1;
|
||||||
ctimer_set(&instance->dao_retransmit_timer, RPL_DAO_RETRANSMISSION_TIMEOUT,
|
ctimer_set(&instance->dao_retransmit_timer, RPL_DAO_RETRANSMISSION_TIMEOUT,
|
||||||
handle_dao_retransmission, parent);
|
handle_dao_retransmission, parent);
|
||||||
if(lifetime == RPL_ZERO_LIFETIME) {
|
|
||||||
rpl_set_downward_link(0);
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/* We know that we have tried to register so now we are assuming
|
/* We know that we have tried to register so now we are assuming
|
||||||
|
|
|
@ -238,6 +238,8 @@ rpl_add_route(rpl_dag_t *dag, uip_ipaddr_t *prefix, int prefix_len,
|
||||||
|
|
||||||
rep->state.dag = dag;
|
rep->state.dag = dag;
|
||||||
rep->state.lifetime = RPL_LIFETIME(dag->instance, dag->instance->default_lifetime);
|
rep->state.lifetime = RPL_LIFETIME(dag->instance, dag->instance->default_lifetime);
|
||||||
|
/* always clear state flags for the no-path received when adding/refreshing */
|
||||||
|
RPL_ROUTE_CLEAR_NOPATH_RECEIVED(rep);
|
||||||
|
|
||||||
PRINTF("RPL: Added a route to ");
|
PRINTF("RPL: Added a route to ");
|
||||||
PRINT6ADDR(prefix);
|
PRINT6ADDR(prefix);
|
||||||
|
|
Loading…
Reference in a new issue