Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpl: pass dodag to the rpl_find_parent function #2644

Merged
merged 1 commit into from
Mar 20, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sys/net/include/rpl/rpl_dodag.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ rpl_dodag_t *rpl_get_my_dodag(void);
void rpl_join_dodag(rpl_dodag_t *dodag, ipv6_addr_t *parent, uint16_t parent_rank);
void rpl_del_dodag(rpl_dodag_t *dodag);
rpl_parent_t *rpl_new_parent(rpl_dodag_t *dodag, ipv6_addr_t *address, uint16_t rank);
rpl_parent_t *rpl_find_parent(ipv6_addr_t *address);
rpl_parent_t *rpl_find_parent(rpl_dodag_t *dodag, ipv6_addr_t *address);
void rpl_leave_dodag(rpl_dodag_t *dodag);
bool rpl_equal_id(ipv6_addr_t *id1, ipv6_addr_t *id2);
ipv6_addr_t *rpl_get_my_preferred_parent(void);
Expand Down
2 changes: 1 addition & 1 deletion sys/net/routing/rpl/rpl_control_messages.c
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ void rpl_recv_DIO(void)
/********************* Parent Handling *********************/

rpl_parent_t *parent;
parent = rpl_find_parent(&ipv6_buf->srcaddr);
parent = rpl_find_parent(my_dodag, &ipv6_buf->srcaddr);

if (parent == NULL) {
/* add new parent candidate */
Expand Down
7 changes: 5 additions & 2 deletions sys/net/routing/rpl/rpl_dodag.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,16 @@ rpl_parent_t *rpl_new_parent(rpl_dodag_t *dodag, ipv6_addr_t *address, uint16_t
return rpl_new_parent(dodag, address, rank);
}

rpl_parent_t *rpl_find_parent(ipv6_addr_t *address)
rpl_parent_t *rpl_find_parent(rpl_dodag_t *dodag, ipv6_addr_t *address)
{
rpl_parent_t *parent;
rpl_parent_t *end;

for (parent = &parents[0], end = parents + RPL_MAX_PARENTS; parent < end; parent++) {
if ((parent->used) && (rpl_equal_id(address, &parent->addr))) {
if ((parent->used) && (rpl_equal_id(address, &parent->addr)
&& (parent->dodag->instance->id == dodag->instance->id)
&& (!memcmp(&parent->dodag->dodag_id,
&dodag->dodag_id, sizeof(ipv6_addr_t))))) {
return parent;
}
}
Expand Down