Removed redundant code and improve code style and documentation.

This commit is contained in:
nvt 2012-04-22 00:18:07 +02:00
parent e94718f95c
commit 534c734465
3 changed files with 38 additions and 40 deletions

View file

@ -155,7 +155,7 @@ dis_input(void)
PRINTF("\n");
for(instance = &instance_table[0], end = instance + RPL_MAX_INSTANCES; instance < end; ++instance) {
if(instance->used == 1 ) {
if(instance->used == 1) {
#if RPL_LEAF_ONLY
if(!uip_is_addr_mcast(&UIP_IP_BUF->destipaddr)) {
#else /* !RPL_LEAF_ONLY */
@ -177,7 +177,7 @@ dis_output(uip_ipaddr_t *addr)
unsigned char *buffer;
uip_ipaddr_t tmpaddr;
/* DAG Information Solicitation - 2 bytes reserved */
/* DAG Information Solicitation - 2 bytes reserved */
/* 0 1 2 */
/* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 */
/* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
@ -188,12 +188,14 @@ dis_output(uip_ipaddr_t *addr)
buffer[0] = buffer[1] = 0;
if(addr == NULL) {
PRINTF("RPL: Sending a DIS\n");
uip_create_linklocal_rplnodes_mcast(&tmpaddr);
addr = &tmpaddr;
} else {
PRINTF("RPL: Sending a unicast DIS\n");
}
PRINTF("RPL: Sending a DIS to ");
PRINT6ADDR(addr);
PRINTF("\n");
uip_icmp6_send(addr, ICMP6_RPL, RPL_CODE_DIS, 2);
}
/*---------------------------------------------------------------------------*/
@ -410,7 +412,8 @@ dio_output(rpl_instance_t *instance, uip_ipaddr_t *uc_addr)
#endif /* !RPL_LEAF_ONLY */
#if RPL_LEAF_ONLY
/* only respond to unicast DIS */
/* In leaf mode, we send DIO message only as unicasts in response to
unicast DIS messages. */
if(uc_addr == NULL) {
return;
}