net: contiki: Add NULL check to neighbor polling

The function is getting called with NULL bufs, so uip_len cannot be
called on them. The stack further down handles NULL buffers correctly.

Jira: ZEP-474

Change-Id: I85fb045ec76bea2a83c64d0f72eabba4e661f5f4
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
This commit is contained in:
Jaakko Hannikainen 2016-08-01 15:04:59 +03:00 committed by Inaky Perez-Gonzalez
commit 2652c0e5a9

View file

@ -273,7 +273,7 @@ uip_ds6_neighbor_periodic(struct net_buf *buf)
case NBR_INCOMPLETE:
if(nbr->nscount >= UIP_ND6_MAX_MULTICAST_SOLICIT) {
uip_ds6_nbr_rm(nbr);
} else if(stimer_expired(&nbr->sendns) && (uip_len(buf) == 0)) {
} else if(stimer_expired(&nbr->sendns) && (!buf || uip_len(buf) == 0)) {
nbr->nscount++;
PRINTF("NBR_INCOMPLETE: NS %u\n", nbr->nscount);
uip_nd6_ns_output(buf, NULL, NULL, &nbr->ipaddr);
@ -298,7 +298,7 @@ uip_ds6_neighbor_periodic(struct net_buf *buf)
}
}
uip_ds6_nbr_rm(nbr);
} else if(stimer_expired(&nbr->sendns) && (uip_len(buf) == 0)) {
} else if(stimer_expired(&nbr->sendns) && (!buf || uip_len(buf) == 0)) {
nbr->nscount++;
PRINTF("PROBE: NS %u\n", nbr->nscount);
uip_nd6_ns_output(buf, NULL, &nbr->ipaddr, &nbr->ipaddr);