RPL: fix a bug accessing an uninitialized pointer
This bug is uncovered when RPL_WITH_MULTICAST is enabled.
This commit is contained in:
parent
3559402781
commit
faeb71de00
|
@ -748,6 +748,11 @@ dao_input_storing(void)
|
||||||
|
|
||||||
#if RPL_WITH_MULTICAST
|
#if RPL_WITH_MULTICAST
|
||||||
if(uip_is_addr_mcast_global(&prefix)) {
|
if(uip_is_addr_mcast_global(&prefix)) {
|
||||||
|
/*
|
||||||
|
* "rep" is used for a unicast route which we don't need now; so set NULL so
|
||||||
|
* that operations on "rep" will be skipped.
|
||||||
|
*/
|
||||||
|
rep = NULL;
|
||||||
mcast_group = uip_mcast6_route_add(&prefix);
|
mcast_group = uip_mcast6_route_add(&prefix);
|
||||||
if(mcast_group) {
|
if(mcast_group) {
|
||||||
mcast_group->dag = dag;
|
mcast_group->dag = dag;
|
||||||
|
@ -844,29 +849,33 @@ fwd_dao:
|
||||||
int should_ack = 0;
|
int should_ack = 0;
|
||||||
|
|
||||||
if(flags & RPL_DAO_K_FLAG) {
|
if(flags & RPL_DAO_K_FLAG) {
|
||||||
/*
|
if(rep != NULL) {
|
||||||
* check if this route is already installed and we can ack now!
|
/*
|
||||||
* not pending - and same seq-no means that we can ack.
|
* check if this route is already installed and we can ack now!
|
||||||
* (e.g. the route is installed already so it will not take any
|
* not pending - and same seq-no means that we can ack.
|
||||||
* more room that it already takes - so should be ok!)
|
* (e.g. the route is installed already so it will not take any
|
||||||
*/
|
* more room that it already takes - so should be ok!)
|
||||||
if((!RPL_ROUTE_IS_DAO_PENDING(rep) &&
|
*/
|
||||||
rep->state.dao_seqno_in == sequence) ||
|
if((!RPL_ROUTE_IS_DAO_PENDING(rep) &&
|
||||||
dag->rank == ROOT_RANK(instance)) {
|
rep->state.dao_seqno_in == sequence) ||
|
||||||
should_ack = 1;
|
dag->rank == ROOT_RANK(instance)) {
|
||||||
|
should_ack = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dag->preferred_parent != NULL &&
|
if(dag->preferred_parent != NULL &&
|
||||||
rpl_get_parent_ipaddr(dag->preferred_parent) != NULL) {
|
rpl_get_parent_ipaddr(dag->preferred_parent) != NULL) {
|
||||||
uint8_t out_seq = 0;
|
uint8_t out_seq = 0;
|
||||||
/* if this is pending and we get the same seq no it is a retrans */
|
if(rep != NULL) {
|
||||||
if(RPL_ROUTE_IS_DAO_PENDING(rep) &&
|
/* if this is pending and we get the same seq no it is a retrans */
|
||||||
rep->state.dao_seqno_in == sequence) {
|
if(RPL_ROUTE_IS_DAO_PENDING(rep) &&
|
||||||
/* keep the same seq-no as before for parent also */
|
rep->state.dao_seqno_in == sequence) {
|
||||||
out_seq = rep->state.dao_seqno_out;
|
/* keep the same seq-no as before for parent also */
|
||||||
} else {
|
out_seq = rep->state.dao_seqno_out;
|
||||||
out_seq = prepare_for_dao_fwd(sequence, rep);
|
} else {
|
||||||
|
out_seq = prepare_for_dao_fwd(sequence, rep);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINTF("RPL: Forwarding DAO to parent ");
|
PRINTF("RPL: Forwarding DAO to parent ");
|
||||||
|
|
Loading…
Reference in a new issue