Merge pull request #401 from yatch/pr/nbr-multi-ipv6-addrs
Introduce UIP_DS6_NBR_MULTI_IPV6_ADDRS
This commit is contained in:
commit
189fd594d3
@ -68,3 +68,4 @@ env:
|
|||||||
- TEST_NAME='compile-tools'
|
- TEST_NAME='compile-tools'
|
||||||
- TEST_NAME='native-runs'
|
- TEST_NAME='native-runs'
|
||||||
- TEST_NAME='ipv6' BUILD_COOJA=true
|
- TEST_NAME='ipv6' BUILD_COOJA=true
|
||||||
|
- TEST_NAME='ipv6-nbr' BUILD_COOJA=true
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
#include "httpd-simple.h"
|
#include "httpd-simple.h"
|
||||||
|
#include "net/ipv6/uip-ds6-nbr.h"
|
||||||
#include "net/ipv6/uip-ds6-route.h"
|
#include "net/ipv6/uip-ds6-route.h"
|
||||||
#include "batmon-sensor.h"
|
#include "batmon-sensor.h"
|
||||||
#include "lib/sensors.h"
|
#include "lib/sensors.h"
|
||||||
@ -436,8 +437,8 @@ PT_THREAD(generate_index(struct httpd_state *s))
|
|||||||
PT_WAIT_THREAD(&s->generate_pt,
|
PT_WAIT_THREAD(&s->generate_pt,
|
||||||
enqueue_chunk(s, 0, SECTION_OPEN "Neighbors" CONTENT_OPEN));
|
enqueue_chunk(s, 0, SECTION_OPEN "Neighbors" CONTENT_OPEN));
|
||||||
|
|
||||||
for(s->nbr = nbr_table_head(ds6_neighbors); s->nbr != NULL;
|
for(s->nbr = uip_ds6_nbr_head(); s->nbr != NULL;
|
||||||
s->nbr = nbr_table_next(ds6_neighbors, s->nbr)) {
|
s->nbr = uip_ds6_nbr_next(s->nbr)) {
|
||||||
|
|
||||||
PT_WAIT_THREAD(&s->generate_pt, enqueue_chunk(s, 0, "\n"));
|
PT_WAIT_THREAD(&s->generate_pt, enqueue_chunk(s, 0, "\n"));
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#include "contiki-net.h"
|
#include "contiki-net.h"
|
||||||
#include "net/ipv6/uip.h"
|
#include "net/ipv6/uip.h"
|
||||||
#include "net/ipv6/uip-ds6.h"
|
#include "net/ipv6/uip-ds6.h"
|
||||||
|
#include "net/ipv6/uip-ds6-nbr.h"
|
||||||
#include "net/routing/routing.h"
|
#include "net/routing/routing.h"
|
||||||
#include "dev/leds.h"
|
#include "dev/leds.h"
|
||||||
#include "ip64/ip64.h"
|
#include "ip64/ip64.h"
|
||||||
@ -142,9 +143,9 @@ PT_THREAD(generate_routes(struct httpd_state *s))
|
|||||||
#endif
|
#endif
|
||||||
ADD("Neighbors<pre>");
|
ADD("Neighbors<pre>");
|
||||||
|
|
||||||
for(nbr = nbr_table_head(ds6_neighbors);
|
for(nbr = uip_ds6_nbr_head();
|
||||||
nbr != NULL;
|
nbr != NULL;
|
||||||
nbr = nbr_table_next(ds6_neighbors, nbr)) {
|
nbr = uip_ds6_nbr_next(nbr)) {
|
||||||
|
|
||||||
#if WEBSERVER_CONF_NEIGHBOR_STATUS
|
#if WEBSERVER_CONF_NEIGHBOR_STATUS
|
||||||
#if BUF_USES_STACK
|
#if BUF_USES_STACK
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
#include "net/routing/routing.h"
|
#include "net/routing/routing.h"
|
||||||
|
#include "net/ipv6/uip-ds6-nbr.h"
|
||||||
#include "net/ipv6/uip-ds6-route.h"
|
#include "net/ipv6/uip-ds6-route.h"
|
||||||
#include "net/ipv6/uip-sr.h"
|
#include "net/ipv6/uip-sr.h"
|
||||||
|
|
||||||
@ -90,9 +91,9 @@ PT_THREAD(generate_routes(struct httpd_state *s))
|
|||||||
|
|
||||||
ADD(" Neighbors\n <ul>\n");
|
ADD(" Neighbors\n <ul>\n");
|
||||||
SEND(&s->sout);
|
SEND(&s->sout);
|
||||||
for(nbr = nbr_table_head(ds6_neighbors);
|
for(nbr = uip_ds6_nbr_head();
|
||||||
nbr != NULL;
|
nbr != NULL;
|
||||||
nbr = nbr_table_next(ds6_neighbors, nbr)) {
|
nbr = uip_ds6_nbr_next(nbr)) {
|
||||||
ADD(" <li>");
|
ADD(" <li>");
|
||||||
ipaddr_add(&nbr->ipaddr);
|
ipaddr_add(&nbr->ipaddr);
|
||||||
ADD("</li>\n");
|
ADD("</li>\n");
|
||||||
|
@ -55,19 +55,67 @@
|
|||||||
#include "net/ipv6/uip-nd6.h"
|
#include "net/ipv6/uip-nd6.h"
|
||||||
#include "net/routing/routing.h"
|
#include "net/routing/routing.h"
|
||||||
|
|
||||||
|
#if UIP_DS6_NBR_MULTI_IPV6_ADDRS
|
||||||
|
#include "lib/memb.h"
|
||||||
|
#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */
|
||||||
|
|
||||||
/* Log configuration */
|
/* Log configuration */
|
||||||
#include "sys/log.h"
|
#include "sys/log.h"
|
||||||
#define LOG_MODULE "IPv6 Nbr"
|
#define LOG_MODULE "IPv6 Nbr"
|
||||||
#define LOG_LEVEL LOG_LEVEL_IPV6
|
#define LOG_LEVEL LOG_LEVEL_IPV6
|
||||||
|
|
||||||
NBR_TABLE_GLOBAL(uip_ds6_nbr_t, ds6_neighbors);
|
#if UIP_DS6_NBR_MULTI_IPV6_ADDRS
|
||||||
|
/**
|
||||||
|
* Add nbr to the list in nbr_entry. In other words, this function associates an
|
||||||
|
* IPv6 address in nbr with a link-layer address in nbr_entry.
|
||||||
|
* \param nbr the neighbor cache entry for an IPv6 address
|
||||||
|
* \param nbr_entry the nbr_table entry for an link-layer address
|
||||||
|
*/
|
||||||
|
static void add_uip_ds6_nbr_to_nbr_entry(uip_ds6_nbr_t *nbr,
|
||||||
|
uip_ds6_nbr_entry_t *nbr_entry);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove nbr from the list of the corresponding nbr_entry
|
||||||
|
* \param nbr a neighbor cache entry (nbr) to be removed
|
||||||
|
*/
|
||||||
|
static void remove_uip_ds6_nbr_from_nbr_entry(uip_ds6_nbr_t *nbr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove nbr_etnry from nbr_table
|
||||||
|
* \param nbr_entry a nbr_table entry (nbr_entry) to be removed
|
||||||
|
*/
|
||||||
|
static void remove_nbr_entry(uip_ds6_nbr_entry_t *nbr_entry);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free memory for a specified neighbor cache entry
|
||||||
|
* \param nbr a neighbor cache entry to be freed
|
||||||
|
*/
|
||||||
|
static void free_uip_ds6_nbr(uip_ds6_nbr_t *nbr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback function called when a nbr_table entry is removed
|
||||||
|
* \param nbr_entry a nbr_entry to be removed
|
||||||
|
*/
|
||||||
|
static void callback_nbr_entry_removal(uip_ds6_nbr_entry_t *nbr_entry);
|
||||||
|
|
||||||
|
NBR_TABLE(uip_ds6_nbr_entry_t, uip_ds6_nbr_entries);
|
||||||
|
MEMB(uip_ds6_nbr_memb, uip_ds6_nbr_t, UIP_DS6_NBR_MAX_NEIGHBOR_CACHES);
|
||||||
|
#else
|
||||||
|
NBR_TABLE(uip_ds6_nbr_t, ds6_neighbors);
|
||||||
|
#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
uip_ds6_neighbors_init(void)
|
uip_ds6_neighbors_init(void)
|
||||||
{
|
{
|
||||||
link_stats_init();
|
link_stats_init();
|
||||||
|
#if UIP_DS6_NBR_MULTI_IPV6_ADDRS
|
||||||
|
memb_init(&uip_ds6_nbr_memb);
|
||||||
|
nbr_table_register(uip_ds6_nbr_entries,
|
||||||
|
(nbr_table_callback *)callback_nbr_entry_removal);
|
||||||
|
#else
|
||||||
nbr_table_register(ds6_neighbors, (nbr_table_callback *)uip_ds6_nbr_rm);
|
nbr_table_register(ds6_neighbors, (nbr_table_callback *)uip_ds6_nbr_rm);
|
||||||
|
#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
uip_ds6_nbr_t *
|
uip_ds6_nbr_t *
|
||||||
@ -75,8 +123,63 @@ uip_ds6_nbr_add(const uip_ipaddr_t *ipaddr, const uip_lladdr_t *lladdr,
|
|||||||
uint8_t isrouter, uint8_t state, nbr_table_reason_t reason,
|
uint8_t isrouter, uint8_t state, nbr_table_reason_t reason,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
uip_ds6_nbr_t *nbr = nbr_table_add_lladdr(ds6_neighbors, (linkaddr_t*)lladdr
|
uip_ds6_nbr_t *nbr;
|
||||||
, reason, data);
|
|
||||||
|
#if UIP_DS6_NBR_MULTI_IPV6_ADDRS
|
||||||
|
uip_ds6_nbr_entry_t *nbr_entry;
|
||||||
|
|
||||||
|
assert(uip_ds6_nbr_lookup(ipaddr) == NULL);
|
||||||
|
if(uip_ds6_nbr_lookup(ipaddr)) {
|
||||||
|
LOG_ERR("%s: uip_ds6_nbr for ", __func__);
|
||||||
|
LOG_ERR_6ADDR(ipaddr);
|
||||||
|
LOG_ERR_("has already existed\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* firstly, allocate memory for a new nbr cache entry */
|
||||||
|
if((nbr = (uip_ds6_nbr_t *)memb_alloc(&uip_ds6_nbr_memb)) == NULL) {
|
||||||
|
LOG_ERR("%s: cannot allocate a new uip_ds6_nbr\n", __func__);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* secondly, get or allocate nbr_entry for the link-layer address */
|
||||||
|
nbr_entry = nbr_table_get_from_lladdr(uip_ds6_nbr_entries,
|
||||||
|
(const linkaddr_t *)lladdr);
|
||||||
|
if(nbr_entry == NULL) {
|
||||||
|
if((nbr_entry =
|
||||||
|
nbr_table_add_lladdr(uip_ds6_nbr_entries,
|
||||||
|
(linkaddr_t*)lladdr, reason, data)) == NULL) {
|
||||||
|
LOG_ERR("%s: cannot allocate a new uip_ds6_nbr_entry\n", __func__);
|
||||||
|
/* return from this function later */
|
||||||
|
} else {
|
||||||
|
LIST_STRUCT_INIT(nbr_entry, uip_ds6_nbrs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* free nbr and return if nbr_entry is not available */
|
||||||
|
if((nbr_entry == NULL) ||
|
||||||
|
(list_length(nbr_entry->uip_ds6_nbrs) == UIP_DS6_NBR_MAX_6ADDRS_PER_NBR)) {
|
||||||
|
if(list_length(nbr_entry->uip_ds6_nbrs) == UIP_DS6_NBR_MAX_6ADDRS_PER_NBR) {
|
||||||
|
/*
|
||||||
|
* it's already had the maximum number of IPv6 addresses; cannot
|
||||||
|
* add another.
|
||||||
|
*/
|
||||||
|
LOG_ERR("%s: no room in nbr_entry for ", __func__);
|
||||||
|
LOG_ERR_LLADDR((const linkaddr_t *)lladdr);
|
||||||
|
LOG_ERR_("\n");
|
||||||
|
}
|
||||||
|
/* free the newly allocated memory in this function call */
|
||||||
|
memb_free(&uip_ds6_nbr_memb, nbr);
|
||||||
|
return NULL;
|
||||||
|
} else {
|
||||||
|
/* everything is fine; nbr is ready to be used */
|
||||||
|
/* it has room to add another IPv6 address */
|
||||||
|
add_uip_ds6_nbr_to_nbr_entry(nbr, nbr_entry);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
nbr = nbr_table_add_lladdr(ds6_neighbors, (linkaddr_t*)lladdr, reason, data);
|
||||||
|
#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */
|
||||||
|
|
||||||
if(nbr) {
|
if(nbr) {
|
||||||
uip_ipaddr_copy(&nbr->ipaddr, ipaddr);
|
uip_ipaddr_copy(&nbr->ipaddr, ipaddr);
|
||||||
#if UIP_ND6_SEND_RA || !UIP_CONF_ROUTER
|
#if UIP_ND6_SEND_RA || !UIP_CONF_ROUTER
|
||||||
@ -113,10 +216,91 @@ uip_ds6_nbr_add(const uip_ipaddr_t *ipaddr, const uip_lladdr_t *lladdr,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UIP_DS6_NBR_MULTI_IPV6_ADDRS
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static void
|
||||||
|
add_uip_ds6_nbr_to_nbr_entry(uip_ds6_nbr_t *nbr,
|
||||||
|
uip_ds6_nbr_entry_t *nbr_entry)
|
||||||
|
{
|
||||||
|
LOG_DBG("%s: add nbr(%p) to nbr_entry (%p)\n",
|
||||||
|
__func__, nbr, nbr_entry);
|
||||||
|
nbr->nbr_entry = nbr_entry;
|
||||||
|
list_add(nbr_entry->uip_ds6_nbrs, nbr);
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static void
|
||||||
|
remove_uip_ds6_nbr_from_nbr_entry(uip_ds6_nbr_t *nbr)
|
||||||
|
{
|
||||||
|
if(nbr == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
LOG_DBG("%s: remove nbr(%p) from nbr_entry (%p)\n",
|
||||||
|
__func__, nbr, nbr->nbr_entry);
|
||||||
|
list_remove(nbr->nbr_entry->uip_ds6_nbrs, nbr);
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static void
|
||||||
|
remove_nbr_entry(uip_ds6_nbr_entry_t *nbr_entry)
|
||||||
|
{
|
||||||
|
if(nbr_entry == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
LOG_DBG("%s: remove nbr_entry (%p) from nbr_table\n",
|
||||||
|
__func__, nbr_entry);
|
||||||
|
(void)nbr_table_remove(uip_ds6_nbr_entries, nbr_entry);
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static void
|
||||||
|
free_uip_ds6_nbr(uip_ds6_nbr_t *nbr)
|
||||||
|
{
|
||||||
|
if(nbr == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#if UIP_CONF_IPV6_QUEUE_PKT
|
||||||
|
uip_packetqueue_free(&nbr->packethandle);
|
||||||
|
#endif /* UIP_CONF_IPV6_QUEUE_PKT */
|
||||||
|
NETSTACK_ROUTING.neighbor_state_changed(nbr);
|
||||||
|
assert(nbr->nbr_entry != NULL);
|
||||||
|
if(nbr->nbr_entry == NULL) {
|
||||||
|
LOG_ERR("%s: unexpected error nbr->nbr_entry is NULL\n", __func__);
|
||||||
|
} else {
|
||||||
|
remove_uip_ds6_nbr_from_nbr_entry(nbr);
|
||||||
|
if(list_length(nbr->nbr_entry->uip_ds6_nbrs) == 0) {
|
||||||
|
remove_nbr_entry(nbr->nbr_entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LOG_DBG("%s: free memory for nbr(%p)\n", __func__, nbr);
|
||||||
|
memb_free(&uip_ds6_nbr_memb, nbr);
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static void
|
||||||
|
callback_nbr_entry_removal(uip_ds6_nbr_entry_t *nbr_entry)
|
||||||
|
{
|
||||||
|
uip_ds6_nbr_t *nbr;
|
||||||
|
uip_ds6_nbr_t *next_nbr;
|
||||||
|
if(nbr_entry == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for(nbr = (uip_ds6_nbr_t *)list_head(nbr_entry->uip_ds6_nbrs);
|
||||||
|
nbr != NULL;
|
||||||
|
nbr = next_nbr) {
|
||||||
|
next_nbr = (uip_ds6_nbr_t *)list_item_next(nbr);
|
||||||
|
free_uip_ds6_nbr(nbr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int
|
int
|
||||||
uip_ds6_nbr_rm(uip_ds6_nbr_t *nbr)
|
uip_ds6_nbr_rm(uip_ds6_nbr_t *nbr)
|
||||||
{
|
{
|
||||||
|
#if UIP_DS6_NBR_MULTI_IPV6_ADDRS
|
||||||
|
if(nbr == NULL) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
free_uip_ds6_nbr(nbr);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#else /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */
|
||||||
if(nbr != NULL) {
|
if(nbr != NULL) {
|
||||||
#if UIP_CONF_IPV6_QUEUE_PKT
|
#if UIP_CONF_IPV6_QUEUE_PKT
|
||||||
uip_packetqueue_free(&nbr->packethandle);
|
uip_packetqueue_free(&nbr->packethandle);
|
||||||
@ -125,19 +309,52 @@ uip_ds6_nbr_rm(uip_ds6_nbr_t *nbr)
|
|||||||
return nbr_table_remove(ds6_neighbors, nbr);
|
return nbr_table_remove(ds6_neighbors, nbr);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int
|
int
|
||||||
uip_ds6_nbr_update_ll(uip_ds6_nbr_t **nbr_pp, const uip_lladdr_t *new_ll_addr)
|
uip_ds6_nbr_update_ll(uip_ds6_nbr_t **nbr_pp, const uip_lladdr_t *new_ll_addr)
|
||||||
{
|
{
|
||||||
|
#if UIP_DS6_NBR_MULTI_IPV6_ADDRS
|
||||||
|
uip_ds6_nbr_entry_t *nbr_entry;
|
||||||
|
uip_ds6_nbr_t *nbr;
|
||||||
|
#else
|
||||||
uip_ds6_nbr_t nbr_backup;
|
uip_ds6_nbr_t nbr_backup;
|
||||||
|
#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */
|
||||||
|
|
||||||
if(nbr_pp == NULL || new_ll_addr == NULL) {
|
if(nbr_pp == NULL || new_ll_addr == NULL) {
|
||||||
LOG_ERR("%s: invalid argument\n", __func__);
|
LOG_ERR("%s: invalid argument\n", __func__);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UIP_DS6_NBR_MULTI_IPV6_ADDRS
|
||||||
|
|
||||||
|
if((nbr_entry =
|
||||||
|
nbr_table_get_from_lladdr(uip_ds6_nbr_entries,
|
||||||
|
(const linkaddr_t *)new_ll_addr)) == NULL) {
|
||||||
|
if((nbr_entry =
|
||||||
|
nbr_table_add_lladdr(uip_ds6_nbr_entries,
|
||||||
|
(const linkaddr_t*)new_ll_addr,
|
||||||
|
NBR_TABLE_REASON_IPV6_ND, NULL)) == NULL) {
|
||||||
|
LOG_ERR("%s: cannot allocate a nbr_entry for", __func__);
|
||||||
|
LOG_ERR_LLADDR((const linkaddr_t *)new_ll_addr);
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
LIST_STRUCT_INIT(nbr_entry, uip_ds6_nbrs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nbr = *nbr_pp;
|
||||||
|
|
||||||
|
remove_uip_ds6_nbr_from_nbr_entry(nbr);
|
||||||
|
if(list_length(nbr->nbr_entry->uip_ds6_nbrs) == 0) {
|
||||||
|
remove_nbr_entry(nbr->nbr_entry);
|
||||||
|
}
|
||||||
|
add_uip_ds6_nbr_to_nbr_entry(nbr, nbr_entry);
|
||||||
|
|
||||||
|
#else /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */
|
||||||
|
|
||||||
/* make sure new_ll_addr is not used in some other nbr */
|
/* make sure new_ll_addr is not used in some other nbr */
|
||||||
if(uip_ds6_nbr_ll_lookup(new_ll_addr) != NULL) {
|
if(uip_ds6_nbr_ll_lookup(new_ll_addr) != NULL) {
|
||||||
LOG_ERR("%s: new_ll_addr, ", __func__);
|
LOG_ERR("%s: new_ll_addr, ", __func__);
|
||||||
@ -159,6 +376,7 @@ uip_ds6_nbr_update_ll(uip_ds6_nbr_t **nbr_pp, const uip_lladdr_t *new_ll_addr)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
memcpy(*nbr_pp, &nbr_backup, sizeof(uip_ds6_nbr_t));
|
memcpy(*nbr_pp, &nbr_backup, sizeof(uip_ds6_nbr_t));
|
||||||
|
#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -173,46 +391,88 @@ uip_ds6_nbr_get_ipaddr(const uip_ds6_nbr_t *nbr)
|
|||||||
const uip_lladdr_t *
|
const uip_lladdr_t *
|
||||||
uip_ds6_nbr_get_ll(const uip_ds6_nbr_t *nbr)
|
uip_ds6_nbr_get_ll(const uip_ds6_nbr_t *nbr)
|
||||||
{
|
{
|
||||||
|
#if UIP_DS6_NBR_MULTI_IPV6_ADDRS
|
||||||
|
if(nbr == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return (const uip_lladdr_t *)nbr_table_get_lladdr(uip_ds6_nbr_entries,
|
||||||
|
nbr->nbr_entry);
|
||||||
|
#else
|
||||||
return (const uip_lladdr_t *)nbr_table_get_lladdr(ds6_neighbors, nbr);
|
return (const uip_lladdr_t *)nbr_table_get_lladdr(ds6_neighbors, nbr);
|
||||||
|
#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int
|
int
|
||||||
uip_ds6_nbr_num(void)
|
uip_ds6_nbr_num(void)
|
||||||
{
|
{
|
||||||
uip_ds6_nbr_t *nbr;
|
int num = 0;
|
||||||
int num;
|
|
||||||
|
|
||||||
num = 0;
|
#if UIP_DS6_NBR_MULTI_IPV6_ADDRS
|
||||||
|
uip_ds6_nbr_entry_t *nbr_entry;
|
||||||
|
for(nbr_entry = nbr_table_head(uip_ds6_nbr_entries);
|
||||||
|
nbr_entry != NULL;
|
||||||
|
nbr_entry = nbr_table_next(uip_ds6_nbr_entries, nbr_entry)) {
|
||||||
|
num += list_length(nbr_entry->uip_ds6_nbrs);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
uip_ds6_nbr_t *nbr;
|
||||||
for(nbr = nbr_table_head(ds6_neighbors);
|
for(nbr = nbr_table_head(ds6_neighbors);
|
||||||
nbr != NULL;
|
nbr != NULL;
|
||||||
nbr = nbr_table_next(ds6_neighbors, nbr)) {
|
nbr = nbr_table_next(ds6_neighbors, nbr)) {
|
||||||
num++;
|
num++;
|
||||||
}
|
}
|
||||||
|
#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
uip_ds6_nbr_t *
|
uip_ds6_nbr_t *
|
||||||
uip_ds6_nbr_head(void)
|
uip_ds6_nbr_head(void)
|
||||||
{
|
{
|
||||||
|
#if UIP_DS6_NBR_MULTI_IPV6_ADDRS
|
||||||
|
uip_ds6_nbr_entry_t *nbr_entry;
|
||||||
|
if((nbr_entry = nbr_table_head(uip_ds6_nbr_entries)) == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
assert(list_head(nbr_entry->uip_ds6_nbrs) != NULL);
|
||||||
|
return (uip_ds6_nbr_t *)list_head(nbr_entry->uip_ds6_nbrs);
|
||||||
|
#else
|
||||||
return nbr_table_head(ds6_neighbors);
|
return nbr_table_head(ds6_neighbors);
|
||||||
|
#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
uip_ds6_nbr_t *
|
uip_ds6_nbr_t *
|
||||||
uip_ds6_nbr_next(uip_ds6_nbr_t *nbr)
|
uip_ds6_nbr_next(uip_ds6_nbr_t *nbr)
|
||||||
{
|
{
|
||||||
|
#if UIP_DS6_NBR_MULTI_IPV6_ADDRS
|
||||||
|
uip_ds6_nbr_entry_t *nbr_entry;
|
||||||
|
if(nbr == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if(list_item_next(nbr) != NULL) {
|
||||||
|
return list_item_next(nbr);
|
||||||
|
}
|
||||||
|
nbr_entry = nbr_table_next(uip_ds6_nbr_entries, nbr->nbr_entry);
|
||||||
|
if(nbr_entry == NULL) {
|
||||||
|
return NULL;
|
||||||
|
} else {
|
||||||
|
assert(list_head(nbr_entry->uip_ds6_nbrs) != NULL);
|
||||||
|
return (uip_ds6_nbr_t *)list_head(nbr_entry->uip_ds6_nbrs);
|
||||||
|
}
|
||||||
|
#else
|
||||||
return nbr_table_next(ds6_neighbors, nbr);
|
return nbr_table_next(ds6_neighbors, nbr);
|
||||||
|
#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
uip_ds6_nbr_t *
|
uip_ds6_nbr_t *
|
||||||
uip_ds6_nbr_lookup(const uip_ipaddr_t *ipaddr)
|
uip_ds6_nbr_lookup(const uip_ipaddr_t *ipaddr)
|
||||||
{
|
{
|
||||||
uip_ds6_nbr_t *nbr = nbr_table_head(ds6_neighbors);
|
uip_ds6_nbr_t *nbr;
|
||||||
if(ipaddr != NULL) {
|
if(ipaddr == NULL) {
|
||||||
while(nbr != NULL) {
|
return NULL;
|
||||||
if(uip_ipaddr_cmp(&nbr->ipaddr, ipaddr)) {
|
}
|
||||||
return nbr;
|
for(nbr = uip_ds6_nbr_head(); nbr != NULL; nbr = uip_ds6_nbr_next(nbr)) {
|
||||||
}
|
if(uip_ipaddr_cmp(&nbr->ipaddr, ipaddr)) {
|
||||||
nbr = nbr_table_next(ds6_neighbors, nbr);
|
return nbr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -221,7 +481,23 @@ uip_ds6_nbr_lookup(const uip_ipaddr_t *ipaddr)
|
|||||||
uip_ds6_nbr_t *
|
uip_ds6_nbr_t *
|
||||||
uip_ds6_nbr_ll_lookup(const uip_lladdr_t *lladdr)
|
uip_ds6_nbr_ll_lookup(const uip_lladdr_t *lladdr)
|
||||||
{
|
{
|
||||||
|
#if UIP_DS6_NBR_MULTI_IPV6_ADDRS
|
||||||
|
uip_ds6_nbr_entry_t *nbr_entry;
|
||||||
|
/*
|
||||||
|
* we cannot determine which entry should return by lladdr alone;
|
||||||
|
* return the first entry associated with lladdr.
|
||||||
|
*/
|
||||||
|
nbr_entry =
|
||||||
|
(uip_ds6_nbr_entry_t *)nbr_table_get_from_lladdr(uip_ds6_nbr_entries,
|
||||||
|
(linkaddr_t*)lladdr);
|
||||||
|
if(nbr_entry == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
assert(list_head(nbr_entry->uip_ds6_nbrs) != NULL);
|
||||||
|
return (uip_ds6_nbr_t *)list_head(nbr_entry->uip_ds6_nbrs);
|
||||||
|
#else
|
||||||
return nbr_table_get_from_lladdr(ds6_neighbors, (linkaddr_t*)lladdr);
|
return nbr_table_get_from_lladdr(ds6_neighbors, (linkaddr_t*)lladdr);
|
||||||
|
#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
@ -239,6 +515,20 @@ uip_ds6_nbr_lladdr_from_ipaddr(const uip_ipaddr_t *ipaddr)
|
|||||||
uip_ds6_nbr_t *nbr = uip_ds6_nbr_lookup(ipaddr);
|
uip_ds6_nbr_t *nbr = uip_ds6_nbr_lookup(ipaddr);
|
||||||
return nbr ? uip_ds6_nbr_get_ll(nbr) : NULL;
|
return nbr ? uip_ds6_nbr_get_ll(nbr) : NULL;
|
||||||
}
|
}
|
||||||
|
#if UIP_DS6_LL_NUD
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static void
|
||||||
|
update_nbr_reachable_state_by_ack(uip_ds6_nbr_t *nbr, const linkaddr_t *lladdr)
|
||||||
|
{
|
||||||
|
if(nbr != NULL && nbr->state != NBR_INCOMPLETE) {
|
||||||
|
nbr->state = NBR_REACHABLE;
|
||||||
|
stimer_set(&nbr->reachable, UIP_ND6_REACHABLE_TIME / 1000);
|
||||||
|
LOG_INFO("received a link layer ACK : ");
|
||||||
|
LOG_INFO_LLADDR(lladdr);
|
||||||
|
LOG_INFO_(" is reachable.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* UIP_DS6_LL_NUD */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
uip_ds6_link_callback(int status, int numtx)
|
uip_ds6_link_callback(int status, int numtx)
|
||||||
@ -266,14 +556,22 @@ uip_ds6_link_callback(int status, int numtx)
|
|||||||
* acknowledges link packets. */
|
* acknowledges link packets. */
|
||||||
if(status == MAC_TX_OK) {
|
if(status == MAC_TX_OK) {
|
||||||
uip_ds6_nbr_t *nbr;
|
uip_ds6_nbr_t *nbr;
|
||||||
nbr = uip_ds6_nbr_ll_lookup((uip_lladdr_t *)dest);
|
#if UIP_DS6_NBR_MULTI_IPV6_ADDRS
|
||||||
if(nbr != NULL && nbr->state != NBR_INCOMPLETE) {
|
uip_ds6_nbr_entry_t *nbr_entry;
|
||||||
nbr->state = NBR_REACHABLE;
|
if((nbr_entry =
|
||||||
stimer_set(&nbr->reachable, UIP_ND6_REACHABLE_TIME / 1000);
|
(uip_ds6_nbr_entry_t *)nbr_table_get_from_lladdr(uip_ds6_nbr_entries,
|
||||||
LOG_INFO("received a link layer ACK : ");
|
dest)) == NULL) {
|
||||||
LOG_INFO_LLADDR((uip_lladdr_t *)dest);
|
return;
|
||||||
LOG_INFO_(" is reachable.\n");
|
|
||||||
}
|
}
|
||||||
|
for(nbr = (uip_ds6_nbr_t *)list_head(nbr_entry->uip_ds6_nbrs);
|
||||||
|
nbr != NULL;
|
||||||
|
nbr = (uip_ds6_nbr_t *)list_item_next(nbr)) {
|
||||||
|
update_nbr_reachable_state_by_ack(nbr, dest);
|
||||||
|
}
|
||||||
|
#else /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */
|
||||||
|
nbr = uip_ds6_nbr_ll_lookup((uip_lladdr_t *)dest);
|
||||||
|
update_nbr_reachable_state_by_ack(nbr, dest);
|
||||||
|
#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */
|
||||||
}
|
}
|
||||||
#endif /* UIP_DS6_LL_NUD */
|
#endif /* UIP_DS6_LL_NUD */
|
||||||
}
|
}
|
||||||
@ -283,7 +581,7 @@ uip_ds6_link_callback(int status, int numtx)
|
|||||||
void
|
void
|
||||||
uip_ds6_neighbor_periodic(void)
|
uip_ds6_neighbor_periodic(void)
|
||||||
{
|
{
|
||||||
uip_ds6_nbr_t *nbr = nbr_table_head(ds6_neighbors);
|
uip_ds6_nbr_t *nbr = uip_ds6_nbr_head();
|
||||||
while(nbr != NULL) {
|
while(nbr != NULL) {
|
||||||
switch(nbr->state) {
|
switch(nbr->state) {
|
||||||
case NBR_REACHABLE:
|
case NBR_REACHABLE:
|
||||||
@ -354,7 +652,7 @@ uip_ds6_neighbor_periodic(void)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
nbr = nbr_table_next(ds6_neighbors, nbr);
|
nbr = uip_ds6_nbr_next(nbr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
@ -373,7 +671,7 @@ uip_ds6_nbr_refresh_reachable_state(const uip_ipaddr_t *ipaddr)
|
|||||||
uip_ds6_nbr_t *
|
uip_ds6_nbr_t *
|
||||||
uip_ds6_get_least_lifetime_neighbor(void)
|
uip_ds6_get_least_lifetime_neighbor(void)
|
||||||
{
|
{
|
||||||
uip_ds6_nbr_t *nbr = nbr_table_head(ds6_neighbors);
|
uip_ds6_nbr_t *nbr = uip_ds6_nbr_head();
|
||||||
uip_ds6_nbr_t *nbr_expiring = NULL;
|
uip_ds6_nbr_t *nbr_expiring = NULL;
|
||||||
while(nbr != NULL) {
|
while(nbr != NULL) {
|
||||||
if(nbr_expiring != NULL) {
|
if(nbr_expiring != NULL) {
|
||||||
@ -384,7 +682,7 @@ uip_ds6_get_least_lifetime_neighbor(void)
|
|||||||
} else {
|
} else {
|
||||||
nbr_expiring = nbr;
|
nbr_expiring = nbr;
|
||||||
}
|
}
|
||||||
nbr = nbr_table_next(ds6_neighbors, nbr);
|
nbr = uip_ds6_nbr_next(nbr);
|
||||||
}
|
}
|
||||||
return nbr_expiring;
|
return nbr_expiring;
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,10 @@
|
|||||||
#if UIP_CONF_IPV6_QUEUE_PKT
|
#if UIP_CONF_IPV6_QUEUE_PKT
|
||||||
#include "net/ipv6/uip-packetqueue.h"
|
#include "net/ipv6/uip-packetqueue.h"
|
||||||
#endif /*UIP_CONF_QUEUE_PKT */
|
#endif /*UIP_CONF_QUEUE_PKT */
|
||||||
|
#if UIP_DS6_NBR_CONF_MULTI_IPV6_ADDRS
|
||||||
|
#include "lib/assert.h"
|
||||||
|
#include "lib/list.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/*--------------------------------------------------*/
|
/*--------------------------------------------------*/
|
||||||
/** \brief Possible states for the nbr cache entries */
|
/** \brief Possible states for the nbr cache entries */
|
||||||
@ -63,10 +67,46 @@
|
|||||||
#define NBR_DELAY 3
|
#define NBR_DELAY 3
|
||||||
#define NBR_PROBE 4
|
#define NBR_PROBE 4
|
||||||
|
|
||||||
NBR_TABLE_DECLARE(ds6_neighbors);
|
/** \brief Set non-zero (1) to enable multiple IPv6 addresses to be
|
||||||
|
* associated with a link-layer address */
|
||||||
|
#ifdef UIP_DS6_NBR_CONF_MULTI_IPV6_ADDRS
|
||||||
|
#define UIP_DS6_NBR_MULTI_IPV6_ADDRS UIP_DS6_NBR_CONF_MULTI_IPV6_ADDRS
|
||||||
|
#else
|
||||||
|
#define UIP_DS6_NBR_MULTI_IPV6_ADDRS 0
|
||||||
|
#endif /* UIP_DS6_NBR_CONF_MULTI_IPV6_ADDRS */
|
||||||
|
|
||||||
/** \brief An entry in the nbr cache */
|
/** \brief Set the maximum number of IPv6 addresses per link-layer
|
||||||
|
* address */
|
||||||
|
#ifdef UIP_DS6_NBR_CONF_MAX_6ADDRS_PER_NBR
|
||||||
|
#define UIP_DS6_NBR_MAX_6ADDRS_PER_NBR UIP_DS6_NBR_CONF_MAX_6ADDRS_PER_NBR
|
||||||
|
#else
|
||||||
|
#define UIP_DS6_NBR_MAX_6ADDRS_PER_NBR 2
|
||||||
|
#endif /* UIP_DS6_NBR_CONF_MAX_6ADDRS_PER_NBR */
|
||||||
|
|
||||||
|
/** \brief Set the maximum number of neighbor cache entries */
|
||||||
|
#ifdef UIP_DS6_NBR_CONF_MAX_NEIGHBOR_CACHES
|
||||||
|
#define UIP_DS6_NBR_MAX_NEIGHBOR_CACHES UIP_DS6_NBR_CONF_MAX_NEIGHBOR_CACHES
|
||||||
|
#else
|
||||||
|
#define UIP_DS6_NBR_MAX_NEIGHBOR_CACHES \
|
||||||
|
(NBR_TABLE_MAX_NEIGHBORS * UIP_DS6_NBR_MAX_6ADDRS_PER_NBR)
|
||||||
|
#endif /* UIP_DS6_NBR_CONF_MAX_NEIGHBOR_CACHES */
|
||||||
|
|
||||||
|
#if UIP_DS6_NBR_MULTI_IPV6_ADDRS
|
||||||
|
/** \brief nbr_table entry when UIP_DS6_NBR_MULTI_IPV6_ADDRS is
|
||||||
|
* enabled. uip_ds6_nbrs is a list of uip_ds6_nbr_t objects */
|
||||||
|
typedef struct {
|
||||||
|
LIST_STRUCT(uip_ds6_nbrs);
|
||||||
|
} uip_ds6_nbr_entry_t;
|
||||||
|
#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */
|
||||||
|
|
||||||
|
/** \brief The default nbr_table entry (when
|
||||||
|
* UIP_DS6_NBR_MULTI_IPV6_ADDRS is disabled), that implements nbr
|
||||||
|
* cache */
|
||||||
typedef struct uip_ds6_nbr {
|
typedef struct uip_ds6_nbr {
|
||||||
|
#if UIP_DS6_NBR_MULTI_IPV6_ADDRS
|
||||||
|
struct uip_ds6_nbr *next;
|
||||||
|
uip_ds6_nbr_entry_t *nbr_entry;
|
||||||
|
#endif /* UIP_DS6_NBR_MULTI_IPV6_ADDRS */
|
||||||
uip_ipaddr_t ipaddr;
|
uip_ipaddr_t ipaddr;
|
||||||
uint8_t isrouter;
|
uint8_t isrouter;
|
||||||
uint8_t state;
|
uint8_t state;
|
||||||
@ -83,25 +123,119 @@ typedef struct uip_ds6_nbr {
|
|||||||
|
|
||||||
void uip_ds6_neighbors_init(void);
|
void uip_ds6_neighbors_init(void);
|
||||||
|
|
||||||
/** \brief Neighbor Cache basic routines */
|
/**
|
||||||
|
* Add a neighbor cache for a specified IPv6 address, which is
|
||||||
|
* associated with a specified link-layer address
|
||||||
|
* \param ipaddr IPv6 address of a neighbor to add
|
||||||
|
* \param lladdr Link-layer address to associate with ipaddr
|
||||||
|
* \param isrouter Set 1 if the neighbor is a router
|
||||||
|
* \param state Set the initial neighbor cache state (e.g.,
|
||||||
|
* NBR_INCOMPLETE)
|
||||||
|
* \param reason Set a reason of the addition (e.g.,
|
||||||
|
* NBR_TABLE_REASON_RPL_DIO)
|
||||||
|
* \param data Set data associated with the nbr cache
|
||||||
|
* \return the address of a newly added nbr cache on success, NULL on
|
||||||
|
* failure
|
||||||
|
*/
|
||||||
uip_ds6_nbr_t *uip_ds6_nbr_add(const uip_ipaddr_t *ipaddr,
|
uip_ds6_nbr_t *uip_ds6_nbr_add(const uip_ipaddr_t *ipaddr,
|
||||||
const uip_lladdr_t *lladdr,
|
const uip_lladdr_t *lladdr,
|
||||||
uint8_t isrouter, uint8_t state,
|
uint8_t isrouter, uint8_t state,
|
||||||
nbr_table_reason_t reason, void *data);
|
nbr_table_reason_t reason, void *data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a neighbor cache
|
||||||
|
* \param nbr the address of a neighbor cache to remove
|
||||||
|
* \return 1 on success, 0 on failure (nothing was removed)
|
||||||
|
*/
|
||||||
int uip_ds6_nbr_rm(uip_ds6_nbr_t *nbr);
|
int uip_ds6_nbr_rm(uip_ds6_nbr_t *nbr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the link-layer address associated with a specified nbr cache
|
||||||
|
* \param nbr the address of a neighbor cache
|
||||||
|
* \return pointer to the link-layer address on success, NULL on failure
|
||||||
|
*/
|
||||||
const uip_lladdr_t *uip_ds6_nbr_get_ll(const uip_ds6_nbr_t *nbr);
|
const uip_lladdr_t *uip_ds6_nbr_get_ll(const uip_ds6_nbr_t *nbr);
|
||||||
int uip_ds6_nbr_update_ll(uip_ds6_nbr_t **nbr, const uip_lladdr_t *new_ll_addr);
|
|
||||||
const uip_ipaddr_t *uip_ds6_nbr_get_ipaddr(const uip_ds6_nbr_t *nbr);
|
/**
|
||||||
uip_ds6_nbr_t *uip_ds6_nbr_lookup(const uip_ipaddr_t *ipaddr);
|
* Get the link-layer address associated with a specified IPv6 address
|
||||||
uip_ds6_nbr_t *uip_ds6_nbr_ll_lookup(const uip_lladdr_t *lladdr);
|
* \param ipaddr an IPv6 address used as a search key
|
||||||
uip_ipaddr_t *uip_ds6_nbr_ipaddr_from_lladdr(const uip_lladdr_t *lladdr);
|
* \return the pointer to the link-layer address on success, NULL on failure
|
||||||
|
*/
|
||||||
const uip_lladdr_t *uip_ds6_nbr_lladdr_from_ipaddr(const uip_ipaddr_t *ipaddr);
|
const uip_lladdr_t *uip_ds6_nbr_lladdr_from_ipaddr(const uip_ipaddr_t *ipaddr);
|
||||||
void uip_ds6_link_callback(int status, int numtx);
|
|
||||||
void uip_ds6_neighbor_periodic(void);
|
/**
|
||||||
|
* Update the link-layer address associated with an IPv6 address
|
||||||
|
* \param nbr the double pointer to a neighbor cache which has the
|
||||||
|
* target IPv6 address
|
||||||
|
* \param new_ll_addr the new link-layer address of the IPv6 address
|
||||||
|
* return 0 on success, -1 on failure
|
||||||
|
*/
|
||||||
|
int uip_ds6_nbr_update_ll(uip_ds6_nbr_t **nbr, const uip_lladdr_t *new_ll_addr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an IPv6 address of a neighbor cache
|
||||||
|
* \param nbr the pointer to a neighbor cache
|
||||||
|
* \return the pointer to an IPv6 address associated with the neighbor cache
|
||||||
|
* \note This returns the first IPv6 address found in the neighbor
|
||||||
|
* cache when UIP_DS6_NBR_MULTI_IPV6_ADDRS is enabled
|
||||||
|
*/
|
||||||
|
const uip_ipaddr_t *uip_ds6_nbr_get_ipaddr(const uip_ds6_nbr_t *nbr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an IPv6 address associated with a specified link-layer address
|
||||||
|
* \param lladdr a link-layer address used as a search key
|
||||||
|
* \return the pointer to an IPv6 address associated with the neighbor cache
|
||||||
|
* \note This returns the first IPv6 address found in the neighbor
|
||||||
|
* cache when UIP_DS6_NBR_MULTI_IPV6_ADDRS is enabled
|
||||||
|
*/
|
||||||
|
uip_ipaddr_t *uip_ds6_nbr_ipaddr_from_lladdr(const uip_lladdr_t *lladdr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the neighbor cache associated with a specified IPv6 address
|
||||||
|
* \param ipaddr an IPv6 address used as a search key
|
||||||
|
* \return the pointer to a neighbor cache on success, NULL on failure
|
||||||
|
*/
|
||||||
|
uip_ds6_nbr_t *uip_ds6_nbr_lookup(const uip_ipaddr_t *ipaddr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the neighbor cache associated with a specified link-layer address
|
||||||
|
* \param lladdr a link-layer address used as a search key
|
||||||
|
* \return the pointer to a neighbor cache on success, NULL on failure
|
||||||
|
*/
|
||||||
|
uip_ds6_nbr_t *uip_ds6_nbr_ll_lookup(const uip_lladdr_t *lladdr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the number of neighbor caches
|
||||||
|
* \return the number of neighbor caches in use
|
||||||
|
*/
|
||||||
int uip_ds6_nbr_num(void);
|
int uip_ds6_nbr_num(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the first neighbor cache in nbr_table
|
||||||
|
* \return the pointer to the first neighbor cache entry
|
||||||
|
*/
|
||||||
uip_ds6_nbr_t *uip_ds6_nbr_head(void);
|
uip_ds6_nbr_t *uip_ds6_nbr_head(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the next neighbor cache of a specified one
|
||||||
|
* \param nbr the pointer to a neighbor cache
|
||||||
|
* \return the pointer to the next one on success, NULL on failure
|
||||||
|
*/
|
||||||
uip_ds6_nbr_t *uip_ds6_nbr_next(uip_ds6_nbr_t *nbr);
|
uip_ds6_nbr_t *uip_ds6_nbr_next(uip_ds6_nbr_t *nbr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The callback function to update link-layer stats in a neighbor
|
||||||
|
* cache
|
||||||
|
* \param status MAC return value defined in mac.h
|
||||||
|
* \param numtx the number of transmissions happened for a packet
|
||||||
|
*/
|
||||||
|
void uip_ds6_link_callback(int status, int numtx);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The housekeeping function called periodically
|
||||||
|
*/
|
||||||
|
void uip_ds6_neighbor_periodic(void);
|
||||||
|
|
||||||
#if UIP_ND6_SEND_NS
|
#if UIP_ND6_SEND_NS
|
||||||
/**
|
/**
|
||||||
* \brief Refresh the reachable state of a neighbor. This function
|
* \brief Refresh the reachable state of a neighbor. This function
|
||||||
|
@ -126,7 +126,7 @@ rpl_get_nbr(rpl_parent_t *parent)
|
|||||||
{
|
{
|
||||||
const linkaddr_t *lladdr = rpl_get_parent_lladdr(parent);
|
const linkaddr_t *lladdr = rpl_get_parent_lladdr(parent);
|
||||||
if(lladdr != NULL) {
|
if(lladdr != NULL) {
|
||||||
return nbr_table_get_from_lladdr(ds6_neighbors, lladdr);
|
return uip_ds6_nbr_ll_lookup((const uip_lladdr_t *)lladdr);
|
||||||
} else {
|
} else {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -145,9 +145,9 @@ rpl_dag_init(void)
|
|||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
rpl_parent_t *
|
rpl_parent_t *
|
||||||
rpl_get_parent(uip_lladdr_t *addr)
|
rpl_get_parent(const uip_lladdr_t *addr)
|
||||||
{
|
{
|
||||||
rpl_parent_t *p = nbr_table_get_from_lladdr(rpl_parents, (linkaddr_t *)addr);
|
rpl_parent_t *p = nbr_table_get_from_lladdr(rpl_parents, (const linkaddr_t *)addr);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
static int num_parents; /* any node that are possible parents */
|
static int num_parents; /* any node that are possible parents */
|
||||||
static int num_children; /* all children that we have as nexthop */
|
static int num_children; /* all children that we have as nexthop */
|
||||||
static int num_free;
|
static int num_free;
|
||||||
static linkaddr_t *worst_rank_nbr; /* the parent that has the worst rank */
|
static const linkaddr_t *worst_rank_nbr; /* the parent that has the worst rank */
|
||||||
static rpl_rank_t worst_rank;
|
static rpl_rank_t worst_rank;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#if LOG_DBG_ENABLED
|
#if LOG_DBG_ENABLED
|
||||||
@ -112,9 +112,9 @@ update_nbr(void)
|
|||||||
num_parents = 0;
|
num_parents = 0;
|
||||||
num_children = 0;
|
num_children = 0;
|
||||||
|
|
||||||
nbr = nbr_table_head(ds6_neighbors);
|
nbr = uip_ds6_nbr_head();
|
||||||
while(nbr != NULL) {
|
while(nbr != NULL) {
|
||||||
linkaddr_t *lladdr = nbr_table_get_lladdr(ds6_neighbors, nbr);
|
const linkaddr_t *lladdr = (const linkaddr_t *)uip_ds6_nbr_get_ll(nbr);
|
||||||
is_used = 0;
|
is_used = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -127,7 +127,7 @@ update_nbr(void)
|
|||||||
num_children++;
|
num_children++;
|
||||||
}
|
}
|
||||||
|
|
||||||
parent = rpl_get_parent((uip_lladdr_t *)lladdr);
|
parent = rpl_get_parent((const uip_lladdr_t *)lladdr);
|
||||||
if(parent != NULL) {
|
if(parent != NULL) {
|
||||||
num_parents++;
|
num_parents++;
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ update_nbr(void)
|
|||||||
LOG_DBG_("\n");
|
LOG_DBG_("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
nbr = nbr_table_next(ds6_neighbors, nbr);
|
nbr = uip_ds6_nbr_next(nbr);
|
||||||
num_used++;
|
num_used++;
|
||||||
}
|
}
|
||||||
/* how many more IP neighbors can be have? */
|
/* how many more IP neighbors can be have? */
|
||||||
|
@ -285,7 +285,7 @@ uint16_t rpl_get_parent_link_metric(rpl_parent_t *p);
|
|||||||
rpl_rank_t rpl_rank_via_parent(rpl_parent_t *p);
|
rpl_rank_t rpl_rank_via_parent(rpl_parent_t *p);
|
||||||
const linkaddr_t *rpl_get_parent_lladdr(rpl_parent_t *p);
|
const linkaddr_t *rpl_get_parent_lladdr(rpl_parent_t *p);
|
||||||
uip_ipaddr_t *rpl_parent_get_ipaddr(rpl_parent_t *nbr);
|
uip_ipaddr_t *rpl_parent_get_ipaddr(rpl_parent_t *nbr);
|
||||||
rpl_parent_t *rpl_get_parent(uip_lladdr_t *addr);
|
rpl_parent_t *rpl_get_parent(const uip_lladdr_t *addr);
|
||||||
rpl_rank_t rpl_get_parent_rank(uip_lladdr_t *addr);
|
rpl_rank_t rpl_get_parent_rank(uip_lladdr_t *addr);
|
||||||
void rpl_dag_init(void);
|
void rpl_dag_init(void);
|
||||||
uip_ds6_nbr_t *rpl_get_nbr(rpl_parent_t *parent);
|
uip_ds6_nbr_t *rpl_get_nbr(rpl_parent_t *parent);
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
|
|
||||||
static int num_parents; /* all nodes that are possible parents */
|
static int num_parents; /* all nodes that are possible parents */
|
||||||
static int num_free;
|
static int num_free;
|
||||||
static linkaddr_t *worst_rank_nbr_lladdr; /* lladdr of the the neighbor with the worst rank */
|
static const linkaddr_t *worst_rank_nbr_lladdr; /* lladdr of the the neighbor with the worst rank */
|
||||||
static rpl_rank_t worst_rank;
|
static rpl_rank_t worst_rank;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
@ -79,10 +79,10 @@ update_state(void)
|
|||||||
worst_rank_nbr_lladdr = NULL;
|
worst_rank_nbr_lladdr = NULL;
|
||||||
num_parents = 0;
|
num_parents = 0;
|
||||||
|
|
||||||
ds6_nbr = nbr_table_head(ds6_neighbors);
|
ds6_nbr = uip_ds6_nbr_head();
|
||||||
while(ds6_nbr != NULL) {
|
while(ds6_nbr != NULL) {
|
||||||
|
|
||||||
linkaddr_t *nbr_lladdr = nbr_table_get_lladdr(ds6_neighbors, ds6_nbr);
|
const linkaddr_t *nbr_lladdr = (const linkaddr_t *)uip_ds6_nbr_get_ll(ds6_nbr);
|
||||||
rpl_nbr = rpl_neighbor_get_from_lladdr((uip_lladdr_t *)nbr_lladdr);
|
rpl_nbr = rpl_neighbor_get_from_lladdr((uip_lladdr_t *)nbr_lladdr);
|
||||||
|
|
||||||
if(rpl_nbr != NULL && rpl_neighbor_is_parent(rpl_nbr)) {
|
if(rpl_nbr != NULL && rpl_neighbor_is_parent(rpl_nbr)) {
|
||||||
@ -98,7 +98,7 @@ update_state(void)
|
|||||||
worst_rank_nbr_lladdr = nbr_lladdr;
|
worst_rank_nbr_lladdr = nbr_lladdr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ds6_nbr = nbr_table_next(ds6_neighbors, ds6_nbr);
|
ds6_nbr = uip_ds6_nbr_next(ds6_nbr);
|
||||||
num_used++;
|
num_used++;
|
||||||
}
|
}
|
||||||
/* how many more IP neighbors can be have? */
|
/* how many more IP neighbors can be have? */
|
||||||
|
@ -181,9 +181,9 @@ rpl_neighbor_count(void)
|
|||||||
static uip_ds6_nbr_t *
|
static uip_ds6_nbr_t *
|
||||||
rpl_get_ds6_nbr(rpl_nbr_t *nbr)
|
rpl_get_ds6_nbr(rpl_nbr_t *nbr)
|
||||||
{
|
{
|
||||||
const linkaddr_t *lladdr = rpl_neighbor_get_lladdr(nbr);
|
const uip_lladdr_t *lladdr = (const uip_lladdr_t *)rpl_neighbor_get_lladdr(nbr);
|
||||||
if(lladdr != NULL) {
|
if(lladdr != NULL) {
|
||||||
return nbr_table_get_from_lladdr(ds6_neighbors, lladdr);
|
return uip_ds6_nbr_ll_lookup(lladdr);
|
||||||
} else {
|
} else {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
108
tests/09-ipv6/09-ping-lla-ula-csma-w-rpl.csc
Normal file
108
tests/09-ipv6/09-ping-lla-ula-csma-w-rpl.csc
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<simconf>
|
||||||
|
<project EXPORT="discard">[APPS_DIR]/mrm</project>
|
||||||
|
<project EXPORT="discard">[APPS_DIR]/mspsim</project>
|
||||||
|
<project EXPORT="discard">[APPS_DIR]/avrora</project>
|
||||||
|
<project EXPORT="discard">[APPS_DIR]/serial_socket</project>
|
||||||
|
<project EXPORT="discard">[APPS_DIR]/powertracker</project>
|
||||||
|
<simulation>
|
||||||
|
<title>My simulation</title>
|
||||||
|
<speedlimit>1.0</speedlimit>
|
||||||
|
<randomseed>123456</randomseed>
|
||||||
|
<motedelay_us>1000000</motedelay_us>
|
||||||
|
<radiomedium>
|
||||||
|
org.contikios.cooja.radiomediums.UDGM
|
||||||
|
<transmitting_range>50.0</transmitting_range>
|
||||||
|
<interference_range>100.0</interference_range>
|
||||||
|
<success_ratio_tx>1.0</success_ratio_tx>
|
||||||
|
<success_ratio_rx>1.0</success_ratio_rx>
|
||||||
|
</radiomedium>
|
||||||
|
<events>
|
||||||
|
<logoutput>40000</logoutput>
|
||||||
|
</events>
|
||||||
|
<motetype>
|
||||||
|
org.contikios.cooja.contikimote.ContikiMoteType
|
||||||
|
<identifier>mtype787</identifier>
|
||||||
|
<description>Cooja Mote Type #1</description>
|
||||||
|
<source>[CONTIKI_DIR]/tests/09-ipv6/code/node.c</source>
|
||||||
|
<commands>make clean
|
||||||
|
make WITH_ULA=1 WITH_CSMA=1 node.cooja</commands>
|
||||||
|
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.interfaces.Battery</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiVib</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiMoteID</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiRS232</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiBeeper</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiIPAddress</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiRadio</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiButton</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiPIR</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiClock</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiLED</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiCFS</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiEEPROM</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.interfaces.Mote2MoteRelations</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.interfaces.MoteAttributes</moteinterface>
|
||||||
|
<symbols>false</symbols>
|
||||||
|
</motetype>
|
||||||
|
<mote>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.interfaces.Position
|
||||||
|
<x>14.03051207883138</x>
|
||||||
|
<y>82.02801380504546</y>
|
||||||
|
<z>0.0</z>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiMoteID
|
||||||
|
<id>1</id>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiRS232
|
||||||
|
<history>ip-nbr~;ping fe80::202:2:2:2~;ip-nbr~;help~;je;p~;ping da~;ping~;help~;</history>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiRadio
|
||||||
|
<bitrate>250.0</bitrate>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiEEPROM
|
||||||
|
<eeprom>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</eeprom>
|
||||||
|
</interface_config>
|
||||||
|
<motetype_identifier>mtype787</motetype_identifier>
|
||||||
|
</mote>
|
||||||
|
<mote>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.interfaces.Position
|
||||||
|
<x>28.22612889898729</x>
|
||||||
|
<y>43.60027658221718</y>
|
||||||
|
<z>0.0</z>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiMoteID
|
||||||
|
<id>2</id>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiRadio
|
||||||
|
<bitrate>250.0</bitrate>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiEEPROM
|
||||||
|
<eeprom>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</eeprom>
|
||||||
|
</interface_config>
|
||||||
|
<motetype_identifier>mtype787</motetype_identifier>
|
||||||
|
</mote>
|
||||||
|
</simulation>
|
||||||
|
<plugin>
|
||||||
|
org.contikios.cooja.plugins.ScriptRunner
|
||||||
|
<plugin_config>
|
||||||
|
<scriptfile>[CONTIKI_DIR]/tests/09-ipv6/js/ping-test-lla-ula.js</scriptfile>
|
||||||
|
<active>true</active>
|
||||||
|
</plugin_config>
|
||||||
|
<width>495</width>
|
||||||
|
<z>0</z>
|
||||||
|
<height>525</height>
|
||||||
|
<location_x>190</location_x>
|
||||||
|
<location_y>18</location_y>
|
||||||
|
</plugin>
|
||||||
|
</simconf>
|
108
tests/09-ipv6/10-ping-lla-ula-tsch-w-rpl.csc
Normal file
108
tests/09-ipv6/10-ping-lla-ula-tsch-w-rpl.csc
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<simconf>
|
||||||
|
<project EXPORT="discard">[APPS_DIR]/mrm</project>
|
||||||
|
<project EXPORT="discard">[APPS_DIR]/mspsim</project>
|
||||||
|
<project EXPORT="discard">[APPS_DIR]/avrora</project>
|
||||||
|
<project EXPORT="discard">[APPS_DIR]/serial_socket</project>
|
||||||
|
<project EXPORT="discard">[APPS_DIR]/powertracker</project>
|
||||||
|
<simulation>
|
||||||
|
<title>My simulation</title>
|
||||||
|
<speedlimit>1.0</speedlimit>
|
||||||
|
<randomseed>123456</randomseed>
|
||||||
|
<motedelay_us>1000000</motedelay_us>
|
||||||
|
<radiomedium>
|
||||||
|
org.contikios.cooja.radiomediums.UDGM
|
||||||
|
<transmitting_range>50.0</transmitting_range>
|
||||||
|
<interference_range>100.0</interference_range>
|
||||||
|
<success_ratio_tx>1.0</success_ratio_tx>
|
||||||
|
<success_ratio_rx>1.0</success_ratio_rx>
|
||||||
|
</radiomedium>
|
||||||
|
<events>
|
||||||
|
<logoutput>40000</logoutput>
|
||||||
|
</events>
|
||||||
|
<motetype>
|
||||||
|
org.contikios.cooja.contikimote.ContikiMoteType
|
||||||
|
<identifier>mtype787</identifier>
|
||||||
|
<description>Cooja Mote Type #1</description>
|
||||||
|
<source>[CONTIKI_DIR]/tests/09-ipv6/code/node.c</source>
|
||||||
|
<commands>make clean
|
||||||
|
make WITH_ULA=1 WITH_TSCH=1 node.cooja</commands>
|
||||||
|
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.interfaces.Battery</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiVib</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiMoteID</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiRS232</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiBeeper</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiIPAddress</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiRadio</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiButton</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiPIR</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiClock</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiLED</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiCFS</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiEEPROM</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.interfaces.Mote2MoteRelations</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.interfaces.MoteAttributes</moteinterface>
|
||||||
|
<symbols>false</symbols>
|
||||||
|
</motetype>
|
||||||
|
<mote>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.interfaces.Position
|
||||||
|
<x>14.03051207883138</x>
|
||||||
|
<y>82.02801380504546</y>
|
||||||
|
<z>0.0</z>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiMoteID
|
||||||
|
<id>1</id>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiRS232
|
||||||
|
<history>ip-nbr~;ping fe80::202:2:2:2~;ip-nbr~;help~;je;p~;ping da~;ping~;help~;</history>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiRadio
|
||||||
|
<bitrate>250.0</bitrate>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiEEPROM
|
||||||
|
<eeprom>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</eeprom>
|
||||||
|
</interface_config>
|
||||||
|
<motetype_identifier>mtype787</motetype_identifier>
|
||||||
|
</mote>
|
||||||
|
<mote>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.interfaces.Position
|
||||||
|
<x>28.22612889898729</x>
|
||||||
|
<y>43.60027658221718</y>
|
||||||
|
<z>0.0</z>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiMoteID
|
||||||
|
<id>2</id>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiRadio
|
||||||
|
<bitrate>250.0</bitrate>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiEEPROM
|
||||||
|
<eeprom>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</eeprom>
|
||||||
|
</interface_config>
|
||||||
|
<motetype_identifier>mtype787</motetype_identifier>
|
||||||
|
</mote>
|
||||||
|
</simulation>
|
||||||
|
<plugin>
|
||||||
|
org.contikios.cooja.plugins.ScriptRunner
|
||||||
|
<plugin_config>
|
||||||
|
<scriptfile>[CONTIKI_DIR]/tests/09-ipv6/js/ping-test-lla-ula.js</scriptfile>
|
||||||
|
<active>true</active>
|
||||||
|
</plugin_config>
|
||||||
|
<width>495</width>
|
||||||
|
<z>0</z>
|
||||||
|
<height>525</height>
|
||||||
|
<location_x>190</location_x>
|
||||||
|
<location_y>18</location_y>
|
||||||
|
</plugin>
|
||||||
|
</simconf>
|
108
tests/09-ipv6/11-ping-lla-ula-csma-wo-rpl.csc
Normal file
108
tests/09-ipv6/11-ping-lla-ula-csma-wo-rpl.csc
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<simconf>
|
||||||
|
<project EXPORT="discard">[APPS_DIR]/mrm</project>
|
||||||
|
<project EXPORT="discard">[APPS_DIR]/mspsim</project>
|
||||||
|
<project EXPORT="discard">[APPS_DIR]/avrora</project>
|
||||||
|
<project EXPORT="discard">[APPS_DIR]/serial_socket</project>
|
||||||
|
<project EXPORT="discard">[APPS_DIR]/powertracker</project>
|
||||||
|
<simulation>
|
||||||
|
<title>My simulation</title>
|
||||||
|
<speedlimit>1.0</speedlimit>
|
||||||
|
<randomseed>123456</randomseed>
|
||||||
|
<motedelay_us>1000000</motedelay_us>
|
||||||
|
<radiomedium>
|
||||||
|
org.contikios.cooja.radiomediums.UDGM
|
||||||
|
<transmitting_range>50.0</transmitting_range>
|
||||||
|
<interference_range>100.0</interference_range>
|
||||||
|
<success_ratio_tx>1.0</success_ratio_tx>
|
||||||
|
<success_ratio_rx>1.0</success_ratio_rx>
|
||||||
|
</radiomedium>
|
||||||
|
<events>
|
||||||
|
<logoutput>40000</logoutput>
|
||||||
|
</events>
|
||||||
|
<motetype>
|
||||||
|
org.contikios.cooja.contikimote.ContikiMoteType
|
||||||
|
<identifier>mtype787</identifier>
|
||||||
|
<description>Cooja Mote Type #1</description>
|
||||||
|
<source>[CONTIKI_DIR]/tests/09-ipv6/code/node.c</source>
|
||||||
|
<commands>make clean
|
||||||
|
make WITH_NBR_MULTI_IPV6_ADDRS=1 WITH_ULA=1 WITH_CSMA=1 WITHOUT_RPL=1 node.cooja</commands>
|
||||||
|
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.interfaces.Battery</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiVib</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiMoteID</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiRS232</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiBeeper</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiIPAddress</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiRadio</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiButton</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiPIR</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiClock</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiLED</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiCFS</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiEEPROM</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.interfaces.Mote2MoteRelations</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.interfaces.MoteAttributes</moteinterface>
|
||||||
|
<symbols>false</symbols>
|
||||||
|
</motetype>
|
||||||
|
<mote>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.interfaces.Position
|
||||||
|
<x>14.03051207883138</x>
|
||||||
|
<y>82.02801380504546</y>
|
||||||
|
<z>0.0</z>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiMoteID
|
||||||
|
<id>1</id>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiRS232
|
||||||
|
<history>ip-nbr~;ping fe80::202:2:2:2~;ip-nbr~;help~;je;p~;ping da~;ping~;help~;</history>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiRadio
|
||||||
|
<bitrate>250.0</bitrate>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiEEPROM
|
||||||
|
<eeprom>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</eeprom>
|
||||||
|
</interface_config>
|
||||||
|
<motetype_identifier>mtype787</motetype_identifier>
|
||||||
|
</mote>
|
||||||
|
<mote>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.interfaces.Position
|
||||||
|
<x>28.22612889898729</x>
|
||||||
|
<y>43.60027658221718</y>
|
||||||
|
<z>0.0</z>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiMoteID
|
||||||
|
<id>2</id>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiRadio
|
||||||
|
<bitrate>250.0</bitrate>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiEEPROM
|
||||||
|
<eeprom>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</eeprom>
|
||||||
|
</interface_config>
|
||||||
|
<motetype_identifier>mtype787</motetype_identifier>
|
||||||
|
</mote>
|
||||||
|
</simulation>
|
||||||
|
<plugin>
|
||||||
|
org.contikios.cooja.plugins.ScriptRunner
|
||||||
|
<plugin_config>
|
||||||
|
<scriptfile>[CONTIKI_DIR]/tests/09-ipv6/js/ping-test-lla-ula.js</scriptfile>
|
||||||
|
<active>true</active>
|
||||||
|
</plugin_config>
|
||||||
|
<width>495</width>
|
||||||
|
<z>0</z>
|
||||||
|
<height>525</height>
|
||||||
|
<location_x>190</location_x>
|
||||||
|
<location_y>18</location_y>
|
||||||
|
</plugin>
|
||||||
|
</simconf>
|
108
tests/09-ipv6/12-ping-lla-ula-tsch-wo-rpl.csc
Normal file
108
tests/09-ipv6/12-ping-lla-ula-tsch-wo-rpl.csc
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<simconf>
|
||||||
|
<project EXPORT="discard">[APPS_DIR]/mrm</project>
|
||||||
|
<project EXPORT="discard">[APPS_DIR]/mspsim</project>
|
||||||
|
<project EXPORT="discard">[APPS_DIR]/avrora</project>
|
||||||
|
<project EXPORT="discard">[APPS_DIR]/serial_socket</project>
|
||||||
|
<project EXPORT="discard">[APPS_DIR]/powertracker</project>
|
||||||
|
<simulation>
|
||||||
|
<title>My simulation</title>
|
||||||
|
<speedlimit>1.0</speedlimit>
|
||||||
|
<randomseed>123456</randomseed>
|
||||||
|
<motedelay_us>1000000</motedelay_us>
|
||||||
|
<radiomedium>
|
||||||
|
org.contikios.cooja.radiomediums.UDGM
|
||||||
|
<transmitting_range>50.0</transmitting_range>
|
||||||
|
<interference_range>100.0</interference_range>
|
||||||
|
<success_ratio_tx>1.0</success_ratio_tx>
|
||||||
|
<success_ratio_rx>1.0</success_ratio_rx>
|
||||||
|
</radiomedium>
|
||||||
|
<events>
|
||||||
|
<logoutput>40000</logoutput>
|
||||||
|
</events>
|
||||||
|
<motetype>
|
||||||
|
org.contikios.cooja.contikimote.ContikiMoteType
|
||||||
|
<identifier>mtype787</identifier>
|
||||||
|
<description>Cooja Mote Type #1</description>
|
||||||
|
<source>[CONTIKI_DIR]/tests/09-ipv6/code/node.c</source>
|
||||||
|
<commands>make clean
|
||||||
|
make WITH_NBR_MULTI_IPV6_ADDRS=1 WITH_ULA=1 WITH_TSCH=1 WITHOUT_RPL=1 node.cooja</commands>
|
||||||
|
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.interfaces.Battery</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiVib</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiMoteID</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiRS232</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiBeeper</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiIPAddress</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiRadio</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiButton</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiPIR</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiClock</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiLED</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiCFS</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiEEPROM</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.interfaces.Mote2MoteRelations</moteinterface>
|
||||||
|
<moteinterface>org.contikios.cooja.interfaces.MoteAttributes</moteinterface>
|
||||||
|
<symbols>false</symbols>
|
||||||
|
</motetype>
|
||||||
|
<mote>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.interfaces.Position
|
||||||
|
<x>14.03051207883138</x>
|
||||||
|
<y>82.02801380504546</y>
|
||||||
|
<z>0.0</z>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiMoteID
|
||||||
|
<id>1</id>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiRS232
|
||||||
|
<history>ip-nbr~;ping fe80::202:2:2:2~;ip-nbr~;help~;je;p~;ping da~;ping~;help~;</history>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiRadio
|
||||||
|
<bitrate>250.0</bitrate>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiEEPROM
|
||||||
|
<eeprom>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</eeprom>
|
||||||
|
</interface_config>
|
||||||
|
<motetype_identifier>mtype787</motetype_identifier>
|
||||||
|
</mote>
|
||||||
|
<mote>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.interfaces.Position
|
||||||
|
<x>28.22612889898729</x>
|
||||||
|
<y>43.60027658221718</y>
|
||||||
|
<z>0.0</z>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiMoteID
|
||||||
|
<id>2</id>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiRadio
|
||||||
|
<bitrate>250.0</bitrate>
|
||||||
|
</interface_config>
|
||||||
|
<interface_config>
|
||||||
|
org.contikios.cooja.contikimote.interfaces.ContikiEEPROM
|
||||||
|
<eeprom>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</eeprom>
|
||||||
|
</interface_config>
|
||||||
|
<motetype_identifier>mtype787</motetype_identifier>
|
||||||
|
</mote>
|
||||||
|
</simulation>
|
||||||
|
<plugin>
|
||||||
|
org.contikios.cooja.plugins.ScriptRunner
|
||||||
|
<plugin_config>
|
||||||
|
<scriptfile>[CONTIKI_DIR]/tests/09-ipv6/js/ping-test-lla-ula.js</scriptfile>
|
||||||
|
<active>true</active>
|
||||||
|
</plugin_config>
|
||||||
|
<width>495</width>
|
||||||
|
<z>0</z>
|
||||||
|
<height>525</height>
|
||||||
|
<location_x>190</location_x>
|
||||||
|
<location_y>18</location_y>
|
||||||
|
</plugin>
|
||||||
|
</simconf>
|
@ -28,6 +28,10 @@ ifeq ($(WITH_TSCH),1)
|
|||||||
CFLAGS += -DTSCH_CONF_DEFAULT_HOPPING_SEQUENCE=TSCH_HOPPING_SEQUENCE_1_1
|
CFLAGS += -DTSCH_CONF_DEFAULT_HOPPING_SEQUENCE=TSCH_HOPPING_SEQUENCE_1_1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(WITH_NBR_MULTI_IPV6_ADDRS),1)
|
||||||
|
CFLAGS += -DUIP_DS6_NBR_CONF_MULTI_IPV6_ADDRS=1
|
||||||
|
endif
|
||||||
|
|
||||||
PLATFORM_ONLY = cooja
|
PLATFORM_ONLY = cooja
|
||||||
TARGET = cooja
|
TARGET = cooja
|
||||||
|
|
||||||
|
72
tests/09-ipv6/js/ping-test-lla-ula.js
Normal file
72
tests/09-ipv6/js/ping-test-lla-ula.js
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
TIMEOUT(20000, log.testFailed());
|
||||||
|
|
||||||
|
dst_lla = "fe80::202:2:2:2";
|
||||||
|
dst_ula = "fd00::202:2:2:2";
|
||||||
|
dst_mac = "0002.0002.0002.0002";
|
||||||
|
step = 0;
|
||||||
|
rpl_is_enabled = false;
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
YIELD();
|
||||||
|
log.log(time + " " + id + " "+ msg + "\n");
|
||||||
|
|
||||||
|
if(msg.contains("Node ID: ")) {
|
||||||
|
if(id == 1) {
|
||||||
|
write(sim.getMoteWithID(1), "rpl-set-root 1");
|
||||||
|
}
|
||||||
|
step += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(msg.contains("Setting as DAG root")) {
|
||||||
|
rpl_is_enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(step == 2 && time > 15000000) {
|
||||||
|
write(sim.getMoteWithID(1), "ping " + dst_lla);
|
||||||
|
step += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(step == 4 && time > 15000000) {
|
||||||
|
write(sim.getMoteWithID(1), "ping " + dst_ula);
|
||||||
|
step += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(msg.contains("Received ping reply")) {
|
||||||
|
if(step == 3) {
|
||||||
|
step += 1;
|
||||||
|
} else {
|
||||||
|
step += 1;
|
||||||
|
write(sim.getMoteWithID(1), "ip-nbr");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(step == 6 && rpl_is_enabled) {
|
||||||
|
/* when RPL is enabled, we skip examining ip-nbr results */
|
||||||
|
log.testOK();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(msg.contains("<->")) {
|
||||||
|
re = /-- | <-> |, router|, state /;
|
||||||
|
nc = msg.split(re);
|
||||||
|
ip_addr = nc[1];
|
||||||
|
ll_addr = nc[2];
|
||||||
|
is_router = nc[3];
|
||||||
|
state = nc[4].trim();
|
||||||
|
if(ll_addr == dst_mac &&
|
||||||
|
state == "Reachable") {
|
||||||
|
if(step == 6 && ip_addr == dst_lla) {
|
||||||
|
step += 1;
|
||||||
|
} else if(step == 7 && ip_addr == dst_ula) {
|
||||||
|
log.testOK();
|
||||||
|
} else {
|
||||||
|
/* unexpected case */
|
||||||
|
log.testFailed();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.log(ip_addr + "\n");
|
||||||
|
log.log(ll_addr + "\n");
|
||||||
|
log.log(state + "\n");
|
||||||
|
log.testFailed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
21
tests/10-ipv6-nbr/01-test-nbr-multi-addrs.sh
Executable file
21
tests/10-ipv6-nbr/01-test-nbr-multi-addrs.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
TEST_NAME=01-test-nbr-multi-addrs
|
||||||
|
|
||||||
|
if [ $# -eq 1 ]; then
|
||||||
|
# a (relative) path to CONTIKI_DIR is supposed to be given as $1
|
||||||
|
TEST_DIR=$1/tests/10-ipv6-nbr
|
||||||
|
else
|
||||||
|
TEST_DIR=.//tests/10-ipv6-nbr
|
||||||
|
fi
|
||||||
|
SRC_DIR=${TEST_DIR}/nbr-multi-addrs
|
||||||
|
EXEC_FILE_NAME=test.native
|
||||||
|
|
||||||
|
make -C ${SRC_DIR} clean
|
||||||
|
|
||||||
|
echo "build the test program"...
|
||||||
|
make -C ${SRC_DIR} > ${TEST_NAME}.log
|
||||||
|
|
||||||
|
echo "run the test..."
|
||||||
|
${TEST_DIR}/${SRC_DIR}/${EXEC_FILE_NAME} | tee ${TEST_NAME}.log | \
|
||||||
|
grep -vE '^\[' >> ${TEST_NAME}.testlog
|
1
tests/10-ipv6-nbr/Makefile
Normal file
1
tests/10-ipv6-nbr/Makefile
Normal file
@ -0,0 +1 @@
|
|||||||
|
include ../Makefile.script-test
|
14
tests/10-ipv6-nbr/nbr-multi-addrs/Makefile
Normal file
14
tests/10-ipv6-nbr/nbr-multi-addrs/Makefile
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
CONTIKI_PROJECT = test
|
||||||
|
all: $(CONTIKI_PROJECT)
|
||||||
|
|
||||||
|
CFLAGS += -DUNIT_TEST_PRINT_FUNCTION=my_test_print
|
||||||
|
CFLAGS += -DLOG_CONF_LEVEL_IPV6=LOG_LEVEL_DBG
|
||||||
|
CFLAGS += -DNBR_TABLE_FIND_REMOVABLE=my_always_return_null
|
||||||
|
CFLAGS += -DUIP_DS6_NBR_CONF_MULTI_IPV6_ADDRS=1
|
||||||
|
|
||||||
|
PLATFORM_ONLY = native
|
||||||
|
TARGET = native
|
||||||
|
MODULES += os/sys/log os/services/unit-test
|
||||||
|
|
||||||
|
CONTIKI = ../../../
|
||||||
|
include $(CONTIKI)/Makefile.include
|
260
tests/10-ipv6-nbr/nbr-multi-addrs/test.c
Normal file
260
tests/10-ipv6-nbr/nbr-multi-addrs/test.c
Normal file
@ -0,0 +1,260 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Yasuyuki Tanaka
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. Neither the name of the copyright holder nor the names of its
|
||||||
|
* contributors may be used to endorse or promote products derived
|
||||||
|
* from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <contiki.h>
|
||||||
|
#include <sys/log.h>
|
||||||
|
#include <lib/random.h>
|
||||||
|
#include <net/nbr-table.h>
|
||||||
|
#include <net/ipv6/uip-ds6-nbr.h>
|
||||||
|
#include <unit-test/unit-test.h>
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#define LOG_MODULE "test"
|
||||||
|
#define LOG_LEVEL LOG_LEVEL_DBG
|
||||||
|
|
||||||
|
/* report function defined in unit-test.c */
|
||||||
|
void unit_test_print_report(const unit_test_t *utp);
|
||||||
|
|
||||||
|
static const uint8_t is_router = 1;
|
||||||
|
static const uint8_t state = NBR_INCOMPLETE;
|
||||||
|
static const nbr_table_reason_t reason = NBR_TABLE_REASON_UNDEFINED;
|
||||||
|
|
||||||
|
static void remove_all_entries_in_neighbor_cache(void);
|
||||||
|
|
||||||
|
PROCESS(node_process, "Node");
|
||||||
|
AUTOSTART_PROCESSES(&node_process);
|
||||||
|
|
||||||
|
void
|
||||||
|
my_test_print(const unit_test_t *utp)
|
||||||
|
{
|
||||||
|
unit_test_print_report(utp);
|
||||||
|
if(utp->result == unit_test_failure) {
|
||||||
|
printf("\nTEST FAILED\n");
|
||||||
|
exit(1); /* exit by failure */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* my_always_return_null() is set to NBR_TABLE_FIND_REMOVABLE */
|
||||||
|
const linkaddr_t *
|
||||||
|
my_always_return_null(nbr_table_reason_t reason, void *data)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
remove_all_entries_in_neighbor_cache(void)
|
||||||
|
{
|
||||||
|
uip_ds6_nbr_t *nbr, *next_nbr;
|
||||||
|
for(nbr = uip_ds6_nbr_head(); nbr != NULL; nbr = next_nbr) {
|
||||||
|
next_nbr = uip_ds6_nbr_next(nbr);
|
||||||
|
uip_ds6_nbr_rm(nbr);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* uip_ds6_nbr_rm() cannot free the memory for an entry in nbr-table. There is
|
||||||
|
* no API to free or deallocate unused nbr-table entry. Because of that,
|
||||||
|
* nbr-table has some link-layer addresses even though this function removes
|
||||||
|
* all the neighbor cache entries.
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
UNIT_TEST_REGISTER(add_v6addrs_to_neighbor,
|
||||||
|
"add IPv6 addresses to a single neighbor");
|
||||||
|
UNIT_TEST(add_v6addrs_to_neighbor)
|
||||||
|
{
|
||||||
|
uip_ipaddr_t ipaddr;
|
||||||
|
uip_lladdr_t lladdr;
|
||||||
|
uip_ds6_nbr_t *nbr;
|
||||||
|
const uip_lladdr_t *ret_lladdr;
|
||||||
|
|
||||||
|
memset(&ipaddr, 0, sizeof(ipaddr));
|
||||||
|
memset(&lladdr, 0, sizeof(lladdr));
|
||||||
|
|
||||||
|
UNIT_TEST_BEGIN();
|
||||||
|
|
||||||
|
/* make sure the neighbor cache table is empty */
|
||||||
|
remove_all_entries_in_neighbor_cache();
|
||||||
|
UNIT_TEST_ASSERT(uip_ds6_nbr_head() == NULL);
|
||||||
|
UNIT_TEST_ASSERT(uip_ds6_nbr_num() == 0);
|
||||||
|
|
||||||
|
/* prepare a link-layer address */
|
||||||
|
LOG_DBG("link-layer addr: ");
|
||||||
|
LOG_DBG_LLADDR((const linkaddr_t *)&lladdr);
|
||||||
|
LOG_DBG_("\n");
|
||||||
|
|
||||||
|
for(int i = 0; i <= UIP_DS6_NBR_MAX_6ADDRS_PER_NBR; i++) {
|
||||||
|
ipaddr.u8[0] = i;
|
||||||
|
LOG_DBG("adding ipv6 addr (");
|
||||||
|
LOG_DBG_6ADDR(&ipaddr);
|
||||||
|
LOG_DBG_("[i=%u])\n", i);
|
||||||
|
|
||||||
|
/* add a binding of the IPv6 address and the MAC address */
|
||||||
|
nbr = uip_ds6_nbr_add(&ipaddr, &lladdr, is_router, state, reason, NULL);
|
||||||
|
if(i < UIP_DS6_NBR_MAX_6ADDRS_PER_NBR) {
|
||||||
|
UNIT_TEST_ASSERT(nbr != NULL);
|
||||||
|
UNIT_TEST_ASSERT(memcmp(&nbr->ipaddr, &ipaddr, sizeof(ipaddr)) == 0);
|
||||||
|
UNIT_TEST_ASSERT(nbr->state == state);
|
||||||
|
UNIT_TEST_ASSERT(uip_ds6_nbr_num() == (i + 1));
|
||||||
|
/*
|
||||||
|
* for some reason, nbr->isrouter is not set if both UIP_ND6_SEND_RA and
|
||||||
|
* !UIP_CONF_ROUTER is 0 (see uip-ds6-nbr.c)
|
||||||
|
*/
|
||||||
|
// UNIT_TEST_ASSERT(nbr->isrouter == is_router);
|
||||||
|
ret_lladdr = uip_ds6_nbr_lladdr_from_ipaddr((const uip_ipaddr_t *)&ipaddr);
|
||||||
|
UNIT_TEST_ASSERT(ret_lladdr != NULL);
|
||||||
|
UNIT_TEST_ASSERT(memcmp(ret_lladdr, &lladdr, sizeof(lladdr)) == 0);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
/* i == UIP_DS6_NBR_MAX_6ADDRS_PER_NBR; the address shouldn't be added */
|
||||||
|
UNIT_TEST_ASSERT(nbr == NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UNIT_TEST_END();
|
||||||
|
}
|
||||||
|
|
||||||
|
UNIT_TEST_REGISTER(remove_v6addrs_of_neighbor,
|
||||||
|
"remove IPv6 addresses associated with a single neighbor");
|
||||||
|
UNIT_TEST(remove_v6addrs_of_neighbor)
|
||||||
|
{
|
||||||
|
uip_ipaddr_t ipaddr;
|
||||||
|
uip_lladdr_t lladdr;
|
||||||
|
uip_ds6_nbr_t *nbr, *next_nbr;
|
||||||
|
|
||||||
|
memset(&ipaddr, 0, sizeof(ipaddr));
|
||||||
|
memset(&lladdr, 0, sizeof(lladdr));
|
||||||
|
|
||||||
|
UNIT_TEST_BEGIN();
|
||||||
|
|
||||||
|
/* make sure the neighbor cache table is empty */
|
||||||
|
remove_all_entries_in_neighbor_cache();
|
||||||
|
UNIT_TEST_ASSERT(uip_ds6_nbr_head() == NULL);
|
||||||
|
UNIT_TEST_ASSERT(uip_ds6_nbr_num() == 0);
|
||||||
|
|
||||||
|
/* prepare a link-layer address */
|
||||||
|
LOG_DBG("link-layer addr: ");
|
||||||
|
LOG_DBG_LLADDR((const linkaddr_t *)&lladdr);
|
||||||
|
LOG_DBG_("\n");
|
||||||
|
|
||||||
|
/* fill the neighbor entry associated with the link-layer address */
|
||||||
|
for(int i = 0; i < UIP_DS6_NBR_MAX_6ADDRS_PER_NBR; i++) {
|
||||||
|
ipaddr.u8[0] = i;
|
||||||
|
nbr = uip_ds6_nbr_add(&ipaddr, &lladdr, is_router, state, reason, NULL);
|
||||||
|
UNIT_TEST_ASSERT(nbr != NULL);
|
||||||
|
UNIT_TEST_ASSERT(uip_ds6_nbr_num() == (i + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* remove IPv6 addresses for the link-layer address one by one */
|
||||||
|
for(nbr = uip_ds6_nbr_head(); nbr != NULL; nbr = next_nbr) {
|
||||||
|
LOG_DBG("removing nbr:%p\n", nbr);
|
||||||
|
next_nbr = uip_ds6_nbr_next(nbr);
|
||||||
|
UNIT_TEST_ASSERT(uip_ds6_nbr_rm(nbr) == 1);
|
||||||
|
}
|
||||||
|
UNIT_TEST_ASSERT(uip_ds6_nbr_num() == 0);
|
||||||
|
UNIT_TEST_ASSERT(uip_ds6_nbr_head() == NULL);
|
||||||
|
|
||||||
|
UNIT_TEST_END();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
UNIT_TEST_REGISTER(fill_neighbor_cache_table,
|
||||||
|
"fill the neighbor cache table");
|
||||||
|
UNIT_TEST(fill_neighbor_cache_table)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* We should be able to add the same number of link-layer addresses as
|
||||||
|
* NBR_TABLE_MAX_NEIGHBORS. In addition, we should be add the same number of
|
||||||
|
* IPv6 addresses per link-layer address as
|
||||||
|
* UIP_DS6_NBR_CONF_MAX_6ADDRS_PER_NBR.
|
||||||
|
*/
|
||||||
|
uip_ipaddr_t ipaddr;
|
||||||
|
uip_lladdr_t lladdr;
|
||||||
|
uip_ds6_nbr_t *nbr;
|
||||||
|
|
||||||
|
memset(&ipaddr, 0, sizeof(ipaddr));
|
||||||
|
memset(&lladdr, 0, sizeof(lladdr));
|
||||||
|
|
||||||
|
UNIT_TEST_BEGIN();
|
||||||
|
|
||||||
|
/* make sure the neighbor cache table is empty */
|
||||||
|
remove_all_entries_in_neighbor_cache();
|
||||||
|
UNIT_TEST_ASSERT(uip_ds6_nbr_head() == NULL);
|
||||||
|
UNIT_TEST_ASSERT(uip_ds6_nbr_num() == 0);
|
||||||
|
|
||||||
|
for(int i = 0; i <= NBR_TABLE_MAX_NEIGHBORS; i++) {
|
||||||
|
lladdr.addr[0] = i & 0xFF;
|
||||||
|
lladdr.addr[1] = i >> 8;
|
||||||
|
for(int j = 0; j <= UIP_DS6_NBR_MAX_6ADDRS_PER_NBR; j++) {
|
||||||
|
ipaddr.u8[0] = i & 0xFF;
|
||||||
|
ipaddr.u8[1] = i >> 8;
|
||||||
|
ipaddr.u8[2] = j;
|
||||||
|
LOG_DBG("adding ipv6 addr (");
|
||||||
|
LOG_DBG_6ADDR(&ipaddr);
|
||||||
|
LOG_DBG_(") to link-layer addr (");
|
||||||
|
LOG_DBG_LLADDR((const linkaddr_t *)&lladdr);
|
||||||
|
LOG_DBG_(") [i=%u,j=%u]\n", i, j);
|
||||||
|
|
||||||
|
nbr = uip_ds6_nbr_add(&ipaddr, &lladdr, is_router, state, reason, NULL);
|
||||||
|
if((i < NBR_TABLE_MAX_NEIGHBORS) &&
|
||||||
|
(j < UIP_DS6_NBR_MAX_6ADDRS_PER_NBR)) {
|
||||||
|
UNIT_TEST_ASSERT(nbr != NULL);
|
||||||
|
} else if(i == NBR_TABLE_MAX_NEIGHBORS) {
|
||||||
|
/* we should not be able to add a link-layer address any more */
|
||||||
|
UNIT_TEST_ASSERT(j == 0);
|
||||||
|
UNIT_TEST_ASSERT(nbr == NULL);
|
||||||
|
break;
|
||||||
|
} else if(j == UIP_DS6_NBR_MAX_6ADDRS_PER_NBR) {
|
||||||
|
/* we should not be able to add an IPv6 address any more */
|
||||||
|
UNIT_TEST_ASSERT(i < NBR_TABLE_MAX_NEIGHBORS);
|
||||||
|
UNIT_TEST_ASSERT(nbr == NULL);
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
/* shouldn't come here */
|
||||||
|
UNIT_TEST_ASSERT(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UNIT_TEST_END();
|
||||||
|
}
|
||||||
|
|
||||||
|
PROCESS_THREAD(node_process, ev, data)
|
||||||
|
{
|
||||||
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
|
UNIT_TEST_RUN(add_v6addrs_to_neighbor);
|
||||||
|
UNIT_TEST_RUN(remove_v6addrs_of_neighbor);
|
||||||
|
UNIT_TEST_RUN(fill_neighbor_cache_table);
|
||||||
|
|
||||||
|
printf("\nTEST SUCCEEDED\n");
|
||||||
|
exit(0); /* success: all the test passed */
|
||||||
|
|
||||||
|
PROCESS_END();
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user