mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-22 10:30:13 +00:00
Make DODAG ID selection RFC 6550-compliant
Some calls to `rpl_set_root` select a hardcoded DODAG ID (0x1111, 0x1100, 0, 0, 0, 0, 0, 0x0011) This is against what RFC 6550 says. We change these calls to select a DODAG ID corresponding to a routable v6 address corresponding to the root
This commit is contained in:
parent
32bc98b0da
commit
a9e7bea675
@ -61,8 +61,6 @@
|
||||
|
||||
#define MAX_SENSORS 4
|
||||
|
||||
uint16_t dag_id[] = {0x1111, 0x1100, 0, 0, 0, 0, 0, 0x0011};
|
||||
|
||||
extern long slip_sent;
|
||||
extern long slip_received;
|
||||
|
||||
@ -290,6 +288,7 @@ border_router_set_sensors(const char *data, int len)
|
||||
static void
|
||||
set_prefix_64(const uip_ipaddr_t *prefix_64)
|
||||
{
|
||||
rpl_dag_t *dag;
|
||||
uip_ipaddr_t ipaddr;
|
||||
memcpy(&prefix, prefix_64, 16);
|
||||
memcpy(&ipaddr, prefix_64, 16);
|
||||
@ -297,12 +296,17 @@ set_prefix_64(const uip_ipaddr_t *prefix_64)
|
||||
prefix_set = 1;
|
||||
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
|
||||
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)
|
||||
{
|
||||
static struct etimer et;
|
||||
rpl_dag_t *dag;
|
||||
|
||||
PROCESS_BEGIN();
|
||||
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
|
||||
print_local_addresses();
|
||||
#endif
|
||||
|
@ -54,8 +54,6 @@
|
||||
#define DEBUG DEBUG_NONE
|
||||
#include "net/ip/uip-debug.h"
|
||||
|
||||
uint16_t dag_id[] = {0x1111, 0x1100, 0, 0, 0, 0, 0, 0x0011};
|
||||
|
||||
static uip_ipaddr_t prefix;
|
||||
static uint8_t prefix_set;
|
||||
|
||||
@ -320,18 +318,24 @@ request_prefix(void)
|
||||
void
|
||||
set_prefix_64(uip_ipaddr_t *prefix_64)
|
||||
{
|
||||
rpl_dag_t *dag;
|
||||
uip_ipaddr_t ipaddr;
|
||||
memcpy(&prefix, prefix_64, 16);
|
||||
memcpy(&ipaddr, prefix_64, 16);
|
||||
prefix_set = 1;
|
||||
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
|
||||
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)
|
||||
{
|
||||
static struct etimer et;
|
||||
rpl_dag_t *dag;
|
||||
|
||||
PROCESS_BEGIN();
|
||||
|
||||
@ -363,12 +367,6 @@ PROCESS_THREAD(border_router_process, ev, data)
|
||||
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.
|
||||
* Since we are the DAG root, reception delays would constrain mesh throughbut.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user