Bug fix: do not overwrite NS or RA messages otherwise generated in the

same uip_ds6_periodic() call.
This commit is contained in:
Ivan Delamer 2012-02-01 09:55:41 -07:00
parent 02d3fd4758
commit e7cd04b558

View file

@ -158,7 +158,8 @@ uip_ds6_periodic(void)
#if UIP_ND6_DEF_MAXDADNS > 0 #if UIP_ND6_DEF_MAXDADNS > 0
} else if((locaddr->state == ADDR_TENTATIVE) } else if((locaddr->state == ADDR_TENTATIVE)
&& (locaddr->dadnscount <= uip_ds6_if.maxdadns) && (locaddr->dadnscount <= uip_ds6_if.maxdadns)
&& (timer_expired(&locaddr->dadtimer))) { && (timer_expired(&locaddr->dadtimer))
&& (uip_len == 0)) {
uip_ds6_dad(locaddr); uip_ds6_dad(locaddr);
#endif /* UIP_ND6_DEF_MAXDADNS > 0 */ #endif /* UIP_ND6_DEF_MAXDADNS > 0 */
} }
@ -195,7 +196,7 @@ uip_ds6_periodic(void)
case NBR_INCOMPLETE: case NBR_INCOMPLETE:
if(locnbr->nscount >= UIP_ND6_MAX_MULTICAST_SOLICIT) { if(locnbr->nscount >= UIP_ND6_MAX_MULTICAST_SOLICIT) {
uip_ds6_nbr_rm(locnbr); uip_ds6_nbr_rm(locnbr);
} else if(stimer_expired(&locnbr->sendns)) { } else if(stimer_expired(&locnbr->sendns) && (uip_len == 0)) {
locnbr->nscount++; locnbr->nscount++;
PRINTF("NBR_INCOMPLETE: NS %u\n", locnbr->nscount); PRINTF("NBR_INCOMPLETE: NS %u\n", locnbr->nscount);
uip_nd6_ns_output(NULL, NULL, &locnbr->ipaddr); uip_nd6_ns_output(NULL, NULL, &locnbr->ipaddr);
@ -211,7 +212,7 @@ uip_ds6_periodic(void)
} }
break; break;
case NBR_DELAY: case NBR_DELAY:
if(stimer_expired(&locnbr->reachable)) { if(stimer_expired(&locnbr->reachable) && (uip_len == 0)) {
locnbr->state = NBR_PROBE; locnbr->state = NBR_PROBE;
locnbr->nscount = 1; locnbr->nscount = 1;
PRINTF("DELAY: moving to PROBE + NS %u\n", locnbr->nscount); PRINTF("DELAY: moving to PROBE + NS %u\n", locnbr->nscount);
@ -226,7 +227,7 @@ uip_ds6_periodic(void)
uip_ds6_defrt_rm(locdefrt); uip_ds6_defrt_rm(locdefrt);
} }
uip_ds6_nbr_rm(locnbr); uip_ds6_nbr_rm(locnbr);
} else if(stimer_expired(&locnbr->sendns)) { } else if(stimer_expired(&locnbr->sendns) && (uip_len == 0)) {
locnbr->nscount++; locnbr->nscount++;
PRINTF("PROBE: NS %u\n", locnbr->nscount); PRINTF("PROBE: NS %u\n", locnbr->nscount);
uip_nd6_ns_output(NULL, &locnbr->ipaddr, &locnbr->ipaddr); uip_nd6_ns_output(NULL, &locnbr->ipaddr, &locnbr->ipaddr);
@ -241,7 +242,7 @@ uip_ds6_periodic(void)
#if UIP_CONF_ROUTER & UIP_ND6_SEND_RA #if UIP_CONF_ROUTER & UIP_ND6_SEND_RA
/* Periodic RA sending */ /* Periodic RA sending */
if(stimer_expired(&uip_ds6_timer_ra)) { if(stimer_expired(&uip_ds6_timer_ra) && (uip_len == 0)) {
uip_ds6_send_ra_periodic(); uip_ds6_send_ra_periodic();
} }
#endif /* UIP_CONF_ROUTER & UIP_ND6_SEND_RA */ #endif /* UIP_CONF_ROUTER & UIP_ND6_SEND_RA */