Merge pull request #2609 from cgundogan/rpl_make_send_DIO_aware_of_multiple_dodags

rpl: make send_DIO aware of multiple dodags
This commit is contained in:
Oleg Hahm 2015-03-18 17:16:33 +01:00
commit f228586d9f
3 changed files with 8 additions and 10 deletions

View File

@ -92,14 +92,15 @@ uint8_t rpl_init(int if_id, ipv6_addr_t *address);
void rpl_init_root(rpl_options_t *rpl_opts); void rpl_init_root(rpl_options_t *rpl_opts);
/** /**
* @brief Sends a DIO-message to a given destination * @brief Sends a DIO-message to a given destination in a given dodag
* *
* This function sends a DIO message to a given destination. * This function sends a DIO message to a given destination in a given dodag.
* *
* @param[in] dodag Dodag of the DIO-message.
* @param[in] destination IPv6-address of the destination of the DIO. Should be a direct neighbor. * @param[in] destination IPv6-address of the destination of the DIO. Should be a direct neighbor.
* *
*/ */
void rpl_send_DIO(ipv6_addr_t *destination); void rpl_send_DIO(rpl_dodag_t *dodag, ipv6_addr_t *destination);
/** /**
* @brief Sends a DAO-message to a given destination * @brief Sends a DAO-message to a given destination

View File

@ -257,7 +257,7 @@ uint8_t rpl_is_root(void)
return i_am_root; return i_am_root;
} }
void rpl_send_DIO(ipv6_addr_t *destination) void rpl_send_DIO(rpl_dodag_t *mydodag, ipv6_addr_t *destination)
{ {
#if ENABLE_DEBUG #if ENABLE_DEBUG
@ -266,11 +266,8 @@ void rpl_send_DIO(ipv6_addr_t *destination)
} }
#endif #endif
rpl_dodag_t *mydodag;
icmp_send_buf = get_rpl_send_icmpv6_buf(ipv6_ext_hdr_len); icmp_send_buf = get_rpl_send_icmpv6_buf(ipv6_ext_hdr_len);
mydodag = rpl_get_my_dodag();
if (mydodag == NULL) { if (mydodag == NULL) {
DEBUGF("Error - trying to send DIO without being part of a dodag.\n"); DEBUGF("Error - trying to send DIO without being part of a dodag.\n");
return; return;
@ -943,7 +940,7 @@ void rpl_recv_DIS(void)
} }
} }
rpl_send_DIO(&ipv6_buf->srcaddr); rpl_send_DIO(my_dodag, &ipv6_buf->srcaddr);
} }

View File

@ -37,11 +37,10 @@ static rpl_parent_t parents[RPL_MAX_PARENTS];
void rpl_trickle_send_dio(void *args) void rpl_trickle_send_dio(void *args)
{ {
(void) args;
ipv6_addr_t mcast; ipv6_addr_t mcast;
ipv6_addr_set_all_rpl_nodes_addr(&mcast); ipv6_addr_set_all_rpl_nodes_addr(&mcast);
rpl_send_DIO(&mcast); rpl_send_DIO((rpl_dodag_t *) args, &mcast);
} }
void rpl_instances_init(void) void rpl_instances_init(void)
@ -107,6 +106,7 @@ rpl_dodag_t *rpl_new_dodag(rpl_instance_t *inst, ipv6_addr_t *dodagid)
dodag->ack_received = true; dodag->ack_received = true;
dodag->dao_counter = 0; dodag->dao_counter = 0;
dodag->trickle.callback.func = &rpl_trickle_send_dio; dodag->trickle.callback.func = &rpl_trickle_send_dio;
dodag->trickle.callback.args = dodag;
memcpy(&dodag->dodag_id, dodagid, sizeof(*dodagid)); memcpy(&dodag->dodag_id, dodagid, sizeof(*dodagid));
return dodag; return dodag;
} }