check if objective function is supported before adding as parent and creating a dag
This commit is contained in:
parent
552408b241
commit
24a38a3aa8
|
@ -938,6 +938,15 @@ rpl_join_instance(uip_ipaddr_t *from, rpl_dio_t *dio)
|
||||||
rpl_parent_t *p;
|
rpl_parent_t *p;
|
||||||
rpl_of_t *of;
|
rpl_of_t *of;
|
||||||
|
|
||||||
|
/* Determine the objective function by using the
|
||||||
|
objective code point of the DIO. */
|
||||||
|
of = rpl_find_of(dio->ocp);
|
||||||
|
if(of == NULL) {
|
||||||
|
PRINTF("RPL: DIO for DAG instance %u does not specify a supported OF: %u\n",
|
||||||
|
dio->instance_id, dio->ocp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
dag = rpl_alloc_dag(dio->instance_id, &dio->dag_id);
|
dag = rpl_alloc_dag(dio->instance_id, &dio->dag_id);
|
||||||
if(dag == NULL) {
|
if(dag == NULL) {
|
||||||
PRINTF("RPL: Failed to allocate a DAG object!\n");
|
PRINTF("RPL: Failed to allocate a DAG object!\n");
|
||||||
|
@ -958,17 +967,6 @@ rpl_join_instance(uip_ipaddr_t *from, rpl_dio_t *dio)
|
||||||
p->dtsn = dio->dtsn;
|
p->dtsn = dio->dtsn;
|
||||||
PRINTF("succeeded\n");
|
PRINTF("succeeded\n");
|
||||||
|
|
||||||
/* Determine the objective function by using the
|
|
||||||
objective code point of the DIO. */
|
|
||||||
of = rpl_find_of(dio->ocp);
|
|
||||||
if(of == NULL) {
|
|
||||||
PRINTF("RPL: DIO for DAG instance %u does not specify a supported OF\n",
|
|
||||||
dio->instance_id);
|
|
||||||
rpl_remove_parent(p);
|
|
||||||
instance->used = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Autoconfigure an address if this node does not already have an address
|
/* Autoconfigure an address if this node does not already have an address
|
||||||
with this prefix. */
|
with this prefix. */
|
||||||
if(dio->prefix_info.flags & UIP_ND6_RA_FLAG_AUTONOMOUS) {
|
if(dio->prefix_info.flags & UIP_ND6_RA_FLAG_AUTONOMOUS) {
|
||||||
|
|
Loading…
Reference in a new issue