1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

debug output when joining a dodag

This commit is contained in:
Oleg Hahm 2013-11-22 23:59:33 +01:00
parent c16a3ed511
commit 7c95a1d44c
2 changed files with 22 additions and 0 deletions

View File

@ -286,9 +286,13 @@ void send_DIO(ipv6_addr_t *destination)
rpl_send_dio_buf = get_rpl_send_dio_buf();
memset(rpl_send_dio_buf, 0, sizeof(*rpl_send_dio_buf));
DEBUG("Sending DIO with ");
rpl_send_dio_buf->rpl_instanceid = mydodag->instance->id;
DEBUG("instance %02X ", rpl_send_dio_buf->rpl_instanceid);
rpl_send_dio_buf->version_number = mydodag->version;
rpl_send_dio_buf->rank = mydodag->my_rank;
DEBUG("rank %04X\n", rpl_send_dio_buf->rank);
rpl_send_dio_buf->g_mop_prf = (mydodag->grounded << RPL_GROUNDED_SHIFT) | (mydodag->mop << RPL_MOP_SHIFT) | mydodag->prf;
rpl_send_dio_buf->dtsn = mydodag->dtsn;
rpl_send_dio_buf->flags = 0;
@ -506,9 +510,12 @@ void rpl_process(void)
void recv_rpl_dio(void)
{
DEBUG("Received DIO with ");
ipv6_buf = get_rpl_ipv6_buf();
rpl_dio_buf = get_rpl_dio_buf();
DEBUG("instance %04X ", rpl_dio_buf->rpl_instanceid);
DEBUG("rank %04X\n", rpl_dio_buf->rank);
int len = DIO_BASE_LEN;
rpl_instance_t *dio_inst = rpl_get_instance(rpl_dio_buf->rpl_instanceid);
@ -517,12 +524,14 @@ void recv_rpl_dio(void)
if (dio_inst == NULL) {
if (my_inst != NULL) {
/* already part of a DODAG -> impossible to join other instance */
DEBUG("Not joining another DODAG!\n");
return;
}
dio_inst = rpl_new_instance(rpl_dio_buf->rpl_instanceid);
if (dio_inst == NULL) {
DEBUG("Failed to create a new RPL instance!\n");
return;
}
}
@ -555,6 +564,7 @@ void recv_rpl_dio(void)
* icmpv6 header, so only ICMPV6_HDR_LEN remains to be
* subtracted. */
while (len < (ipv6_buf->length - ICMPV6_HDR_LEN)) {
DEBUG("parsing DIO options\n");
rpl_opt_buf = get_rpl_opt_buf(len);
switch (rpl_opt_buf->type) {
@ -583,6 +593,7 @@ void recv_rpl_dio(void)
has_dodag_conf_opt = 1;
if (rpl_opt_buf->length != RPL_OPT_DODAG_CONF_LEN) {
DEBUG("DODAG configuration is malformed.\n");
/* error malformed */
return;
}

View File

@ -24,6 +24,9 @@
#include "rpl.h"
#define ENABLE_DEBUG (0)
#if ENABLE_DEBUG
char addr_str[IPV6_MAX_ADDR_STR_LEN];
#endif
#include "debug.h"
rpl_instance_t instances[RPL_MAX_INSTANCES];
@ -324,6 +327,14 @@ void rpl_join_dodag(rpl_dodag_t *dodag, ipv6_addr_t *parent, uint16_t parent_ran
my_dodag->my_rank = dodag->of->calc_rank(preferred_parent, dodag->my_rank);
my_dodag->dao_seq = RPL_COUNTER_INIT;
my_dodag->min_rank = my_dodag->my_rank;
DEBUG("Joint DODAG:\n");
DEBUG("\tMOP:\t%02X\n", my_dodag->mop);
DEBUG("\tminhoprankincrease :\t%04X\n", my_dodag->minhoprankincrease);
DEBUG("\tdefault_lifetime:\t%02X\n", my_dodag->default_lifetime);
DEBUG("\tgrounded:\t%02X\n", my_dodag->grounded);
DEBUG("\tmy_preferred_parent:\t%s\n", ipv6_addr_to_str(addr_str, &my_dodag->my_preferred_parent->addr));
DEBUG("\tmy_preferred_parent rank\t%02X\n", my_dodag->my_preferred_parent->rank);
DEBUG("\tmy_preferred_parent lifetime\t%04X\n", my_dodag->my_preferred_parent->lifetime);
start_trickle(my_dodag->dio_min, my_dodag->dio_interval_doubling, my_dodag->dio_redundancy);
delay_dao();