From e7cd04b558990690fc7c3d2589b05129b1d4cf84 Mon Sep 17 00:00:00 2001 From: Ivan Delamer Date: Wed, 1 Feb 2012 09:55:41 -0700 Subject: [PATCH] Bug fix: do not overwrite NS or RA messages otherwise generated in the same uip_ds6_periodic() call. --- core/net/uip-ds6.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/core/net/uip-ds6.c b/core/net/uip-ds6.c index 22ebea15a..1f54ca072 100644 --- a/core/net/uip-ds6.c +++ b/core/net/uip-ds6.c @@ -158,7 +158,8 @@ uip_ds6_periodic(void) #if UIP_ND6_DEF_MAXDADNS > 0 } else if((locaddr->state == ADDR_TENTATIVE) && (locaddr->dadnscount <= uip_ds6_if.maxdadns) - && (timer_expired(&locaddr->dadtimer))) { + && (timer_expired(&locaddr->dadtimer)) + && (uip_len == 0)) { uip_ds6_dad(locaddr); #endif /* UIP_ND6_DEF_MAXDADNS > 0 */ } @@ -195,7 +196,7 @@ uip_ds6_periodic(void) case NBR_INCOMPLETE: if(locnbr->nscount >= UIP_ND6_MAX_MULTICAST_SOLICIT) { uip_ds6_nbr_rm(locnbr); - } else if(stimer_expired(&locnbr->sendns)) { + } else if(stimer_expired(&locnbr->sendns) && (uip_len == 0)) { locnbr->nscount++; PRINTF("NBR_INCOMPLETE: NS %u\n", locnbr->nscount); uip_nd6_ns_output(NULL, NULL, &locnbr->ipaddr); @@ -211,7 +212,7 @@ uip_ds6_periodic(void) } break; case NBR_DELAY: - if(stimer_expired(&locnbr->reachable)) { + if(stimer_expired(&locnbr->reachable) && (uip_len == 0)) { locnbr->state = NBR_PROBE; locnbr->nscount = 1; 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_nbr_rm(locnbr); - } else if(stimer_expired(&locnbr->sendns)) { + } else if(stimer_expired(&locnbr->sendns) && (uip_len == 0)) { locnbr->nscount++; PRINTF("PROBE: NS %u\n", locnbr->nscount); 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 /* 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(); } #endif /* UIP_CONF_ROUTER & UIP_ND6_SEND_RA */