Skip to content

Commit

Permalink
Merge pull request #2 from gebart/spr/cgundogan/ng_rpl_fib/rpl-ocp-de…
Browse files Browse the repository at this point in the history
…fault

sys/net/routing/ng_rpl: Add default case for missing OCP implementation
  • Loading branch information
cgundogan committed Jul 22, 2015
2 parents 700f6b5 + 2a8580e commit b9cd22a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions sys/net/routing/ng_rpl/ng_rpl_control_messages.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,16 +193,21 @@ void _parse_options(ng_rpl_dodag_t *dodag, ng_rpl_opt_t *opt, uint16_t len, ng_i
case (NG_RPL_OPT_DODAG_CONF): {
DEBUG("RPL: DODAG CONF DIO option parsed\n");
ng_rpl_opt_dodag_conf_t *dc = (ng_rpl_opt_dodag_conf_t *) opt;
ng_rpl_of_t *of = ng_rpl_get_of_for_ocp(byteorder_ntohs(dc->ocp));
if (of != NULL) {
dodag->instance->of = of;
}
else {
DEBUG("RPL: Unsupported OCP 0x%02x\n", dc->ocp);
dodag->instance->of = ng_rpl_get_of_for_ocp(NG_RPL_DEFAULT_OCP);
}
dodag->dio_interval_doubl = dc->dio_int_doubl;
dodag->dio_min = dc->dio_int_min;
dodag->dio_redun = dc->dio_redun;
dodag->instance->max_rank_inc = byteorder_ntohs(dc->max_rank_inc);
dodag->instance->min_hop_rank_inc = byteorder_ntohs(dc->min_hop_rank_inc);
dodag->default_lifetime = dc->default_lifetime;
dodag->lifetime_unit = byteorder_ntohs(dc->lifetime_unit);
dodag->instance->of =
(ng_rpl_of_t *) ng_rpl_get_of_for_ocp(byteorder_ntohs(dc->ocp));

dodag->trickle.Imin = (1 << dodag->dio_min);
dodag->trickle.Imax = dodag->dio_interval_doubl;
dodag->trickle.k = dodag->dio_redun;
Expand Down Expand Up @@ -262,7 +267,7 @@ void ng_rpl_recv_DIO(ng_rpl_dio_t *dio, ng_ipv6_addr_t *src, uint16_t len)

if (ng_rpl_instance_add(dio->instance_id, &inst)) {
inst->mop = (dio->g_mop_prf >> NG_RPL_MOP_SHIFT) & NG_RPL_SHIFTED_MOP_MASK;
inst->of = (ng_rpl_of_t *) ng_rpl_get_of_for_ocp(NG_RPL_DEFAULT_OCP);
inst->of = ng_rpl_get_of_for_ocp(NG_RPL_DEFAULT_OCP);
}
else if (inst == NULL) {
DEBUG("RPL: Could not allocate a new instance.\n");
Expand Down

0 comments on commit b9cd22a

Please sign in to comment.