From 4d0ecaae0284b9d1f85b5186c1b4829b5b450d34 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Mon, 12 Aug 2013 00:11:48 +0200 Subject: [PATCH] Make sure our parent's IP address isn't NULL. --- core/net/rpl/rpl-icmp6.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/net/rpl/rpl-icmp6.c b/core/net/rpl/rpl-icmp6.c index 06f727e3a..1f3009555 100644 --- a/core/net/rpl/rpl-icmp6.c +++ b/core/net/rpl/rpl-icmp6.c @@ -720,7 +720,8 @@ dao_input(void) rep->state.learned_from = learned_from; 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 "); PRINT6ADDR(rpl_get_parent_ipaddr(dag->preferred_parent)); 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)); 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