Skip to content

Commit

Permalink
Merge pull request #2608 from cgundogan/rpl_make_send_DAO_aware_of_mu…
Browse files Browse the repository at this point in the history
…ltiple_dodags

rpl: make send_DAO aware of multiple dodags
  • Loading branch information
OlegHahm committed Mar 18, 2015
2 parents f228586 + f840830 commit dd0a649
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
10 changes: 6 additions & 4 deletions sys/net/include/rpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,16 @@ void rpl_send_DIO(rpl_dodag_t *dodag, ipv6_addr_t *destination);
/**
* @brief Sends a DAO-message to a given destination
*
* This function sends a DAO message to a given destination.
* This function sends a DAO message to a given destination in a given dodag.
*
* @param[in] dodag Dodag of the DAO-message.
* @param[in] destination IPv6-address of the destination of the DAO. Should be the preferred parent.
* @param[in] lifetime Lifetime of the node. Reflect the estimated time of presence in the network.
* @param[in] default_lifetime If true, param lifetime is ignored and lifetime is dodag default-lifetime
* @param[in] start_index Describes whether a DAO must be split because of too many routing entries.
*
*/
void rpl_send_DAO(ipv6_addr_t *destination, uint8_t lifetime, bool default_lifetime, uint8_t start_index);
void rpl_send_DAO(rpl_dodag_t *dodag, ipv6_addr_t *destination, uint8_t lifetime, bool default_lifetime, uint8_t start_index);

/**
* @brief Sends a DIS-message to a given destination
Expand All @@ -129,12 +130,13 @@ void rpl_send_DIS(ipv6_addr_t *destination);
/**
* @brief Sends a DAO acknowledgment-message to a given destination
*
* This function sends a DAO_ACK message to a given destination.
* This function sends a DAO_ACK message to a given destination in a given dodag.
*
* @param[in] dodag Dodag of the DAO_ACK message.
* @param[in] destination IPv6-address of the destination of the DAO_ACK. Should be a direct neighbor.
*
*/
void rpl_send_DAO_ACK(ipv6_addr_t *destination);
void rpl_send_DAO_ACK(rpl_dodag_t *dodag, ipv6_addr_t *destination);
#endif

/**
Expand Down
2 changes: 1 addition & 1 deletion sys/net/routing/rpl/rpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ void _dao_handle_send(rpl_dodag_t *dodag)
{
if ((dodag->ack_received == false) && (dodag->dao_counter < DAO_SEND_RETRIES)) {
dodag->dao_counter++;
rpl_send_DAO(NULL, 0, true, 0);
rpl_send_DAO(dodag, NULL, 0, true, 0);
dodag->dao_time = timex_set(DEFAULT_WAIT_FOR_DAO_ACK, 0);
vtimer_remove(&dodag->dao_timer);
vtimer_set_msg(&dodag->dao_timer, dodag->dao_time,
Expand Down
17 changes: 6 additions & 11 deletions sys/net/routing/rpl/rpl_control_messages.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ void rpl_send_DIO(rpl_dodag_t *mydodag, ipv6_addr_t *destination)
rpl_send(destination, (uint8_t *)icmp_send_buf, plen, IPV6_PROTO_NUM_ICMPV6);
}

void rpl_send_DAO(ipv6_addr_t *destination, uint8_t lifetime, bool default_lifetime,
void rpl_send_DAO(rpl_dodag_t *my_dodag, ipv6_addr_t *destination, uint8_t lifetime, bool default_lifetime,
uint8_t start_index)
{
#if RPL_DEFAULT_MOP == RPL_MOP_NON_STORING_MODE
Expand All @@ -346,9 +346,7 @@ void rpl_send_DAO(ipv6_addr_t *destination, uint8_t lifetime, bool default_lifet
return;
}

rpl_dodag_t *my_dodag;

if ((my_dodag = rpl_get_my_dodag()) == NULL) {
if (my_dodag == NULL) {
DEBUGF("send_DAO: I have no my_dodag\n");
return;
}
Expand Down Expand Up @@ -442,7 +440,7 @@ void rpl_send_DAO(ipv6_addr_t *destination, uint8_t lifetime, bool default_lifet

#if RPL_DEFAULT_MOP == RPL_MOP_NON_STORING_MODE
rpl_send_opt_transit_buf->length = RPL_OPT_TRANSIT_LEN;
memcpy(&rpl_send_opt_transit_buf->parent, rpl_get_my_preferred_parent(), sizeof(ipv6_addr_t));
memcpy(&rpl_send_opt_transit_buf->parent, &my_dodag->my_preferred_parent->addr, sizeof(ipv6_addr_t));
opt_len += RPL_OPT_TRANSIT_LEN_WITH_OPT_LEN;
#else
rpl_send_opt_transit_buf->length = (RPL_OPT_TRANSIT_LEN - sizeof(ipv6_addr_t));
Expand All @@ -455,7 +453,7 @@ void rpl_send_DAO(ipv6_addr_t *destination, uint8_t lifetime, bool default_lifet
#if RPL_DEFAULT_MOP != RPL_MOP_NON_STORING_MODE

if (continue_index > 1) {
rpl_send_DAO(destination, lifetime, default_lifetime, continue_index);
rpl_send_DAO(my_dodag, destination, lifetime, default_lifetime, continue_index);
}

#endif
Expand Down Expand Up @@ -483,7 +481,7 @@ void rpl_send_DIS(ipv6_addr_t *destination)
}

#if RPL_DEFAULT_MOP != RPL_MOP_NON_STORING_MODE
void rpl_send_DAO_ACK(ipv6_addr_t *destination)
void rpl_send_DAO_ACK(rpl_dodag_t *my_dodag, ipv6_addr_t *destination)
{
#if ENABLE_DEBUG

Expand All @@ -494,9 +492,6 @@ void rpl_send_DAO_ACK(ipv6_addr_t *destination)

#endif

rpl_dodag_t *my_dodag;
my_dodag = rpl_get_my_dodag();

if (my_dodag == NULL) {
return;
}
Expand Down Expand Up @@ -868,7 +863,7 @@ void rpl_recv_DAO(void)
}

#if RPL_DEFAULT_MOP != RPL_MOP_NON_STORING_MODE
rpl_send_DAO_ACK(&ipv6_buf->srcaddr);
rpl_send_DAO_ACK(my_dodag, &ipv6_buf->srcaddr);
#endif

if (increment_seq) {
Expand Down
2 changes: 1 addition & 1 deletion sys/net/routing/rpl/rpl_dodag.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ rpl_parent_t *rpl_find_preferred_parent(void)
if (!rpl_equal_id(&my_dodag->my_preferred_parent->addr, &best->addr)) {
if (my_dodag->mop != RPL_MOP_NO_DOWNWARD_ROUTES) {
/* send DAO with ZERO_LIFETIME to old parent */
rpl_send_DAO(&my_dodag->my_preferred_parent->addr, 0, false, 0);
rpl_send_DAO(my_dodag, &my_dodag->my_preferred_parent->addr, 0, false, 0);
}

my_dodag->my_preferred_parent = best;
Expand Down

0 comments on commit dd0a649

Please sign in to comment.