Make sure our parent's IP address isn't NULL.

This commit is contained in:
Adam Dunkels 2013-08-12 00:11:48 +02:00 committed by Simon Duquennoy
parent e5a6565137
commit 4d0ecaae02

View File

@ -720,7 +720,8 @@ dao_input(void)
rep->state.learned_from = learned_from; rep->state.learned_from = learned_from;
if(learned_from == RPL_ROUTE_FROM_UNICAST_DAO) { if(learned_from == RPL_ROUTE_FROM_UNICAST_DAO) {
if(dag->preferred_parent) { if(dag->preferred_parent != NULL &&
rpl_get_parent_ipaddr(dag->preferred_parent) != NULL) {
PRINTF("RPL: Forwarding DAO to parent "); PRINTF("RPL: Forwarding DAO to parent ");
PRINT6ADDR(rpl_get_parent_ipaddr(dag->preferred_parent)); PRINT6ADDR(rpl_get_parent_ipaddr(dag->preferred_parent));
PRINTF("\n"); PRINTF("\n");
@ -828,7 +829,9 @@ dao_output_target(rpl_parent_t *parent, uip_ipaddr_t *prefix, uint8_t lifetime)
PRINT6ADDR(rpl_get_parent_ipaddr(parent)); PRINT6ADDR(rpl_get_parent_ipaddr(parent));
PRINTF("\n"); PRINTF("\n");
uip_icmp6_send(rpl_get_parent_ipaddr(parent), ICMP6_RPL, RPL_CODE_DAO, pos); if(rpl_get_parent_ipaddr(parent) != NULL) {
uip_icmp6_send(rpl_get_parent_ipaddr(parent), ICMP6_RPL, RPL_CODE_DAO, pos);
}
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void static void