fixed clearing of state flag and avoid starting retransmission timer

This commit is contained in:
Joakim Eriksson 2015-10-02 07:38:52 +02:00
parent 8afe3fb9b7
commit 09c624dcd3
4 changed files with 26 additions and 19 deletions

View file

@ -106,6 +106,9 @@ void uip_ds6_notification_rm(struct uip_ds6_notification *n);
#define RPL_ROUTE_SET_NOPATH_RECEIVED(route) do { \
(route)->state.state_flags |= RPL_ROUTE_ENTRY_NOPATH_RECEIVED; \
} 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) \
((route->state.state_flags & RPL_ROUTE_ENTRY_DAO_PENDING) != 0)

View file

@ -201,6 +201,8 @@ ns_input(void)
#endif /*UIP_CONF_IPV6_CHECKS */
nbr = uip_ds6_nbr_lookup(&UIP_IP_BUF->srcipaddr);
if(nbr == NULL) {
uip_lladdr_t lladdr_aligned;
extract_lladdr_aligned(&lladdr_aligned);
uip_ds6_nbr_add(&UIP_IP_BUF->srcipaddr, &lladdr_aligned,
0, NBR_STALE, NBR_TABLE_REASON_IPV6_ND, NULL);
} else {
@ -642,8 +644,7 @@ rs_input(void)
uip_ds6_nbr_t nbr_data = *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, 0, NBR_STALE,
NBR_TABLE_REASON_IPV6_ND, NULL);
0, NBR_STALE, NBR_TABLE_REASON_IPV6_ND, NULL);
nbr->reachable = nbr_data.reachable;
nbr->sendns = nbr_data.sendns;
nbr->nscount = nbr_data.nscount;
@ -872,8 +873,8 @@ ra_input(void)
if(nbr == NULL) {
uip_lladdr_t lladdr_aligned;
extract_lladdr_aligned(&lladdr_aligned);
nbr = uip_ds6_nbr_add(&UIP_IP_BUF->srcipaddr, &lladdr_aligned, 1,
NBR_STALE, NBR_TABLE_REASON_IPV6_ND, NULL);
nbr = uip_ds6_nbr_add(&UIP_IP_BUF->srcipaddr, &lladdr_aligned,
1, NBR_STALE, NBR_TABLE_REASON_IPV6_ND, NULL);
} else {
uip_lladdr_t *lladdr = (uip_lladdr_t *)uip_ds6_nbr_get_ll(nbr);
if(nbr->state == NBR_INCOMPLETE) {

View file

@ -53,6 +53,7 @@
#include "net/rpl/rpl-private.h"
#include "net/packetbuf.h"
#include "net/ipv6/multicast/uip-mcast6.h"
#include "random.h"
#include <limits.h>
#include <string.h>
@ -811,12 +812,13 @@ dao_input(void)
uip_icmp6_send(rpl_get_parent_ipaddr(dag->preferred_parent),
ICMP6_RPL, RPL_CODE_DAO, buffer_length);
}
}
/* independent if we remove or not - ACK the request */
if(flags & RPL_DAO_K_FLAG) {
/* indicate that we accepted the no-path DAO */
dao_ack_output(instance, &dao_sender_addr, sequence,
RPL_DAO_ACK_UNCONDITIONAL_ACCEPT);
}
}
goto discard;
}
@ -851,8 +853,9 @@ dao_input(void)
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);
RPL_ROUTE_CLEAR_NOPATH_RECEIVED(rep);
#if RPL_CONF_MULTICAST
fwd_dao:
@ -978,15 +981,13 @@ dao_output(rpl_parent_t *parent, uint8_t lifetime)
/* Sending a DAO with own prefix as target */
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
/* 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;
ctimer_set(&instance->dao_retransmit_timer, RPL_DAO_RETRANSMISSION_TIMEOUT,
handle_dao_retransmission, parent);
if(lifetime == RPL_ZERO_LIFETIME) {
rpl_set_downward_link(0);
}
#else
/* We know that we have tried to register so now we are assuming

View file

@ -238,6 +238,8 @@ rpl_add_route(rpl_dag_t *dag, uip_ipaddr_t *prefix, int prefix_len,
rep->state.dag = dag;
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 ");
PRINT6ADDR(prefix);