DAD: Remove useless "if" that tests if the source address is unspecified

No need to do the unspecified address twice.

#if UIP_ND6_DEF_MAXDADNS > 0
    if(uip_is_addr_unspecified(&UIP_IP_BUF->srcipaddr)) {
      /* DAD CASE */
       ..........
#else /* UIP_ND6_DEF_MAXDADNS > 0 */
    if(uip_is_addr_unspecified(&UIP_IP_BUF->srcipaddr)) {
      /* DAD CASE */
      goto discard; 
#endif /* UIP_ND6_DEF_MAXDADNS > 0 */

this logic will bring confusion, especially if you analyze the other ND functions (NUD, address resolution)  .
This commit is contained in:
Mohamed Seliem 2016-09-10 10:56:19 +02:00 committed by GitHub
parent 8bf235ef86
commit 675d9325b9

View File

@ -238,9 +238,9 @@ ns_input(void)
addr = uip_ds6_addr_lookup(&UIP_ND6_NS_BUF->tgtipaddr);
if(addr != NULL) {
#if UIP_ND6_DEF_MAXDADNS > 0
if(uip_is_addr_unspecified(&UIP_IP_BUF->srcipaddr)) {
/* DAD CASE */
#if UIP_ND6_DEF_MAXDADNS > 0
#if UIP_CONF_IPV6_CHECKS
if(!uip_is_addr_solicited_node(&UIP_IP_BUF->destipaddr)) {
PRINTF("NS received is bad\n");
@ -258,9 +258,7 @@ ns_input(void)
goto discard;
}
#else /* UIP_ND6_DEF_MAXDADNS > 0 */
if(uip_is_addr_unspecified(&UIP_IP_BUF->srcipaddr)) {
/* DAD CASE */
goto discard;
goto discard; /* DAD CASE */
#endif /* UIP_ND6_DEF_MAXDADNS > 0 */
}
#if UIP_CONF_IPV6_CHECKS