subsys/net/ip/rpl.c
/* Return true if parent is kept, false if it is dropped */
Return true if parent is kept, false if it is dropped
Return true if parent is kept false if it is dropped
static bool net_rpl_process_parent_event(struct net_if *iface,
					 struct net_rpl_instance *instance,
					 struct net_rpl_parent *parent)
{
	bool ret = true;
#if defined(CONFIG_NET_DEBUG_RPL)
	u16_t old_rank = instance->current_dag->rank;
#endif
	if (!acceptable_rank(parent->dag, parent->rank)) {
		NET_DBG("Unacceptable rank %u", parent->rank);
		net_rpl_nullify_parent(iface, parent);
		if (parent != instance->current_dag->preferred_parent) {
			return false;
		}
		ret = false;
	}
	if (!net_rpl_select_dag(iface, instance, parent)) {
		NET_DBG("No parents found in any DAG");
		net_rpl_local_repair(iface, instance);
		return false;
	}
#if defined(CONFIG_NET_DEBUG_RPL)
	if (NET_RPL_DAG_RANK(old_rank, instance) !=
	    NET_RPL_DAG_RANK(instance->current_dag->rank, instance)) {
		NET_DBG("Moving in the instance from rank %u to %u",
			NET_RPL_DAG_RANK(old_rank, instance),
			NET_RPL_DAG_RANK(instance->current_dag->rank,
					 instance));
		if (instance->current_dag->rank != NET_RPL_INFINITE_RANK) {
			NET_DBG("The preferred parent is %s (rank %u)",
				net_sprint_ipv6_addr(
					net_rpl_get_parent_addr(iface,
						instance->current_dag->
						preferred_parent)),
				NET_RPL_DAG_RANK(instance->current_dag->
						 preferred_parent->rank,
						 instance));
		} else {
			NET_DBG("We don't have any parent");
		}
	}
#endif 
	return ret;
}
static bool net_rpl_process_parent_event ( struct net_if * iface , struct net_rpl_instance * instance , struct net_rpl_parent * parent ) { bool ret = true ; #if defined ( CONFIG_NET_DEBUG_RPL ) u16_t old_rank = instance -> current_dag -> rank ; #endif if ( ! acceptable_rank ( parent -> dag , parent -> rank ) ) { NET_DBG ( " " , parent -> rank ) ; net_rpl_nullify_parent ( iface , parent ) ; if ( parent != instance -> current_dag -> preferred_parent ) { return false ; } ret = false ; } if ( ! net_rpl_select_dag ( iface , instance , parent ) ) { NET_DBG ( " " ) ; net_rpl_local_repair ( iface , instance ) ; return false ; } #if defined ( CONFIG_NET_DEBUG_RPL ) if ( NET_RPL_DAG_RANK ( old_rank , instance ) != NET_RPL_DAG_RANK ( instance -> current_dag -> rank , instance ) ) { NET_DBG ( " " , NET_RPL_DAG_RANK ( old_rank , instance ) , NET_RPL_DAG_RANK ( instance -> current_dag -> rank , instance ) ) ; if ( instance -> current_dag -> rank != NET_RPL_INFINITE_RANK ) { NET_DBG ( " " , net_sprint_ipv6_addr ( net_rpl_get_parent_addr ( iface , instance -> current_dag -> preferred_parent ) ) , NET_RPL_DAG_RANK ( instance -> current_dag -> preferred_parent -> rank , instance ) ) ; } else { NET_DBG ( " " ) ; } } #endif return ret ; }
Return true if parent is kept, false if it is dropped
Return true if parent is kept false if it is dropped
/* The candidate parent is no longer valid: the rank increase
		 * resulting from the choice of it as a parent would be too
		 * high.
		 */ /* No suitable parent; trigger a local repair. */ /* CONFIG_NET_DEBUG_RPL */