Merge pull request #718 from g-oikonomou/rpl-dodagid-compliance
Make DODAG ID selection RFC 6550-compliant
This commit is contained in:
commit
24e260910c
|
@ -234,7 +234,7 @@ struct rpl_instance {
|
||||||
/* Public RPL functions. */
|
/* Public RPL functions. */
|
||||||
void rpl_init(void);
|
void rpl_init(void);
|
||||||
void uip_rpl_input(void);
|
void uip_rpl_input(void);
|
||||||
rpl_dag_t *rpl_set_root(uint8_t instance_id, uip_ipaddr_t * dag_id);
|
rpl_dag_t *rpl_set_root(uint8_t instance_id, uip_ipaddr_t *dag_id);
|
||||||
int rpl_set_prefix(rpl_dag_t *dag, uip_ipaddr_t *prefix, unsigned len);
|
int rpl_set_prefix(rpl_dag_t *dag, uip_ipaddr_t *prefix, unsigned len);
|
||||||
int rpl_repair_root(uint8_t instance_id);
|
int rpl_repair_root(uint8_t instance_id);
|
||||||
int rpl_set_default_route(rpl_instance_t *instance, uip_ipaddr_t *from);
|
int rpl_set_default_route(rpl_instance_t *instance, uip_ipaddr_t *from);
|
||||||
|
|
|
@ -61,8 +61,6 @@
|
||||||
|
|
||||||
#define MAX_SENSORS 4
|
#define MAX_SENSORS 4
|
||||||
|
|
||||||
uint16_t dag_id[] = {0x1111, 0x1100, 0, 0, 0, 0, 0, 0x0011};
|
|
||||||
|
|
||||||
extern long slip_sent;
|
extern long slip_sent;
|
||||||
extern long slip_received;
|
extern long slip_received;
|
||||||
|
|
||||||
|
@ -290,6 +288,7 @@ border_router_set_sensors(const char *data, int len)
|
||||||
static void
|
static void
|
||||||
set_prefix_64(const uip_ipaddr_t *prefix_64)
|
set_prefix_64(const uip_ipaddr_t *prefix_64)
|
||||||
{
|
{
|
||||||
|
rpl_dag_t *dag;
|
||||||
uip_ipaddr_t ipaddr;
|
uip_ipaddr_t ipaddr;
|
||||||
memcpy(&prefix, prefix_64, 16);
|
memcpy(&prefix, prefix_64, 16);
|
||||||
memcpy(&ipaddr, prefix_64, 16);
|
memcpy(&ipaddr, prefix_64, 16);
|
||||||
|
@ -297,12 +296,17 @@ set_prefix_64(const uip_ipaddr_t *prefix_64)
|
||||||
prefix_set = 1;
|
prefix_set = 1;
|
||||||
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
|
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
|
||||||
uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);
|
uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);
|
||||||
|
|
||||||
|
dag = rpl_set_root(RPL_DEFAULT_INSTANCE, &ipaddr);
|
||||||
|
if(dag != NULL) {
|
||||||
|
rpl_set_prefix(dag, &prefix, 64);
|
||||||
|
PRINTF("created a new RPL dag\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
PROCESS_THREAD(border_router_process, ev, data)
|
PROCESS_THREAD(border_router_process, ev, data)
|
||||||
{
|
{
|
||||||
static struct etimer et;
|
static struct etimer et;
|
||||||
rpl_dag_t *dag;
|
|
||||||
|
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
prefix_set = 0;
|
prefix_set = 0;
|
||||||
|
@ -336,12 +340,6 @@ PROCESS_THREAD(border_router_process, ev, data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dag = rpl_set_root(RPL_DEFAULT_INSTANCE,(uip_ip6addr_t *)dag_id);
|
|
||||||
if(dag != NULL) {
|
|
||||||
rpl_set_prefix(dag, &prefix, 64);
|
|
||||||
PRINTF("created a new RPL dag\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
print_local_addresses();
|
print_local_addresses();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -54,8 +54,6 @@
|
||||||
#define DEBUG DEBUG_NONE
|
#define DEBUG DEBUG_NONE
|
||||||
#include "net/ip/uip-debug.h"
|
#include "net/ip/uip-debug.h"
|
||||||
|
|
||||||
uint16_t dag_id[] = {0x1111, 0x1100, 0, 0, 0, 0, 0, 0x0011};
|
|
||||||
|
|
||||||
static uip_ipaddr_t prefix;
|
static uip_ipaddr_t prefix;
|
||||||
static uint8_t prefix_set;
|
static uint8_t prefix_set;
|
||||||
|
|
||||||
|
@ -320,18 +318,24 @@ request_prefix(void)
|
||||||
void
|
void
|
||||||
set_prefix_64(uip_ipaddr_t *prefix_64)
|
set_prefix_64(uip_ipaddr_t *prefix_64)
|
||||||
{
|
{
|
||||||
|
rpl_dag_t *dag;
|
||||||
uip_ipaddr_t ipaddr;
|
uip_ipaddr_t ipaddr;
|
||||||
memcpy(&prefix, prefix_64, 16);
|
memcpy(&prefix, prefix_64, 16);
|
||||||
memcpy(&ipaddr, prefix_64, 16);
|
memcpy(&ipaddr, prefix_64, 16);
|
||||||
prefix_set = 1;
|
prefix_set = 1;
|
||||||
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
|
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
|
||||||
uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);
|
uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);
|
||||||
|
|
||||||
|
dag = rpl_set_root(RPL_DEFAULT_INSTANCE, &ipaddr);
|
||||||
|
if(dag != NULL) {
|
||||||
|
rpl_set_prefix(dag, &prefix, 64);
|
||||||
|
PRINTF("created a new RPL dag\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
PROCESS_THREAD(border_router_process, ev, data)
|
PROCESS_THREAD(border_router_process, ev, data)
|
||||||
{
|
{
|
||||||
static struct etimer et;
|
static struct etimer et;
|
||||||
rpl_dag_t *dag;
|
|
||||||
|
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
|
@ -363,12 +367,6 @@ PROCESS_THREAD(border_router_process, ev, data)
|
||||||
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
|
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
|
||||||
}
|
}
|
||||||
|
|
||||||
dag = rpl_set_root(RPL_DEFAULT_INSTANCE,(uip_ip6addr_t *)dag_id);
|
|
||||||
if(dag != NULL) {
|
|
||||||
rpl_set_prefix(dag, &prefix, 64);
|
|
||||||
PRINTF("created a new RPL dag\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Now turn the radio on, but disable radio duty cycling.
|
/* Now turn the radio on, but disable radio duty cycling.
|
||||||
* Since we are the DAG root, reception delays would constrain mesh throughbut.
|
* Since we are the DAG root, reception delays would constrain mesh throughbut.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue