From cfb3bbdad93bb29d8134b1fbf8a05ff7caaa9a97 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Wed, 3 Jul 2013 19:12:23 +0200 Subject: [PATCH 01/29] Added new neighbor-table module, a centralized place where to store all data about neighbors, indexed by link-layer address. Meant for use in other Contiki modules such as rpl, ds6, ds6-route, phase, neighbor-info. --- core/net/Makefile.uip | 1 + core/net/neighbor-table.c | 350 ++++++++++++++++++++++++++++++++++++++ core/net/neighbor-table.h | 103 +++++++++++ 3 files changed, 454 insertions(+) create mode 100644 core/net/neighbor-table.c create mode 100644 core/net/neighbor-table.h diff --git a/core/net/Makefile.uip b/core/net/Makefile.uip index 469a29b22..c675bfe74 100644 --- a/core/net/Makefile.uip +++ b/core/net/Makefile.uip @@ -3,6 +3,7 @@ dhcpc.c \ hc.c \ neighbor-attr.c \ neighbor-info.c \ +neighbor-table.c \ netstack.c \ packetbuf.c \ packetqueue.c \ diff --git a/core/net/neighbor-table.c b/core/net/neighbor-table.c new file mode 100644 index 000000000..194e996d5 --- /dev/null +++ b/core/net/neighbor-table.c @@ -0,0 +1,350 @@ +/* + * Copyright (c) 2013, Swedish Institute of Computer Science + * Copyright (c) 2010, Vrije Universiteit Brussel + * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. + * + * + * Authors: Simon Duquennoy + * Joris Borms + */ + +#include "contiki.h" + +#include +#include +#include "lib/memb.h" +#include "lib/list.h" +#include "net/neighbor-table.h" + +/* List of link-layer addresses of the neighbors, used as key in the tables */ +typedef struct nbr_table_key { + struct nbr_table_key *next; + rimeaddr_t lladdr; +} nbr_table_key_t; + +/* For each neighbor, a map of the tables that use the neighbor. + * As we are using uint8_t, we have a maximum of 8 tables in the system */ +static uint8_t used_map[NEIGHBOR_TABLE_MAX_NEIGHBORS]; +/* For each neighbor, a map of the tables that lock the neighbor */ +static uint8_t locked_map[NEIGHBOR_TABLE_MAX_NEIGHBORS]; +/* The maximum number of tables */ +#define MAX_NUM_TABLES 8 +/* A list of pointers to tables in use */ +static struct nbr_table *all_tables[MAX_NUM_TABLES]; +/* The current number of tables */ +static unsigned num_tables; + +/* The neighbor address table */ +MEMB(neighbor_addr_mem, nbr_table_key_t, NEIGHBOR_TABLE_MAX_NEIGHBORS); +LIST(nbr_table_keys); + +/*---------------------------------------------------------------------------*/ +/* Get a key from a neighbor index */ +static nbr_table_key_t * +key_from_index(int index) +{ + return index != -1 ? &((nbr_table_key_t *)neighbor_addr_mem.mem)[index] : NULL; +} +/*---------------------------------------------------------------------------*/ +/* Get an item from its neighbor index */ +static item_t * +item_from_index(nbr_table_t *table, int index) +{ + return table != NULL && index != -1 ? (char *)table->data + index * table->item_size : NULL; +} +/*---------------------------------------------------------------------------*/ +/* Get the neighbor index of an item */ +static int +index_from_key(nbr_table_key_t *key) +{ + return key != NULL ? key - (nbr_table_key_t *)neighbor_addr_mem.mem : -1; +} +/*---------------------------------------------------------------------------*/ +/* Get the neighbor index of an item */ +static int +index_from_item(nbr_table_t *table, item_t *item) +{ + return table != NULL && item != NULL ? ((int)((char *)item - (char *)table->data)) / table->item_size : -1; +} +/*---------------------------------------------------------------------------*/ +/* Get an item from its key */ +static item_t * +item_from_key(nbr_table_t *table, nbr_table_key_t *key) +{ + return item_from_index(table, index_from_key(key)); +} +/*---------------------------------------------------------------------------*/ +/* Get the key af an item */ +static nbr_table_key_t * +key_from_item(nbr_table_t *table, item_t *item) +{ + return key_from_index(index_from_item(table, item)); +} +/*---------------------------------------------------------------------------*/ +/* Get the index of a neighbor from its link-layer address */ +static int +index_from_lladdr(const rimeaddr_t *lladdr) +{ + nbr_table_key_t *key; + /* Allow lladdr-free insertion, useful e.g. for IPv6 ND. + * Only one such entry is possible at a time, indexed by rimeaddr_null. */ + if(lladdr == NULL) { + lladdr = &rimeaddr_null; + } + key = list_head(nbr_table_keys); + while(key != NULL) { + if(lladdr && rimeaddr_cmp(lladdr, &key->lladdr)) { + return index_from_key(key); + } + key = list_item_next(key); + } + return -1; +} +/*---------------------------------------------------------------------------*/ +/* Get bit from "used" or "locked" bitmap */ +static int +nbr_get_bit(uint8_t *bitmap, nbr_table_t *table, item_t *item) +{ + int item_index = index_from_item(table, item); + if(table != NULL && item_index != -1) { + return (bitmap[item_index] & (1 << table->index)) != 0; + } else { + return 0; + } + return 0; +} +/*---------------------------------------------------------------------------*/ +/* Set bit in "used" or "locked" bitmap */ +static int +nbr_set_bit(uint8_t *bitmap, nbr_table_t *table, item_t *item, int value) +{ + int item_index = index_from_item(table, item); + if(table != NULL && item_index != -1) { + if(value) { + bitmap[item_index] |= 1 << table->index; + } else { + bitmap[item_index] &= ~(1 << table->index); + } + return 1; + } else { + return 0; + } + return 0; +} +/*---------------------------------------------------------------------------*/ +static nbr_table_key_t * +nbr_table_allocate() +{ + nbr_table_key_t *key; + int least_used_count = 0; + nbr_table_key_t *least_used_key = NULL; + + key = memb_alloc(&neighbor_addr_mem); + if(key != NULL) { + return key; + } else { /* No more space, try to free a neighbor. + * The replacement policy is the following: remove neighbor that is: + * (1) not locked + * (2) used by fewest tables + * (3) oldest (the list is ordered by insertion time) + * */ + /* Get item from first key */ + key = list_head(nbr_table_keys); + while(key != NULL) { + int item_index = index_from_key(key); + int locked = locked_map[item_index]; + /* Never delete a locked item */ + if(!locked) { + int used = used_map[item_index]; + int used_count = 0; + /* Count how many tables are using this item */ + while(used != 0) { + if((used & 1) == 1) { + used_count++; + } + used >>= 1; + } + /* Find least used item */ + if(least_used_key == NULL || used_count < least_used_count) { + least_used_key = key; + least_used_count = used_count; + if(used_count == 0) { /* We won't find any least used item */ + break; + } + } + } + key = list_item_next(key); + } + if(least_used_key == NULL) { + /* We haven't found any unlocked item, allocation fails */ + return NULL; + } else { + /* Reuse least used item */ + int i; + for(i = 0; icallback != NULL) { + /* Call table callback for each table that uses this item */ + item_t *removed_item = item_from_key(all_tables[i], least_used_key); + if(nbr_get_bit(used_map, all_tables[i], removed_item) == 1) { + all_tables[i]->callback(removed_item); + } + } + } + /* Empty used map */ + used_map[index_from_key(least_used_key)] = 0; + /* Remove neighbor from list */ + list_remove(nbr_table_keys, least_used_key); + /* Return associated key */ + return least_used_key; + } + } +} +/*---------------------------------------------------------------------------*/ +/* Register a new neighbor table. To be used at initialization by modules + * using a neighbor table */ +int +nbr_table_register(nbr_table_t *table, remove_callback_func *callback) +{ + if(num_tables < MAX_NUM_TABLES) { + table->index = num_tables++; + table->callback = callback; + all_tables[table->index] = table; + return 1; + } else { + /* Maximum number of tables exceeded */ + return 0; + } +} +/*---------------------------------------------------------------------------*/ +/* Returns the first item of the current table */ +item_t * +nbr_table_head(nbr_table_t *table) +{ + /* Get item from first key */ + item_t *item = item_from_key(table, list_head(nbr_table_keys)); + /* Item is the first neighbor, now check is it is in the current table */ + if(nbr_get_bit(used_map, table, item)) { + return item; + } else { + return nbr_table_next(table, item); + } +} +/*---------------------------------------------------------------------------*/ +/* Iterates over the current table */ +item_t * +nbr_table_next(nbr_table_t *table, item_t *item) +{ + do { + void *key = key_from_item(table, item); + key = list_item_next(key); + /* Loop until the next item is in the current table */ + item = item_from_key(table, key); + } while(item && !nbr_get_bit(used_map, table, item)); + return item; +} +/*---------------------------------------------------------------------------*/ +/* Add a neighbor indexed with its link-layer address */ +item_t * +nbr_table_add_lladdr(nbr_table_t *table, const rimeaddr_t *lladdr) +{ + int index; + item_t *item; + nbr_table_key_t *key; + + /* Allow lladdr-free insertion, useful e.g. for IPv6 ND. + * Only one such entry is possible at a time, indexed by rimeaddr_null. */ + if(lladdr == NULL) { + lladdr = &rimeaddr_null; + } + + if((index = index_from_lladdr(lladdr)) == -1) { + /* Neighbor not yet in table, let's try to allocate one */ + key = nbr_table_allocate(); + + /* No space available for new entry */ + if(key == NULL) { + return NULL; + } + + /* Add neighbor to list */ + list_add(nbr_table_keys, key); + + /* Get index from newly allocated neighbor */ + index = index_from_key(key); + + /* Set link-layer address */ + rimeaddr_copy(&key->lladdr, lladdr); + } + + /* Get item in the current table */ + item = item_from_index(table, index); + + /* Initialize item data and set "used" bit */ + memset(item, 0, table->item_size); + nbr_set_bit(used_map, table, item, 1); + + return item; +} +/*---------------------------------------------------------------------------*/ +/* Get an item from its link-layer address */ +void * +nbr_table_get_from_lladdr(nbr_table_t *table, const rimeaddr_t *lladdr) +{ + void *item = item_from_index(table, index_from_lladdr(lladdr)); + return nbr_get_bit(used_map, table, item) ? item : NULL; +} +/*---------------------------------------------------------------------------*/ +/* Removes a neighbor from the current table (unset "used" bit) */ +int +nbr_table_remove(nbr_table_t *table, void *item) +{ + int ret = nbr_set_bit(used_map, table, item, 0); + nbr_set_bit(locked_map, table, item, 0); + return ret; +} +/*---------------------------------------------------------------------------*/ +/* Lock a neighbor for the current table (set "locked" bit) */ +int +nbr_table_lock(nbr_table_t *table, void *item) +{ + return nbr_set_bit(locked_map, table, item, 1); +} +/*---------------------------------------------------------------------------*/ +/* Release the lock on a neighbor for the current table (unset "locked" bit) */ +int +nbr_table_unlock(nbr_table_t *table, void *item) +{ + return nbr_set_bit(locked_map, table, item, 0); +} +/*---------------------------------------------------------------------------*/ +/* Get link-layer address of an item */ +rimeaddr_t * +nbr_table_get_lladdr(nbr_table_t *table, void *item) +{ + nbr_table_key_t *key = key_from_item(table, item); + return key != NULL ? &key->lladdr : NULL; +} diff --git a/core/net/neighbor-table.h b/core/net/neighbor-table.h new file mode 100644 index 000000000..f2b2f8034 --- /dev/null +++ b/core/net/neighbor-table.h @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2013, Swedish Institute of Computer Science + * Copyright (c) 2010, Vrije Universiteit Brussel + * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. + * + * + * Authors: Simon Duquennoy + * Joris Borms + */ + +#ifndef _NEIGHBOR_TABLE_H_ +#define _NEIGHBOR_TABLE_H_ + +#include "contiki.h" +#include "net/rime/rimeaddr.h" +#include "net/netstack.h" + +/* Neighbor table size */ +#ifdef NEIGHBOR_CONF_MAX_NEIGHBORS +#define NEIGHBOR_TABLE_MAX_NEIGHBORS NEIGHBOR_CONF_MAX_NEIGHBORS +#else /* NEIGHBOR_CONF_MAX_NEIGHBORS */ +#define NEIGHBOR_TABLE_MAX_NEIGHBORS 8 +#endif /* NEIGHBOR_CONF_MAX_NEIGHBORS */ + +/* An item in a neighbor table */ +typedef void item_t; + +/* Callback function, called when removing an item from a table */ +typedef void(remove_callback_func)(item_t *item); + +/* A neighbor table */ +typedef struct nbr_table { + int index; + int item_size; + remove_callback_func *callback; + item_t *data; +} nbr_table_t; + +/** \brief A static neighbor table. To be initialized through nbr_table_register(name) */ +#define NEIGHBOR_TABLE(type, name) \ + static type _##name##_mem[NEIGHBOR_TABLE_MAX_NEIGHBORS]; \ + static nbr_table_t name##_struct = { 0, sizeof(type), NULL, (item_t *)_##name##_mem }; \ + static nbr_table_t *name = &name##_struct \ + +/** \brief A non-static neighbor table. To be initialized through nbr_table_register(name) */ +#define NEIGHBOR_TABLE_GLOBAL(type, name) \ + static type _##name##_mem[NEIGHBOR_TABLE_MAX_NEIGHBORS]; \ + static nbr_table_t name##_struct = { 0, sizeof(type), NULL, (item_t *)_##name##_mem }; \ + nbr_table_t *name = &name##_struct \ + +/** \brief Declaration of non-static neighbor tables */ +#define NEIGHBOR_TABLE_DECLARE(name) extern nbr_table_t *name + +/** \name Neighbor tables: register and loop through table elements */ +/** @{ */ +int nbr_table_register(nbr_table_t *table, remove_callback_func *callback); +item_t *nbr_table_head(nbr_table_t *table); +item_t *nbr_table_next(nbr_table_t *table, item_t *item); +/** @} */ + +/** \name Neighbor tables: add and get data */ +/** @{ */ +item_t *nbr_table_add_lladdr(nbr_table_t *table, const rimeaddr_t *lladdr); +item_t *nbr_table_get_from_lladdr(nbr_table_t *table, const rimeaddr_t *lladdr); +/** @} */ + +/** \name Neighbor tables: set flags (unused, locked, unlocked) */ +/** @{ */ +int nbr_table_remove(nbr_table_t *table, item_t *item); +int nbr_table_lock(nbr_table_t *table, item_t *item); +int nbr_table_unlock(nbr_table_t *table, item_t *item); +/** @} */ + +/** \name Neighbor tables: address manipulation */ +/** @{ */ +rimeaddr_t *nbr_table_get_lladdr(nbr_table_t *table, item_t *item); +/** @} */ + +#endif /* _NEIGHBOR_TABLE_H_ */ From 5a1d8d800696fb00c44ae7fd87f785652c77b3f5 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Wed, 3 Jul 2013 19:14:10 +0200 Subject: [PATCH 02/29] Make phase module use neighbor-table. --- core/net/mac/contikimac.c | 16 ++------ core/net/mac/phase.c | 78 ++++++++++++++------------------------- core/net/mac/phase.h | 35 ++---------------- 3 files changed, 35 insertions(+), 94 deletions(-) diff --git a/core/net/mac/contikimac.c b/core/net/mac/contikimac.c index 9021fda21..66faafa5f 100644 --- a/core/net/mac/contikimac.c +++ b/core/net/mac/contikimac.c @@ -255,16 +255,6 @@ static struct compower_activity current_packet; #include "net/mac/phase.h" -#ifdef CONTIKIMAC_CONF_MAX_PHASE_NEIGHBORS -#define MAX_PHASE_NEIGHBORS CONTIKIMAC_CONF_MAX_PHASE_NEIGHBORS -#endif - -#ifndef MAX_PHASE_NEIGHBORS -#define MAX_PHASE_NEIGHBORS 30 -#endif - -PHASE_LIST(phase_list, MAX_PHASE_NEIGHBORS); - #endif /* WITH_PHASE_OPTIMIZATION */ #define DEFAULT_STREAM_TIME (4 * CYCLE_TIME) @@ -665,7 +655,7 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr, if(!is_broadcast && !is_receiver_awake) { #if WITH_PHASE_OPTIMIZATION - ret = phase_wait(&phase_list, packetbuf_addr(PACKETBUF_ADDR_RECEIVER), + ret = phase_wait(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), CYCLE_TIME, GUARD_TIME, mac_callback, mac_callback_ptr, buf_list); if(ret == PHASE_DEFERRED) { @@ -865,7 +855,7 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr, if(!is_broadcast) { if(collisions == 0 && is_receiver_awake == 0) { - phase_update(&phase_list, packetbuf_addr(PACKETBUF_ADDR_RECEIVER), + phase_update(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), encounter_time, ret); } } @@ -1049,7 +1039,7 @@ init(void) contikimac_is_on = 1; #if WITH_PHASE_OPTIMIZATION - phase_init(&phase_list); + phase_init(); #endif /* WITH_PHASE_OPTIMIZATION */ } diff --git a/core/net/mac/phase.c b/core/net/mac/phase.c index ac29c4afa..f7e48bcab 100644 --- a/core/net/mac/phase.c +++ b/core/net/mac/phase.c @@ -40,11 +40,24 @@ #include "net/mac/phase.h" #include "net/packetbuf.h" #include "sys/clock.h" -#include "lib/memb.h" #include "sys/ctimer.h" #include "net/queuebuf.h" -#include "dev/watchdog.h" -#include "dev/leds.h" +#include "net/neighbor-table.h" + +#if PHASE_CONF_DRIFT_CORRECT +#define PHASE_DRIFT_CORRECT PHASE_CONF_DRIFT_CORRECT +#else +#define PHASE_DRIFT_CORRECT 0 +#endif + +struct phase { + rtimer_clock_t time; +#if PHASE_DRIFT_CORRECT + rtimer_clock_t drift; +#endif + uint8_t noacks; + struct timer noacks_timer; +}; struct phase_queueitem { struct ctimer timer; @@ -62,6 +75,7 @@ struct phase_queueitem { #define MAX_NOACKS_TIME CLOCK_SECOND * 30 MEMB(queued_packets_memb, struct phase_queueitem, PHASE_QUEUESIZE); +NEIGHBOR_TABLE(struct phase, nbr_phase); #define DEBUG 0 #if DEBUG @@ -73,38 +87,14 @@ MEMB(queued_packets_memb, struct phase_queueitem, PHASE_QUEUESIZE); #define PRINTDEBUG(...) #endif /*---------------------------------------------------------------------------*/ -struct phase * -find_neighbor(const struct phase_list *list, const rimeaddr_t *addr) -{ - struct phase *e; - for(e = list_head(*list->list); e != NULL; e = list_item_next(e)) { - if(rimeaddr_cmp(addr, &e->neighbor)) { - return e; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ void -phase_remove(const struct phase_list *list, const rimeaddr_t *neighbor) -{ - struct phase *e; - e = find_neighbor(list, neighbor); - if(e != NULL) { - list_remove(*list->list, e); - memb_free(list->memb, e); - } -} -/*---------------------------------------------------------------------------*/ -void -phase_update(const struct phase_list *list, - const rimeaddr_t *neighbor, rtimer_clock_t time, +phase_update(const rimeaddr_t *neighbor, rtimer_clock_t time, int mac_status) { struct phase *e; /* If we have an entry for this neighbor already, we renew it. */ - e = find_neighbor(list, neighbor); + e = nbr_table_get_from_lladdr(nbr_phase, neighbor); if(e != NULL) { if(mac_status == MAC_TX_OK) { #if PHASE_DRIFT_CORRECT @@ -123,8 +113,7 @@ phase_update(const struct phase_list *list, } if(e->noacks >= MAX_NOACKS || timer_expired(&e->noacks_timer)) { PRINTF("drop %d\n", neighbor->u8[0]); - list_remove(*list->list, e); - memb_free(list->memb, e); + nbr_table_remove(nbr_phase, e); return; } } else if(mac_status == MAC_TX_OK) { @@ -133,20 +122,14 @@ phase_update(const struct phase_list *list, } else { /* No matching phase was found, so we allocate a new one. */ if(mac_status == MAC_TX_OK && e == NULL) { - e = memb_alloc(list->memb); - if(e == NULL) { - PRINTF("phase alloc NULL\n"); - /* We could not allocate memory for this phase, so we drop - the last item on the list and reuse it for our phase. */ - e = list_chop(*list->list); - } - rimeaddr_copy(&e->neighbor, neighbor); - e->time = time; + e = nbr_table_add_lladdr(nbr_phase, neighbor); + if(e) { + e->time = time; #if PHASE_DRIFT_CORRECT e->drift = 0; #endif e->noacks = 0; - list_push(*list->list, e); + } } } } @@ -168,8 +151,7 @@ send_packet(void *ptr) } /*---------------------------------------------------------------------------*/ phase_status_t -phase_wait(struct phase_list *list, - const rimeaddr_t *neighbor, rtimer_clock_t cycle_time, +phase_wait(const rimeaddr_t *neighbor, rtimer_clock_t cycle_time, rtimer_clock_t guard_time, mac_callback_t mac_callback, void *mac_callback_ptr, struct rdc_buf_list *buf_list) @@ -180,7 +162,7 @@ phase_wait(struct phase_list *list, phase for this particular neighbor. If so, we can compute the time for the next expected phase and setup a ctimer to switch on the radio just before the phase. */ - e = find_neighbor(list, neighbor); + e = nbr_table_get_from_lladdr(nbr_phase, neighbor); if(e != NULL) { rtimer_clock_t wait, now, expected, sync; clock_time_t ctimewait; @@ -242,15 +224,12 @@ phase_wait(struct phase_list *list, p->buf_list = buf_list; ctimer_set(&p->timer, ctimewait, send_packet, p); return PHASE_DEFERRED; - } else { - memb_free(&queued_packets_memb, p); } } expected = now + wait - guard_time; if(!RTIMER_CLOCK_LT(expected, now)) { /* Wait until the receiver is expected to be awake */ -// printf("%d ",expected%cycle_time); //for spreadsheet export while(RTIMER_CLOCK_LT(RTIMER_NOW(), expected)); } return PHASE_SEND_NOW; @@ -259,10 +238,9 @@ phase_wait(struct phase_list *list, } /*---------------------------------------------------------------------------*/ void -phase_init(struct phase_list *list) +phase_init(void) { - list_init(*list->list); - memb_init(list->memb); memb_init(&queued_packets_memb); + nbr_table_register(nbr_phase, NULL); } /*---------------------------------------------------------------------------*/ diff --git a/core/net/mac/phase.h b/core/net/mac/phase.h index 8025d2c13..c605d7565 100644 --- a/core/net/mac/phase.h +++ b/core/net/mac/phase.h @@ -47,28 +47,6 @@ #include "lib/memb.h" #include "net/netstack.h" -#if PHASE_CONF_DRIFT_CORRECT -#define PHASE_DRIFT_CORRECT PHASE_CONF_DRIFT_CORRECT -#else -#define PHASE_DRIFT_CORRECT 0 -#endif - -struct phase { - struct phase *next; - rimeaddr_t neighbor; - rtimer_clock_t time; -#if PHASE_DRIFT_CORRECT - rtimer_clock_t drift; -#endif - uint8_t noacks; - struct timer noacks_timer; -}; - -struct phase_list { - list_t *list; - struct memb *memb; -}; - typedef enum { PHASE_UNKNOWN, PHASE_SEND_NOW, @@ -76,18 +54,13 @@ typedef enum { } phase_status_t; -#define PHASE_LIST(name, num) LIST(phase_list_list); \ - MEMB(phase_list_memb, struct phase, num); \ - struct phase_list name = { &phase_list_list, &phase_list_memb } - -void phase_init(struct phase_list *list); -phase_status_t phase_wait(struct phase_list *list, const rimeaddr_t *neighbor, +void phase_init(void); +phase_status_t phase_wait(const rimeaddr_t *neighbor, rtimer_clock_t cycle_time, rtimer_clock_t wait_before, mac_callback_t mac_callback, void *mac_callback_ptr, struct rdc_buf_list *buf_list); -void phase_update(const struct phase_list *list, const rimeaddr_t *neighbor, +void phase_update(const rimeaddr_t *neighbor, rtimer_clock_t time, int mac_status); - -void phase_remove(const struct phase_list *list, const rimeaddr_t *neighbor); +void phase_remove(const rimeaddr_t *neighbor); #endif /* PHASE_H */ From ec609b49eb5300b6c21c0fe1d962092c7d15b87c Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Wed, 3 Jul 2013 19:32:26 +0200 Subject: [PATCH 03/29] Make DS6 neighbors use neighbor-table, and move all DS6 neighbor management from uip-ds6 to a new uip-ds6-neighbor module. --- core/net/Makefile.uip | 1 + core/net/rpl/rpl.c | 37 ++---- core/net/tcpip.c | 12 +- core/net/uip-ds6-neighbor.c | 248 ++++++++++++++++++++++++++++++++++++ core/net/uip-ds6-neighbor.h | 97 ++++++++++++++ core/net/uip-ds6.c | 206 +----------------------------- core/net/uip-ds6.h | 46 +------ core/net/uip-nd6.c | 29 +++-- 8 files changed, 386 insertions(+), 290 deletions(-) create mode 100644 core/net/uip-ds6-neighbor.c create mode 100644 core/net/uip-ds6-neighbor.h diff --git a/core/net/Makefile.uip b/core/net/Makefile.uip index c675bfe74..66ca1d0ec 100644 --- a/core/net/Makefile.uip +++ b/core/net/Makefile.uip @@ -18,6 +18,7 @@ uaodv-rt.c \ uaodv.c \ uip-debug.c \ uip-ds6-route.c \ +uip-ds6-neighbor.c \ uip-ds6.c \ uip-fw-drv.c \ uip-fw.c \ diff --git a/core/net/rpl/rpl.c b/core/net/rpl/rpl.c index 2e9a10e5a..a5cabef91 100644 --- a/core/net/rpl/rpl.c +++ b/core/net/rpl/rpl.c @@ -142,21 +142,6 @@ rpl_remove_routes_by_nexthop(uip_ipaddr_t *nexthop, rpl_dag_t *dag) } } ANNOTATE("#L %u 0\n", nexthop->u8[sizeof(uip_ipaddr_t) - 1]); - -#if 0 - uip_ds6_route_t *locroute; - - for(locroute = uip_ds6_routing_table; - locroute < uip_ds6_routing_table + UIP_DS6_ROUTE_NB; - locroute++) { - if(locroute->isused - && uip_ipaddr_cmp(&locroute->nexthop, nexthop) - && locroute->state.dag == dag) { - locroute->isused = 0; - } - } - ANNOTATE("#L %u 0\n",nexthop->u8[sizeof(uip_ipaddr_t) - 1]); -#endif /* 0 */ } /*---------------------------------------------------------------------------*/ uip_ds6_route_t * @@ -242,18 +227,16 @@ rpl_ipv6_neighbor_callback(uip_ds6_nbr_t *nbr) rpl_instance_t *instance; rpl_instance_t *end; - if(!nbr->isused) { - PRINTF("RPL: Removing neighbor "); - PRINT6ADDR(&nbr->ipaddr); - PRINTF("\n"); - for(instance = &instance_table[0], end = instance + RPL_MAX_INSTANCES; instance < end; ++instance) { - if(instance->used == 1 ) { - p = rpl_find_parent_any_dag(instance, &nbr->ipaddr); - if(p != NULL) { - p->rank = INFINITE_RANK; - /* Trigger DAG rank recalculation. */ - p->updated = 1; - } + PRINTF("RPL: Removing neighbor "); + PRINT6ADDR(&nbr->ipaddr); + PRINTF("\n"); + for(instance = &instance_table[0], end = instance + RPL_MAX_INSTANCES; instance < end; ++instance) { + if(instance->used == 1 ) { + p = rpl_find_parent_any_dag(instance, &nbr->ipaddr); + if(p != NULL) { + p->rank = INFINITE_RANK; + /* Trigger DAG rank recalculation. */ + p->updated = 1; } } } diff --git a/core/net/tcpip.c b/core/net/tcpip.c index 20e504bc7..81a2f2e60 100644 --- a/core/net/tcpip.c +++ b/core/net/tcpip.c @@ -567,6 +567,7 @@ tcpip_ipv6_output(void) uip_ds6_route_t* locrt; locrt = uip_ds6_route_lookup(&UIP_IP_BUF->destipaddr); if(locrt == NULL) { + PRINTF("tcpip_ipv6_output: no route found, using default route\n"); if((nexthop = uip_ds6_defrt_choose()) == NULL) { #ifdef UIP_FALLBACK_INTERFACE PRINTF("FALLBACK: removing ext hdrs & setting proto %d %d\n", @@ -588,11 +589,14 @@ tcpip_ipv6_output(void) } else { nexthop = &locrt->nexthop; } -#if TCPIP_CONF_ANNOTATE_TRANSMISSIONS if(nexthop != NULL) { + PRINTF("tcpip_ipv6_output: next hop "); + PRINT6ADDR(nexthop); + PRINTF("\n"); +#if TCPIP_CONF_ANNOTATE_TRANSMISSIONS printf("#L %u 1; red\n", nexthop->u8[sizeof(uip_ipaddr_t) - 1]); - } #endif /* TCPIP_CONF_ANNOTATE_TRANSMISSIONS */ + } } /* End of next hop determination */ #if UIP_CONF_IPV6_RPL @@ -655,7 +659,7 @@ tcpip_ipv6_output(void) } #endif /* UIP_ND6_SEND_NA */ - tcpip_output(&nbr->lladdr); + tcpip_output(uip_ds6_nbr_get_ll(nbr)); #if UIP_CONF_IPV6_QUEUE_PKT /* @@ -668,7 +672,7 @@ tcpip_ipv6_output(void) uip_len = uip_packetqueue_buflen(&nbr->packethandle); memcpy(UIP_IP_BUF, uip_packetqueue_buf(&nbr->packethandle), uip_len); uip_packetqueue_free(&nbr->packethandle); - tcpip_output(&nbr->lladdr); + tcpip_output(uip_ds6_nbr_get_ll(nbr)); } #endif /*UIP_CONF_IPV6_QUEUE_PKT*/ diff --git a/core/net/uip-ds6-neighbor.c b/core/net/uip-ds6-neighbor.c new file mode 100644 index 000000000..e5dd36897 --- /dev/null +++ b/core/net/uip-ds6-neighbor.c @@ -0,0 +1,248 @@ +/** + * \addtogroup uip6 + * @{ + */ + +/* + * Copyright (c) 2013, Swedish Institute of Computer Science. + * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. + * + * + */ + +/** + * \file + * IPv6 Neighbor cache (link-layer/IPv6 address mapping) + * \author Mathilde Durvy + * \author Julien Abeille + * \author Simon Duquennoy + * + */ + +#include +#include +#include +#include "lib/list.h" +#include "net/rime/rimeaddr.h" +#include "net/packetbuf.h" +#include "net/uip-ds6-neighbor.h" + +#define DEBUG DEBUG_NONE +#include "net/uip-debug.h" + +#ifdef UIP_CONF_DS6_NEIGHBOR_STATE_CHANGED +#define NEIGHBOR_STATE_CHANGED(n) UIP_CONF_DS6_NEIGHBOR_STATE_CHANGED(n) +void NEIGHBOR_STATE_CHANGED(uip_ds6_nbr_t *n); +#else +#define NEIGHBOR_STATE_CHANGED(n) +#endif /* UIP_DS6_CONF_NEIGHBOR_STATE_CHANGED */ + +NEIGHBOR_TABLE_GLOBAL(uip_ds6_nbr_t, ds6_neighbors); + +/*---------------------------------------------------------------------------*/ +void +uip_ds6_neighbors_init(void) +{ + nbr_table_register(ds6_neighbors, (remove_callback_func *)uip_ds6_nbr_rm); +} +/*---------------------------------------------------------------------------*/ +uip_ds6_nbr_t * +uip_ds6_nbr_add(uip_ipaddr_t *ipaddr, uip_lladdr_t *lladdr, + uint8_t isrouter, uint8_t state) +{ + uip_ds6_nbr_t *nbr = nbr_table_add_lladdr(ds6_neighbors, (rimeaddr_t*)lladdr); + if(nbr) { + uip_ipaddr_copy(&nbr->ipaddr, ipaddr); + nbr->isrouter = isrouter; + nbr->state = state; + #if UIP_CONF_IPV6_QUEUE_PKT + uip_packetqueue_new(&nbr->packethandle); + #endif /* UIP_CONF_IPV6_QUEUE_PKT */ + /* timers are set separately, for now we put them in expired state */ + stimer_set(&nbr->reachable, 0); + stimer_set(&nbr->sendns, 0); + nbr->nscount = 0; + PRINTF("Adding neighbor with ip addr "); + PRINT6ADDR(ipaddr); + PRINTF(" link addr "); + PRINTLLADDR(lladdr); + PRINTF(" state %u\n", state); + NEIGHBOR_STATE_CHANGED(nbr); + return nbr; + } else { + PRINTF("uip_ds6_nbr_add drop ip addr "); + PRINT6ADDR(ipaddr); + PRINTF(" link addr (%p) ", lladdr); + PRINTLLADDR(lladdr); + PRINTF(" state %u\n", state); + return NULL; + } +} + +/*---------------------------------------------------------------------------*/ +void +uip_ds6_nbr_rm(uip_ds6_nbr_t *nbr) +{ + if(nbr != NULL) { +#if UIP_CONF_IPV6_QUEUE_PKT + uip_packetqueue_free(&nbr->packethandle); +#endif /* UIP_CONF_IPV6_QUEUE_PKT */ + NEIGHBOR_STATE_CHANGED(nbr); + nbr_table_remove(ds6_neighbors, nbr); + } + return; +} + +/*---------------------------------------------------------------------------*/ +uip_ipaddr_t * +uip_ds6_nbr_get_ipaddr(uip_ds6_nbr_t *nbr) +{ + return (nbr != NULL) ? &nbr->ipaddr : NULL; +} + +/*---------------------------------------------------------------------------*/ +uip_lladdr_t * +uip_ds6_nbr_get_ll(uip_ds6_nbr_t *nbr) +{ + return (uip_lladdr_t *)nbr_table_get_lladdr(ds6_neighbors, nbr); +} + +/*---------------------------------------------------------------------------*/ +uip_ds6_nbr_t * +uip_ds6_nbr_lookup(uip_ipaddr_t *ipaddr) +{ + uip_ds6_nbr_t *nbr = nbr_table_head(ds6_neighbors); + while(nbr != NULL) { + if(uip_ipaddr_cmp(&nbr->ipaddr, ipaddr)) { + return nbr; + } + nbr = nbr_table_next(ds6_neighbors, nbr); + } + return NULL; +} +/*---------------------------------------------------------------------------*/ +uip_ds6_nbr_t * +uip_ds6_nbr_ll_lookup(uip_lladdr_t *lladdr) +{ + return nbr_table_get_from_lladdr(ds6_neighbors, (rimeaddr_t*)lladdr); +} + +/*---------------------------------------------------------------------------*/ +uip_ipaddr_t * +uip_ds6_nbr_ipaddr_from_lladdr(uip_lladdr_t *lladdr) +{ + uip_ds6_nbr_t *nbr = uip_ds6_nbr_ll_lookup(lladdr); + return nbr ? &nbr->ipaddr : NULL; +} + +/*---------------------------------------------------------------------------*/ +uip_lladdr_t * +uip_ds6_nbr_lladdr_from_ipaddr(uip_ipaddr_t *ipaddr) +{ + uip_ds6_nbr_t *nbr = uip_ds6_nbr_lookup(ipaddr); + return nbr ? uip_ds6_nbr_get_ll(nbr) : NULL; +} + +/*---------------------------------------------------------------------------*/ +void +uip_ds6_neighbor_periodic() +{ + /* Periodic processing on neighbors */ + uip_ds6_nbr_t *nbr = nbr_table_head(ds6_neighbors); + while(nbr != NULL) { + switch(nbr->state) { + case NBR_REACHABLE: + if(stimer_expired(&nbr->reachable)) { + PRINTF("REACHABLE: moving to STALE ("); + PRINT6ADDR(&nbr->ipaddr); + PRINTF(")\n"); + nbr->state = NBR_STALE; + } + break; +#if UIP_ND6_SEND_NA + case NBR_INCOMPLETE: + if(nbr->nscount >= UIP_ND6_MAX_MULTICAST_SOLICIT) { + uip_ds6_nbr_rm(nbr); + } else if(stimer_expired(&nbr->sendns) && (uip_len == 0)) { + nbr->nscount++; + PRINTF("NBR_INCOMPLETE: NS %u\n", nbr->nscount); + uip_nd6_ns_output(NULL, NULL, &nbr->ipaddr); + stimer_set(&nbr->sendns, uip_ds6_if.retrans_timer / 1000); + } + break; + case NBR_DELAY: + if(stimer_expired(&nbr->reachable)) { + nbr->state = NBR_PROBE; + nbr->nscount = 0; + PRINTF("DELAY: moving to PROBE\n"); + stimer_set(&nbr->sendns, 0); + } + break; + case NBR_PROBE: + if(nbr->nscount >= UIP_ND6_MAX_UNICAST_SOLICIT) { + uip_ds6_defrt_t *locdefrt; + PRINTF("PROBE END\n"); + if((locdefrt = uip_ds6_defrt_lookup(&nbr->ipaddr)) != NULL) { + if (!locdefrt->isinfinite) { + uip_ds6_defrt_rm(locdefrt); + } + } + uip_ds6_nbr_rm(nbr); + } else if(stimer_expired(&nbr->sendns) && (uip_len == 0)) { + nbr->nscount++; + PRINTF("PROBE: NS %u\n", nbr->nscount); + uip_nd6_ns_output(NULL, &nbr->ipaddr, &nbr->ipaddr); + stimer_set(&nbr->sendns, uip_ds6_if.retrans_timer / 1000); + } + break; +#endif /* UIP_ND6_SEND_NA */ + default: + break; + } + nbr = nbr_table_next(ds6_neighbors, nbr); + } +} + +/*---------------------------------------------------------------------------*/ +uip_ds6_nbr_t * +uip_ds6_get_least_lifetime_neighbor(void) +{ + uip_ds6_nbr_t *nbr = nbr_table_head(ds6_neighbors); + uip_ds6_nbr_t *nbr_expiring = NULL; + while(nbr != NULL) { + if(nbr_expiring != NULL) { + clock_time_t curr = stimer_remaining(&nbr->reachable); + if(curr < stimer_remaining(&nbr->reachable)) { + nbr_expiring = nbr; + } + } else { + nbr_expiring = nbr; + } + nbr = nbr_table_next(ds6_neighbors, nbr); + } + return nbr_expiring; +} diff --git a/core/net/uip-ds6-neighbor.h b/core/net/uip-ds6-neighbor.h new file mode 100644 index 000000000..686fb6abd --- /dev/null +++ b/core/net/uip-ds6-neighbor.h @@ -0,0 +1,97 @@ +/** + * \addtogroup uip6 + * @{ + */ + +/* + * Copyright (c) 2013, Swedish Institute of Computer Science. + * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. + * + * + */ + +/** + * \file + * IPv6 Neighbor cache (link-layer/IPv6 address mapping) + * \author Mathilde Durvy + * \author Julien Abeille + * \author Simon Duquennoy + * + */ + +#ifndef __UIP_DS6_NEIGHBOR_H__ +#define __UIP_DS6_NEIGHBOR_H__ + +#include "net/uip-ds6.h" +#include "net/neighbor-table.h" + +#if UIP_CONF_IPV6_QUEUE_PKT +#include "net/uip-packetqueue.h" +#endif /*UIP_CONF_QUEUE_PKT */ + +NEIGHBOR_TABLE_DECLARE(ds6_neighbors); + +/** \brief An entry in the nbr cache */ +typedef struct uip_ds6_nbr { + uip_ipaddr_t ipaddr; + struct stimer reachable; + struct stimer sendns; + uint8_t nscount; + uint8_t isrouter; + uint8_t state; +#if UIP_CONF_IPV6_QUEUE_PKT + struct uip_packetqueue_handle packethandle; +#define UIP_DS6_NBR_PACKET_LIFETIME CLOCK_SECOND * 4 +#endif /*UIP_CONF_QUEUE_PKT */ +} uip_ds6_nbr_t; + +void uip_ds6_neighbors_init(void); + +/** \brief Neighbor Cache basic routines */ +uip_ds6_nbr_t *uip_ds6_nbr_add(uip_ipaddr_t *ipaddr, uip_lladdr_t *lladdr, + uint8_t isrouter, uint8_t state); +void uip_ds6_nbr_rm(uip_ds6_nbr_t *nbr); +uip_lladdr_t *uip_ds6_nbr_get_ll(uip_ds6_nbr_t *nbr); +uip_ipaddr_t *uip_ds6_nbr_get_ipaddr(uip_ds6_nbr_t *nbr); +uip_ds6_nbr_t *uip_ds6_nbr_lookup(uip_ipaddr_t *ipaddr); +uip_ds6_nbr_t *uip_ds6_nbr_ll_lookup(uip_lladdr_t *lladdr); +uip_ipaddr_t *uip_ds6_nbr_ipaddr_from_lladdr(uip_lladdr_t *lladdr); +uip_lladdr_t *uip_ds6_nbr_lladdr_from_ipaddr(uip_ipaddr_t *ipaddr); +void uip_ds6_neighbor_periodic(); + +/** + * \brief + * This searches inside the neighbor table for the neighbor that is about to + * expire the next. + * + * \return + * A reference to the neighbor about to expire the next or NULL if + * table is empty. + */ +uip_ds6_nbr_t *uip_ds6_get_least_lifetime_neighbor(void); + +#endif /* __UIP_DS6_NEIGHBOR_H__ */ diff --git a/core/net/uip-ds6.c b/core/net/uip-ds6.c index 354583d5a..41e97bfd6 100644 --- a/core/net/uip-ds6.c +++ b/core/net/uip-ds6.c @@ -53,13 +53,6 @@ #define DEBUG DEBUG_NONE #include "net/uip-debug.h" -#ifdef UIP_CONF_DS6_NEIGHBOR_STATE_CHANGED -#define NEIGHBOR_STATE_CHANGED(n) UIP_CONF_DS6_NEIGHBOR_STATE_CHANGED(n) -void NEIGHBOR_STATE_CHANGED(uip_ds6_nbr_t *n); -#else -#define NEIGHBOR_STATE_CHANGED(n) -#endif /* UIP_DS6_CONF_NEIGHBOR_STATE_CHANGED */ - struct etimer uip_ds6_timer_periodic; /** \brief Timer for maintenance of data structures */ #if UIP_CONF_ROUTER @@ -76,10 +69,7 @@ static uint8_t rscount; /** \brief numbe /** \name "DS6" Data structures */ /** @{ */ uip_ds6_netif_t uip_ds6_if; /** \brief The single interface */ -uip_ds6_nbr_t uip_ds6_nbr_cache[UIP_DS6_NBR_NB]; /** \brief Neighor cache */ -//uip_ds6_defrt_t uip_ds6_defrt_list[UIP_DS6_DEFRT_NB]; /** \brief Default rt list */ uip_ds6_prefix_t uip_ds6_prefix_list[UIP_DS6_PREFIX_NB]; /** \brief Prefix list */ -//uip_ds6_route_t uip_ds6_routing_table[UIP_DS6_ROUTE_NB]; /** \brief Routing table */ /* Used by Cooja to enable extraction of addresses from memory.*/ uint8_t uip_ds6_addr_size; @@ -95,25 +85,21 @@ static uip_ds6_addr_t *locaddr; static uip_ds6_maddr_t *locmaddr; static uip_ds6_aaddr_t *locaaddr; static uip_ds6_prefix_t *locprefix; -static uip_ds6_nbr_t *locnbr; -static uip_ds6_defrt_t *locdefrt; /*---------------------------------------------------------------------------*/ void uip_ds6_init(void) { + uip_ds6_neighbors_init(); uip_ds6_route_init(); PRINTF("Init of IPv6 data structures\n"); PRINTF("%u neighbors\n%u default routers\n%u prefixes\n%u routes\n%u unicast addresses\n%u multicast addresses\n%u anycast addresses\n", - UIP_DS6_NBR_NB, UIP_DS6_DEFRT_NB, UIP_DS6_PREFIX_NB, UIP_DS6_ROUTE_NB, + NEIGHBOR_TABLE_MAX_NEIGHBORS, UIP_DS6_DEFRT_NB, UIP_DS6_PREFIX_NB, UIP_DS6_ROUTE_NB, UIP_DS6_ADDR_NB, UIP_DS6_MADDR_NB, UIP_DS6_AADDR_NB); - memset(uip_ds6_nbr_cache, 0, sizeof(uip_ds6_nbr_cache)); - // memset(uip_ds6_defrt_list, 0, sizeof(uip_ds6_defrt_list)); memset(uip_ds6_prefix_list, 0, sizeof(uip_ds6_prefix_list)); memset(&uip_ds6_if, 0, sizeof(uip_ds6_if)); - // memset(uip_ds6_routing_table, 0, sizeof(uip_ds6_routing_table)); uip_ds6_addr_size = sizeof(struct uip_ds6_addr); uip_ds6_netif_addr_list_offset = offsetof(struct uip_ds6_netif, addr_list); @@ -198,61 +184,7 @@ uip_ds6_periodic(void) } #endif /* !UIP_CONF_ROUTER */ - /* Periodic processing on neighbors */ - for(locnbr = uip_ds6_nbr_cache; - locnbr < uip_ds6_nbr_cache + UIP_DS6_NBR_NB; - locnbr++) { - if(locnbr->isused) { - switch(locnbr->state) { - case NBR_REACHABLE: - if(stimer_expired(&locnbr->reachable)) { - PRINTF("REACHABLE: moving to STALE ("); - PRINT6ADDR(&locnbr->ipaddr); - PRINTF(")\n"); - locnbr->state = NBR_STALE; - } - break; -#if UIP_ND6_SEND_NA - case NBR_INCOMPLETE: - if(locnbr->nscount >= UIP_ND6_MAX_MULTICAST_SOLICIT) { - uip_ds6_nbr_rm(locnbr); - } else if(stimer_expired(&locnbr->sendns) && (uip_len == 0)) { - locnbr->nscount++; - PRINTF("NBR_INCOMPLETE: NS %u\n", locnbr->nscount); - uip_nd6_ns_output(NULL, NULL, &locnbr->ipaddr); - stimer_set(&locnbr->sendns, uip_ds6_if.retrans_timer / 1000); - } - break; - case NBR_DELAY: - if(stimer_expired(&locnbr->reachable)) { - locnbr->state = NBR_PROBE; - locnbr->nscount = 0; - PRINTF("DELAY: moving to PROBE\n"); - stimer_set(&locnbr->sendns, 0); - } - break; - case NBR_PROBE: - if(locnbr->nscount >= UIP_ND6_MAX_UNICAST_SOLICIT) { - PRINTF("PROBE END\n"); - if((locdefrt = uip_ds6_defrt_lookup(&locnbr->ipaddr)) != NULL) { - if (!locdefrt->isinfinite) { - uip_ds6_defrt_rm(locdefrt); - } - } - uip_ds6_nbr_rm(locnbr); - } else if(stimer_expired(&locnbr->sendns) && (uip_len == 0)) { - locnbr->nscount++; - PRINTF("PROBE: NS %u\n", locnbr->nscount); - uip_nd6_ns_output(NULL, &locnbr->ipaddr, &locnbr->ipaddr); - stimer_set(&locnbr->sendns, uip_ds6_if.retrans_timer / 1000); - } - break; -#endif /* UIP_ND6_SEND_NA */ - default: - break; - } - } - } + uip_ds6_neighbor_periodic(); #if UIP_CONF_ROUTER & UIP_ND6_SEND_RA /* Periodic RA sending */ @@ -291,118 +223,6 @@ uip_ds6_list_loop(uip_ds6_element_t *list, uint8_t size, return *out_element != NULL ? FREESPACE : NOSPACE; } -/*---------------------------------------------------------------------------*/ -uip_ds6_nbr_t * -uip_ds6_nbr_add(uip_ipaddr_t *ipaddr, uip_lladdr_t *lladdr, - uint8_t isrouter, uint8_t state) -{ - int r; - - r = uip_ds6_list_loop - ((uip_ds6_element_t *)uip_ds6_nbr_cache, UIP_DS6_NBR_NB, - sizeof(uip_ds6_nbr_t), ipaddr, 128, - (uip_ds6_element_t **)&locnbr); - - if(r == FREESPACE) { - locnbr->isused = 1; - uip_ipaddr_copy(&locnbr->ipaddr, ipaddr); - if(lladdr != NULL) { - memcpy(&locnbr->lladdr, lladdr, UIP_LLADDR_LEN); - } else { - memset(&locnbr->lladdr, 0, UIP_LLADDR_LEN); - } - locnbr->isrouter = isrouter; - locnbr->state = state; -#if UIP_CONF_IPV6_QUEUE_PKT - uip_packetqueue_new(&locnbr->packethandle); -#endif /* UIP_CONF_IPV6_QUEUE_PKT */ - /* timers are set separately, for now we put them in expired state */ - stimer_set(&locnbr->reachable, 0); - stimer_set(&locnbr->sendns, 0); - locnbr->nscount = 0; - PRINTF("Adding neighbor with ip addr "); - PRINT6ADDR(ipaddr); - PRINTF("link addr "); - PRINTLLADDR((&(locnbr->lladdr))); - PRINTF("state %u\n", state); - NEIGHBOR_STATE_CHANGED(locnbr); - - locnbr->last_lookup = clock_time(); - return locnbr; - } else if(r == NOSPACE) { - /* We did not find any empty slot on the neighbor list, so we need - to remove one old entry to make room. */ - uip_ds6_nbr_t *n, *oldest; - clock_time_t oldest_time; - - oldest = NULL; - oldest_time = clock_time(); - - for(n = uip_ds6_nbr_cache; - n < &uip_ds6_nbr_cache[UIP_DS6_NBR_NB]; - n++) { - if(n->isused && !uip_ds6_defrt_lookup(&n->ipaddr)) { - if(n->last_lookup < oldest_time) { - oldest = n; - oldest_time = n->last_lookup; - } - } - } - if(oldest != NULL) { - uip_ds6_nbr_rm(oldest); - return uip_ds6_nbr_add(ipaddr, lladdr, isrouter, state); - } - } - PRINTF("uip_ds6_nbr_add drop\n"); - return NULL; -} - -/*---------------------------------------------------------------------------*/ -void -uip_ds6_nbr_rm(uip_ds6_nbr_t *nbr) -{ - if(nbr != NULL) { - nbr->isused = 0; -#if UIP_CONF_IPV6_QUEUE_PKT - uip_packetqueue_free(&nbr->packethandle); -#endif /* UIP_CONF_IPV6_QUEUE_PKT */ - NEIGHBOR_STATE_CHANGED(nbr); - } - return; -} - -/*---------------------------------------------------------------------------*/ -uip_ds6_nbr_t * -uip_ds6_nbr_lookup(uip_ipaddr_t *ipaddr) -{ - if(uip_ds6_list_loop - ((uip_ds6_element_t *)uip_ds6_nbr_cache, UIP_DS6_NBR_NB, - sizeof(uip_ds6_nbr_t), ipaddr, 128, - (uip_ds6_element_t **)&locnbr) == FOUND) { - locnbr->last_lookup = clock_time(); - return locnbr; - } - return NULL; -} - -/*---------------------------------------------------------------------------*/ -uip_ds6_nbr_t * -uip_ds6_nbr_ll_lookup(uip_lladdr_t *lladdr) -{ - uip_ds6_nbr_t *fin; - - for(locnbr = uip_ds6_nbr_cache, fin = locnbr + UIP_DS6_NBR_NB; - locnbr < fin; - ++locnbr) { - if(locnbr->isused) { - if(!memcmp(lladdr, &locnbr->lladdr, UIP_LLADDR_LEN)) { - return locnbr; - } - } - } - return NULL; -} - /*---------------------------------------------------------------------------*/ #if UIP_CONF_ROUTER /*---------------------------------------------------------------------------*/ @@ -878,25 +698,5 @@ uip_ds6_compute_reachable_time(void) UIP_ND6_MIN_RANDOM_FACTOR(uip_ds6_if.base_reachable_time)); } /*---------------------------------------------------------------------------*/ -uip_ds6_nbr_t * -uip_ds6_get_least_lifetime_neighbor(void) -{ - uip_ds6_nbr_t *nbr_expiring = NULL; - uint8_t i; - for(i = 0; i < UIP_DS6_NBR_NB; i++) { - if(uip_ds6_nbr_cache[i].isused) { - if(nbr_expiring != NULL) { - clock_time_t curr = stimer_remaining(&uip_ds6_nbr_cache[i].reachable); - if(curr < stimer_remaining(&nbr_expiring->reachable)) { - nbr_expiring = &uip_ds6_nbr_cache[i]; - } - } else { - nbr_expiring = &uip_ds6_nbr_cache[i]; - } - } - } - return nbr_expiring; -} -/*---------------------------------------------------------------------------*/ /** @} */ #endif /* UIP_CONF_IPV6 */ diff --git a/core/net/uip-ds6.h b/core/net/uip-ds6.h index 556dc8629..e0d032c96 100644 --- a/core/net/uip-ds6.h +++ b/core/net/uip-ds6.h @@ -47,6 +47,7 @@ /* The size of uip_ds6_addr_t depends on UIP_ND6_DEF_MAXDADNS. Include uip-nd6.h to define it. */ #include "net/uip-nd6.h" #include "net/uip-ds6-route.h" +#include "net/uip-ds6-neighbor.h" /*--------------------------------------------------*/ /** Configuration. For all tables (Neighbor cache, Prefix List, Routing Table, @@ -56,14 +57,6 @@ * - the number of elements assigned by the system (name suffixed by _NBS) * - the total number of elements is the sum (name suffixed by _NB) */ -/* Neighbor cache */ -#define UIP_DS6_NBR_NBS 0 -#ifndef UIP_CONF_DS6_NBR_NBU -#define UIP_DS6_NBR_NBU 4 -#else -#define UIP_DS6_NBR_NBU UIP_CONF_DS6_NBR_NBU -#endif -#define UIP_DS6_NBR_NB UIP_DS6_NBR_NBS + UIP_DS6_NBR_NBU /* Default router list */ #define UIP_DS6_DEFRT_NBS 0 @@ -155,22 +148,6 @@ #if UIP_CONF_IPV6_QUEUE_PKT #include "net/uip-packetqueue.h" #endif /*UIP_CONF_QUEUE_PKT */ -/** \brief An entry in the nbr cache */ -typedef struct uip_ds6_nbr { - uint8_t isused; - uip_ipaddr_t ipaddr; - uip_lladdr_t lladdr; - struct stimer reachable; - struct stimer sendns; - clock_time_t last_lookup; - uint8_t nscount; - uint8_t isrouter; - uint8_t state; -#if UIP_CONF_IPV6_QUEUE_PKT - struct uip_packetqueue_handle packethandle; -#define UIP_DS6_NBR_PACKET_LIFETIME CLOCK_SECOND * 4 -#endif /*UIP_CONF_QUEUE_PKT */ -} uip_ds6_nbr_t; /** \brief A prefix list entry */ #if UIP_CONF_ROUTER @@ -226,8 +203,6 @@ typedef struct uip_ds6_maddr { #endif /* UIP_CONF_DS6_NEIGHBOR_STATE_CHANGED */ #endif /* UIP_CONF_IPV6_RPL */ - - /** \brief Interface structure (contains all the interface variables) */ typedef struct uip_ds6_netif { uint32_t link_mtu; @@ -273,14 +248,6 @@ uint8_t uip_ds6_list_loop(uip_ds6_element_t *list, uint8_t size, uint8_t ipaddrlen, uip_ds6_element_t **out_element); -/** \name Neighbor Cache basic routines */ -/** @{ */ -uip_ds6_nbr_t *uip_ds6_nbr_add(uip_ipaddr_t *ipaddr, uip_lladdr_t *lladdr, - uint8_t isrouter, uint8_t state); -void uip_ds6_nbr_rm(uip_ds6_nbr_t *nbr); -uip_ds6_nbr_t *uip_ds6_nbr_lookup(uip_ipaddr_t *ipaddr); -uip_ds6_nbr_t *uip_ds6_nbr_ll_lookup(uip_lladdr_t *lladdr); - /** @} */ @@ -371,15 +338,4 @@ uint32_t uip_ds6_compute_reachable_time(void); /** \brief compute random reachab /** @} */ /** @} */ -/** - * \brief - * This searches inside the neighbor table for the neighbor that is about to - * expire the next. - * - * \return - * A reference to the neighbor about to expire the next or NULL if - * table is empty. - */ -uip_ds6_nbr_t *uip_ds6_get_least_lifetime_neighbor(void); - #endif /* __UIP_DS6_H__ */ diff --git a/core/net/uip-nd6.c b/core/net/uip-nd6.c index 868032872..30424713a 100644 --- a/core/net/uip-nd6.c +++ b/core/net/uip-nd6.c @@ -191,9 +191,10 @@ uip_nd6_ns_input(void) (uip_lladdr_t *)&nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], 0, NBR_STALE); } else { + uip_lladdr_t *lladdr = uip_ds6_nbr_get_ll(nbr); if(memcmp(&nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], - &nbr->lladdr, UIP_LLADDR_LEN) != 0) { - memcpy(&nbr->lladdr, &nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], + lladdr, UIP_LLADDR_LEN) != 0) { + memcpy(lladdr, &nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], UIP_LLADDR_LEN); nbr->state = NBR_STALE; } else { @@ -460,20 +461,22 @@ uip_nd6_na_input(void) PRINTF("NA received is bad\n"); goto discard; } else { + uip_lladdr_t *lladdr; nbr = uip_ds6_nbr_lookup(&UIP_ND6_NA_BUF->tgtipaddr); + lladdr = uip_ds6_nbr_get_ll(nbr); if(nbr == NULL) { goto discard; } if(nd6_opt_llao != 0) { is_llchange = - memcmp(&nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], (void *)(&nbr->lladdr), + memcmp(&nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], (void *)lladdr, UIP_LLADDR_LEN); } if(nbr->state == NBR_INCOMPLETE) { if(nd6_opt_llao == NULL) { goto discard; } - memcpy(&nbr->lladdr, &nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], + memcpy(lladdr, &nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], UIP_LLADDR_LEN); if(is_solicited) { nbr->state = NBR_REACHABLE; @@ -496,7 +499,7 @@ uip_nd6_na_input(void) if(is_override || (!is_override && nd6_opt_llao != 0 && !is_llchange) || nd6_opt_llao == 0) { if(nd6_opt_llao != 0) { - memcpy(&nbr->lladdr, &nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], + memcpy(lladdr, &nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], UIP_LLADDR_LEN); } if(is_solicited) { @@ -583,7 +586,7 @@ uip_nd6_rs_input(void) #endif /*UIP_CONF_IPV6_CHECKS */ switch (UIP_ND6_OPT_HDR_BUF->type) { case UIP_ND6_OPT_SLLAO: - nd6_opt_llao = UIP_ND6_OPT_HDR_BUF; + nd6_opt_llao = (uint8_t *)UIP_ND6_OPT_HDR_BUF; break; default: PRINTF("ND option not supported in RS\n"); @@ -602,14 +605,18 @@ uip_nd6_rs_input(void) if((nbr = uip_ds6_nbr_lookup(&UIP_IP_BUF->srcipaddr)) == NULL) { /* we need to add the neighbor */ uip_ds6_nbr_add(&UIP_IP_BUF->srcipaddr, - &nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], 0, NBR_STALE); + (uip_lladdr_t *)&nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], 0, NBR_STALE); } else { /* If LL address changed, set neighbor state to stale */ if(memcmp(&nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], - &nbr->lladdr, UIP_LLADDR_LEN) != 0) { - memcpy(&nbr->lladdr, &nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], - UIP_LLADDR_LEN); - nbr->state = NBR_STALE; + uip_ds6_nbr_get_ll(nbr), UIP_LLADDR_LEN) != 0) { + uip_ds6_nbr_t nbr_data = *nbr; + uip_ds6_nbr_rm(nbr); + nbr = uip_ds6_nbr_add(&UIP_IP_BUF->srcipaddr, + (uip_lladdr_t *)&nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], 0, NBR_STALE); + nbr->reachable = nbr_data.reachable; + nbr->sendns = nbr_data.sendns; + nbr->nscount = nbr_data.nscount; } nbr->isrouter = 0; } From 09d26f8060bfd2cf294f7eb066750f4e57051f92 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Wed, 3 Jul 2013 19:45:56 +0200 Subject: [PATCH 04/29] Make uip-ds6-route use neighbor table. Instead of storing a global list of routing entries that contain both the next hop and the destination, we have a separate list of reachable destination for each neighbor in the global table. --- core/net/rpl/rpl-icmp6.c | 11 ++- core/net/rpl/rpl.c | 41 ++++----- core/net/tcpip.c | 2 +- core/net/uip-ds6-route.c | 187 +++++++++++++++++++++++++++------------ core/net/uip-ds6-route.h | 15 ++-- 5 files changed, 167 insertions(+), 89 deletions(-) diff --git a/core/net/rpl/rpl-icmp6.c b/core/net/rpl/rpl-icmp6.c index 265f7c53f..711617ae0 100644 --- a/core/net/rpl/rpl-icmp6.c +++ b/core/net/rpl/rpl-icmp6.c @@ -243,6 +243,13 @@ dio_input(void) PRINTF(", "); PRINTLLADDR((uip_lladdr_t *)packetbuf_addr(PACKETBUF_ADDR_SENDER)); PRINTF("\n"); + } else { + PRINTF("RPL: Out of Memory, dropping DIO from "); + PRINT6ADDR(&from); + PRINTF(", "); + PRINTLLADDR((uip_lladdr_t *)packetbuf_addr(PACKETBUF_ADDR_SENDER)); + PRINTF("\n"); + return; } } else { PRINTF("RPL: Neighbor already in neighbor cache\n"); @@ -657,11 +664,11 @@ dao_input(void) if(lifetime == RPL_ZERO_LIFETIME) { /* No-Path DAO received; invoke the route purging routine. */ - if(rep != NULL && rep->state.saved_lifetime == 0 && rep->length == prefixlen && uip_ipaddr_cmp(&rep->nexthop, &dao_sender_addr)) { + if(rep != NULL && rep->state.nopath_received == 0 && rep->length == prefixlen && uip_ipaddr_cmp(&rep->nexthop, &dao_sender_addr)) { PRINTF("RPL: Setting expiration timer for prefix "); PRINT6ADDR(&prefix); PRINTF("\n"); - rep->state.saved_lifetime = rep->state.lifetime; + rep->state.nopath_received = 1; rep->state.lifetime = DAO_EXPIRATION_TIMEOUT; } return; diff --git a/core/net/rpl/rpl.c b/core/net/rpl/rpl.c index a5cabef91..b12c869be 100644 --- a/core/net/rpl/rpl.c +++ b/core/net/rpl/rpl.c @@ -67,7 +67,7 @@ rpl_purge_routes(void) rpl_dag_t *dag; /* First pass, decrement lifetime */ - r = uip_ds6_route_list_head(); + r = uip_ds6_route_head(); while(r != NULL) { if(r->state.lifetime >= 1) { @@ -78,11 +78,11 @@ rpl_purge_routes(void) */ r->state.lifetime--; } - r = list_item_next(r); + r = uip_ds6_route_next(r); } /* Second pass, remove dead routes */ - r = uip_ds6_route_list_head(); + r = uip_ds6_route_head(); while(r != NULL) { if(r->state.lifetime < 1) { @@ -90,7 +90,7 @@ rpl_purge_routes(void) * thus we want to keep them. Hence < and not <= */ uip_ipaddr_copy(&prefix, &r->ipaddr); uip_ds6_route_rm(r); - r = uip_ds6_route_list_head(); + r = uip_ds6_route_head(); PRINTF("No more routes to "); PRINT6ADDR(&prefix); dag = default_instance->current_dag; @@ -103,7 +103,7 @@ rpl_purge_routes(void) } PRINTF("\n"); } else { - r = list_item_next(r); + r = uip_ds6_route_next(r); } } } @@ -113,14 +113,14 @@ rpl_remove_routes(rpl_dag_t *dag) { uip_ds6_route_t *r; - r = uip_ds6_route_list_head(); + r = uip_ds6_route_head(); while(r != NULL) { if(r->state.dag == dag) { uip_ds6_route_rm(r); - r = uip_ds6_route_list_head(); + r = uip_ds6_route_head(); } else { - r = list_item_next(r); + r = uip_ds6_route_next(r); } } } @@ -130,15 +130,15 @@ rpl_remove_routes_by_nexthop(uip_ipaddr_t *nexthop, rpl_dag_t *dag) { uip_ds6_route_t *r; - r = uip_ds6_route_list_head(); + r = uip_ds6_route_head(); while(r != NULL) { - if(uip_ipaddr_cmp(&r->nexthop, nexthop) && + if(uip_ipaddr_cmp(uip_ds6_route_nexthop(r), nexthop) && r->state.dag == dag) { uip_ds6_route_rm(r); - r = uip_ds6_route_list_head(); + r = uip_ds6_route_head(); } else { - r = list_item_next(r); + r = uip_ds6_route_next(r); } } ANNOTATE("#L %u 0\n", nexthop->u8[sizeof(uip_ipaddr_t) - 1]); @@ -150,20 +150,11 @@ rpl_add_route(rpl_dag_t *dag, uip_ipaddr_t *prefix, int prefix_len, { uip_ds6_route_t *rep; - rep = uip_ds6_route_lookup(prefix); - if(rep == NULL) { - if((rep = uip_ds6_route_add(prefix, prefix_len, next_hop, 0)) == NULL) { - PRINTF("RPL: No space for more route entries\n"); - return NULL; - } - } else { - PRINTF("RPL: Updated the next hop for prefix "); - PRINT6ADDR(prefix); - PRINTF(" to "); - PRINT6ADDR(next_hop); - PRINTF("\n"); - uip_ipaddr_copy(&rep->nexthop, next_hop); + if((rep = uip_ds6_route_add(prefix, prefix_len, next_hop)) == NULL) { + PRINTF("RPL: No space for more route entries\n"); + return NULL; } + rep->state.dag = dag; rep->state.lifetime = RPL_LIFETIME(dag->instance, dag->instance->default_lifetime); rep->state.learned_from = RPL_ROUTE_FROM_INTERNAL; diff --git a/core/net/tcpip.c b/core/net/tcpip.c index 81a2f2e60..cf22a0556 100644 --- a/core/net/tcpip.c +++ b/core/net/tcpip.c @@ -587,7 +587,7 @@ tcpip_ipv6_output(void) return; } } else { - nexthop = &locrt->nexthop; + nexthop = uip_ds6_route_nexthop(locrt); } if(nexthop != NULL) { PRINTF("tcpip_ipv6_output: next hop "); diff --git a/core/net/uip-ds6-route.c b/core/net/uip-ds6-route.c index 0ba45a03e..e5c6faaa3 100644 --- a/core/net/uip-ds6-route.c +++ b/core/net/uip-ds6-route.c @@ -34,12 +34,15 @@ #include "lib/list.h" #include "lib/memb.h" +#include "net/neighbor-table.h" #if UIP_CONF_IPV6 #include -LIST(routelist); +void uip_ds6_route_rm_routelist(list_t nbr_table_get_from_lladdr); + +NEIGHBOR_TABLE(uip_ds6_route_t *, nbr_routes); MEMB(routememb, uip_ds6_route_t, UIP_DS6_ROUTE_NB); LIST(defaultrouterlist); @@ -49,6 +52,8 @@ MEMB(defaultroutermemb, uip_ds6_defrt_t, UIP_DS6_DEFRT_NB); LIST(notificationlist); #endif +static int num_routes = 0; + #undef DEBUG #define DEBUG DEBUG_NONE #include "net/uip-debug.h" @@ -68,7 +73,7 @@ call_route_callback(int event, uip_ipaddr_t *route, event == UIP_DS6_NOTIFICATION_DEFRT_RM) { num = list_length(defaultrouterlist); } else { - num = list_length(routelist); + num = num_routes; } n->callback(event, route, nexthop, num); } @@ -95,7 +100,7 @@ void uip_ds6_route_init(void) { memb_init(&routememb); - list_init(routelist); + nbr_table_register(nbr_routes, (remove_callback_func *)uip_ds6_route_rm_routelist); memb_init(&defaultroutermemb); list_init(defaultrouterlist); @@ -105,16 +110,59 @@ uip_ds6_route_init(void) #endif } /*---------------------------------------------------------------------------*/ -uip_ds6_route_t * -uip_ds6_route_list_head(void) +static uip_lladdr_t * +uip_ds6_route_nexthop_lladdr(uip_ds6_route_t *route) { - return list_head(routelist); + if(route != NULL) { + return (uip_lladdr_t *)nbr_table_get_lladdr(nbr_routes, route->route_list); + } else { + return NULL; + } +} +/*---------------------------------------------------------------------------*/ +uip_ipaddr_t * +uip_ds6_route_nexthop(uip_ds6_route_t *route) +{ + if(route != NULL) { + return uip_ds6_nbr_ipaddr_from_lladdr(uip_ds6_route_nexthop_lladdr(route)); + } else { + return NULL; + } +} +/*---------------------------------------------------------------------------*/ +uip_ds6_route_t * +uip_ds6_route_head(void) +{ + list_t nbr_route_list = nbr_table_head(nbr_routes); + if(nbr_route_list != NULL) { + return list_head((list_t)nbr_route_list); + } else { + return NULL; + } +} +/*---------------------------------------------------------------------------*/ +uip_ds6_route_t * +uip_ds6_route_next(uip_ds6_route_t *r) +{ + if(r != NULL) { + uip_ds6_route_t *n = list_item_next(r); + if(n != NULL) { + return n; + } else { + list_t nbr_route_list = nbr_table_next(nbr_routes, r->route_list); + if(nbr_route_list != NULL) { + return list_head((list_t)nbr_route_list); + } + } + } + + return NULL; } /*---------------------------------------------------------------------------*/ int uip_ds6_route_num_routes(void) { - return list_length(routelist); + return num_routes; } /*---------------------------------------------------------------------------*/ uip_ds6_route_t * @@ -131,22 +179,21 @@ uip_ds6_route_lookup(uip_ipaddr_t *addr) found_route = NULL; longestmatch = 0; - for(r = list_head(routelist); + for(r = uip_ds6_route_head(); r != NULL; - r = list_item_next(r)) { + r = uip_ds6_route_next(r)) { if(r->length >= longestmatch && uip_ipaddr_prefixcmp(addr, &r->ipaddr, r->length)) { longestmatch = r->length; found_route = r; } - } if(found_route != NULL) { - PRINTF("uip-ds6-route: Found route:"); + PRINTF("uip-ds6-route: Found route: "); PRINT6ADDR(addr); PRINTF(" via "); - PRINT6ADDR(&found_route->nexthop); + PRINT6ADDR(uip_ds6_route_nexthop(found_route)); PRINTF("\n"); } else { PRINTF("uip-ds6-route: No route found\n"); @@ -157,9 +204,22 @@ uip_ds6_route_lookup(uip_ipaddr_t *addr) /*---------------------------------------------------------------------------*/ uip_ds6_route_t * uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length, - uip_ipaddr_t *nexthop, uint8_t metric) + uip_ipaddr_t *nexthop) { uip_ds6_route_t *r; + list_t nbr_route_list; + + /* Get link-layer address of next hop, make sure it is in neighbor table */ + uip_lladdr_t *nexthop_lladdr = uip_ds6_nbr_lladdr_from_ipaddr(nexthop); + if(nexthop_lladdr == NULL) { + PRINTF("uip_ds6_route_add: neighbor link-local address unknown "); + PRINT6ADDR(ipaddr); + PRINTF("\n"); + return NULL; + } + + /* Get routing entry list of this neighbor */ + nbr_route_list = nbr_table_get_from_lladdr(nbr_routes, (rimeaddr_t *)nexthop_lladdr); /* First make sure that we don't add a route twice. If we find an existing route for our destination, we'll just update the old @@ -170,6 +230,18 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length, PRINT6ADDR(ipaddr); PRINTF("\n"); } else { + /* If there is no routing entry, create one */ + if(nbr_route_list == NULL) { + nbr_route_list = nbr_table_add_lladdr(nbr_routes, (rimeaddr_t *)nexthop_lladdr); + if(nbr_route_list == NULL) { + PRINTF("uip_ds6_route_add: could not allocate memory (route list) for new route to "); + PRINT6ADDR(ipaddr); + PRINTF(", dropping it\n"); + return NULL; + } + list_init((list_t)nbr_route_list); + } + /* Allocate a routing entry and add the route to the list */ r = memb_alloc(&routememb); if(r == NULL) { @@ -178,15 +250,16 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length, PRINTF(", dropping it\n"); return NULL; } - list_add(routelist, r); + /* Add the route to this neighbor */ + list_add((list_t)nbr_route_list, r); + num_routes++; - PRINTF("uip_ds6_route_add num %d\n", list_length(routelist)); + PRINTF("uip_ds6_route_add num %d\n", num_routes); } + r->route_list = nbr_route_list; uip_ipaddr_copy(&(r->ipaddr), ipaddr); r->length = length; - uip_ipaddr_copy(&(r->nexthop), nexthop); - r->metric = metric; #ifdef UIP_DS6_ROUTE_STATE_TYPE memset(&r->state, 0, sizeof(UIP_DS6_ROUTE_STATE_TYPE)); @@ -210,57 +283,61 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length, void uip_ds6_route_rm(uip_ds6_route_t *route) { - uip_ds6_route_t *r; - /* Make sure that the route is in the list before removing it. */ - for(r = list_head(routelist); - r != NULL; - r = list_item_next(r)) { - if(r == route) { - list_remove(routelist, route); - memb_free(&routememb, route); + if(route != NULL && route->route_list != NULL) { - PRINTF("uip_ds6_route_rm num %d\n", list_length(routelist)); + if(list_head((list_t)route->route_list) == NULL) { + /* If this was the only route using this neighbor, remove the neibhor from the table */ + nbr_table_remove(nbr_routes, route->route_list); + } + list_remove((list_t)route->route_list, route); + memb_free(&routememb, route); + + num_routes--; + + PRINTF("uip_ds6_route_rm num %d\n", num_routes); #if UIP_DS6_NOTIFICATIONS - call_route_callback(UIP_DS6_NOTIFICATION_ROUTE_RM, - &route->ipaddr, &route->nexthop); + call_route_callback(UIP_DS6_NOTIFICATION_ROUTE_RM, + &route->ipaddr, uip_ds6_route_nexthop(route)); #endif #if (DEBUG & DEBUG_ANNOTATE) == DEBUG_ANNOTATE - /* we need to check if this was the last route towards "nexthop" */ - /* if so - remove that link (annotation) */ - for(r = list_head(routelist); - r != NULL; - r = list_item_next(r)) { - if(uip_ipaddr_cmp(&r->nexthop, &route->nexthop)) { - /* we found another link using the specific nexthop, so keep the #L */ - return; - } + /* we need to check if this was the last route towards "nexthop" */ + /* if so - remove that link (annotation) */ + for(r = uip_ds6_route_head(); + r != NULL; + r = uip_ds6_route_next(r)) { + if(uip_ipaddr_cmp(uip_ds6_route_nexthop(r), uip_ds6_route_nexthop(route))) { + /* we found another link using the specific nexthop, so keep the #L */ + return; } - ANNOTATE("#L %u 0\n", route->nexthop.u8[sizeof(uip_ipaddr_t) - 1]); -#endif - return; } + ANNOTATE("#L %u 0\n", uip_ds6_route_nexthop(route)->u8[sizeof(uip_ipaddr_t) - 1]); +#endif + } + return; +} +/*---------------------------------------------------------------------------*/ +void +uip_ds6_route_rm_routelist(list_t nbr_route_list) +{ + if(nbr_route_list != NULL) { + uip_ds6_route_t *r; + r = list_head((list_t)nbr_route_list); + while(r != NULL) { + uip_ds6_route_rm(r); + r = list_head((list_t)nbr_route_list); + } + nbr_table_remove(nbr_routes, nbr_route_list); } } /*---------------------------------------------------------------------------*/ void uip_ds6_route_rm_by_nexthop(uip_ipaddr_t *nexthop) { - uip_ds6_route_t *r; - - r = list_head(routelist); - while(r != NULL) { - if(uip_ipaddr_cmp(&r->nexthop, nexthop)) { - list_remove(routelist, r); -#if UIP_DS6_NOTIFICATIONS - call_route_callback(UIP_DS6_NOTIFICATION_ROUTE_RM, - &r->ipaddr, &r->nexthop); -#endif - r = list_head(routelist); - } else { - r = list_item_next(r); - } - } + /* Get routing entry list of this neighbor */ + uip_lladdr_t *nexthop_lladdr = uip_ds6_nbr_lladdr_from_ipaddr(nexthop); + list_t nbr_route_list = nbr_table_get_from_lladdr(nbr_routes, (rimeaddr_t *)nexthop_lladdr); + uip_ds6_route_rm_routelist(nbr_route_list); } /*---------------------------------------------------------------------------*/ uip_ds6_defrt_t * diff --git a/core/net/uip-ds6-route.h b/core/net/uip-ds6-route.h index 3b8bc15b7..ba672adf1 100644 --- a/core/net/uip-ds6-route.h +++ b/core/net/uip-ds6-route.h @@ -32,6 +32,8 @@ #ifndef UIP_DS6_ROUTE_H #define UIP_DS6_ROUTE_H +#include "lib/list.h" + void uip_ds6_route_init(void); #ifndef UIP_CONF_UIP_DS6_NOTIFICATIONS @@ -84,9 +86,9 @@ void uip_ds6_notification_rm(struct uip_ds6_notification *n); /* Needed for the extended route entry state when using ContikiRPL */ typedef struct rpl_route_entry { uint32_t lifetime; - uint32_t saved_lifetime; void *dag; uint8_t learned_from; + uint8_t nopath_received; } rpl_route_entry_t; #endif /* UIP_DS6_ROUTE_STATE_TYPE */ @@ -95,13 +97,12 @@ typedef struct rpl_route_entry { /** \brief An entry in the routing table */ typedef struct uip_ds6_route { struct uip_ds6_route *next; + list_t route_list; /* The list the routing entry belongs to. */ uip_ipaddr_t ipaddr; - uip_ipaddr_t nexthop; - uint8_t length; - uint8_t metric; #ifdef UIP_DS6_ROUTE_STATE_TYPE UIP_DS6_ROUTE_STATE_TYPE state; #endif + uint8_t length; } uip_ds6_route_t; @@ -130,12 +131,14 @@ void uip_ds6_defrt_periodic(void); /** @{ */ uip_ds6_route_t *uip_ds6_route_lookup(uip_ipaddr_t *destipaddr); uip_ds6_route_t *uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length, - uip_ipaddr_t *next_hop, uint8_t metric); + uip_ipaddr_t *next_hop); void uip_ds6_route_rm(uip_ds6_route_t *route); void uip_ds6_route_rm_by_nexthop(uip_ipaddr_t *nexthop); +uip_ipaddr_t *uip_ds6_route_nexthop(uip_ds6_route_t *); int uip_ds6_route_num_routes(void); -uip_ds6_route_t *uip_ds6_route_list_head(void); +uip_ds6_route_t *uip_ds6_route_head(void); +uip_ds6_route_t *uip_ds6_route_next(uip_ds6_route_t *); /** @} */ From c50d10aa5397fc64304453c256b3357a010bf70d Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Wed, 3 Jul 2013 19:53:51 +0200 Subject: [PATCH 05/29] Make RPL use neighbor tables. RPL locks the neighbor used as preferred parent. --- core/net/rpl/rpl-dag.c | 281 +++++++++++++++++-------------------- core/net/rpl/rpl-icmp6.c | 6 +- core/net/rpl/rpl-private.h | 4 +- core/net/rpl/rpl.c | 1 + core/net/rpl/rpl.h | 6 +- 5 files changed, 140 insertions(+), 158 deletions(-) diff --git a/core/net/rpl/rpl-dag.c b/core/net/rpl/rpl-dag.c index 5970cbede..dfd9c997c 100644 --- a/core/net/rpl/rpl-dag.c +++ b/core/net/rpl/rpl-dag.c @@ -45,6 +45,7 @@ #include "net/rpl/rpl-private.h" #include "net/uip.h" #include "net/uip-nd6.h" +#include "net/neighbor-table.h" #include "lib/list.h" #include "lib/memb.h" #include "sys/ctimer.h" @@ -62,13 +63,6 @@ extern rpl_of_t RPL_OF; static rpl_of_t * const objective_functions[] = {&RPL_OF}; -/*---------------------------------------------------------------------------*/ -#ifndef RPL_CONF_MAX_PARENTS_PER_DAG -#define RPL_MAX_PARENTS_PER_DAG 8 -#else -#define RPL_MAX_PARENTS_PER_DAG RPL_CONF_MAX_PARENTS_PER_DAG -#endif /* !RPL_CONF_MAX_PARENTS_PER_DAG */ - /*---------------------------------------------------------------------------*/ /* RPL definitions. */ @@ -79,14 +73,49 @@ static rpl_of_t * const objective_functions[] = {&RPL_OF}; #endif /* !RPL_CONF_GROUNDED */ /*---------------------------------------------------------------------------*/ -/* Allocate parents from the same static MEMB chunk to reduce memory waste. */ -MEMB(parent_memb, struct rpl_parent, - RPL_MAX_PARENTS_PER_DAG * RPL_MAX_INSTANCES * RPL_MAX_DAG_PER_INSTANCE); +/* Per-parent RPL information */ +NEIGHBOR_TABLE(rpl_parent_t, rpl_parents); /*---------------------------------------------------------------------------*/ /* Allocate instance table. */ rpl_instance_t instance_table[RPL_MAX_INSTANCES]; rpl_instance_t *default_instance; /*---------------------------------------------------------------------------*/ +void +rpl_dag_init() +{ + nbr_table_register(rpl_parents, (remove_callback_func *)rpl_remove_parent); +} +/*---------------------------------------------------------------------------*/ +rpl_rank_t +rpl_get_parent_rank(uip_lladdr_t *addr) +{ + rpl_parent_t *p = nbr_table_get_from_lladdr(rpl_parents, (rimeaddr_t *)addr); + if(p != NULL) { + return p->rank; + } else { + return 0; + } +} +/*---------------------------------------------------------------------------*/ +uip_ipaddr_t * +rpl_get_parent_ipaddr(rpl_parent_t *p) +{ + rimeaddr_t *lladdr = nbr_table_get_lladdr(rpl_parents, p); + return uip_ds6_nbr_ipaddr_from_lladdr((uip_lladdr_t *)lladdr); +} +/*---------------------------------------------------------------------------*/ +static void +rpl_set_preferred_parent(rpl_dag_t *dag, rpl_parent_t *p) +{ + if(dag != NULL && dag->preferred_parent != p) { + /* Always keep the preferred parent locked, so it remains in the + * neighbor table. */ + nbr_table_unlock(rpl_parents, dag->preferred_parent); + nbr_table_lock(rpl_parents, p); + } + dag->preferred_parent = p; +} +/*---------------------------------------------------------------------------*/ /* Greater-than function for the lollipop counter. */ /*---------------------------------------------------------------------------*/ static int @@ -107,53 +136,34 @@ lollipop_greater_than(int a, int b) static void remove_parents(rpl_dag_t *dag, rpl_rank_t minimum_rank) { - rpl_parent_t *p, *p2; + rpl_parent_t *p; PRINTF("RPL: Removing parents (minimum rank %u)\n", minimum_rank); - for(p = list_head(dag->parents); p != NULL; p = p2) { - p2 = p->next; - if(p->rank >= minimum_rank) { - rpl_remove_parent(dag, p); + p = nbr_table_head(rpl_parents); + while(p != NULL) { + if(dag == p->dag && p->rank >= minimum_rank) { + rpl_remove_parent(p); } + p = nbr_table_next(rpl_parents, p); } } /*---------------------------------------------------------------------------*/ static void nullify_parents(rpl_dag_t *dag, rpl_rank_t minimum_rank) { - rpl_parent_t *p, *p2; + rpl_parent_t *p; PRINTF("RPL: Removing parents (minimum rank %u)\n", minimum_rank); - for(p = list_head(dag->parents); p != NULL; p = p2) { - p2 = p->next; - if(p->rank >= minimum_rank) { - rpl_nullify_parent(dag, p); + p = nbr_table_head(rpl_parents); + while(p != NULL) { + if(dag == p->dag && p->rank >= minimum_rank) { + rpl_nullify_parent(p); } - } -} -/*---------------------------------------------------------------------------*/ -static void -remove_worst_parent(rpl_dag_t *dag, rpl_rank_t min_worst_rank) -{ - rpl_parent_t *p, *worst; - - PRINTF("RPL: Removing the worst parent\n"); - - /* Find the parent with the highest rank. */ - worst = NULL; - for(p = list_head(dag->parents); p != NULL; p = list_item_next(p)) { - if(p != dag->preferred_parent && - (worst == NULL || p->rank > worst->rank)) { - worst = p; - } - } - /* Remove the neighbor if its rank is worse than the minimum worst rank. */ - if(worst != NULL && worst->rank > min_worst_rank) { - rpl_remove_parent(dag, worst); + p = nbr_table_next(rpl_parents, p); } } /*---------------------------------------------------------------------------*/ @@ -231,7 +241,7 @@ rpl_set_root(uint8_t instance_id, uip_ipaddr_t *dag_id) dag->grounded = RPL_GROUNDED; instance->mop = RPL_MOP_DEFAULT; instance->of = &RPL_OF; - dag->preferred_parent = NULL; + rpl_set_preferred_parent(dag, NULL); memcpy(&dag->dag_id, dag_id, sizeof(dag->dag_id)); @@ -378,8 +388,8 @@ rpl_set_default_route(rpl_instance_t *instance, uip_ipaddr_t *from) PRINT6ADDR(from); PRINTF("\n"); instance->def_route = uip_ds6_defrt_add(from, - RPL_LIFETIME(instance, - instance->default_lifetime)); + RPL_LIFETIME(instance, + instance->default_lifetime)); if(instance->def_route == NULL) { return 0; } @@ -430,7 +440,6 @@ rpl_alloc_dag(uint8_t instance_id, uip_ipaddr_t *dag_id) for(dag = &instance->dag_table[0], end = dag + RPL_MAX_DAG_PER_INSTANCE; dag < end; ++dag) { if(!dag->used) { memset(dag, 0, sizeof(*dag)); - LIST_STRUCT_INIT(dag, parents); dag->used = 1; dag->rank = INFINITE_RANK; dag->min_rank = INFINITE_RANK; @@ -502,77 +511,65 @@ rpl_free_dag(rpl_dag_t *dag) rpl_parent_t * rpl_add_parent(rpl_dag_t *dag, rpl_dio_t *dio, uip_ipaddr_t *addr) { - rpl_parent_t *p; + rpl_parent_t *p = NULL; + /* Is the parent known by ds6? Drop this request if not. + * Typically, the parent is added upon receiving a DIO. */ + uip_lladdr_t *lladdr = uip_ds6_nbr_lladdr_from_ipaddr(addr); - if(RPL_PARENT_COUNT(dag) == RPL_MAX_PARENTS_PER_DAG) { - return NULL; - } - - p = memb_alloc(&parent_memb); - if(p == NULL) { - RPL_STAT(rpl_stats.mem_overflows++); - return NULL; - } - memcpy(&p->addr, addr, sizeof(p->addr)); - p->dag = dag; - p->rank = dio->rank; - p->dtsn = dio->dtsn; - p->link_metric = RPL_INIT_LINK_METRIC; + if(lladdr != NULL) { + /* Add parent in rpl_parents */ + p = nbr_table_add_lladdr(rpl_parents, (rimeaddr_t *)lladdr); + p->dag = dag; + p->rank = dio->rank; + p->dtsn = dio->dtsn; + p->link_metric = RPL_INIT_LINK_METRIC; #if RPL_DAG_MC != RPL_DAG_MC_NONE - memcpy(&p->mc, &dio->mc, sizeof(p->mc)); + memcpy(&p->mc, &dio->mc, sizeof(p->mc)); #endif /* RPL_DAG_MC != RPL_DAG_MC_NONE */ - list_add(dag->parents, p); + } + return p; } /*---------------------------------------------------------------------------*/ +static rpl_parent_t * +find_parent_any_dag_any_instance(uip_ipaddr_t *addr) +{ + uip_ds6_nbr_t *ds6_nbr = uip_ds6_nbr_lookup(addr); + uip_lladdr_t *lladdr = uip_ds6_nbr_get_ll(ds6_nbr); + return nbr_table_get_from_lladdr(rpl_parents, (rimeaddr_t *)lladdr); +} +/*---------------------------------------------------------------------------*/ rpl_parent_t * rpl_find_parent(rpl_dag_t *dag, uip_ipaddr_t *addr) { - rpl_parent_t *p; - - for(p = list_head(dag->parents); p != NULL; p = p->next) { - if(uip_ipaddr_cmp(&p->addr, addr)) { - return p; - } + rpl_parent_t *p = find_parent_any_dag_any_instance(addr); + if(p != NULL && p->dag == dag) { + return p; + } else { + return NULL; } - return NULL; } - /*---------------------------------------------------------------------------*/ static rpl_dag_t * find_parent_dag(rpl_instance_t *instance, uip_ipaddr_t *addr) { - rpl_parent_t *p; - rpl_dag_t *dag, *end; - - for(dag = &instance->dag_table[0], end = dag + RPL_MAX_DAG_PER_INSTANCE; dag < end; ++dag) { - if(dag->used) { - for(p = list_head(dag->parents); p != NULL; p = p->next) { - if(uip_ipaddr_cmp(&p->addr, addr)) { - return dag; - } - } - } + rpl_parent_t *p = find_parent_any_dag_any_instance(addr); + if(p != NULL) { + return p->dag; + } else { + return NULL; } - return NULL; } /*---------------------------------------------------------------------------*/ rpl_parent_t * rpl_find_parent_any_dag(rpl_instance_t *instance, uip_ipaddr_t *addr) { - rpl_parent_t *p; - rpl_dag_t *dag, *end; - - for(dag = &instance->dag_table[0], end = dag + RPL_MAX_DAG_PER_INSTANCE; dag < end; ++dag) { - if(dag->used) { - for(p = list_head(dag->parents); p != NULL; p = p->next) { - if(uip_ipaddr_cmp(&p->addr, addr)) { - return p; - } - } - } + rpl_parent_t *p = find_parent_any_dag_any_instance(addr); + if(p && p->dag && p->dag->instance == instance) { + return p; + } else { + return NULL; } - return NULL; } /*---------------------------------------------------------------------------*/ rpl_dag_t * @@ -636,7 +633,7 @@ rpl_select_dag(rpl_instance_t *instance, rpl_parent_t *p) best_dag->min_rank = best_dag->rank; } else if(!acceptable_rank(best_dag, best_dag->rank)) { PRINTF("RPL: New rank unacceptable!\n"); - instance->current_dag->preferred_parent = NULL; + rpl_set_preferred_parent(instance->current_dag, NULL); if(instance->mop != RPL_MOP_NO_DOWNWARD_ROUTES && last_parent != NULL) { /* Send a No-Path DAO to the removed preferred parent. */ dao_output(last_parent, RPL_ZERO_LIFETIME); @@ -645,7 +642,7 @@ rpl_select_dag(rpl_instance_t *instance, rpl_parent_t *p) } if(best_dag->preferred_parent != last_parent) { - rpl_set_default_route(instance, &best_dag->preferred_parent->addr); + rpl_set_default_route(instance, rpl_get_parent_ipaddr(best_dag->preferred_parent)); PRINTF("RPL: Changed preferred parent, rank changed from %u to %u\n", (unsigned)old_rank, best_dag->rank); RPL_STAT(rpl_stats.parent_switch++); @@ -672,7 +669,9 @@ rpl_select_parent(rpl_dag_t *dag) rpl_parent_t *p, *best; best = NULL; - for(p = list_head(dag->parents); p != NULL; p = p->next) { + + p = nbr_table_head(rpl_parents); + while(p != NULL) { if(p->rank == INFINITE_RANK) { /* ignore this neighbor */ } else if(best == NULL) { @@ -680,42 +679,43 @@ rpl_select_parent(rpl_dag_t *dag) } else { best = dag->instance->of->best_parent(best, p); } + p = nbr_table_next(rpl_parents, p); } if(best != NULL) { - dag->preferred_parent = best; + rpl_set_preferred_parent(dag, best); } return best; } /*---------------------------------------------------------------------------*/ void -rpl_remove_parent(rpl_dag_t *dag, rpl_parent_t *parent) +rpl_remove_parent(rpl_parent_t *parent) { - rpl_nullify_parent(dag, parent); - PRINTF("RPL: Removing parent "); - PRINT6ADDR(&parent->addr); + PRINT6ADDR(rpl_get_parent_ipaddr(parent)); PRINTF("\n"); - list_remove(dag->parents, parent); - memb_free(&parent_memb, parent); + rpl_nullify_parent(parent); + + nbr_table_remove(rpl_parents, parent); } /*---------------------------------------------------------------------------*/ void -rpl_nullify_parent(rpl_dag_t *dag, rpl_parent_t *parent) +rpl_nullify_parent(rpl_parent_t *parent) { + rpl_dag_t *dag = parent->dag; /* This function can be called when the preferred parent is NULL, so we need to handle this condition in order to trigger uip_ds6_defrt_rm. */ if(parent == dag->preferred_parent || dag->preferred_parent == NULL) { - dag->preferred_parent = NULL; + rpl_set_preferred_parent(dag, NULL); dag->rank = INFINITE_RANK; if(dag->joined) { if(dag->instance->def_route != NULL) { - PRINTF("RPL: Removing default route "); - PRINT6ADDR(&parent->addr); - PRINTF("\n"); - uip_ds6_defrt_rm(dag->instance->def_route); + PRINTF("RPL: Removing default route "); + PRINT6ADDR(rpl_get_parent_ipaddr(parent)); + PRINTF("\n"); + uip_ds6_defrt_rm(dag->instance->def_route); dag->instance->def_route = NULL; } dao_output(parent, RPL_ZERO_LIFETIME); @@ -723,7 +723,7 @@ rpl_nullify_parent(rpl_dag_t *dag, rpl_parent_t *parent) } PRINTF("RPL: Nullifying parent "); - PRINT6ADDR(&parent->addr); + PRINT6ADDR(rpl_get_parent_ipaddr(parent)); PRINTF("\n"); } /*---------------------------------------------------------------------------*/ @@ -731,11 +731,11 @@ void rpl_move_parent(rpl_dag_t *dag_src, rpl_dag_t *dag_dst, rpl_parent_t *parent) { if(parent == dag_src->preferred_parent) { - dag_src->preferred_parent = NULL; + rpl_set_preferred_parent(dag_src, NULL); dag_src->rank = INFINITE_RANK; if(dag_src->joined && dag_src->instance->def_route != NULL) { PRINTF("RPL: Removing default route "); - PRINT6ADDR(&parent->addr); + PRINT6ADDR(rpl_get_parent_ipaddr(parent)); PRINTF("\n"); PRINTF("rpl_move_parent\n"); uip_ds6_defrt_rm(dag_src->instance->def_route); @@ -743,11 +743,11 @@ rpl_move_parent(rpl_dag_t *dag_src, rpl_dag_t *dag_dst, rpl_parent_t *parent) } } else if(dag_src->joined) { /* Remove uIPv6 routes that have this parent as the next hop. */ - rpl_remove_routes_by_nexthop(&parent->addr, dag_src); + rpl_remove_routes_by_nexthop(rpl_get_parent_ipaddr(parent), dag_src); } PRINTF("RPL: Moving parent "); - PRINT6ADDR(&parent->addr); + PRINT6ADDR(rpl_get_parent_ipaddr(parent)); PRINTF("\n"); list_remove(dag_src->parents, parent); @@ -831,7 +831,7 @@ rpl_join_instance(uip_ipaddr_t *from, rpl_dio_t *dio) if(of == NULL) { PRINTF("RPL: DIO for DAG instance %u does not specify a supported OF\n", dio->instance_id); - rpl_remove_parent(dag, p); + rpl_remove_parent(p); instance->used = 0; return; } @@ -866,7 +866,7 @@ rpl_join_instance(uip_ipaddr_t *from, rpl_dio_t *dio) /* Copy prefix information from the DIO into the DAG object. */ memcpy(&dag->prefix_info, &dio->prefix_info, sizeof(rpl_prefix_t)); - dag->preferred_parent = p; + rpl_set_preferred_parent(dag, p); instance->of->update_metric_container(instance); dag->rank = instance->of->calculate_rank(p, 0); /* So far this is the lowest rank we are aware of. */ @@ -943,7 +943,7 @@ rpl_add_dag(uip_ipaddr_t *from, rpl_dio_t *dio) instance->lifetime_unit != dio->lifetime_unit) { PRINTF("RPL: DIO for DAG instance %u uncompatible with previos DIO\n", dio->instance_id); - rpl_remove_parent(dag, p); + rpl_remove_parent(p); dag->used = 0; return; } @@ -958,7 +958,7 @@ rpl_add_dag(uip_ipaddr_t *from, rpl_dio_t *dio) /* copy prefix information into the dag */ memcpy(&dag->prefix_info, &dio->prefix_info, sizeof(rpl_prefix_t)); - dag->preferred_parent = p; + rpl_set_preferred_parent(dag, p); dag->rank = instance->of->calculate_rank(p, 0); dag->min_rank = dag->rank; /* So far this is the lowest rank we know of. */ @@ -1022,38 +1022,22 @@ rpl_local_repair(rpl_instance_t *instance) void rpl_recalculate_ranks(void) { - rpl_instance_t *instance, *end; rpl_parent_t *p; - int i; /* * We recalculate ranks when we receive feedback from the system rather * than RPL protocol messages. This periodical recalculation is called * from a timer in order to keep the stack depth reasonably low. */ - for(instance = &instance_table[0], end = instance + RPL_MAX_INSTANCES; - instance < end; ++instance) { - if(instance->used) { - for(i = 0; i < RPL_MAX_DAG_PER_INSTANCE; i++) { - if(instance->dag_table[i].used) { - for(p = list_head(instance->dag_table[i].parents); - p != NULL; p = p->next) { - if(p->updated) { - p->updated = 0; - if(!rpl_process_parent_event(instance, p)) { - PRINTF("RPL: A parent was dropped\n"); - } - /* - * Stop calculating here because the parent list may have changed. - * If more ranks need to be recalculated, it will be taken care of - * in subsequent calls to this functions. - */ - break; - } - } - } + p = nbr_table_head(rpl_parents); + while(p != NULL) { + if(p->dag != NULL && p->dag->instance && p->updated) { + p->updated = 0; + if(!rpl_process_parent_event(p->dag->instance, p)) { + PRINTF("RPL: A parent was dropped\n"); } } + p = nbr_table_next(rpl_parents, p); } } /*---------------------------------------------------------------------------*/ @@ -1070,11 +1054,10 @@ rpl_process_parent_event(rpl_instance_t *instance, rpl_parent_t *p) /* The candidate parent is no longer valid: the rank increase resulting from the choice of it as a parent would be too high. */ PRINTF("RPL: Unacceptable rank %u\n", (unsigned)p->rank); + rpl_nullify_parent(p); if(p != instance->current_dag->preferred_parent) { - rpl_nullify_parent(p->dag, p); return 0; } else { - rpl_nullify_parent(p->dag, p); return_value = 0; } } @@ -1092,7 +1075,7 @@ rpl_process_parent_event(rpl_instance_t *instance, rpl_parent_t *p) DAG_RANK(old_rank, instance), DAG_RANK(instance->current_dag->rank, instance)); if(instance->current_dag->rank != INFINITE_RANK) { PRINTF("RPL: The preferred parent is "); - PRINT6ADDR(&instance->current_dag->preferred_parent->addr); + PRINT6ADDR(rpl_get_parent_ipaddr(instance->current_dag->preferred_parent)); PRINTF(" (rank %u)\n", (unsigned)DAG_RANK(instance->current_dag->preferred_parent->rank, instance)); } else { @@ -1143,8 +1126,8 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio) /* The DIO sender is on an older version of the DAG. */ PRINTF("RPL: old version received => inconsistency detected\n"); if(dag->joined) { - rpl_reset_dio_timer(instance); - return; + rpl_reset_dio_timer(instance); + return; } } } @@ -1196,10 +1179,6 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio) if(p == NULL) { previous_dag = find_parent_dag(instance, from); if(previous_dag == NULL) { - if(RPL_PARENT_COUNT(dag) == RPL_MAX_PARENTS_PER_DAG) { - /* Make room for a new parent. */ - remove_worst_parent(dag, dio->rank); - } /* Add the DIO sender as a candidate parent. */ p = rpl_add_parent(dag, dio, from); if(p == NULL) { diff --git a/core/net/rpl/rpl-icmp6.c b/core/net/rpl/rpl-icmp6.c index 711617ae0..dee62fcff 100644 --- a/core/net/rpl/rpl-icmp6.c +++ b/core/net/rpl/rpl-icmp6.c @@ -664,7 +664,7 @@ dao_input(void) if(lifetime == RPL_ZERO_LIFETIME) { /* No-Path DAO received; invoke the route purging routine. */ - if(rep != NULL && rep->state.nopath_received == 0 && rep->length == prefixlen && uip_ipaddr_cmp(&rep->nexthop, &dao_sender_addr)) { + if(rep != NULL && rep->state.nopath_received == 0 && rep->length == prefixlen && uip_ipaddr_cmp(uip_ds6_route_nexthop(rep), &dao_sender_addr)) { PRINTF("RPL: Setting expiration timer for prefix "); PRINT6ADDR(&prefix); PRINTF("\n"); @@ -706,7 +706,7 @@ dao_input(void) PRINTF("RPL: Forwarding DAO to parent "); PRINT6ADDR(&dag->preferred_parent->addr); PRINTF("\n"); - uip_icmp6_send(&dag->preferred_parent->addr, + uip_icmp6_send(rpl_get_parent_ipaddr(dag->preferred_parent), ICMP6_RPL, RPL_CODE_DAO, buffer_length); } if(flags & RPL_DAO_K_FLAG) { @@ -792,7 +792,7 @@ dao_output_target(rpl_parent_t *parent, uip_ipaddr_t *prefix, uint8_t lifetime) PRINT6ADDR(&parent->addr); PRINTF("\n"); - uip_icmp6_send(&parent->addr, ICMP6_RPL, RPL_CODE_DAO, pos); + uip_icmp6_send(rpl_get_parent_ipaddr(parent), ICMP6_RPL, RPL_CODE_DAO, pos); } /*---------------------------------------------------------------------------*/ static void diff --git a/core/net/rpl/rpl-private.h b/core/net/rpl/rpl-private.h index b4c3deca8..bc307e459 100644 --- a/core/net/rpl/rpl-private.h +++ b/core/net/rpl/rpl-private.h @@ -290,8 +290,8 @@ void rpl_free_instance(rpl_instance_t *); rpl_parent_t *rpl_add_parent(rpl_dag_t *, rpl_dio_t *dio, uip_ipaddr_t *); rpl_parent_t *rpl_find_parent(rpl_dag_t *, uip_ipaddr_t *); rpl_parent_t *rpl_find_parent_any_dag(rpl_instance_t *instance, uip_ipaddr_t *addr); -void rpl_nullify_parent(rpl_dag_t *, rpl_parent_t *); -void rpl_remove_parent(rpl_dag_t *, rpl_parent_t *); +void rpl_nullify_parent(rpl_parent_t *); +void rpl_remove_parent(rpl_parent_t *); void rpl_move_parent(rpl_dag_t *dag_src, rpl_dag_t *dag_dst, rpl_parent_t *parent); rpl_parent_t *rpl_select_parent(rpl_dag_t *dag); rpl_dag_t *rpl_select_dag(rpl_instance_t *instance,rpl_parent_t *parent); diff --git a/core/net/rpl/rpl.c b/core/net/rpl/rpl.c index b12c869be..c57d4105d 100644 --- a/core/net/rpl/rpl.c +++ b/core/net/rpl/rpl.c @@ -240,6 +240,7 @@ rpl_init(void) PRINTF("RPL started\n"); default_instance = NULL; + rpl_dag_init(); rpl_reset_periodic_timer(); neighbor_info_subscribe(rpl_link_neighbor_callback); diff --git a/core/net/rpl/rpl.h b/core/net/rpl/rpl.h index 8e770ddd8..db89f38cd 100644 --- a/core/net/rpl/rpl.h +++ b/core/net/rpl/rpl.h @@ -113,9 +113,8 @@ struct rpl_parent { #if RPL_DAG_MC != RPL_DAG_MC_NONE rpl_metric_container_t mc; #endif /* RPL_DAG_MC != RPL_DAG_MC_NONE */ - uip_ipaddr_t addr; rpl_rank_t rank; - uint8_t link_metric; + uint16_t link_metric; uint8_t dtsn; uint8_t updated; }; @@ -243,5 +242,8 @@ int rpl_update_header_final(uip_ipaddr_t *addr); int rpl_verify_header(int); void rpl_remove_header(void); uint8_t rpl_invert_header(void); +uip_ipaddr_t *rpl_get_parent_ipaddr(rpl_parent_t *nbr); +rpl_rank_t rpl_get_parent_rank(uip_lladdr_t *addr); +void rpl_dag_init(); /*---------------------------------------------------------------------------*/ #endif /* RPL_H */ From c3f62b24c8ea0679833e8a3031297012a021eac8 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Mon, 29 Jul 2013 21:50:33 +0200 Subject: [PATCH 06/29] Moved ETX management from neighbor-info to rpl-of-etx. Avoids conversions between different fixed point representations, and simplifies neighbor management. Makes more clear how default-ETX and noack-ETX actually affect the rank. Removed neighbor-info and neighbor-attr. --- core/net/Makefile.uip | 2 - core/net/neighbor-attr.c | 250 ------------------------------------ core/net/neighbor-attr.h | 163 ----------------------- core/net/neighbor-info.c | 193 ---------------------------- core/net/neighbor-info.h | 94 -------------- core/net/rpl/rpl-conf.h | 4 +- core/net/rpl/rpl-dag.c | 2 - core/net/rpl/rpl-mrhof.c | 38 +++++- core/net/rpl/rpl-of0.c | 8 +- core/net/rpl/rpl.c | 28 +--- core/net/rpl/rpl.h | 4 +- core/net/sicslowpan.c | 15 +-- core/net/uip-ds6-neighbor.c | 34 +++++ core/net/uip-ds6-neighbor.h | 1 + core/net/uip-ds6.h | 7 + 15 files changed, 86 insertions(+), 757 deletions(-) delete mode 100644 core/net/neighbor-attr.c delete mode 100644 core/net/neighbor-attr.h delete mode 100644 core/net/neighbor-info.c delete mode 100644 core/net/neighbor-info.h diff --git a/core/net/Makefile.uip b/core/net/Makefile.uip index 66ca1d0ec..6fb3facbd 100644 --- a/core/net/Makefile.uip +++ b/core/net/Makefile.uip @@ -1,8 +1,6 @@ NET = \ dhcpc.c \ hc.c \ -neighbor-attr.c \ -neighbor-info.c \ neighbor-table.c \ netstack.c \ packetbuf.c \ diff --git a/core/net/neighbor-attr.c b/core/net/neighbor-attr.c deleted file mode 100644 index 38b42839a..000000000 --- a/core/net/neighbor-attr.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright (c) 2010, Vrije Universiteit Brussel - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * - * Author: Joris Borms - * - */ - -#include "contiki.h" - -#include "lib/memb.h" -#include "lib/list.h" -#include -#include - -#include "net/neighbor-attr.h" - -#define DEBUG 0 - -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -static uint16_t timeout = 0; - -MEMB(neighbor_addr_mem, struct neighbor_addr, NEIGHBOR_ATTR_MAX_NEIGHBORS); - -LIST(neighbor_addrs); -LIST(neighbor_attrs); -/*---------------------------------------------------------------------------*/ -static struct neighbor_addr * -neighbor_addr_get(const rimeaddr_t *addr) -{ - struct neighbor_addr *item; - - /* check if addr is derived from table, inside memb */ - if(memb_inmemb(&neighbor_addr_mem, (char *)addr)) { - return (struct neighbor_addr *) - (((char *)addr) - offsetof(struct neighbor_addr, addr)); - } - - item = list_head(neighbor_addrs); - while(item != NULL) { - if(rimeaddr_cmp(addr, &item->addr)) { - return item; - } - item = item->next; - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -struct neighbor_addr * -neighbor_attr_list_neighbors(void) -{ - return list_head(neighbor_addrs); -} -/*---------------------------------------------------------------------------*/ -static void -set_attr(struct neighbor_attr *attr, uint16_t index) -{ - if(attr->default_value != NULL) { - memcpy((char *)attr->data + index * attr->size, - attr->default_value, attr->size); - } else { - /* fill with zeroes */ - memset((char *)attr->data + index * attr->size, 0, attr->size); - } -} -/*---------------------------------------------------------------------------*/ -int -neighbor_attr_register(struct neighbor_attr *def) -{ - struct neighbor_addr *addr; - - list_push(neighbor_attrs, def); - - /* set default values for already existing neighbors */ - for(addr = list_head(neighbor_addrs); addr != NULL; addr = addr->next) { - set_attr(def, addr->index); - } - return 1; -} -/*---------------------------------------------------------------------------*/ -int -neighbor_attr_has_neighbor(const rimeaddr_t *addr) -{ - return neighbor_addr_get(addr) != NULL; -} -/*---------------------------------------------------------------------------*/ -int -neighbor_attr_add_neighbor(const rimeaddr_t *addr) -{ - struct neighbor_attr *def; - struct neighbor_addr *item; - struct neighbor_addr *ptr; - uint16_t i; - - if(neighbor_attr_has_neighbor(addr)) { - return 0; - } - - item = memb_alloc(&neighbor_addr_mem); - if(item == NULL) { - return -1; - } - - list_push(neighbor_addrs, item); - - item->time = 0; - rimeaddr_copy(&item->addr, addr); - - /* look up index and set default values */ - ptr = neighbor_addr_mem.mem; - for(i = 0; i < neighbor_addr_mem.num; ++i) { - if(&ptr[i] == item) { - break; - } - } - - item->index = i; - - for(def = list_head(neighbor_attrs); def != NULL; def = def->next) { - set_attr(def, i); - } - - return 1; -} -/*---------------------------------------------------------------------------*/ -int -neighbor_attr_remove_neighbor(const rimeaddr_t *addr) -{ - struct neighbor_addr *item = neighbor_addr_get(addr); - - if(item != NULL) { - list_remove(neighbor_addrs, item); - memb_free(&neighbor_addr_mem, item); - return 0; - } - return -1; -} -/*---------------------------------------------------------------------------*/ -void * -neighbor_attr_get_data(struct neighbor_attr *def, const rimeaddr_t *addr) -{ - struct neighbor_addr *attr = neighbor_addr_get(addr); - - if(attr != NULL) { - return (char *)def->data + attr->index * def->size; - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -int -neighbor_attr_set_data(struct neighbor_attr *def, const rimeaddr_t *addr, - void *data) -{ - struct neighbor_addr *attr = neighbor_addr_get(addr); - - if(attr == NULL) { - if(neighbor_attr_add_neighbor(addr)) { - attr = neighbor_addr_get(addr); - } - } - if(attr != NULL) { - attr->time = 0; - memcpy((char *)def->data + attr->index * def->size, data, def->size); - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -void -neighbor_attr_tick(const rimeaddr_t * addr) -{ - struct neighbor_addr *attr = neighbor_addr_get(addr); - - if(attr != NULL) { - attr->time = 0; - } -} -/*---------------------------------------------------------------------------*/ -uint16_t -neighbor_attr_get_timeout(void) -{ - return timeout; -} -/*---------------------------------------------------------------------------*/ -static struct ctimer ct; - -#define TIMEOUT_SECONDS 5 -static void -timeout_check(void *ptr) -{ - if(timeout > 0) { - struct neighbor_addr *item = neighbor_attr_list_neighbors(); - - while(item != NULL) { - item->time += TIMEOUT_SECONDS; - if(item->time >= timeout) { - struct neighbor_addr *next_item = item->next; - - list_remove(neighbor_addrs, item); - memb_free(&neighbor_addr_mem, item); - item = next_item; - } else { - item = item->next; - } - } - ctimer_set(&ct, TIMEOUT_SECONDS * CLOCK_SECOND, timeout_check, ptr); - } -} -/*---------------------------------------------------------------------------*/ -void -neighbor_attr_set_timeout(uint16_t time) -{ - if(timeout == 0 && time > 0) { - ctimer_set(&ct, TIMEOUT_SECONDS * CLOCK_SECOND, timeout_check, NULL); - } else if(timeout > 0 && time == 0) { - ctimer_stop(&ct); - } - timeout = time; -} -/*---------------------------------------------------------------------------*/ diff --git a/core/net/neighbor-attr.h b/core/net/neighbor-attr.h deleted file mode 100644 index abf119c25..000000000 --- a/core/net/neighbor-attr.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2010, Vrije Universiteit Brussel - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * - * Author: Joris Borms - * - */ -#ifndef NEIGHBORATTR_H_ -#define NEIGHBORATTR_H_ - -#include "net/rime.h" - -/** - * define how many neighbors you can store - */ -#ifdef NEIGHBOR_CONF_MAX_NEIGHBORS -#define NEIGHBOR_ATTR_MAX_NEIGHBORS NEIGHBOR_CONF_MAX_NEIGHBORS -#else /* NEIGHBOR_CONF_MAX_NEIGHBORS */ -#define NEIGHBOR_ATTR_MAX_NEIGHBORS 12 -#endif /* NEIGHBOR_CONF_MAX_NEIGHBORS */ - -/** - * \brief properties of a single neighbor - */ -struct neighbor_addr { - struct neighbor_addr *next; - rimeaddr_t addr; - uint16_t time; - uint16_t index; -}; - -/** - * \brief properties that define a neighbor attribute - */ -struct neighbor_attr { - struct neighbor_attr *next; - uint16_t size; - void *default_value; - void *data; -}; - -/** - * \brief Define space for additional parameters in neighbor table entries. - * \param type The type of the attribute. - * \param name The name of the attribute. - * \param def A ptr to the default value for this attribute. If NULL, attribute will - * be filled with zeroes by default. - * - * The attribute 'name' should be registered with 'neighbor_attr_register' - * during initialization. - */ -#define NEIGHBOR_ATTRIBUTE(type, name, default_value_ptr) \ - static type _##name##_mem[NEIGHBOR_ATTR_MAX_NEIGHBORS]; \ - static struct neighbor_attr name = \ - {NULL, sizeof(type), default_value_ptr, (void *)_##name##_mem} - -/** Same as NEIGHBOR_ATTRIBUTE, only the attr is not declared static - * this way you can say extern struct neighbor_attr name in header to declare - * a global neighbor attribute - */ -#define NEIGHBOR_ATTRIBUTE_GLOBAL(type, name, default_value_ptr) \ - static type _##name##_mem[NEIGHBOR_ATTR_MAX_NEIGHBORS]; \ - struct neighbor_attr name = \ - {NULL, sizeof(type), default_value_ptr, (void *)_##name##_mem} - -#define NEIGHBOR_ATTRIBUTE_DECLARE(name) extern struct neighbor_attr name - -/** - * \brief register a neighbor attribute - * \retval non-zero if successful, zero if not - */ -int neighbor_attr_register(struct neighbor_attr *); - -/** - * \retval head of neighbor list, useful for iterating over all neighbors - */ -struct neighbor_addr *neighbor_attr_list_neighbors(void); - -/** - * \brief Check if a neighbor is already added to the neighbor table - * \retval non-zero if present, zero if not - */ -int neighbor_attr_has_neighbor(const rimeaddr_t *addr); - -/** - * \brief Add a neighbor entry to neighbor table - * \retval -1 if unsuccessful, 0 if the neighbor was already - * in the table, and 1 if successful - */ -int neighbor_attr_add_neighbor(const rimeaddr_t *addr); - -/** - * \brief Remove a neighbor entry to neighbor table - * \retval -1 if unsuccessful, 0 if the neighbor was removed - */ -int neighbor_attr_remove_neighbor(const rimeaddr_t *addr); - -/** - * \brief Get pointer to neighbor table data specified by id - * \param requested attribute - * \param addr requested neighbor - * \retval pointer to data, NULL if neighbor was not found - * - * Searches neighbor table for addr and returns pointer to data section - * specified by attribute type and addr. - * This pointer should not be saved, as it may point to data from another - * neighbor in the future if neighbors get removed/added over time. - */ -void *neighbor_attr_get_data(struct neighbor_attr *, const rimeaddr_t *addr); - -/** - * \brief Copy data to neighbor table - * \retval non-zero if successful, zero if not - * - * Copies data to specific part of the neighbor table, specified by - * neighbor and attribute type, and resets timeout for that neighbor. - * If neighbor was not found, this will add a new neighbor to the table. - */ -int neighbor_attr_set_data(struct neighbor_attr *, const rimeaddr_t *addr, - void *data); - -/** - * \brief Set global lifetime of neighbor entries. - * \param Lifetime in seconds. If 0, entries will not time out - */ -void neighbor_attr_set_timeout(uint16_t); - -/** - * \brief get global lifetime of neighbor entries. If 0, entries will not time out - */ -uint16_t neighbor_attr_get_timeout(void); - -/** - * \brief reset timeout of a neighbor to prevent it from being removed - */ -void neighbor_attr_tick(const rimeaddr_t *); - -#endif /* NEIGHBORATTR_H_ */ diff --git a/core/net/neighbor-info.c b/core/net/neighbor-info.c deleted file mode 100644 index dc232cf02..000000000 --- a/core/net/neighbor-info.c +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * This file is part of the Contiki operating system. - * - */ -/** - * \file - * A generic module for management of neighbor information. - * - * \author Nicolas Tsiftes - */ - -#include "net/neighbor-info.h" -#include "net/neighbor-attr.h" -#include "net/uip-ds6.h" -#include "net/uip-nd6.h" - -#define DEBUG DEBUG_NONE -#include "net/uip-debug.h" - -#define ETX_LIMIT 15 -#define ETX_SCALE 100 -#define ETX_ALPHA 90 -#define ETX_NOACK_PENALTY ETX_LIMIT -/*---------------------------------------------------------------------------*/ -NEIGHBOR_ATTRIBUTE_GLOBAL(link_metric_t, attr_etx, NULL); -NEIGHBOR_ATTRIBUTE_GLOBAL(unsigned long, attr_timestamp, NULL); - -static neighbor_info_subscriber_t subscriber_callback; -/*---------------------------------------------------------------------------*/ -static void -update_metric(const rimeaddr_t *dest, int packet_metric) -{ - link_metric_t *metricp; - link_metric_t recorded_metric, new_metric; - unsigned long time; - int first_update = 0; - - metricp = (link_metric_t *)neighbor_attr_get_data(&attr_etx, dest); - packet_metric = NEIGHBOR_INFO_ETX2FIX(packet_metric); - if(metricp == NULL || *metricp == 0) { - recorded_metric = NEIGHBOR_INFO_ETX2FIX(ETX_LIMIT); - new_metric = packet_metric; - first_update = 1; - } else { - recorded_metric = *metricp; - /* Update the EWMA of the ETX for the neighbor. */ - new_metric = ((uint16_t)recorded_metric * ETX_ALPHA + - (uint16_t)packet_metric * (ETX_SCALE - ETX_ALPHA)) / ETX_SCALE; - } - - PRINTF("neighbor-info: ETX changed from %d to %d (packet ETX = %d) %d\n", - NEIGHBOR_INFO_FIX2ETX(recorded_metric), - NEIGHBOR_INFO_FIX2ETX(new_metric), - NEIGHBOR_INFO_FIX2ETX(packet_metric), - dest->u8[7]); - - if(neighbor_attr_has_neighbor(dest)) { - time = clock_seconds(); - neighbor_attr_set_data(&attr_etx, dest, &new_metric); - neighbor_attr_set_data(&attr_timestamp, dest, &time); - if((first_update || new_metric != recorded_metric) && subscriber_callback != NULL) { - subscriber_callback(dest, 1, new_metric); - } - } -} -/*---------------------------------------------------------------------------*/ -static void -add_neighbor(const rimeaddr_t *addr) -{ - switch(neighbor_attr_add_neighbor(addr)) { - case -1: - PRINTF("neighbor-info: failed to add a node.\n"); - break; - case 0: - PRINTF("neighbor-info: The neighbor is already known\n"); - break; - default: - break; - } -} -/*---------------------------------------------------------------------------*/ -void -neighbor_info_packet_sent(int status, int numtx) -{ - const rimeaddr_t *dest; - link_metric_t packet_metric; -#if UIP_DS6_LL_NUD - uip_ds6_nbr_t *nbr; -#endif /* UIP_DS6_LL_NUD */ - - dest = packetbuf_addr(PACKETBUF_ADDR_RECEIVER); - if(rimeaddr_cmp(dest, &rimeaddr_null)) { - return; - } - - packet_metric = numtx; - - PRINTF("neighbor-info: packet sent to %d.%d, status=%d, metric=%u\n", - dest->u8[sizeof(*dest) - 2], dest->u8[sizeof(*dest) - 1], - status, (unsigned)packet_metric); - - switch(status) { - case MAC_TX_OK: - add_neighbor(dest); -#if UIP_DS6_LL_NUD - nbr = uip_ds6_nbr_ll_lookup((uip_lladdr_t *)dest); - if(nbr != NULL && - (nbr->state == STALE || nbr->state == DELAY || nbr->state == PROBE)) { - nbr->state = REACHABLE; - stimer_set(&nbr->reachable, UIP_ND6_REACHABLE_TIME / 1000); - PRINTF("neighbor-info : received a link layer ACK : "); - PRINTLLADDR((uip_lladdr_t *)dest); - PRINTF(" is reachable.\n"); - } -#endif /* UIP_DS6_LL_NUD */ - break; - case MAC_TX_NOACK: - packet_metric = ETX_NOACK_PENALTY; - break; - default: - /* Do not penalize the ETX when collisions or transmission - errors occur. */ - return; - } - - update_metric(dest, packet_metric); -} -/*---------------------------------------------------------------------------*/ -void -neighbor_info_packet_received(void) -{ - const rimeaddr_t *src; - - src = packetbuf_addr(PACKETBUF_ADDR_SENDER); - if(rimeaddr_cmp(src, &rimeaddr_null)) { - return; - } - - PRINTF("neighbor-info: packet received from %d.%d\n", - src->u8[sizeof(*src) - 2], src->u8[sizeof(*src) - 1]); - - add_neighbor(src); -} -/*---------------------------------------------------------------------------*/ -int -neighbor_info_subscribe(neighbor_info_subscriber_t s) -{ - if(subscriber_callback == NULL) { - neighbor_attr_register(&attr_etx); - neighbor_attr_register(&attr_timestamp); - subscriber_callback = s; - return 1; - } - - return 0; -} -/*---------------------------------------------------------------------------*/ -link_metric_t -neighbor_info_get_metric(const rimeaddr_t *addr) -{ - link_metric_t *metricp; - - metricp = (link_metric_t *)neighbor_attr_get_data(&attr_etx, addr); - return metricp == NULL ? ETX_LIMIT : *metricp; -} -/*---------------------------------------------------------------------------*/ diff --git a/core/net/neighbor-info.h b/core/net/neighbor-info.h deleted file mode 100644 index 4bfed1ade..000000000 --- a/core/net/neighbor-info.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. - * - * This file is part of the Contiki operating system. - * - */ -/** - * \file - * Declarations for the neighbor information module. - * - * \author Nicolas Tsiftes - */ - -#ifndef NEIGHBOR_INFO_H -#define NEIGHBOR_INFO_H - -#include "net/neighbor-attr.h" -#include "net/rime.h" - -/* ETX_DIVISOR is the value that a fix-point representation of the ETX - should be divided by in order to obtain the integer representation. */ -#define NEIGHBOR_INFO_ETX_DIVISOR 16 - -/* Macros for converting between a fix-point representation of the ETX - and a integer representation. */ -#define NEIGHBOR_INFO_ETX2FIX(etx) ((etx) * NEIGHBOR_INFO_ETX_DIVISOR) -#define NEIGHBOR_INFO_FIX2ETX(fix) ((fix) / NEIGHBOR_INFO_ETX_DIVISOR) - -typedef void (*neighbor_info_subscriber_t)(const rimeaddr_t *, int known, int etx); -typedef uint8_t link_metric_t; - -NEIGHBOR_ATTRIBUTE_DECLARE(attr_etx); -NEIGHBOR_ATTRIBUTE_DECLARE(attr_timestamp); - -/** - * Notify the neighbor information module about the status of - * a packet transmission. - * - * \param status The MAC status code for this packet. - * - * \param numtx The amount of transmissions made for this packet. - */ -void neighbor_info_packet_sent(int status, int numtx); - -/** - * Notify the neighbor information module that a packet was received. - * - * \param status The MAC status code for this packet. - * - * \param numtx The amount of transmissions made for this packet. - */ -void neighbor_info_packet_received(void); - -/** - * Subscribe to notifications of changed neighbor information. - * - * \return Returns 1 if the subscription was successful, and 0 if not. - */ -int neighbor_info_subscribe(neighbor_info_subscriber_t); - - -/** - * Get link metric value for a specific neighbor. - * - * \return Returns link metric if the neighbor exists, and 0 if not. - */ -link_metric_t neighbor_info_get_metric(const rimeaddr_t *addr); - -#endif /* NEIGHBOR_INFO_H */ diff --git a/core/net/rpl/rpl-conf.h b/core/net/rpl/rpl-conf.h index 2810bd6d3..197c5abbe 100644 --- a/core/net/rpl/rpl-conf.h +++ b/core/net/rpl/rpl-conf.h @@ -162,9 +162,9 @@ * Initial metric attributed to a link when the ETX is unknown */ #ifndef RPL_CONF_INIT_LINK_METRIC -#define RPL_INIT_LINK_METRIC NEIGHBOR_INFO_ETX2FIX(5) +#define RPL_INIT_LINK_METRIC 5 * RPL_MIN_HOPRANKINC #else -#define RPL_INIT_LINK_METRIC NEIGHBOR_INFO_ETX2FIX(RPL_CONF_INIT_LINK_METRIC) +#define RPL_INIT_LINK_METRIC RPL_CONF_INIT_LINK_METRIC #endif /* diff --git a/core/net/rpl/rpl-dag.c b/core/net/rpl/rpl-dag.c index dfd9c997c..74f0d3cf0 100644 --- a/core/net/rpl/rpl-dag.c +++ b/core/net/rpl/rpl-dag.c @@ -56,8 +56,6 @@ #define DEBUG DEBUG_NONE #include "net/uip-debug.h" -#include "net/neighbor-info.h" - #if UIP_CONF_IPV6 /*---------------------------------------------------------------------------*/ extern rpl_of_t RPL_OF; diff --git a/core/net/rpl/rpl-mrhof.c b/core/net/rpl/rpl-mrhof.c index 567977c70..5f7e85f42 100644 --- a/core/net/rpl/rpl-mrhof.c +++ b/core/net/rpl/rpl-mrhof.c @@ -45,13 +45,13 @@ */ #include "net/rpl/rpl-private.h" -#include "net/neighbor-info.h" +#include "net/neighbor-table.h" #define DEBUG DEBUG_NONE #include "net/uip-debug.h" static void reset(rpl_dag_t *); -static void parent_state_callback(rpl_parent_t *, int, int); +static void neighbor_link_callback(rpl_parent_t *, int, int); static rpl_parent_t *best_parent(rpl_parent_t *, rpl_parent_t *); static rpl_dag_t *best_dag(rpl_dag_t *, rpl_dag_t *); static rpl_rank_t calculate_rank(rpl_parent_t *, rpl_rank_t); @@ -59,7 +59,7 @@ static void update_metric_container(rpl_instance_t *); rpl_of_t rpl_mrhof = { reset, - parent_state_callback, + neighbor_link_callback, best_parent, best_dag, calculate_rank, @@ -67,6 +67,10 @@ rpl_of_t rpl_mrhof = { 1 }; +/* Constants for the ETX moving average */ +#define ETX_SCALE 100 +#define ETX_ALPHA 90 + /* Reject parents that have a higher link metric than the following. */ #define MAX_LINK_METRIC 10 @@ -88,7 +92,6 @@ calculate_path_metric(rpl_parent_t *p) return MAX_PATH_COST * RPL_DAG_MC_ETX_DIVISOR; } else { long link_metric = p->link_metric; - link_metric = (link_metric * RPL_DAG_MC_ETX_DIVISOR) / NEIGHBOR_INFO_ETX_DIVISOR; #if RPL_DAG_MC == RPL_DAG_MC_NONE return p->rank + (uint16_t)link_metric; #elif RPL_DAG_MC == RPL_DAG_MC_ETX @@ -105,8 +108,29 @@ reset(rpl_dag_t *sag) } static void -parent_state_callback(rpl_parent_t *parent, int known, int etx) +neighbor_link_callback(rpl_parent_t *p, int status, int numtx) { + /* Do not penalize the ETX when collisions or transmission errors occur. */ + if(status == MAC_TX_OK || status == MAC_TX_NOACK) { + int recorded_etx = p->link_metric; + int packet_etx = numtx; + int new_etx; + + if(status == MAC_TX_NOACK) { + packet_etx = MAX_LINK_METRIC; + } + + new_etx = ((uint16_t)recorded_etx * ETX_ALPHA + + (uint16_t)packet_etx * (ETX_SCALE - ETX_ALPHA)) / ETX_SCALE; + + PRINTF("RPL: ETX changed from %d to %d (packet ETX = %d) %d\n", + recorded_etx / p->dag->instance->min_hoprankinc, + new_etx / p->dag->instance->min_hoprankinc, + packet_etx / p->dag->instance->min_hoprankinc, + dest->u8[7]); + p->link_metric = new_etx; + + } } static rpl_rank_t @@ -119,10 +143,10 @@ calculate_rank(rpl_parent_t *p, rpl_rank_t base_rank) if(base_rank == 0) { return INFINITE_RANK; } - rank_increase = NEIGHBOR_INFO_FIX2ETX(RPL_INIT_LINK_METRIC) * RPL_MIN_HOPRANKINC; + rank_increase = RPL_INIT_LINK_METRIC; } else { /* multiply first, then scale down to avoid truncation effects */ - rank_increase = NEIGHBOR_INFO_FIX2ETX(p->link_metric * p->dag->instance->min_hoprankinc); + rank_increase = p->link_metric; if(base_rank == 0) { base_rank = p->rank; } diff --git a/core/net/rpl/rpl-of0.c b/core/net/rpl/rpl-of0.c index 49f3c99d0..36241c7ef 100644 --- a/core/net/rpl/rpl-of0.c +++ b/core/net/rpl/rpl-of0.c @@ -44,8 +44,6 @@ #define DEBUG DEBUG_NONE #include "net/uip-debug.h" -#include "net/neighbor-info.h" - static void reset(rpl_dag_t *); static rpl_parent_t *best_parent(rpl_parent_t *, rpl_parent_t *); static rpl_dag_t *best_dag(rpl_dag_t *, rpl_dag_t *); @@ -64,7 +62,7 @@ rpl_of_t rpl_of0 = { #define DEFAULT_RANK_INCREMENT RPL_MIN_HOPRANKINC -#define MIN_DIFFERENCE (NEIGHBOR_INFO_ETX_DIVISOR + NEIGHBOR_INFO_ETX_DIVISOR / 2) +#define MIN_DIFFERENCE (RPL_MIN_HOPRANKINC + RPL_MIN_HOPRANKINC / 2) static void reset(rpl_dag_t *dag) @@ -137,9 +135,9 @@ best_parent(rpl_parent_t *p1, rpl_parent_t *p2) p2->link_metric, p2->rank); - r1 = DAG_RANK(p1->rank, p1->dag->instance) * NEIGHBOR_INFO_ETX_DIVISOR + + r1 = DAG_RANK(p1->rank, p1->dag->instance) * RPL_MIN_HOPRANKINC + p1->link_metric; - r2 = DAG_RANK(p2->rank, p1->dag->instance) * NEIGHBOR_INFO_ETX_DIVISOR + + r2 = DAG_RANK(p2->rank, p1->dag->instance) * RPL_MIN_HOPRANKINC + p2->link_metric; /* Compare two parents by looking both and their rank and at the ETX for that parent. We choose the parent that has the most diff --git a/core/net/rpl/rpl.c b/core/net/rpl/rpl.c index c57d4105d..cf01c286a 100644 --- a/core/net/rpl/rpl.c +++ b/core/net/rpl/rpl.c @@ -44,7 +44,6 @@ #include "net/tcpip.h" #include "net/uip-ds6.h" #include "net/rpl/rpl-private.h" -#include "net/neighbor-info.h" #define DEBUG DEBUG_NONE #include "net/uip-debug.h" @@ -168,8 +167,8 @@ rpl_add_route(rpl_dag_t *dag, uip_ipaddr_t *prefix, int prefix_len, return rep; } /*---------------------------------------------------------------------------*/ -static void -rpl_link_neighbor_callback(const rimeaddr_t *addr, int known, int etx) +void +rpl_link_neighbor_callback(const rimeaddr_t *addr, int status, int numtx) { uip_ipaddr_t ipaddr; rpl_parent_t *parent; @@ -178,9 +177,6 @@ rpl_link_neighbor_callback(const rimeaddr_t *addr, int known, int etx) uip_ip6addr(&ipaddr, 0xfe80, 0, 0, 0, 0, 0, 0, 0); uip_ds6_set_addr_iid(&ipaddr, (uip_lladdr_t *)addr); - PRINTF("RPL: Neighbor "); - PRINT6ADDR(&ipaddr); - PRINTF(" is %sknown. ETX = %u\n", known ? "" : "no longer ", NEIGHBOR_INFO_FIX2ETX(etx)); for(instance = &instance_table[0], end = instance + RPL_MAX_INSTANCES; instance < end; ++instance) { if(instance->used == 1 ) { @@ -188,27 +184,12 @@ rpl_link_neighbor_callback(const rimeaddr_t *addr, int known, int etx) if(parent != NULL) { /* Trigger DAG rank recalculation. */ parent->updated = 1; - parent->link_metric = etx; - - if(instance->of->parent_state_callback != NULL) { - instance->of->parent_state_callback(parent, known, etx); - } - if(!known) { - PRINTF("RPL: Removing parent "); - PRINT6ADDR(&parent->addr); - PRINTF(" in instance %u because of bad connectivity (ETX %d)\n", instance->instance_id, etx); - parent->rank = INFINITE_RANK; + if(instance->of->neighbor_link_callback != NULL) { + instance->of->neighbor_link_callback(parent, status, numtx); } } } } - - if(!known) { - PRINTF("RPL: Deleting routes installed by DAOs received from "); - PRINT6ADDR(&ipaddr); - PRINTF("\n"); - uip_ds6_route_rm_by_nexthop(&ipaddr); - } } /*---------------------------------------------------------------------------*/ void @@ -242,7 +223,6 @@ rpl_init(void) rpl_dag_init(); rpl_reset_periodic_timer(); - neighbor_info_subscribe(rpl_link_neighbor_callback); /* add rpl multicast address */ uip_create_linklocal_rplnodes_mcast(&rplmaddr); diff --git a/core/net/rpl/rpl.h b/core/net/rpl/rpl.h index db89f38cd..6109874ef 100644 --- a/core/net/rpl/rpl.h +++ b/core/net/rpl/rpl.h @@ -156,7 +156,7 @@ typedef struct rpl_instance rpl_instance_t; * Resets the objective function state for a specific DAG. This function is * called when doing a global repair on the DAG. * - * parent_state_callback(parent, known, etx) + * neighbor_link_callback(parent, known, etx) * * Receives link-layer neighbor information. The parameter "known" is set * either to 0 or 1. The "etx" parameter specifies the current @@ -185,7 +185,7 @@ typedef struct rpl_instance rpl_instance_t; */ struct rpl_of { void (*reset)(struct rpl_dag *); - void (*parent_state_callback)(rpl_parent_t *, int, int); + void (*neighbor_link_callback)(rpl_parent_t *, int, int); rpl_parent_t *(*best_parent)(rpl_parent_t *, rpl_parent_t *); rpl_dag_t *(*best_dag)(rpl_dag_t *, rpl_dag_t *); rpl_rank_t (*calculate_rank)(rpl_parent_t *, rpl_rank_t); diff --git a/core/net/sicslowpan.c b/core/net/sicslowpan.c index ad9cc96c8..cdbe33fc8 100644 --- a/core/net/sicslowpan.c +++ b/core/net/sicslowpan.c @@ -65,7 +65,6 @@ #include "net/uip-ds6.h" #include "net/rime.h" #include "net/sicslowpan.h" -#include "net/neighbor-info.h" #include "net/netstack.h" #if UIP_CONF_IPV6 @@ -113,11 +112,6 @@ void uip_log(char *msg); #endif /* SICSLOWPAN_CONF_COMPRESSION */ #endif /* SICSLOWPAN_COMPRESSION */ -#ifndef SICSLOWPAN_CONF_NEIGHBOR_INFO -/* Default is to use neighbor info updates if using RPL */ -#define SICSLOWPAN_CONF_NEIGHBOR_INFO UIP_CONF_IPV6_RPL -#endif /* SICSLOWPAN_CONF_NEIGHBOR_INFO */ - #define GET16(ptr,index) (((uint16_t)((ptr)[index] << 8)) | ((ptr)[(index) + 1])) #define SET16(ptr,index,value) do { \ (ptr)[index] = ((value) >> 8) & 0xff; \ @@ -1309,9 +1303,8 @@ compress_hdr_ipv6(rimeaddr_t *rime_destaddr) static void packet_sent(void *ptr, int status, int transmissions) { -#if SICSLOWPAN_CONF_NEIGHBOR_INFO - neighbor_info_packet_sent(status, transmissions); -#endif /* SICSLOWPAN_CONF_NEIGHBOR_INFO */ + uip_ds6_link_neighbor_callback(status, transmissions); + if(callback != NULL) { callback->output_callback(status); } @@ -1834,10 +1827,6 @@ input(void) } #endif -#if SICSLOWPAN_CONF_NEIGHBOR_INFO - neighbor_info_packet_received(); -#endif /* SICSLOWPAN_CONF_NEIGHBOR_INFO */ - /* if callback is set then set attributes and call */ if(callback) { set_packet_attrs(); diff --git a/core/net/uip-ds6-neighbor.c b/core/net/uip-ds6-neighbor.c index e5dd36897..89371baf4 100644 --- a/core/net/uip-ds6-neighbor.c +++ b/core/net/uip-ds6-neighbor.c @@ -61,6 +61,13 @@ void NEIGHBOR_STATE_CHANGED(uip_ds6_nbr_t *n); #define NEIGHBOR_STATE_CHANGED(n) #endif /* UIP_DS6_CONF_NEIGHBOR_STATE_CHANGED */ +#ifdef UIP_CONF_DS6_LINK_NEIGHBOR_CALLBACK +#define LINK_NEIGHBOR_CALLBACK(addr, status, numtx) UIP_CONF_DS6_LINK_NEIGHBOR_CALLBACK(addr, status, numtx) +void LINK_NEIGHBOR_CALLBACK(const rimeaddr_t *addr, int status, int numtx); +#else +#define LINK_NEIGHBOR_CALLBACK(addr, status, numtx) +#endif /* UIP_CONF_DS6_LINK_NEIGHBOR_CALLBACK */ + NEIGHBOR_TABLE_GLOBAL(uip_ds6_nbr_t, ds6_neighbors); /*---------------------------------------------------------------------------*/ @@ -166,6 +173,33 @@ uip_ds6_nbr_lladdr_from_ipaddr(uip_ipaddr_t *ipaddr) uip_ds6_nbr_t *nbr = uip_ds6_nbr_lookup(ipaddr); return nbr ? uip_ds6_nbr_get_ll(nbr) : NULL; } +/*---------------------------------------------------------------------------*/ +void +uip_ds6_link_neighbor_callback(int status, int numtx) +{ + const rimeaddr_t *dest = packetbuf_addr(PACKETBUF_ADDR_RECEIVER); + if(rimeaddr_cmp(dest, &rimeaddr_null)) { + return; + } + + LINK_NEIGHBOR_CALLBACK(dest, status, numtx); + +#if UIP_DS6_LL_NUD + if(status == MAC_TX_OK) { + uip_ds6_nbr_t *nbr; + nbr = uip_ds6_nbr_ll_lookup((uip_lladdr_t *)dest); + if(nbr != NULL && + (nbr->state == STALE || nbr->state == DELAY || nbr->state == PROBE)) { + nbr->state = REACHABLE; + stimer_set(&nbr->reachable, UIP_ND6_REACHABLE_TIME / 1000); + PRINTF("uip-ds6-neighbor : received a link layer ACK : "); + PRINTLLADDR((uip_lladdr_t *)dest); + PRINTF(" is reachable.\n"); + } + } +#endif /* UIP_DS6_LL_NUD */ + +} /*---------------------------------------------------------------------------*/ void diff --git a/core/net/uip-ds6-neighbor.h b/core/net/uip-ds6-neighbor.h index 686fb6abd..4de23cb03 100644 --- a/core/net/uip-ds6-neighbor.h +++ b/core/net/uip-ds6-neighbor.h @@ -81,6 +81,7 @@ uip_ds6_nbr_t *uip_ds6_nbr_lookup(uip_ipaddr_t *ipaddr); uip_ds6_nbr_t *uip_ds6_nbr_ll_lookup(uip_lladdr_t *lladdr); uip_ipaddr_t *uip_ds6_nbr_ipaddr_from_lladdr(uip_lladdr_t *lladdr); uip_lladdr_t *uip_ds6_nbr_lladdr_from_ipaddr(uip_ipaddr_t *ipaddr); +void uip_ds6_link_neighbor_callback(int status, int numtx); void uip_ds6_neighbor_periodic(); /** diff --git a/core/net/uip-ds6.h b/core/net/uip-ds6.h index e0d032c96..1ee6b176f 100644 --- a/core/net/uip-ds6.h +++ b/core/net/uip-ds6.h @@ -203,6 +203,13 @@ typedef struct uip_ds6_maddr { #endif /* UIP_CONF_DS6_NEIGHBOR_STATE_CHANGED */ #endif /* UIP_CONF_IPV6_RPL */ +#if UIP_CONF_IPV6_RPL +#ifndef UIP_CONF_DS6_LINK_NEIGHBOR_CALLBACK +#define UIP_CONF_DS6_LINK_NEIGHBOR_CALLBACK rpl_link_neighbor_callback +#endif /* UIP_CONF_DS6_NEIGHBOR_STATE_CHANGED */ +#endif /* UIP_CONF_IPV6_RPL */ + + /** \brief Interface structure (contains all the interface variables) */ typedef struct uip_ds6_netif { uint32_t link_mtu; From ff093a2b50b69a31d95cbcec657ac24c5aa5701a Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Wed, 3 Jul 2013 20:17:10 +0200 Subject: [PATCH 07/29] Removed now unused per-module neighbor table size configs. Use NEIGHBOR_CONF_MAX_NEIGHBORS instead. --- core/contiki-default-conf.h | 5 +++++ core/net/uipopt.h | 5 ----- examples/er-rest-example/project-conf.h | 4 ++-- examples/ipv6/json-ws/project-conf.h | 6 ++---- examples/udp-stream/project-conf.h | 4 ++-- platform/avr-atmega128rfa1/contiki-conf.h | 6 +++--- platform/avr-raven/contiki-conf.h | 6 +++--- platform/avr-ravenusb/contiki-conf.h | 12 ++++++------ platform/avr-rcb/contiki-conf.h | 1 - platform/avr-zigbit/contiki-conf.h | 1 - platform/cc2530dk/contiki-conf.h | 4 ++-- platform/cc2538dk/contiki-conf.h | 4 ++-- platform/cooja/contiki-conf.h | 8 +++----- platform/econotag/contiki-conf.h | 3 +-- platform/exp5438/contiki-conf.h | 7 +++---- platform/iris/contiki-conf.h | 3 +-- platform/mbxxx/contiki-conf.h | 3 +-- platform/micaz/contiki-conf.h | 3 +-- platform/minimal-net/contiki-conf.h | 3 +-- platform/native/contiki-conf.h | 7 +++---- platform/redbee-dev/contiki-conf.h | 3 +-- platform/redbee-econotag/contiki-conf.h | 3 +-- platform/seedeye/contiki-conf.h | 2 +- platform/sensinode/contiki-conf.h | 4 ++-- platform/sky/contiki-conf.h | 7 +++---- platform/stk500/contiki-conf.h | 2 +- platform/win32/contiki-conf.h | 2 +- platform/wismote/contiki-conf.h | 7 +++---- platform/z1/contiki-conf.h | 3 +-- platform/z1sp/contiki-conf.h | 3 +-- 30 files changed, 56 insertions(+), 75 deletions(-) diff --git a/core/contiki-default-conf.h b/core/contiki-default-conf.h index b3780a952..ded2df5ff 100644 --- a/core/contiki-default-conf.h +++ b/core/contiki-default-conf.h @@ -174,6 +174,11 @@ #define UIP_CONF_TCP_SPLIT 0 #endif /* UIP_CONF_TCP_SPLIT */ +/* NEIGHBOR_CONF_MAX_NEIGHBORS specifies the maximum number of neighbors + that each node will be able to handle. */ +#ifndef NEIGHBOR_CONF_MAX_NEIGHBORS +#define NEIGHBOR_CONF_MAX_NEIGHBORS 8 +#endif /* NEIGHBOR_CONF_MAX_NEIGHBORS */ /*---------------------------------------------------------------------------*/ /* 6lowpan configuration options. diff --git a/core/net/uipopt.h b/core/net/uipopt.h index ab31737ca..bf3097a0a 100644 --- a/core/net/uipopt.h +++ b/core/net/uipopt.h @@ -213,11 +213,6 @@ #define UIP_CONF_DS6_PREFIX_NBU 2 #endif -#ifndef UIP_CONF_DS6_NBR_NBU -/** Default number of neighbors that can be stored in the %neighbor cache */ -#define UIP_CONF_DS6_NBR_NBU 4 -#endif - #ifndef UIP_CONF_DS6_DEFRT_NBU /** Minimum number of default routers */ #define UIP_CONF_DS6_DEFRT_NBU 2 diff --git a/examples/er-rest-example/project-conf.h b/examples/er-rest-example/project-conf.h index 9ba0f0000..ff76fde14 100644 --- a/examples/er-rest-example/project-conf.h +++ b/examples/er-rest-example/project-conf.h @@ -73,8 +73,8 @@ */ /* Save some memory for the sky platform. */ -#undef UIP_CONF_DS6_NBR_NBU -#define UIP_CONF_DS6_NBR_NBU 10 +#undef NEIGHBOR_CONF_MAX_NEIGHBORS +#define NEIGHBOR_CONF_MAX_NEIGHBORS 10 #undef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 10 diff --git a/examples/ipv6/json-ws/project-conf.h b/examples/ipv6/json-ws/project-conf.h index a62582357..d67f1bbba 100644 --- a/examples/ipv6/json-ws/project-conf.h +++ b/examples/ipv6/json-ws/project-conf.h @@ -43,8 +43,6 @@ #define NETSTACK_CONF_RDC nullrdc_driver /* #define NETSTACK_CONF_RDC contikimac_driver */ -#define CONTIKIMAC_CONF_MAX_PHASE_NEIGHBORS 7 - #undef NULLRDC_CONF_802154_AUTOACK #define NULLRDC_CONF_802154_AUTOACK 1 @@ -56,8 +54,8 @@ #undef QUEUEBUF_CONF_NUM #define QUEUEBUF_CONF_NUM 4 -#undef UIP_CONF_DS6_NBR_NBU -#define UIP_CONF_DS6_NBR_NBU 7 +#undef NEIGHBOR_CONF_MAX_NEIGHBORS +#define NEIGHBOR_CONF_MAX_NEIGHBORS 7 #undef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 7 diff --git a/examples/udp-stream/project-conf.h b/examples/udp-stream/project-conf.h index 605772c00..f4357d5ca 100644 --- a/examples/udp-stream/project-conf.h +++ b/examples/udp-stream/project-conf.h @@ -33,8 +33,8 @@ /* Free some code and RAM space */ #define UIP_CONF_TCP 0 -#undef UIP_CONF_DS6_NBR_NBU -#define UIP_CONF_DS6_NBR_NBU 8 +#undef NEIGHBOR_CONF_MAX_NEIGHBORS +#define NEIGHBOR_CONF_MAX_NEIGHBORS 8 #undef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 8 diff --git a/platform/avr-atmega128rfa1/contiki-conf.h b/platform/avr-atmega128rfa1/contiki-conf.h index d08d0590b..09c3f6679 100644 --- a/platform/avr-atmega128rfa1/contiki-conf.h +++ b/platform/avr-atmega128rfa1/contiki-conf.h @@ -221,7 +221,7 @@ typedef unsigned short uip_stats_t; /* 25 bytes per UDP connection */ #define UIP_CONF_UDP_CONNS 10 /* See uip-ds6.h */ -#define UIP_CONF_DS6_NBR_NBU 20 +#define NEIGHBOR_CONF_MAX_NEIGHBORS 20 #define UIP_CONF_DS6_DEFRT_NBU 2 #define UIP_CONF_DS6_PREFIX_NBU 3 #define UIP_CONF_MAX_ROUTES 20 @@ -266,7 +266,7 @@ typedef unsigned short uip_stats_t; #define UIP_CONF_MAX_CONNECTIONS 2 #define UIP_CONF_MAX_LISTENPORTS 4 #define UIP_CONF_UDP_CONNS 5 -#define UIP_CONF_DS6_NBR_NBU 20 +#define NEIGHBOR_CONF_MAX_NEIGHBORS 20 #define UIP_CONF_DS6_DEFRT_NBU 2 #define UIP_CONF_DS6_PREFIX_NBU 3 #define UIP_CONF_MAX_ROUTES 4 @@ -302,7 +302,7 @@ typedef unsigned short uip_stats_t; #define UIP_CONF_MAX_CONNECTIONS 2 #define UIP_CONF_MAX_LISTENPORTS 4 #define UIP_CONF_UDP_CONNS 5 -#define UIP_CONF_DS6_NBR_NBU 4 +#define NEIGHBOR_CONF_MAX_NEIGHBORS 4 #define UIP_CONF_DS6_DEFRT_NBU 2 #define UIP_CONF_DS6_PREFIX_NBU 3 #define UIP_CONF_MAX_ROUTES 4 diff --git a/platform/avr-raven/contiki-conf.h b/platform/avr-raven/contiki-conf.h index 395280877..c1b58c75f 100644 --- a/platform/avr-raven/contiki-conf.h +++ b/platform/avr-raven/contiki-conf.h @@ -238,7 +238,7 @@ typedef unsigned short uip_stats_t; /* 25 bytes per UDP connection */ #define UIP_CONF_UDP_CONNS 10 /* See uip-ds6.h */ -#define UIP_CONF_DS6_NBR_NBU 20 +#define NEIGHBOR_CONF_MAX_NEIGHBORS 20 #define UIP_CONF_DS6_DEFRT_NBU 2 #define UIP_CONF_DS6_PREFIX_NBU 3 #define UIP_CONF_MAX_ROUTES 20 @@ -281,7 +281,7 @@ typedef unsigned short uip_stats_t; #define UIP_CONF_MAX_CONNECTIONS 2 #define UIP_CONF_MAX_LISTENPORTS 2 #define UIP_CONF_UDP_CONNS 4 -#define UIP_CONF_DS6_NBR_NBU 10 +#define NEIGHBOR_CONF_MAX_NEIGHBORS 10 #define UIP_CONF_DS6_DEFRT_NBU 2 #define UIP_CONF_DS6_PREFIX_NBU 2 #define UIP_CONF_MAX_ROUTES 4 @@ -314,7 +314,7 @@ typedef unsigned short uip_stats_t; #define UIP_CONF_MAX_CONNECTIONS 2 #define UIP_CONF_MAX_LISTENPORTS 4 #define UIP_CONF_UDP_CONNS 5 -#define UIP_CONF_DS6_NBR_NBU 4 +#define NEIGHBOR_CONF_MAX_NEIGHBORS 4 #define UIP_CONF_DS6_DEFRT_NBU 2 #define UIP_CONF_DS6_PREFIX_NBU 3 #define UIP_CONF_MAX_ROUTES 4 diff --git a/platform/avr-ravenusb/contiki-conf.h b/platform/avr-ravenusb/contiki-conf.h index a6382eb27..26a1aebf4 100644 --- a/platform/avr-ravenusb/contiki-conf.h +++ b/platform/avr-ravenusb/contiki-conf.h @@ -232,7 +232,7 @@ extern void mac_log_802_15_4_rx(const uint8_t* buffer, size_t total_len); #endif /* UIP_CONF_IPV6 */ /* See uip-ds6.h */ -#define UIP_CONF_DS6_NBR_NBU 2 +#define NEIGHBOR_CONF_MAX_NEIGHBORS 2 #define UIP_CONF_DS6_DEFRT_NBU 2 #define UIP_CONF_DS6_PREFIX_NBU 3 #define UIP_CONF_MAX_ROUTES 2 @@ -360,8 +360,8 @@ typedef unsigned short uip_stats_t; #define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8 #undef QUEUEBUF_CONF_NUM #define QUEUEBUF_CONF_NUM 8 -#undef UIP_CONF_DS6_NBR_NBU -#define UIP_CONF_DS6_NBR_NBU 5 +#undef NEIGHBOR_CONF_MAX_NEIGHBORS +#define NEIGHBOR_CONF_MAX_NEIGHBORS 5 #undef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 5 @@ -409,7 +409,7 @@ typedef unsigned short uip_stats_t; #endif #define RPL_CONF_STATS 0 #define UIP_CONF_BUFFER_SIZE 1300 -//#define UIP_CONF_DS6_NBR_NBU 12 +//#define NEIGHBOR_CONF_MAX_NEIGHBORS 12 //#define UIP_CONF_MAX_ROUTES 12 #ifdef RPL_BORDER_ROUTER @@ -446,8 +446,8 @@ typedef unsigned short uip_stats_t; #define UIP_CONF_TCP 1 #define UIP_CONF_TCP_MSS 48 #define UIP_CONF_RECEIVE_WINDOW 48 -#undef UIP_CONF_DS6_NBR_NBU -#define UIP_CONF_DS6_NBR_NBU 5 +#undef NEIGHBOR_CONF_MAX_NEIGHBORS +#define NEIGHBOR_CONF_MAX_NEIGHBORS 5 #undef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 5 #undef UIP_CONF_MAX_CONNECTIONS diff --git a/platform/avr-rcb/contiki-conf.h b/platform/avr-rcb/contiki-conf.h index b2cc0053e..e8170bdd9 100644 --- a/platform/avr-rcb/contiki-conf.h +++ b/platform/avr-rcb/contiki-conf.h @@ -123,7 +123,6 @@ void clock_adjust_ticks(clock_time_t howmany); #define UIP_CONF_IPV6_REASSEMBLY 0 #define UIP_CONF_NETIF_MAX_ADDRESSES 3 #define UIP_CONF_ND6_MAX_PREFIXES 3 -#define UIP_CONF_ND6_MAX_NEIGHBORS 4 #define UIP_CONF_ND6_MAX_DEFROUTERS 2 #if UIP_CONF_IPV6 //tcpip.c error on ipv4 build if UIP_CONF_ICMP6 defined #define UIP_CONF_ICMP6 1 diff --git a/platform/avr-zigbit/contiki-conf.h b/platform/avr-zigbit/contiki-conf.h index 32d3e1d5b..c0e8ca305 100644 --- a/platform/avr-zigbit/contiki-conf.h +++ b/platform/avr-zigbit/contiki-conf.h @@ -163,7 +163,6 @@ void clock_adjust_ticks(clock_time_t howmany); #define UIP_CONF_IPV6_REASSEMBLY 0 #define UIP_CONF_NETIF_MAX_ADDRESSES 3 #define UIP_CONF_ND6_MAX_PREFIXES 3 -#define UIP_CONF_ND6_MAX_NEIGHBORS 4 #define UIP_CONF_ND6_MAX_DEFROUTERS 2 #define UIP_CONF_UDP_CHECKSUMS 1 #define UIP_CONF_TCP_SPLIT 1 diff --git a/platform/cc2530dk/contiki-conf.h b/platform/cc2530dk/contiki-conf.h index 4c9804dd1..51a0faa9f 100644 --- a/platform/cc2530dk/contiki-conf.h +++ b/platform/cc2530dk/contiki-conf.h @@ -232,8 +232,8 @@ #define UIP_CONF_ND6_REACHABLE_TIME 600000 #define UIP_CONF_ND6_RETRANS_TIMER 10000 -#ifndef UIP_CONF_DS6_NBR_NBU -#define UIP_CONF_DS6_NBR_NBU 4 /* Handle n Neighbors */ +#ifndef NEIGHBOR_CONF_MAX_NEIGHBORS +#define NEIGHBOR_CONF_MAX_NEIGHBORS 4 /* Handle n Neighbors */ #endif #ifndef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 4 /* Handle n Routes */ diff --git a/platform/cc2538dk/contiki-conf.h b/platform/cc2538dk/contiki-conf.h index 0251553e9..779f32904 100644 --- a/platform/cc2538dk/contiki-conf.h +++ b/platform/cc2538dk/contiki-conf.h @@ -341,8 +341,8 @@ typedef uint32_t rtimer_clock_t; #define UIP_CONF_ND6_REACHABLE_TIME 600000 #define UIP_CONF_ND6_RETRANS_TIMER 10000 -#ifndef UIP_CONF_DS6_NBR_NBU -#define UIP_CONF_DS6_NBR_NBU 20 +#ifndef NEIGHBOR_CONF_MAX_NEIGHBORS +#define NEIGHBOR_CONF_MAX_NEIGHBORS 20 #endif #ifndef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 20 diff --git a/platform/cooja/contiki-conf.h b/platform/cooja/contiki-conf.h index e43a13ce7..07141aa13 100644 --- a/platform/cooja/contiki-conf.h +++ b/platform/cooja/contiki-conf.h @@ -129,9 +129,9 @@ #endif /* UIP_CONF_IPV6_RPL */ /* configure number of neighbors and routes */ -#ifndef UIP_CONF_DS6_NBR_NBU -#define UIP_CONF_DS6_NBR_NBU 300 -#endif /* UIP_CONF_DS6_NBR_NBU */ +#ifndef NEIGHBOR_CONF_MAX_NEIGHBORS +#define NEIGHBOR_CONF_MAX_NEIGHBORS 300 +#endif /* NEIGHBOR_CONF_MAX_NEIGHBORS */ #ifndef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 300 #endif /* UIP_CONF_MAX_ROUTES */ @@ -145,7 +145,6 @@ #define RIMEADDR_CONF_SIZE 8 #define UIP_CONF_NETIF_MAX_ADDRESSES 3 #define UIP_CONF_ND6_MAX_PREFIXES 3 -#define UIP_CONF_ND6_MAX_NEIGHBORS 4 #define UIP_CONF_ND6_MAX_DEFROUTERS 2 #ifndef UIP_CONF_IPV6_QUEUE_PKT @@ -155,7 +154,6 @@ #define UIP_CONF_IPV6_REASSEMBLY 0 #define UIP_CONF_NETIF_MAX_ADDRESSES 3 #define UIP_CONF_ND6_MAX_PREFIXES 3 -#define UIP_CONF_ND6_MAX_NEIGHBORS 4 #define UIP_CONF_ND6_MAX_DEFROUTERS 2 #define UIP_CONF_IP_FORWARD 0 #ifndef UIP_CONF_BUFFER_SIZE diff --git a/platform/econotag/contiki-conf.h b/platform/econotag/contiki-conf.h index 9264af915..a9d5d00d5 100644 --- a/platform/econotag/contiki-conf.h +++ b/platform/econotag/contiki-conf.h @@ -184,7 +184,7 @@ #define UIP_CONF_IPV6_RPL 1 #endif -#define UIP_CONF_DS6_NBR_NBU 30 +#define NEIGHBOR_CONF_MAX_NEIGHBORS 30 #define UIP_CONF_MAX_ROUTES 30 #define UIP_CONF_ND6_SEND_RA 0 @@ -197,7 +197,6 @@ #define UIP_CONF_IPV6_REASSEMBLY 0 #define UIP_CONF_NETIF_MAX_ADDRESSES 3 #define UIP_CONF_ND6_MAX_PREFIXES 3 -#define UIP_CONF_ND6_MAX_NEIGHBORS 4 #define UIP_CONF_ND6_MAX_DEFROUTERS 2 #define UIP_CONF_IP_FORWARD 0 #define UIP_CONF_BUFFER_SIZE 1300 diff --git a/platform/exp5438/contiki-conf.h b/platform/exp5438/contiki-conf.h index e968df31d..af0e60624 100644 --- a/platform/exp5438/contiki-conf.h +++ b/platform/exp5438/contiki-conf.h @@ -137,9 +137,9 @@ #endif /* UIP_CONF_IPV6_RPL */ /* configure number of neighbors and routes */ -#ifndef UIP_CONF_DS6_NBR_NBU -#define UIP_CONF_DS6_NBR_NBU 30 -#endif /* UIP_CONF_DS6_NBR_NBU */ +#ifndef NEIGHBOR_CONF_MAX_NEIGHBORS +#define NEIGHBOR_CONF_MAX_NEIGHBORS 30 +#endif /* NEIGHBOR_CONF_MAX_NEIGHBORS */ #ifndef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 30 #endif /* UIP_CONF_MAX_ROUTES */ @@ -156,7 +156,6 @@ #define UIP_CONF_IPV6_REASSEMBLY 0 #define UIP_CONF_NETIF_MAX_ADDRESSES 3 #define UIP_CONF_ND6_MAX_PREFIXES 3 -#define UIP_CONF_ND6_MAX_NEIGHBORS 4 #define UIP_CONF_ND6_MAX_DEFROUTERS 2 #define UIP_CONF_IP_FORWARD 0 #ifndef UIP_CONF_BUFFER_SIZE diff --git a/platform/iris/contiki-conf.h b/platform/iris/contiki-conf.h index 2651b6ea9..267173de1 100644 --- a/platform/iris/contiki-conf.h +++ b/platform/iris/contiki-conf.h @@ -113,7 +113,7 @@ #define UIP_CONF_IPV6_RPL 1 /* configure number of neighbors and routes */ -#define UIP_CONF_DS6_NBR_NBU 5 +#define NEIGHBOR_CONF_MAX_NEIGHBORS 5 #define UIP_CONF_MAX_ROUTES 5 #define RPL_CONF_MAX_PARENTS 4 @@ -129,7 +129,6 @@ #define UIP_CONF_IPV6_REASSEMBLY 0 #define UIP_CONF_NETIF_MAX_ADDRESSES 3 #define UIP_CONF_ND6_MAX_PREFIXES 3 -#define UIP_CONF_ND6_MAX_NEIGHBORS 4 #define UIP_CONF_ND6_MAX_DEFROUTERS 2 #define UIP_CONF_IP_FORWARD 0 #define UIP_CONF_BUFFER_SIZE 240 diff --git a/platform/mbxxx/contiki-conf.h b/platform/mbxxx/contiki-conf.h index 7331f32a7..3a2513c19 100644 --- a/platform/mbxxx/contiki-conf.h +++ b/platform/mbxxx/contiki-conf.h @@ -108,7 +108,7 @@ #define ENERGEST_CONF_ON 0 #define QUEUEBUF_CONF_NUM 2 #define QUEUEBUF_CONF_REF_NUM 0 -#define UIP_CONF_DS6_NBR_NBU 4 +#define NEIGHBOR_CONF_MAX_NEIGHBORS 4 #define UIP_CONF_DS6_ROUTE_NBU 4 #define RPL_CONF_MAX_PARENTS_PER_DAG 4 #define RPL_CONF_MAX_INSTANCES 1 @@ -144,7 +144,6 @@ #define UIP_CONF_IPV6_CHECKS 1 #define UIP_CONF_IPV6_REASSEMBLY 0 #define UIP_CONF_ND6_MAX_PREFIXES 2 -#define UIP_CONF_ND6_MAX_NEIGHBORS 2 #define UIP_CONF_ND6_MAX_DEFROUTERS 1 #define UIP_CONF_IP_FORWARD 0 #define UIP_CONF_BUFFER_SIZE 140 diff --git a/platform/micaz/contiki-conf.h b/platform/micaz/contiki-conf.h index 437674498..19294e518 100644 --- a/platform/micaz/contiki-conf.h +++ b/platform/micaz/contiki-conf.h @@ -118,7 +118,7 @@ #define UIP_CONF_IPV6_RPL 1 /* configure number of neighbors and routes */ -#define UIP_CONF_DS6_NBR_NBU 5 +#define NEIGHBOR_CONF_MAX_NEIGHBORS 5 #define UIP_CONF_MAX_ROUTES 5 #define RPL_CONF_MAX_PARENTS 4 @@ -134,7 +134,6 @@ #define UIP_CONF_IPV6_REASSEMBLY 0 #define UIP_CONF_NETIF_MAX_ADDRESSES 3 #define UIP_CONF_ND6_MAX_PREFIXES 3 -#define UIP_CONF_ND6_MAX_NEIGHBORS 4 #define UIP_CONF_ND6_MAX_DEFROUTERS 2 #define UIP_CONF_IP_FORWARD 0 #define UIP_CONF_BUFFER_SIZE 240 diff --git a/platform/minimal-net/contiki-conf.h b/platform/minimal-net/contiki-conf.h index 9f132ead8..fb78993bd 100644 --- a/platform/minimal-net/contiki-conf.h +++ b/platform/minimal-net/contiki-conf.h @@ -160,9 +160,8 @@ typedef unsigned short uip_stats_t; #define UIP_CONF_IPV6_REASSEMBLY 1 //#define UIP_CONF_NETIF_MAX_ADDRESSES 5 //#define UIP_CONF_ND6_MAX_PREFIXES 3 -//#define UIP_CONF_ND6_MAX_NEIGHBORS 40 //#define UIP_CONF_ND6_MAX_DEFROUTERS 2 -#define UIP_CONF_DS6_NBR_NBU 100 +#define NEIGHBOR_CONF_MAX_NEIGHBORS 100 #define UIP_CONF_DS6_DEFRT_NBU 2 #define UIP_CONF_DS6_PREFIX_NBU 5 #define UIP_CONF_MAX_ROUTES 100 diff --git a/platform/native/contiki-conf.h b/platform/native/contiki-conf.h index 952c90658..763fffe6b 100644 --- a/platform/native/contiki-conf.h +++ b/platform/native/contiki-conf.h @@ -125,14 +125,13 @@ typedef unsigned short uip_stats_t; #define UIP_CONF_IPV6_REASSEMBLY 0 #define UIP_CONF_NETIF_MAX_ADDRESSES 3 #define UIP_CONF_ND6_MAX_PREFIXES 3 -#define UIP_CONF_ND6_MAX_NEIGHBORS 4 #define UIP_CONF_ND6_MAX_DEFROUTERS 2 #define UIP_CONF_ICMP6 1 /* configure number of neighbors and routes */ -#ifndef UIP_CONF_DS6_NBR_NBU -#define UIP_CONF_DS6_NBR_NBU 30 -#endif /* UIP_CONF_DS6_NBR_NBU */ +#ifndef NEIGHBOR_CONF_MAX_NEIGHBORS +#define NEIGHBOR_CONF_MAX_NEIGHBORS 30 +#endif /* NEIGHBOR_CONF_MAX_NEIGHBORS */ #ifndef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 30 #endif /* UIP_CONF_MAX_ROUTES */ diff --git a/platform/redbee-dev/contiki-conf.h b/platform/redbee-dev/contiki-conf.h index 8110ec5e2..a25669a30 100644 --- a/platform/redbee-dev/contiki-conf.h +++ b/platform/redbee-dev/contiki-conf.h @@ -178,7 +178,7 @@ typedef unsigned long rtimer_clock_t; #define UIP_CONF_ROUTER 1 #define UIP_CONF_IPV6_RPL 1 -#define UIP_CONF_DS6_NBR_NBU 30 +#define NEIGHBOR_CONF_MAX_NEIGHBORS 30 #define UIP_CONF_MAX_ROUTES 30 #define UIP_CONF_ND6_SEND_RA 0 @@ -191,7 +191,6 @@ typedef unsigned long rtimer_clock_t; #define UIP_CONF_IPV6_REASSEMBLY 0 #define UIP_CONF_NETIF_MAX_ADDRESSES 3 #define UIP_CONF_ND6_MAX_PREFIXES 3 -#define UIP_CONF_ND6_MAX_NEIGHBORS 4 #define UIP_CONF_ND6_MAX_DEFROUTERS 2 #define UIP_CONF_IP_FORWARD 0 #define UIP_CONF_BUFFER_SIZE 1300 diff --git a/platform/redbee-econotag/contiki-conf.h b/platform/redbee-econotag/contiki-conf.h index b7c125c51..08eab1282 100644 --- a/platform/redbee-econotag/contiki-conf.h +++ b/platform/redbee-econotag/contiki-conf.h @@ -196,7 +196,7 @@ typedef unsigned long rtimer_clock_t; #define UIP_CONF_ROUTER 1 #define UIP_CONF_IPV6_RPL 1 -#define UIP_CONF_DS6_NBR_NBU 30 +#define NEIGHBOR_CONF_MAX_NEIGHBORS 30 #define UIP_CONF_MAX_ROUTES 30 #define UIP_CONF_ND6_SEND_RA 0 @@ -209,7 +209,6 @@ typedef unsigned long rtimer_clock_t; #define UIP_CONF_IPV6_REASSEMBLY 0 #define UIP_CONF_NETIF_MAX_ADDRESSES 3 #define UIP_CONF_ND6_MAX_PREFIXES 3 -#define UIP_CONF_ND6_MAX_NEIGHBORS 4 #define UIP_CONF_ND6_MAX_DEFROUTERS 2 #define UIP_CONF_IP_FORWARD 0 #define UIP_CONF_BUFFER_SIZE 1300 diff --git a/platform/seedeye/contiki-conf.h b/platform/seedeye/contiki-conf.h index 80ca80947..2bb2db3d7 100644 --- a/platform/seedeye/contiki-conf.h +++ b/platform/seedeye/contiki-conf.h @@ -97,7 +97,7 @@ typedef uint32_t rtimer_clock_t; /* IPv6 configuration options */ #define UIP_CONF_IPV6 1 -#define UIP_CONF_DS6_NBR_NBU 20 /* number of neighbors */ +#define NEIGHBOR_CONF_MAX_NEIGHBORS 20 /* number of neighbors */ #define UIP_CONF_DS6_ROUTE_NBU 20 /* number of routes */ #define UIP_CONF_ND6_SEND_RA 0 #define UIP_CONF_ND6_REACHABLE_TIME 600000 diff --git a/platform/sensinode/contiki-conf.h b/platform/sensinode/contiki-conf.h index f327b3ee2..d176284a7 100644 --- a/platform/sensinode/contiki-conf.h +++ b/platform/sensinode/contiki-conf.h @@ -230,8 +230,8 @@ #define UIP_CONF_ND6_REACHABLE_TIME 600000 #define UIP_CONF_ND6_RETRANS_TIMER 10000 -#ifndef UIP_CONF_DS6_NBR_NBU -#define UIP_CONF_DS6_NBR_NBU 4 /* Handle n Neighbors */ +#ifndef NEIGHBOR_CONF_MAX_NEIGHBORS +#define NEIGHBOR_CONF_MAX_NEIGHBORS 4 /* Handle n Neighbors */ #endif #ifndef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 4 /* Handle n Routes */ diff --git a/platform/sky/contiki-conf.h b/platform/sky/contiki-conf.h index 753cc0063..9c3bd202e 100644 --- a/platform/sky/contiki-conf.h +++ b/platform/sky/contiki-conf.h @@ -137,9 +137,9 @@ #endif /* UIP_CONF_IPV6_RPL */ /* configure number of neighbors and routes */ -#ifndef UIP_CONF_DS6_NBR_NBU -#define UIP_CONF_DS6_NBR_NBU 20 -#endif /* UIP_CONF_DS6_NBR_NBU */ +#ifndef NEIGHBOR_CONF_MAX_NEIGHBORS +#define NEIGHBOR_CONF_MAX_NEIGHBORS 20 +#endif /* NEIGHBOR_CONF_MAX_NEIGHBORS */ #ifndef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 20 #endif /* UIP_CONF_MAX_ROUTES */ @@ -156,7 +156,6 @@ #define UIP_CONF_IPV6_REASSEMBLY 0 #define UIP_CONF_NETIF_MAX_ADDRESSES 3 #define UIP_CONF_ND6_MAX_PREFIXES 3 -#define UIP_CONF_ND6_MAX_NEIGHBORS 4 #define UIP_CONF_ND6_MAX_DEFROUTERS 2 #define UIP_CONF_IP_FORWARD 0 #ifndef UIP_CONF_BUFFER_SIZE diff --git a/platform/stk500/contiki-conf.h b/platform/stk500/contiki-conf.h index aac315295..46491d44e 100644 --- a/platform/stk500/contiki-conf.h +++ b/platform/stk500/contiki-conf.h @@ -45,7 +45,7 @@ void clock_adjust_ticks(clock_time_t howmany); //#define UIP_CONF_IPV6_RPL 0 /* See uip-ds6.h */ -#define UIP_CONF_DS6_NBR_NBU 20 +#define NEIGHBOR_CONF_MAX_NEIGHBORS 20 #define UIP_CONF_DS6_DEFRT_NBU 2 #define UIP_CONF_DS6_PREFIX_NBU 3 #define UIP_CONF_MAX_ROUTES 20 diff --git a/platform/win32/contiki-conf.h b/platform/win32/contiki-conf.h index 638e9a637..66af5f47c 100644 --- a/platform/win32/contiki-conf.h +++ b/platform/win32/contiki-conf.h @@ -63,7 +63,7 @@ typedef unsigned short uip_stats_t; #define UIP_CONF_TCP_SPLIT 1 #if UIP_CONF_IPV6 #define UIP_CONF_IP_FORWARD 0 -#define UIP_CONF_DS6_NBR_NBU 100 +#define NEIGHBOR_CONF_MAX_NEIGHBORS 100 #define UIP_CONF_DS6_DEFRT_NBU 2 #define UIP_CONF_DS6_PREFIX_NBU 5 #define UIP_CONF_MAX_ROUTES 100 diff --git a/platform/wismote/contiki-conf.h b/platform/wismote/contiki-conf.h index 95568d27a..9678b9d24 100644 --- a/platform/wismote/contiki-conf.h +++ b/platform/wismote/contiki-conf.h @@ -133,9 +133,9 @@ #endif /* UIP_CONF_IPV6_RPL */ /* configure number of neighbors and routes */ -#ifndef UIP_CONF_DS6_NBR_NBU -#define UIP_CONF_DS6_NBR_NBU 30 -#endif /* UIP_CONF_DS6_NBR_NBU */ +#ifndef NEIGHBOR_CONF_MAX_NEIGHBORS +#define NEIGHBOR_CONF_MAX_NEIGHBORS 30 +#endif /* NEIGHBOR_CONF_MAX_NEIGHBORS */ #ifndef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 30 #endif /* UIP_CONF_MAX_ROUTES */ @@ -152,7 +152,6 @@ #define UIP_CONF_IPV6_REASSEMBLY 0 #define UIP_CONF_NETIF_MAX_ADDRESSES 3 #define UIP_CONF_ND6_MAX_PREFIXES 3 -#define UIP_CONF_ND6_MAX_NEIGHBORS 4 #define UIP_CONF_ND6_MAX_DEFROUTERS 2 #define UIP_CONF_IP_FORWARD 0 #ifndef UIP_CONF_BUFFER_SIZE diff --git a/platform/z1/contiki-conf.h b/platform/z1/contiki-conf.h index 383bd12c6..44a7f1f71 100644 --- a/platform/z1/contiki-conf.h +++ b/platform/z1/contiki-conf.h @@ -134,7 +134,7 @@ #define UIP_CONF_IPV6_RPL 1 /* Handle 10 neighbors */ -#define UIP_CONF_DS6_NBR_NBU 15 +#define NEIGHBOR_CONF_MAX_NEIGHBORS 15 /* Handle 10 routes */ #define UIP_CONF_MAX_ROUTES 15 @@ -148,7 +148,6 @@ #define UIP_CONF_IPV6_REASSEMBLY 0 #define UIP_CONF_NETIF_MAX_ADDRESSES 3 #define UIP_CONF_ND6_MAX_PREFIXES 3 -#define UIP_CONF_ND6_MAX_NEIGHBORS 4 #define UIP_CONF_ND6_MAX_DEFROUTERS 2 #define UIP_CONF_IP_FORWARD 0 #define UIP_CONF_BUFFER_SIZE 140 diff --git a/platform/z1sp/contiki-conf.h b/platform/z1sp/contiki-conf.h index 93d56474c..ca818c212 100644 --- a/platform/z1sp/contiki-conf.h +++ b/platform/z1sp/contiki-conf.h @@ -133,7 +133,7 @@ #define UIP_CONF_IPV6_RPL 1 /* Handle 10 neighbors */ -#define UIP_CONF_DS6_NBR_NBU 15 +#define NEIGHBOR_CONF_MAX_NEIGHBORS 15 /* Handle 10 routes */ #define UIP_CONF_MAX_ROUTES 15 @@ -147,7 +147,6 @@ #define UIP_CONF_IPV6_REASSEMBLY 0 #define UIP_CONF_NETIF_MAX_ADDRESSES 3 #define UIP_CONF_ND6_MAX_PREFIXES 3 -#define UIP_CONF_ND6_MAX_NEIGHBORS 4 #define UIP_CONF_ND6_MAX_DEFROUTERS 2 #define UIP_CONF_IP_FORWARD 0 #define UIP_CONF_BUFFER_SIZE 140 From 5dc05e79130e3eba95cd7c31ec52ba2cccdc81f8 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Wed, 3 Jul 2013 20:26:54 +0200 Subject: [PATCH 08/29] Port apps, examples, platforms and tools so they use the new neighbor and route API. --- apps/rest-common/static-routing.h | 2 +- apps/webserver-nano/httpd-cgi.c | 44 ++++++------ apps/webserver/httpd-cgi.c | 23 +++---- .../ipv6/native-border-router/border-router.c | 27 ++++---- .../ipv6/rpl-border-router/border-router.c | 24 +++---- examples/ipv6/rpl-collect/udp-sender.c | 12 ++-- examples/ravenusbstick/fakeuip.c | 6 ++ .../apps/raven-webserver/httpd-cgi.c | 33 ++++----- platform/avr-atmega128rfa1/contiki-main.c | 30 ++++----- .../apps/raven-webserver/httpd-cgi.c | 24 +++---- platform/avr-raven/contiki-raven-main.c | 31 ++++----- platform/avr-ravenusb/cdc_task.c | 24 ++++--- platform/avr-ravenusb/contiki-raven-main.c | 38 ++++++----- platform/avr-ravenusb/httpd-simple-avr.c | 21 +++--- platform/cc2530dk/viztool.c | 67 +++++++++---------- platform/cooja/net/radio-uip-uaodv.c | 2 +- .../redbee-econotag/contiki-mc1322x-main.c | 25 +++---- platform/sensinode/viztool.c | 67 +++++++++---------- tools/sky/uip6-bridge/fakeuip.c | 7 ++ tools/stm32w/uip6_bridge/fakeuip.c | 6 ++ tools/stm32w/wpcapslip6/fakeuip.c | 6 ++ 21 files changed, 262 insertions(+), 257 deletions(-) diff --git a/apps/rest-common/static-routing.h b/apps/rest-common/static-routing.h index fc255ba4f..c4b757893 100644 --- a/apps/rest-common/static-routing.h +++ b/apps/rest-common/static-routing.h @@ -51,7 +51,7 @@ do{\ uip_ipaddr_t ipaddr_local, ipaddr_global;\ NODE_IP(node_global, GLOBAL, &ipaddr_global);\ NODE_IP(node_local, LOCAL, &ipaddr_local);\ - uip_ds6_route_add(&ipaddr_global, 128, &ipaddr_local, 0);\ + uip_ds6_route_add(&ipaddr_global, 128, &ipaddr_local);\ }while(0) void set_global_address(void); diff --git a/apps/webserver-nano/httpd-cgi.c b/apps/webserver-nano/httpd-cgi.c index cf85697ec..55cdafd8b 100644 --- a/apps/webserver-nano/httpd-cgi.c +++ b/apps/webserver-nano/httpd-cgi.c @@ -50,6 +50,7 @@ #include "httpd-fs.h" #include "httpd-fsdata.h" #include "lib/petsciiconv.h" +#include "net/neighbor-table.h" #include "sensors.h" @@ -479,7 +480,6 @@ PT_THREAD(addresses(struct httpd_state *s, char *ptr)) #endif /* WEBSERVER_CONF_ADDRESSES */ #if WEBSERVER_CONF_NEIGHBORS -extern uip_ds6_nbr_t uip_ds6_nbr_cache[]; /*---------------------------------------------------------------------------*/ static unsigned short make_neighbors(void *p) @@ -487,11 +487,13 @@ make_neighbors(void *p) uint8_t i,j; uint16_t numprinted=0; struct httpd_state *s=p; +static uip_ds6_nbr_t *nbr; /* Span generator calls over tcp segments */ /* Note retransmissions will execute thise code multiple times for a segment */ i=s->starti;j=s->startj; - for (;iipaddr, uip_appdata + numprinted); while (numprinted < k) {*((char *)uip_appdata+numprinted++) = ' ';} - switch (uip_ds6_nbr_cache[i].state) { + switch (nbr->state) { case NBR_INCOMPLETE: numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_nbrs1);break; case NBR_REACHABLE: numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_nbrs2);break; - case NBR_STALE: numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_nbrs3);break; + case NBR_STALE: numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_nbrs3);break; case NBR_DELAY: numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_nbrs4);break; case NBR_PROBE: numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_nbrs5);break; } } #else - numprinted += httpd_cgi_sprint_ip6(uip_ds6_nbr_cache[i].ipaddr, uip_appdata + numprinted); + numprinted += httpd_cgi_sprint_ip6(nbr->ipaddr, uip_appdata + numprinted); #endif *((char *)uip_appdata+numprinted++) = '\n'; /* If buffer near full, send it and wait for the next call. Could be a retransmission, or the next segment */ if(numprinted > (uip_mss() - 50)) { - s->savei=i;s->savej=j; + s->savei=i;s->savej=j; return numprinted; } - } } #if WEBSERVER_CONF_SHOW_ROOM - numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf,UIP_DS6_NBR_NB-j); + numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf,NEIGHBOR_TABLE_MAX_NEIGHBORS-j); #else - if(UIP_DS6_NBR_NB == j) { + if(NEIGHBOR_TABLE_MAX_NEIGHBORS == j) { numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf); } #endif @@ -554,7 +555,6 @@ PT_THREAD(neighbors(struct httpd_state *s, char *ptr)) #endif #if WEBSERVER_CONF_ROUTES -extern uip_ds6_route_t uip_ds6_routing_table[]; #if WEBSERVER_CONF_ROUTE_LINKS static const char httpd_cgi_rtesl1[] HTTPD_STRING_ATTR = "starti;j=s->startj; - for (;iipaddr, uip_appdata + numprinted); numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtesl2); - numprinted += httpd_cgi_sprint_ip6(uip_ds6_routing_table[i].ipaddr, uip_appdata + numprinted); + numprinted += httpd_cgi_sprint_ip6(r->ipaddr, uip_appdata + numprinted); numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtesl3); #else - numprinted += httpd_cgi_sprint_ip6(uip_ds6_routing_table[i].ipaddr, uip_appdata + numprinted); + numprinted += httpd_cgi_sprint_ip6(r->ipaddr, uip_appdata + numprinted); #endif - numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes1, uip_ds6_routing_table[i].length); - numprinted += httpd_cgi_sprint_ip6(uip_ds6_routing_table[i].nexthop, uip_appdata + numprinted); - if(1 || uip_ds6_routing_table[i].state.lifetime < 3600) { - numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes2, (long unsigned int)uip_ds6_routing_table[i].state.lifetime); + numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes1, r->length); + numprinted += httpd_cgi_sprint_ip6(uip_ds6_route_nexthop(r), uip_appdata + numprinted); + if(1 || r->state.lifetime < 3600) { + numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes2, (long unsigned int)r->state.lifetime); } else { numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes3); } diff --git a/apps/webserver/httpd-cgi.c b/apps/webserver/httpd-cgi.c index 85ce3a521..c11a8770a 100644 --- a/apps/webserver/httpd-cgi.c +++ b/apps/webserver/httpd-cgi.c @@ -244,8 +244,6 @@ static const char httpd_cgi_addrh[] HTTPD_STRING_ATTR = ""; static const char httpd_cgi_addrf[] HTTPD_STRING_ATTR = "[Room for %u more]"; static const char httpd_cgi_addrb[] HTTPD_STRING_ATTR = "
"; static const char httpd_cgi_addrn[] HTTPD_STRING_ATTR = "(none)
"; -extern uip_ds6_nbr_t uip_ds6_nbr_cache[]; -extern uip_ds6_route_t uip_ds6_routing_table[]; extern uip_ds6_netif_t uip_ds6_if; static unsigned short @@ -282,15 +280,16 @@ make_neighbors(void *p) uint8_t i,j=0; uint16_t numprinted; numprinted = httpd_snprintf((char *)uip_appdata, uip_mss(),httpd_cgi_addrh); - for (i=0; iipaddr, uip_appdata + numprinted); + numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrb); } //if (j==0) numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrn); - numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf,UIP_DS6_NBR_NB-j); + numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf,NEIGHBOR_TABLE_MAX_NEIGHBORS-j); return numprinted; } /*---------------------------------------------------------------------------*/ @@ -315,13 +314,13 @@ make_routes(void *p) uip_ds6_route_t *r; numprinted = httpd_snprintf((char *)uip_appdata, uip_mss(),httpd_cgi_addrh); - for(r = uip_ds6_route_list_head(); + for(r = uip_ds6_route_head(); r != NULL; - r = list_item_next(r)) { + r = uip_ds6_route_next(r)) { j++; numprinted += httpd_cgi_sprint_ip6(r->ipaddr, uip_appdata + numprinted); numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes1, r->length); - numprinted += httpd_cgi_sprint_ip6(r->nexthop, uip_appdata + numprinted); + numprinted += httpd_cgi_sprint_ip6(uip_ds6_route_nexthop(r), uip_appdata + numprinted); if(r->state.lifetime < 3600) { numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes2, r->state.lifetime); } else { diff --git a/examples/ipv6/native-border-router/border-router.c b/examples/ipv6/native-border-router/border-router.c index b8d01f2bb..6fb2f9168 100644 --- a/examples/ipv6/native-border-router/border-router.c +++ b/examples/ipv6/native-border-router/border-router.c @@ -63,9 +63,6 @@ uint16_t dag_id[] = {0x1111, 0x1100, 0, 0, 0, 0, 0, 0x0011}; -extern uip_ds6_nbr_t uip_ds6_nbr_cache[]; -extern uip_ds6_route_t uip_ds6_routing_table[]; - extern long slip_sent; extern long slip_received; @@ -150,32 +147,34 @@ PT_THREAD(generate_routes(struct httpd_state *s)) { static int i; static uip_ds6_route_t *r; + static uip_ds6_nbr_t *nbr; + PSOCK_BEGIN(&s->sout); SEND_STRING(&s->sout, TOP); blen = 0; ADD("Neighbors
");
-  for(i = 0; i < UIP_DS6_NBR_NB; i++) {
-    if(uip_ds6_nbr_cache[i].isused) {
-      ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr);
-      ADD("\n");
-      if(blen > sizeof(buf) - 45) {
-        SEND_STRING(&s->sout, buf);
-        blen = 0;
-      }
+  for(nbr = nbr_table_head(ds6_neighbors);
+      nbr != NULL;
+      nbr = nbr_table_next(ds6_neighbors, nbr)) {
+    ipaddr_add(&nbr->ipaddr;);
+    ADD("\n");
+    if(blen > sizeof(buf) - 45) {
+      SEND_STRING(&s->sout, buf);
+      blen = 0;
     }
   }
 
   ADD("
Routes
");
   SEND_STRING(&s->sout, buf);
   blen = 0;
-  for(r = uip_ds6_route_list_head();
+  for(r = uip_ds6_route_head();
       r != NULL;
-      r = list_item_next(r)) {
+      r = uip_ds6_route_next(r)) {
     ipaddr_add(&r->ipaddr);
     ADD("/%u (via ", r->length);
-    ipaddr_add(&r->nexthop);
+    ipaddr_add(uip_ds6_route_nexthop(r));
     if(r->state.lifetime < 600) {
       ADD(") %lus\n", (unsigned long)r->state.lifetime);
     } else {
diff --git a/examples/ipv6/rpl-border-router/border-router.c b/examples/ipv6/rpl-border-router/border-router.c
index 9a40f84a1..4128cac38 100644
--- a/examples/ipv6/rpl-border-router/border-router.c
+++ b/examples/ipv6/rpl-border-router/border-router.c
@@ -56,8 +56,6 @@
 
 uint16_t dag_id[] = {0x1111, 0x1100, 0, 0, 0, 0, 0, 0x0011};
 
-extern uip_ds6_nbr_t uip_ds6_nbr_cache[];
-
 static uip_ipaddr_t prefix;
 static uint8_t prefix_set;
 
@@ -149,6 +147,7 @@ PT_THREAD(generate_routes(struct httpd_state *s))
 {
   static int i;
   static uip_ds6_route_t *r;
+  static uip_ds6_nbr_t *nbr;
 #if BUF_USES_STACK
   char buf[256];
 #endif
@@ -166,15 +165,17 @@ PT_THREAD(generate_routes(struct httpd_state *s))
   blen = 0;
 #endif
   ADD("Neighbors
");
-  for(i = 0; i < UIP_DS6_NBR_NB; i++) {
-    if(uip_ds6_nbr_cache[i].isused) {
+
+  for(nbr = nbr_table_head(ds6_neighbors);
+      nbr != NULL;
+      nbr = nbr_table_next(ds6_neighbors, nbr)) {
 
 #if WEBSERVER_CONF_NEIGHBOR_STATUS
 #if BUF_USES_STACK
 {char* j=bufptr+25;
-      ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr);
+      ipaddr_add(&nbr->ipaddr);
       while (bufptr < j) ADD(" ");
-      switch (uip_ds6_nbr_cache[i].state) {
+      switch (nbr->state) {
       case NBR_INCOMPLETE: ADD(" INCOMPLETE");break;
       case NBR_REACHABLE: ADD(" REACHABLE");break;
       case NBR_STALE: ADD(" STALE");break;      
@@ -184,9 +185,9 @@ PT_THREAD(generate_routes(struct httpd_state *s))
 }
 #else
 {uint8_t j=blen+25;
-      ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr);
+      ipaddr_add(&nbr->ipaddr);
       while (blen < j) ADD(" ");
-      switch (uip_ds6_nbr_cache[i].state) {
+      switch (nbr->state) {
       case NBR_INCOMPLETE: ADD(" INCOMPLETE");break;
       case NBR_REACHABLE: ADD(" REACHABLE");break;
       case NBR_STALE: ADD(" STALE");break;      
@@ -196,7 +197,7 @@ PT_THREAD(generate_routes(struct httpd_state *s))
 }
 #endif
 #else
-      ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr);
+      ipaddr_add(&nbr->ipaddr);
 #endif
 
       ADD("\n");
@@ -211,7 +212,6 @@ PT_THREAD(generate_routes(struct httpd_state *s))
         blen = 0;
       }
 #endif
-    }
   }
   ADD("
Routes
");
   SEND_STRING(&s->sout, buf);
@@ -221,7 +221,7 @@ PT_THREAD(generate_routes(struct httpd_state *s))
   blen = 0;
 #endif
 
-  for(r = uip_ds6_route_list_head(); r != NULL; r = list_item_next(r)) {
+  for(r = uip_ds6_route_head(); r != NULL; r = uip_ds6_route_next(r)) {
 
 #if BUF_USES_STACK
 #if WEBSERVER_CONF_ROUTE_LINKS
@@ -247,7 +247,7 @@ PT_THREAD(generate_routes(struct httpd_state *s))
 #endif
 #endif
     ADD("/%u (via ", r->length);
-    ipaddr_add(&r->nexthop);
+    ipaddr_add(uip_ds6_route_nexthop(r));
     if(1 || (r->state.lifetime < 600)) {
       ADD(") %lus\n", r->state.lifetime);
     } else {
diff --git a/examples/ipv6/rpl-collect/udp-sender.c b/examples/ipv6/rpl-collect/udp-sender.c
index 113afdc4a..75d63e806 100644
--- a/examples/ipv6/rpl-collect/udp-sender.c
+++ b/examples/ipv6/rpl-collect/udp-sender.c
@@ -31,7 +31,6 @@
 #include "net/uip.h"
 #include "net/uip-ds6.h"
 #include "net/uip-udp-packet.h"
-#include "net/neighbor-info.h"
 #include "net/rpl/rpl.h"
 #include "dev/serial-line.h"
 #if CONTIKI_TARGET_Z1
@@ -64,7 +63,6 @@ collect_common_set_sink(void)
   /* A udp client can never become sink */
 }
 /*---------------------------------------------------------------------------*/
-extern uip_ds6_route_t uip_ds6_routing_table[UIP_DS6_ROUTE_NB];
 
 void
 collect_common_net_print(void)
@@ -76,12 +74,12 @@ collect_common_net_print(void)
   dag = rpl_get_any_dag();
   if(dag->preferred_parent != NULL) {
     PRINTF("Preferred parent: ");
-    PRINT6ADDR(&dag->preferred_parent->addr);
+    PRINT6ADDR(rpl_get_parent_ipaddr(dag->preferred_parent));
     PRINTF("\n");
   }
-  for(r = uip_ds6_route_list_head();
+  for(r = uip_ds6_route_head();
       r != NULL;
-      r = list_item_next(r)) {
+      r = uip_ds6_route_next(r)) {
     PRINT6ADDR(&r->ipaddr);
   }
   PRINTF("---\n");
@@ -134,12 +132,12 @@ collect_common_send(void)
     preferred_parent = dag->preferred_parent;
     if(preferred_parent != NULL) {
       uip_ds6_nbr_t *nbr;
-      nbr = uip_ds6_nbr_lookup(&preferred_parent->addr);
+      nbr = uip_ds6_nbr_lookup(rpl_get_parent_ipaddr(preferred_parent));
       if(nbr != NULL) {
         /* Use parts of the IPv6 address as the parent address, in reversed byte order. */
         parent.u8[RIMEADDR_SIZE - 1] = nbr->ipaddr.u8[sizeof(uip_ipaddr_t) - 2];
         parent.u8[RIMEADDR_SIZE - 2] = nbr->ipaddr.u8[sizeof(uip_ipaddr_t) - 1];
-        parent_etx = neighbor_info_get_metric((rimeaddr_t *) &nbr->lladdr) / 2;
+        parent_etx = rpl_get_parent_rank((rimeaddr_t *) uip_ds6_nbr_get_ll(nbr)) / 2;
       }
     }
     rtmetric = dag->rank;
diff --git a/examples/ravenusbstick/fakeuip.c b/examples/ravenusbstick/fakeuip.c
index 0b8bd57d6..f7d4fff81 100644
--- a/examples/ravenusbstick/fakeuip.c
+++ b/examples/ravenusbstick/fakeuip.c
@@ -131,3 +131,9 @@ uip_icmp6chksum(void)
 {
   return upper_layer_chksum(UIP_PROTO_ICMP6); 
 }
+
+/*---------------------------------------------------------------------------*/
+void
+uip_ds6_link_neighbor_callback(int status, int numtx)
+{
+}
diff --git a/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-cgi.c b/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-cgi.c
index 8bf7687c7..58c1f9649 100644
--- a/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-cgi.c
+++ b/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-cgi.c
@@ -290,8 +290,6 @@ static const char httpd_cgi_addrh[] HTTPD_STRING_ATTR = "";
 static const char httpd_cgi_addrf[] HTTPD_STRING_ATTR = "[Room for %u more]";
 static const char httpd_cgi_addrb[] HTTPD_STRING_ATTR = "
"; static const char httpd_cgi_addrn[] HTTPD_STRING_ATTR = "(none)
"; -extern uip_ds6_nbr_t uip_ds6_nbr_cache[]; -extern uip_ds6_route_t uip_ds6_routing_table[]; extern uip_ds6_netif_t uip_ds6_if; static unsigned short @@ -328,15 +326,16 @@ make_neighbors(void *p) uint8_t i,j=0; uint16_t numprinted; numprinted = httpd_snprintf((char *)uip_appdata, uip_mss(),httpd_cgi_addrh); - for (i=0; iipaddr, uip_appdata + numprinted); + numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrb); } //if (j==0) numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrn); - numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf,UIP_DS6_NBR_NB-j); + numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf,NEIGHBOR_TABLE_MAX_NEIGHBORS-j); return numprinted; } /*---------------------------------------------------------------------------*/ @@ -358,15 +357,17 @@ static const char httpd_cgi_rtes2[] HTTPD_STRING_ATTR = ") %lus
"; static const char httpd_cgi_rtes3[] HTTPD_STRING_ATTR = ")
"; uint8_t i,j=0; uint16_t numprinted; +uip_ds6_route_t *r; numprinted = httpd_snprintf((char *)uip_appdata, uip_mss(),httpd_cgi_addrh); - for (i=0; iipaddr, uip_appdata + numprinted); + numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes1, r->length); + numprinted += httpd_cgi_sprint_ip6(uip_ds6_route_nexthop(r), uip_appdata + numprinted); + if(r->state.lifetime < 3600) { + numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes2, r->state.lifetime); } else { numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes3); } diff --git a/platform/avr-atmega128rfa1/contiki-main.c b/platform/avr-atmega128rfa1/contiki-main.c index 05a9ee392..cecc176db 100644 --- a/platform/avr-atmega128rfa1/contiki-main.c +++ b/platform/avr-atmega128rfa1/contiki-main.c @@ -419,6 +419,9 @@ ipaddr_add(const uip_ipaddr_t *addr) int main(void) { +#if UIP_CONF_IPV6 + uip_ds6_nbr_t *nbr; +#endif /* UIP_CONF_IPV6 */ initialize(); while(1) { @@ -514,8 +517,6 @@ if ((clocktime%PINGS)==1) { #if ROUTES && UIP_CONF_IPV6 if ((clocktime%ROUTES)==2) { -extern uip_ds6_nbr_t uip_ds6_nbr_cache[]; -extern uip_ds6_route_t uip_ds6_routing_table[]; extern uip_ds6_netif_t uip_ds6_if; uint8_t i,j; @@ -526,13 +527,14 @@ extern uip_ds6_netif_t uip_ds6_if; PRINTF("\n"); } } - PRINTF("\nNeighbors [%u max]\n",UIP_DS6_NBR_NB); - for(i = 0,j=1; i < UIP_DS6_NBR_NB; i++) { - if(uip_ds6_nbr_cache[i].isused) { - ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr); - PRINTF("\n"); - j=0; - } + PRINTF("\nNeighbors [%u max]\n",NEIGHBOR_TABLE_MAX_NEIGHBORS); + + for(nbr = nbr_table_head(ds6_neighbors); + nbr != NULL; + nbr = nbr_table_next(ds6_neighbors, nbr)) { + ipaddr_add(&nbr->ipaddr); + PRINTF("\n"); + j=0; } if (j) PRINTF(" "); PRINTF("\nRoutes [%u max]\n",UIP_DS6_ROUTE_NB); @@ -540,17 +542,13 @@ extern uip_ds6_netif_t uip_ds6_if; uip_ds6_route_t *r; PRINTF("\nRoutes [%u max]\n",UIP_DS6_ROUTE_NB); j = 1; - for(r = uip_ds6_route_list_head(); + for(r = uip_ds6_route_head(); r != NULL; - r = list_item_next(r)) { + r = uip_ds6_route_next(r)) { ipaddr_add(&r->ipaddr); PRINTF("/%u (via ", r->length); - ipaddr_add(&r->nexthop); - // if(uip_ds6_routing_table[i].state.lifetime < 600) { + ipaddr_add(uip_ds6_route_nexthop(r)); PRINTF(") %lus\n", r->state.lifetime); - // } else { - // PRINTF(")\n"); - // } j = 0; } } diff --git a/platform/avr-raven/apps/raven-webserver/httpd-cgi.c b/platform/avr-raven/apps/raven-webserver/httpd-cgi.c index a9ed784f8..d6961f17d 100644 --- a/platform/avr-raven/apps/raven-webserver/httpd-cgi.c +++ b/platform/avr-raven/apps/raven-webserver/httpd-cgi.c @@ -291,8 +291,6 @@ static const char httpd_cgi_addrh[] HTTPD_STRING_ATTR = ""; static const char httpd_cgi_addrf[] HTTPD_STRING_ATTR = "[Room for %u more]"; static const char httpd_cgi_addrb[] HTTPD_STRING_ATTR = "
"; static const char httpd_cgi_addrn[] HTTPD_STRING_ATTR = "(none)
"; -extern uip_ds6_nbr_t uip_ds6_nbr_cache[]; -extern uip_ds6_route_t uip_ds6_routing_table[]; extern uip_ds6_netif_t uip_ds6_if; static unsigned short @@ -328,16 +326,18 @@ make_neighbors(void *p) { uint8_t i,j=0; uint16_t numprinted; +uip_ds6_nbr_t *nbr; + numprinted = httpd_snprintf((char *)uip_appdata, uip_mss(),httpd_cgi_addrh); - for (i=0; iipaddr, uip_appdata + numprinted); + numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrb); } //if (j==0) numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrn); - numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf,UIP_DS6_NBR_NB-j); + numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf,NEIGHBOR_TABLE_MAX_NEIGHBORS-j); return numprinted; } /*---------------------------------------------------------------------------*/ @@ -362,13 +362,13 @@ make_routes(void *p) uip_ds6_route_t *r; numprinted = httpd_snprintf((char *)uip_appdata, uip_mss(),httpd_cgi_addrh); - for(r = uip_ds6_route_list_head(); + for(r = uip_ds6_route_head(); r != NULL; - r = list_item_next(r)) { + r = uip_ds6_route_next(r)) { j++; numprinted += httpd_cgi_sprint_ip6(r->ipaddr, uip_appdata + numprinted); numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes1, r->length); - numprinted += httpd_cgi_sprint_ip6(r->nexthop, uip_appdata + numprinted); + numprinted += httpd_cgi_sprint_ip6(uip_ds6_route_nexthop(r), uip_appdata + numprinted); if(r->state.lifetime < 3600) { numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_rtes2, r->state.lifetime); } else { diff --git a/platform/avr-raven/contiki-raven-main.c b/platform/avr-raven/contiki-raven-main.c index c9521c124..6294c68a2 100644 --- a/platform/avr-raven/contiki-raven-main.c +++ b/platform/avr-raven/contiki-raven-main.c @@ -429,6 +429,9 @@ ipaddr_add(const uip_ipaddr_t *addr) int main(void) { +#if UIP_CONF_IPV6 + uip_ds6_nbr_t *nbr; +#endif /* UIP_CONF_IPV6 */ initialize(); while(1) { @@ -510,8 +513,6 @@ if ((clocktime%PINGS)==1) { #if ROUTES && UIP_CONF_IPV6 if ((clocktime%ROUTES)==2) { -extern uip_ds6_nbr_t uip_ds6_nbr_cache[]; -extern uip_ds6_route_t uip_ds6_routing_table[]; extern uip_ds6_netif_t uip_ds6_if; uint8_t i,j; @@ -522,30 +523,26 @@ extern uip_ds6_netif_t uip_ds6_if; PRINTF("\n"); } } - PRINTF("\nNeighbors [%u max]\n",UIP_DS6_NBR_NB); - for(i = 0,j=1; i < UIP_DS6_NBR_NB; i++) { - if(uip_ds6_nbr_cache[i].isused) { - ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr); - PRINTF("\n"); - j=0; - } + PRINTF("\nNeighbors [%u max]\n",NEIGHBOR_TABLE_MAX_NEIGHBORS); + for(nbr = nbr_table_head(ds6_neighbors); + nbr != NULL; + nbr = nbr_table_next(ds6_neighbors, nbr)) { + ipaddr_add(&nbr->ipaddr); + PRINTF("\n"); + j=0; } if (j) PRINTF(" "); { uip_ds6_route_t *r; PRINTF("\nRoutes [%u max]\n",UIP_DS6_ROUTE_NB); j = 1; - for(r = uip_ds6_route_list_head(); + for(r = uip_ds6_route_head(); r != NULL; - r = list_item_next(r)) { + r = uip_ds6_route_next(r)) { ipaddr_add(&r->ipaddr); PRINTF("/%u (via ", r->length); - ipaddr_add(&r->nexthop); - // if(uip_ds6_routing_table[i].state.lifetime < 600) { - PRINTF(") %lus\n", r->state.lifetime); - // } else { - // PRINTF(")\n"); - // } + ipaddr_add(uip_ds6_route_nexthop(r)); + PRINTF(") %lus\n", r->state.lifetime); j = 0; } } diff --git a/platform/avr-ravenusb/cdc_task.c b/platform/avr-ravenusb/cdc_task.c index e7a402997..47da86baa 100644 --- a/platform/avr-ravenusb/cdc_task.c +++ b/platform/avr-ravenusb/cdc_task.c @@ -579,11 +579,10 @@ void menu_process(char c) #if UIP_CONF_IPV6_RPL #include "rpl.h" -extern uip_ds6_nbr_t uip_ds6_nbr_cache[]; -extern uip_ds6_route_t uip_ds6_routing_table[]; extern uip_ds6_netif_t uip_ds6_if; case 'N': { uint8_t i,j; + uip_ds6_nbr_t *nbr; PRINTF_P(PSTR("\n\rAddresses [%u max]\n\r"),UIP_DS6_ADDR_NB); for (i=0;iipaddr); + PRINTF_P(PSTR("\n\r")); + j=0; } if (j) PRINTF_P(PSTR(" ")); PRINTF_P(PSTR("\n\rRoutes [%u max]\n\r"),UIP_DS6_ROUTE_NB); uip_ds6_route_t *route; - for(route = uip_ds6_route_list_head(),j=1; route != NULL; route = list_item_next(route)) { + for(route = uip_ds6_route_head(); + route != NULL; + route = uip_ds6_route_next(r)) { ipaddr_add(&route->ipaddr); PRINTF_P(PSTR("/%u (via "), route->length); - ipaddr_add(&route->nexthop); + ipaddr_add(uip_ds6_route_nexthop(route)); if(route->state.lifetime < 600) { PRINTF_P(PSTR(") %lus\n\r"), route->state.lifetime); } else { diff --git a/platform/avr-ravenusb/contiki-raven-main.c b/platform/avr-ravenusb/contiki-raven-main.c index 37fdf49da..929ca56b6 100644 --- a/platform/avr-ravenusb/contiki-raven-main.c +++ b/platform/avr-ravenusb/contiki-raven-main.c @@ -652,12 +652,12 @@ if ((rtime%PINGS)==1) { #if ROUTES && UIP_CONF_IPV6_RPL if ((rtime%ROUTES)==2) { - -extern uip_ds6_nbr_t uip_ds6_nbr_cache[]; -extern uip_ds6_route_t uip_ds6_routing_table[]; + extern uip_ds6_netif_t uip_ds6_if; uint8_t i,j; + uip_ds6_nbr_t *nbr; + PRINTA("\nAddresses [%u max]\n",UIP_DS6_ADDR_NB); for (i=0;iipaddr); + PRINTA("\n"); + j=0; } if (j) PRINTA(" "); PRINTA("\nRoutes [%u max]\n",UIP_DS6_ROUTE_NB); - for(i = 0,j=1; i < UIP_DS6_ROUTE_NB; i++) { - if(uip_ds6_routing_table[i].isused) { - uip_debug_ipaddr_print(&uip_ds6_routing_table[i].ipaddr); - PRINTA("/%u (via ", uip_ds6_routing_table[i].length); - uip_debug_ipaddr_print(&uip_ds6_routing_table[i].nexthop); - // if(uip_ds6_routing_table[i].state.lifetime < 600) { - PRINTA(") %lus\n", uip_ds6_routing_table[i].state.lifetime); + uip_ds6_route_t *r; + for(r = uip_ds6_route_head(); + r != NULL; + r = uip_ds6_route_next(r)) { + if(r->isused) { + uip_debug_ipaddr_print(&r->ipaddr); + PRINTA("/%u (via ", r->length); + uip_debug_ipaddr_print(uip_ds6_route_nexthop(r)); + // if(r->state.lifetime < 600) { + PRINTA(") %lus\n", r->state.lifetime); // } else { // PRINTA(")\n"); // } diff --git a/platform/avr-ravenusb/httpd-simple-avr.c b/platform/avr-ravenusb/httpd-simple-avr.c index 8b48443ba..7c2ac9b03 100644 --- a/platform/avr-ravenusb/httpd-simple-avr.c +++ b/platform/avr-ravenusb/httpd-simple-avr.c @@ -243,10 +243,6 @@ ipaddr_add(const uip_ipaddr_t *addr) const char TOP1[] PROGMEM = "ContikiRPL(Jackdaw)"; const char TOP2[] PROGMEM = ""; const char BOTTOM[] PROGMEM = ""; -#if UIP_CONF_IPV6 -extern uip_ds6_nbr_t uip_ds6_nbr_cache[]; -extern uip_ds6_route_t uip_ds6_routing_table[]; -#endif static PT_THREAD(generate_routes(struct httpd_state *s)) @@ -259,30 +255,33 @@ PT_THREAD(generate_routes(struct httpd_state *s)) #if UIP_CONF_IPV6 //allow ip4 builds blen = 0; - ADD("

Neighbors [%u max]

",UIP_DS6_NBR_NB); + ADD("

Neighbors [%u max]

",NEIGHBOR_CONF_MAX_NEIGHBORS); PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf); blen = 0; - for(i = 0; i < UIP_DS6_NBR_NB; i++) { - if(uip_ds6_nbr_cache[i].isused) { - ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr); + uip_ds6_nbr_t *nbr; + for(nbr = nbr_table_head(ds6_neighbors); + nbr != NULL; + nbr = nbr_table_next(ds6_neighbors, nbr)) { + ipaddr_add(&nbr->ipaddr); ADD("
"); // if(blen > sizeof(buf) - 45) { PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf); blen = 0; // } - } } ADD("

Routes [%u max]

",UIP_DS6_ROUTE_NB); PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf); blen = 0; uip_ds6_route_t *route; - for(route = uip_ds6_route_list_head(); route != NULL; route = list_item_next(route)) { + for(route = uip_ds6_route_head(); + route != NULL; + route = uip_ds6_route_next(route)) { ipaddr_add(&route->ipaddr); ADD("/%u (via ", route->length); PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf); blen=0; - ipaddr_add(&route->nexthop); + ipaddr_add(uip_ds6_route_nexthop(route)); if(route->state.lifetime < 600) { PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf); blen=0; diff --git a/platform/cc2530dk/viztool.c b/platform/cc2530dk/viztool.c index 4c37fc114..a88b08790 100644 --- a/platform/cc2530dk/viztool.c +++ b/platform/cc2530dk/viztool.c @@ -69,7 +69,6 @@ static int8_t len; #define REQUEST_TYPE_TOTALS 0xFF extern uip_ds6_netif_t uip_ds6_if; -extern uip_ds6_nbr_t uip_ds6_nbr_cache[UIP_DS6_NBR_NB]; static uip_ds6_route_t *rt; static uip_ds6_defrt_t *defrt; static uip_ipaddr_t *addr; @@ -82,6 +81,7 @@ process_request() CC_NON_BANKED uint8_t i; uint8_t left; uint8_t entry_size; + uip_ds6_nbr_t *nbr; left = VIZTOOL_MAX_PAYLOAD_LEN - 1; len = 2; /* start filling the buffer from position [2] */ @@ -89,46 +89,44 @@ process_request() CC_NON_BANKED if(buf[0] == REQUEST_TYPE_ND) { /* Neighbors */ PRINTF("Neighbors\n"); - for(i = buf[1]; i < UIP_DS6_NBR_NB; i++) { - if(uip_ds6_nbr_cache[i].isused) { - entry_size = sizeof(i) + sizeof(uip_ipaddr_t) + sizeof(uip_lladdr_t) - + sizeof(uip_ds6_nbr_cache[i].state); - PRINTF("%02u: ", i); - PRINT6ADDR(&uip_ds6_nbr_cache[i].ipaddr); - PRINTF(" - "); - PRINTLLADDR(&uip_ds6_nbr_cache[i].lladdr); - PRINTF(" - %u\n", uip_ds6_nbr_cache[i].state); + for(nbr = nbr_table_head(ds6_neighbors); + nbr != NULL; + nbr = nbr_table_next(ds6_neighbors, nbr)) { + entry_size = sizeof(i) + sizeof(uip_ipaddr_t) + sizeof(uip_lladdr_t) + + sizeof(nbr->state); + PRINTF("%02u: ", i); + PRINT6ADDR(&nbr->ipaddr); + PRINTF(" - "); + PRINTLLADDR(&nbr->lladdr); + PRINTF(" - %u\n", nbr->state); - memcpy(buf + len, &i, sizeof(i)); - len += sizeof(i); - memcpy(buf + len, &uip_ds6_nbr_cache[i].ipaddr, sizeof(uip_ipaddr_t)); - len += sizeof(uip_ipaddr_t); - memcpy(buf + len, &uip_ds6_nbr_cache[i].lladdr, sizeof(uip_lladdr_t)); - len += sizeof(uip_lladdr_t); - memcpy(buf + len, &uip_ds6_nbr_cache[i].state, - sizeof(uip_ds6_nbr_cache[i].state)); - len += sizeof(uip_ds6_nbr_cache[i].state); + memcpy(buf + len, &i, sizeof(i)); + len += sizeof(i); + memcpy(buf + len, uip_ds6_nbr_get_ipaddr(nbr), sizeof(uip_ipaddr_t)); + len += sizeof(uip_ipaddr_t); + memcpy(buf + len, uip_ds6_nbr_get_ll(nbr), sizeof(uip_lladdr_t)); + len += sizeof(uip_lladdr_t); + memcpy(buf + len, &nbr->state, + sizeof(nbr->state)); + len += sizeof(nbr->state); - count++; - left -= entry_size; + count++; + left -= entry_size; - if(left < entry_size) { - break; - } + if(left < entry_size) { + break; } } } else if(buf[0] == REQUEST_TYPE_RT) { uint32_t flip = 0; PRINTF("Routing table\n"); - rt = uip_ds6_route_list_head(); + rt = uip_ds6_route_head(); for(i = buf[1]; i < uip_ds6_route_num_routes(); i++) { if(rt != NULL) { entry_size = sizeof(i) + sizeof(rt->ipaddr) + sizeof(rt->length) - + sizeof(rt->metric) - + sizeof(rt->nexthop) + sizeof(rt->state.lifetime) + sizeof(rt->state.learned_from); @@ -138,16 +136,11 @@ process_request() CC_NON_BANKED len += sizeof(rt->ipaddr); memcpy(buf + len, &rt->length, sizeof(rt->length)); len += sizeof(rt->length); - memcpy(buf + len, &rt->metric, sizeof(rt->metric)); - len += sizeof(rt->metric); - memcpy(buf + len, &rt->nexthop, sizeof(rt->nexthop)); - len += sizeof(rt->nexthop); PRINT6ADDR(&rt->ipaddr); PRINTF(" - %02x", rt->length); - PRINTF(" - %02x", rt->metric); PRINTF(" - "); - PRINT6ADDR(&rt->nexthop); + PRINT6ADDR(uip_ds6_route_nexthop(rt)); flip = uip_htonl(rt->state.lifetime); memcpy(buf + len, &flip, sizeof(flip)); @@ -163,7 +156,7 @@ process_request() CC_NON_BANKED count++; left -= entry_size; - rt = list_item_next(rt); + rt = uip_ds6_route_next(rt); if(left < entry_size) { break; @@ -226,10 +219,10 @@ process_request() CC_NON_BANKED buf[2]++; } } - for(i = 0; i < UIP_DS6_NBR_NB; i++) { - if(uip_ds6_nbr_cache[i].isused) { + for(nbr = nbr_table_head(ds6_neighbors); + nbr != NULL; + nbr = nbr_table_next(ds6_neighbors, nbr)) { buf[3]++; - } } buf[4] = uip_ds6_route_num_routes(); diff --git a/platform/cooja/net/radio-uip-uaodv.c b/platform/cooja/net/radio-uip-uaodv.c index 05cecd225..dd9a606e1 100644 --- a/platform/cooja/net/radio-uip-uaodv.c +++ b/platform/cooja/net/radio-uip-uaodv.c @@ -239,7 +239,7 @@ radio_uip_uaodv_send(void) } /* Add header and buffer packet for persistent transmission */ - uip_len = radio_uip_uaodv_add_header(&uip_buf[UIP_LLH_LEN], uip_len, &route->nexthop); /* TODO Correct? */ + uip_len = radio_uip_uaodv_add_header(&uip_buf[UIP_LLH_LEN], uip_len, uip_ds6_route_nexthop(route)); /* TODO Correct? */ return radio_uip_buffer_outgoing_packet( &uip_buf[UIP_LLH_LEN], uip_len, diff --git a/platform/redbee-econotag/contiki-mc1322x-main.c b/platform/redbee-econotag/contiki-mc1322x-main.c index d43d34661..9ad210ef2 100644 --- a/platform/redbee-econotag/contiki-mc1322x-main.c +++ b/platform/redbee-econotag/contiki-mc1322x-main.c @@ -593,8 +593,6 @@ if ((clocktime%PINGS)==1) { #if ROUTES && UIP_CONF_IPV6 if ((clocktime%ROUTES)==2) { -extern uip_ds6_nbr_t uip_ds6_nbr_cache[]; -extern uip_ds6_route_t uip_ds6_routing_table[]; extern uip_ds6_netif_t uip_ds6_if; uint8_t i,j; @@ -605,13 +603,14 @@ extern uip_ds6_netif_t uip_ds6_if; printf("\n"); } } - printf("\nNeighbors [%u max]\n",UIP_DS6_NBR_NB); - for(i = 0,j=1; i < UIP_DS6_NBR_NB; i++) { - if(uip_ds6_nbr_cache[i].isused) { - uip_debug_ipaddr_print(&uip_ds6_nbr_cache[i].ipaddr); + printf("\nNeighbors [%u max]\n",NEIGHBOR_TABLE_MAX_NEIGHBORS); + uip_ds6_nbr_t *nbr; + for(nbr = nbr_table_head(ds6_neighbors); + nbr != NULL; + nbr = nbr_table_next(ds6_neighbors, nbr)) { + uip_debug_ipaddr_print(&nbr->ipaddr); printf("\n"); j=0; - } } if (j) printf(" "); PRINTF("\nRoutes [%u max]\n",UIP_DS6_ROUTE_NB); @@ -619,17 +618,13 @@ extern uip_ds6_netif_t uip_ds6_if; uip_ds6_route_t *r; PRINTF("\nRoutes [%u max]\n",UIP_DS6_ROUTE_NB); j = 1; - for(r = uip_ds6_route_list_head(); + for(r = uip_ds6_route_head(); r != NULL; - r = list_item_next(r)) { + r = uip_ds6_route_next(r)) { ipaddr_add(&r->ipaddr); PRINTF("/%u (via ", r->length); - ipaddr_add(&r->nexthop); - // if(uip_ds6_routing_table[i].state.lifetime < 600) { - PRINTF(") %lus\n", r->state.lifetime); - // } else { - // PRINTF(")\n"); - // } + ipaddr_add(uip_ds6_route_nexthop(r)); + PRINTF(") %lus\n", r->state.lifetime); j = 0; } } diff --git a/platform/sensinode/viztool.c b/platform/sensinode/viztool.c index 4c37fc114..a88b08790 100644 --- a/platform/sensinode/viztool.c +++ b/platform/sensinode/viztool.c @@ -69,7 +69,6 @@ static int8_t len; #define REQUEST_TYPE_TOTALS 0xFF extern uip_ds6_netif_t uip_ds6_if; -extern uip_ds6_nbr_t uip_ds6_nbr_cache[UIP_DS6_NBR_NB]; static uip_ds6_route_t *rt; static uip_ds6_defrt_t *defrt; static uip_ipaddr_t *addr; @@ -82,6 +81,7 @@ process_request() CC_NON_BANKED uint8_t i; uint8_t left; uint8_t entry_size; + uip_ds6_nbr_t *nbr; left = VIZTOOL_MAX_PAYLOAD_LEN - 1; len = 2; /* start filling the buffer from position [2] */ @@ -89,46 +89,44 @@ process_request() CC_NON_BANKED if(buf[0] == REQUEST_TYPE_ND) { /* Neighbors */ PRINTF("Neighbors\n"); - for(i = buf[1]; i < UIP_DS6_NBR_NB; i++) { - if(uip_ds6_nbr_cache[i].isused) { - entry_size = sizeof(i) + sizeof(uip_ipaddr_t) + sizeof(uip_lladdr_t) - + sizeof(uip_ds6_nbr_cache[i].state); - PRINTF("%02u: ", i); - PRINT6ADDR(&uip_ds6_nbr_cache[i].ipaddr); - PRINTF(" - "); - PRINTLLADDR(&uip_ds6_nbr_cache[i].lladdr); - PRINTF(" - %u\n", uip_ds6_nbr_cache[i].state); + for(nbr = nbr_table_head(ds6_neighbors); + nbr != NULL; + nbr = nbr_table_next(ds6_neighbors, nbr)) { + entry_size = sizeof(i) + sizeof(uip_ipaddr_t) + sizeof(uip_lladdr_t) + + sizeof(nbr->state); + PRINTF("%02u: ", i); + PRINT6ADDR(&nbr->ipaddr); + PRINTF(" - "); + PRINTLLADDR(&nbr->lladdr); + PRINTF(" - %u\n", nbr->state); - memcpy(buf + len, &i, sizeof(i)); - len += sizeof(i); - memcpy(buf + len, &uip_ds6_nbr_cache[i].ipaddr, sizeof(uip_ipaddr_t)); - len += sizeof(uip_ipaddr_t); - memcpy(buf + len, &uip_ds6_nbr_cache[i].lladdr, sizeof(uip_lladdr_t)); - len += sizeof(uip_lladdr_t); - memcpy(buf + len, &uip_ds6_nbr_cache[i].state, - sizeof(uip_ds6_nbr_cache[i].state)); - len += sizeof(uip_ds6_nbr_cache[i].state); + memcpy(buf + len, &i, sizeof(i)); + len += sizeof(i); + memcpy(buf + len, uip_ds6_nbr_get_ipaddr(nbr), sizeof(uip_ipaddr_t)); + len += sizeof(uip_ipaddr_t); + memcpy(buf + len, uip_ds6_nbr_get_ll(nbr), sizeof(uip_lladdr_t)); + len += sizeof(uip_lladdr_t); + memcpy(buf + len, &nbr->state, + sizeof(nbr->state)); + len += sizeof(nbr->state); - count++; - left -= entry_size; + count++; + left -= entry_size; - if(left < entry_size) { - break; - } + if(left < entry_size) { + break; } } } else if(buf[0] == REQUEST_TYPE_RT) { uint32_t flip = 0; PRINTF("Routing table\n"); - rt = uip_ds6_route_list_head(); + rt = uip_ds6_route_head(); for(i = buf[1]; i < uip_ds6_route_num_routes(); i++) { if(rt != NULL) { entry_size = sizeof(i) + sizeof(rt->ipaddr) + sizeof(rt->length) - + sizeof(rt->metric) - + sizeof(rt->nexthop) + sizeof(rt->state.lifetime) + sizeof(rt->state.learned_from); @@ -138,16 +136,11 @@ process_request() CC_NON_BANKED len += sizeof(rt->ipaddr); memcpy(buf + len, &rt->length, sizeof(rt->length)); len += sizeof(rt->length); - memcpy(buf + len, &rt->metric, sizeof(rt->metric)); - len += sizeof(rt->metric); - memcpy(buf + len, &rt->nexthop, sizeof(rt->nexthop)); - len += sizeof(rt->nexthop); PRINT6ADDR(&rt->ipaddr); PRINTF(" - %02x", rt->length); - PRINTF(" - %02x", rt->metric); PRINTF(" - "); - PRINT6ADDR(&rt->nexthop); + PRINT6ADDR(uip_ds6_route_nexthop(rt)); flip = uip_htonl(rt->state.lifetime); memcpy(buf + len, &flip, sizeof(flip)); @@ -163,7 +156,7 @@ process_request() CC_NON_BANKED count++; left -= entry_size; - rt = list_item_next(rt); + rt = uip_ds6_route_next(rt); if(left < entry_size) { break; @@ -226,10 +219,10 @@ process_request() CC_NON_BANKED buf[2]++; } } - for(i = 0; i < UIP_DS6_NBR_NB; i++) { - if(uip_ds6_nbr_cache[i].isused) { + for(nbr = nbr_table_head(ds6_neighbors); + nbr != NULL; + nbr = nbr_table_next(ds6_neighbors, nbr)) { buf[3]++; - } } buf[4] = uip_ds6_route_num_routes(); diff --git a/tools/sky/uip6-bridge/fakeuip.c b/tools/sky/uip6-bridge/fakeuip.c index 0b1592efc..af4c8ad3a 100644 --- a/tools/sky/uip6-bridge/fakeuip.c +++ b/tools/sky/uip6-bridge/fakeuip.c @@ -127,3 +127,10 @@ uip_icmp6chksum(void) { return upper_layer_chksum(UIP_PROTO_ICMP6); } + +/*---------------------------------------------------------------------------*/ +void +uip_ds6_link_neighbor_callback(int status, int numtx) +{ + +} diff --git a/tools/stm32w/uip6_bridge/fakeuip.c b/tools/stm32w/uip6_bridge/fakeuip.c index f52c77ef5..9702cce57 100644 --- a/tools/stm32w/uip6_bridge/fakeuip.c +++ b/tools/stm32w/uip6_bridge/fakeuip.c @@ -127,3 +127,9 @@ uip_icmp6chksum(void) { return upper_layer_chksum(UIP_PROTO_ICMP6); } + +/*---------------------------------------------------------------------------*/ +void +uip_ds6_link_neighbor_callback(int status, int numtx) +{ +} diff --git a/tools/stm32w/wpcapslip6/fakeuip.c b/tools/stm32w/wpcapslip6/fakeuip.c index 3072bda84..401b60770 100644 --- a/tools/stm32w/wpcapslip6/fakeuip.c +++ b/tools/stm32w/wpcapslip6/fakeuip.c @@ -73,3 +73,9 @@ uip_icmp6chksum(void) { return upper_layer_chksum(UIP_PROTO_ICMP6); } + +/*---------------------------------------------------------------------------*/ +void +uip_ds6_link_neighbor_callback(int status, int numtx) +{ +} From 248301a041c6483e59acd4bf324c6a1643313e4f Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Mon, 29 Jul 2013 18:49:21 +0200 Subject: [PATCH 09/29] Fix naming issues and includes in uip-ds6-nbr.h --- apps/webserver-nano/httpd-cgi.c | 6 +- apps/webserver/httpd-cgi.c | 2 +- core/contiki-default-conf.h | 8 +-- core/net/Makefile.uip | 4 +- core/net/mac/phase.c | 4 +- core/net/{neighbor-table.c => nbr-table.c} | 36 ++++++------ core/net/{neighbor-table.h => nbr-table.h} | 56 +++++++++---------- core/net/rpl/rpl-dag.c | 6 +- core/net/rpl/rpl-mrhof.c | 2 +- .../net/{uip-ds6-neighbor.c => uip-ds6-nbr.c} | 6 +- .../net/{uip-ds6-neighbor.h => uip-ds6-nbr.h} | 15 ++++- core/net/uip-ds6-route.c | 6 +- core/net/uip-ds6.c | 2 +- core/net/uip-ds6.h | 10 +--- examples/er-rest-example/project-conf.h | 4 +- examples/ipv6/json-ws/project-conf.h | 4 +- examples/udp-stream/project-conf.h | 4 +- .../apps/raven-webserver/httpd-cgi.c | 2 +- platform/avr-atmega128rfa1/contiki-conf.h | 6 +- platform/avr-atmega128rfa1/contiki-main.c | 2 +- .../apps/raven-webserver/httpd-cgi.c | 2 +- platform/avr-raven/contiki-conf.h | 6 +- platform/avr-raven/contiki-raven-main.c | 2 +- platform/avr-ravenusb/cdc_task.c | 2 +- platform/avr-ravenusb/contiki-conf.h | 12 ++-- platform/avr-ravenusb/contiki-raven-main.c | 2 +- platform/avr-ravenusb/httpd-simple-avr.c | 2 +- platform/cc2530dk/contiki-conf.h | 4 +- platform/cc2538dk/contiki-conf.h | 4 +- platform/cooja/contiki-conf.h | 6 +- platform/econotag/contiki-conf.h | 4 +- platform/exp5438/contiki-conf.h | 6 +- platform/iris/contiki-conf.h | 6 +- platform/mbxxx/contiki-conf.h | 2 +- platform/micaz/contiki-conf.h | 6 +- platform/minimal-net/contiki-conf.h | 2 +- platform/native/contiki-conf.h | 6 +- platform/redbee-dev/contiki-conf.h | 4 +- platform/redbee-econotag/contiki-conf.h | 4 +- .../redbee-econotag/contiki-mc1322x-main.c | 2 +- platform/seedeye/contiki-conf.h | 2 +- platform/sensinode/contiki-conf.h | 4 +- platform/sky/contiki-conf.h | 6 +- platform/stk500/contiki-conf.h | 2 +- platform/win32/contiki-conf.h | 2 +- platform/wismote/contiki-conf.h | 6 +- platform/z1/contiki-conf.h | 4 +- platform/z1sp/contiki-conf.h | 4 +- 48 files changed, 151 insertions(+), 148 deletions(-) rename core/net/{neighbor-table.c => nbr-table.c} (92%) rename core/net/{neighbor-table.h => nbr-table.h} (63%) rename core/net/{uip-ds6-neighbor.c => uip-ds6-nbr.c} (98%) rename core/net/{uip-ds6-neighbor.h => uip-ds6-nbr.h} (90%) diff --git a/apps/webserver-nano/httpd-cgi.c b/apps/webserver-nano/httpd-cgi.c index 55cdafd8b..96b06f393 100644 --- a/apps/webserver-nano/httpd-cgi.c +++ b/apps/webserver-nano/httpd-cgi.c @@ -50,7 +50,7 @@ #include "httpd-fs.h" #include "httpd-fsdata.h" #include "lib/petsciiconv.h" -#include "net/neighbor-table.h" +#include "net/nbr-table.h" #include "sensors.h" @@ -525,9 +525,9 @@ static const char httpd_cgi_nbrs5[] HTTPD_STRING_ATTR = " NBR_PROBE"; } } #if WEBSERVER_CONF_SHOW_ROOM - numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf,NEIGHBOR_TABLE_MAX_NEIGHBORS-j); + numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf,NBR_TABLE_MAX_NEIGHBORS-j); #else - if(NEIGHBOR_TABLE_MAX_NEIGHBORS == j) { + if(NBR_TABLE_MAX_NEIGHBORS == j) { numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf); } #endif diff --git a/apps/webserver/httpd-cgi.c b/apps/webserver/httpd-cgi.c index c11a8770a..909ceb762 100644 --- a/apps/webserver/httpd-cgi.c +++ b/apps/webserver/httpd-cgi.c @@ -289,7 +289,7 @@ uint16_t numprinted; numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrb); } //if (j==0) numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrn); - numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf,NEIGHBOR_TABLE_MAX_NEIGHBORS-j); + numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf,NBR_TABLE_MAX_NEIGHBORS-j); return numprinted; } /*---------------------------------------------------------------------------*/ diff --git a/core/contiki-default-conf.h b/core/contiki-default-conf.h index ded2df5ff..37422668a 100644 --- a/core/contiki-default-conf.h +++ b/core/contiki-default-conf.h @@ -174,11 +174,11 @@ #define UIP_CONF_TCP_SPLIT 0 #endif /* UIP_CONF_TCP_SPLIT */ -/* NEIGHBOR_CONF_MAX_NEIGHBORS specifies the maximum number of neighbors +/* NBR_TABLE_CONF_MAX_NEIGHBORS specifies the maximum number of neighbors that each node will be able to handle. */ -#ifndef NEIGHBOR_CONF_MAX_NEIGHBORS -#define NEIGHBOR_CONF_MAX_NEIGHBORS 8 -#endif /* NEIGHBOR_CONF_MAX_NEIGHBORS */ +#ifndef NBR_TABLE_CONF_MAX_NEIGHBORS +#define NBR_TABLE_CONF_MAX_NEIGHBORS 8 +#endif /* NBR_TABLE_CONF_MAX_NEIGHBORS */ /*---------------------------------------------------------------------------*/ /* 6lowpan configuration options. diff --git a/core/net/Makefile.uip b/core/net/Makefile.uip index 6fb3facbd..bf1bb6b3e 100644 --- a/core/net/Makefile.uip +++ b/core/net/Makefile.uip @@ -1,7 +1,7 @@ NET = \ dhcpc.c \ hc.c \ -neighbor-table.c \ +nbr-table.c \ netstack.c \ packetbuf.c \ packetqueue.c \ @@ -16,7 +16,7 @@ uaodv-rt.c \ uaodv.c \ uip-debug.c \ uip-ds6-route.c \ -uip-ds6-neighbor.c \ +uip-ds6-nbr.c \ uip-ds6.c \ uip-fw-drv.c \ uip-fw.c \ diff --git a/core/net/mac/phase.c b/core/net/mac/phase.c index f7e48bcab..922322dc2 100644 --- a/core/net/mac/phase.c +++ b/core/net/mac/phase.c @@ -42,7 +42,7 @@ #include "sys/clock.h" #include "sys/ctimer.h" #include "net/queuebuf.h" -#include "net/neighbor-table.h" +#include "net/nbr-table.h" #if PHASE_CONF_DRIFT_CORRECT #define PHASE_DRIFT_CORRECT PHASE_CONF_DRIFT_CORRECT @@ -75,7 +75,7 @@ struct phase_queueitem { #define MAX_NOACKS_TIME CLOCK_SECOND * 30 MEMB(queued_packets_memb, struct phase_queueitem, PHASE_QUEUESIZE); -NEIGHBOR_TABLE(struct phase, nbr_phase); +NBR_TABLE(struct phase, nbr_phase); #define DEBUG 0 #if DEBUG diff --git a/core/net/neighbor-table.c b/core/net/nbr-table.c similarity index 92% rename from core/net/neighbor-table.c rename to core/net/nbr-table.c index 194e996d5..74028d573 100644 --- a/core/net/neighbor-table.c +++ b/core/net/nbr-table.c @@ -38,7 +38,7 @@ #include #include "lib/memb.h" #include "lib/list.h" -#include "net/neighbor-table.h" +#include "net/nbr-table.h" /* List of link-layer addresses of the neighbors, used as key in the tables */ typedef struct nbr_table_key { @@ -48,9 +48,9 @@ typedef struct nbr_table_key { /* For each neighbor, a map of the tables that use the neighbor. * As we are using uint8_t, we have a maximum of 8 tables in the system */ -static uint8_t used_map[NEIGHBOR_TABLE_MAX_NEIGHBORS]; +static uint8_t used_map[NBR_TABLE_MAX_NEIGHBORS]; /* For each neighbor, a map of the tables that lock the neighbor */ -static uint8_t locked_map[NEIGHBOR_TABLE_MAX_NEIGHBORS]; +static uint8_t locked_map[NBR_TABLE_MAX_NEIGHBORS]; /* The maximum number of tables */ #define MAX_NUM_TABLES 8 /* A list of pointers to tables in use */ @@ -59,7 +59,7 @@ static struct nbr_table *all_tables[MAX_NUM_TABLES]; static unsigned num_tables; /* The neighbor address table */ -MEMB(neighbor_addr_mem, nbr_table_key_t, NEIGHBOR_TABLE_MAX_NEIGHBORS); +MEMB(neighbor_addr_mem, nbr_table_key_t, NBR_TABLE_MAX_NEIGHBORS); LIST(nbr_table_keys); /*---------------------------------------------------------------------------*/ @@ -71,7 +71,7 @@ key_from_index(int index) } /*---------------------------------------------------------------------------*/ /* Get an item from its neighbor index */ -static item_t * +static nbr_table_item_t * item_from_index(nbr_table_t *table, int index) { return table != NULL && index != -1 ? (char *)table->data + index * table->item_size : NULL; @@ -86,13 +86,13 @@ index_from_key(nbr_table_key_t *key) /*---------------------------------------------------------------------------*/ /* Get the neighbor index of an item */ static int -index_from_item(nbr_table_t *table, item_t *item) +index_from_item(nbr_table_t *table, nbr_table_item_t *item) { return table != NULL && item != NULL ? ((int)((char *)item - (char *)table->data)) / table->item_size : -1; } /*---------------------------------------------------------------------------*/ /* Get an item from its key */ -static item_t * +static nbr_table_item_t * item_from_key(nbr_table_t *table, nbr_table_key_t *key) { return item_from_index(table, index_from_key(key)); @@ -100,7 +100,7 @@ item_from_key(nbr_table_t *table, nbr_table_key_t *key) /*---------------------------------------------------------------------------*/ /* Get the key af an item */ static nbr_table_key_t * -key_from_item(nbr_table_t *table, item_t *item) +key_from_item(nbr_table_t *table, nbr_table_item_t *item) { return key_from_index(index_from_item(table, item)); } @@ -127,7 +127,7 @@ index_from_lladdr(const rimeaddr_t *lladdr) /*---------------------------------------------------------------------------*/ /* Get bit from "used" or "locked" bitmap */ static int -nbr_get_bit(uint8_t *bitmap, nbr_table_t *table, item_t *item) +nbr_get_bit(uint8_t *bitmap, nbr_table_t *table, nbr_table_item_t *item) { int item_index = index_from_item(table, item); if(table != NULL && item_index != -1) { @@ -140,7 +140,7 @@ nbr_get_bit(uint8_t *bitmap, nbr_table_t *table, item_t *item) /*---------------------------------------------------------------------------*/ /* Set bit in "used" or "locked" bitmap */ static int -nbr_set_bit(uint8_t *bitmap, nbr_table_t *table, item_t *item, int value) +nbr_set_bit(uint8_t *bitmap, nbr_table_t *table, nbr_table_item_t *item, int value) { int item_index = index_from_item(table, item); if(table != NULL && item_index != -1) { @@ -208,7 +208,7 @@ nbr_table_allocate() for(i = 0; icallback != NULL) { /* Call table callback for each table that uses this item */ - item_t *removed_item = item_from_key(all_tables[i], least_used_key); + nbr_table_item_t *removed_item = item_from_key(all_tables[i], least_used_key); if(nbr_get_bit(used_map, all_tables[i], removed_item) == 1) { all_tables[i]->callback(removed_item); } @@ -227,7 +227,7 @@ nbr_table_allocate() /* Register a new neighbor table. To be used at initialization by modules * using a neighbor table */ int -nbr_table_register(nbr_table_t *table, remove_callback_func *callback) +nbr_table_register(nbr_table_t *table, nbr_table_callback *callback) { if(num_tables < MAX_NUM_TABLES) { table->index = num_tables++; @@ -241,11 +241,11 @@ nbr_table_register(nbr_table_t *table, remove_callback_func *callback) } /*---------------------------------------------------------------------------*/ /* Returns the first item of the current table */ -item_t * +nbr_table_item_t * nbr_table_head(nbr_table_t *table) { /* Get item from first key */ - item_t *item = item_from_key(table, list_head(nbr_table_keys)); + nbr_table_item_t *item = item_from_key(table, list_head(nbr_table_keys)); /* Item is the first neighbor, now check is it is in the current table */ if(nbr_get_bit(used_map, table, item)) { return item; @@ -255,8 +255,8 @@ nbr_table_head(nbr_table_t *table) } /*---------------------------------------------------------------------------*/ /* Iterates over the current table */ -item_t * -nbr_table_next(nbr_table_t *table, item_t *item) +nbr_table_item_t * +nbr_table_next(nbr_table_t *table, nbr_table_item_t *item) { do { void *key = key_from_item(table, item); @@ -268,11 +268,11 @@ nbr_table_next(nbr_table_t *table, item_t *item) } /*---------------------------------------------------------------------------*/ /* Add a neighbor indexed with its link-layer address */ -item_t * +nbr_table_item_t * nbr_table_add_lladdr(nbr_table_t *table, const rimeaddr_t *lladdr) { int index; - item_t *item; + nbr_table_item_t *item; nbr_table_key_t *key; /* Allow lladdr-free insertion, useful e.g. for IPv6 ND. diff --git a/core/net/neighbor-table.h b/core/net/nbr-table.h similarity index 63% rename from core/net/neighbor-table.h rename to core/net/nbr-table.h index f2b2f8034..113db94b6 100644 --- a/core/net/neighbor-table.h +++ b/core/net/nbr-table.h @@ -32,72 +32,72 @@ * Joris Borms */ -#ifndef _NEIGHBOR_TABLE_H_ -#define _NEIGHBOR_TABLE_H_ +#ifndef _NBR_TABLE_H_ +#define _NBR_TABLE_H_ #include "contiki.h" #include "net/rime/rimeaddr.h" #include "net/netstack.h" /* Neighbor table size */ -#ifdef NEIGHBOR_CONF_MAX_NEIGHBORS -#define NEIGHBOR_TABLE_MAX_NEIGHBORS NEIGHBOR_CONF_MAX_NEIGHBORS -#else /* NEIGHBOR_CONF_MAX_NEIGHBORS */ -#define NEIGHBOR_TABLE_MAX_NEIGHBORS 8 -#endif /* NEIGHBOR_CONF_MAX_NEIGHBORS */ +#ifdef NBR_TABLE_CONF_MAX_NEIGHBORS +#define NBR_TABLE_MAX_NEIGHBORS NBR_TABLE_CONF_MAX_NEIGHBORS +#else /* NBR_TABLE_CONF_MAX_NEIGHBORS */ +#define NBR_TABLE_MAX_NEIGHBORS 8 +#endif /* NBR_TABLE_CONF_MAX_NEIGHBORS */ /* An item in a neighbor table */ -typedef void item_t; +typedef void nbr_table_item_t; /* Callback function, called when removing an item from a table */ -typedef void(remove_callback_func)(item_t *item); +typedef void(nbr_table_callback)(nbr_table_item_t *item); /* A neighbor table */ typedef struct nbr_table { int index; int item_size; - remove_callback_func *callback; - item_t *data; + nbr_table_callback *callback; + nbr_table_item_t *data; } nbr_table_t; /** \brief A static neighbor table. To be initialized through nbr_table_register(name) */ -#define NEIGHBOR_TABLE(type, name) \ - static type _##name##_mem[NEIGHBOR_TABLE_MAX_NEIGHBORS]; \ - static nbr_table_t name##_struct = { 0, sizeof(type), NULL, (item_t *)_##name##_mem }; \ +#define NBR_TABLE(type, name) \ + static type _##name##_mem[NBR_TABLE_MAX_NEIGHBORS]; \ + static nbr_table_t name##_struct = { 0, sizeof(type), NULL, (nbr_table_item_t *)_##name##_mem }; \ static nbr_table_t *name = &name##_struct \ /** \brief A non-static neighbor table. To be initialized through nbr_table_register(name) */ -#define NEIGHBOR_TABLE_GLOBAL(type, name) \ - static type _##name##_mem[NEIGHBOR_TABLE_MAX_NEIGHBORS]; \ - static nbr_table_t name##_struct = { 0, sizeof(type), NULL, (item_t *)_##name##_mem }; \ +#define NBR_TABLE_GLOBAL(type, name) \ + static type _##name##_mem[NBR_TABLE_MAX_NEIGHBORS]; \ + static nbr_table_t name##_struct = { 0, sizeof(type), NULL, (nbr_table_item_t *)_##name##_mem }; \ nbr_table_t *name = &name##_struct \ /** \brief Declaration of non-static neighbor tables */ -#define NEIGHBOR_TABLE_DECLARE(name) extern nbr_table_t *name +#define NBR_TABLE_DECLARE(name) extern nbr_table_t *name /** \name Neighbor tables: register and loop through table elements */ /** @{ */ -int nbr_table_register(nbr_table_t *table, remove_callback_func *callback); -item_t *nbr_table_head(nbr_table_t *table); -item_t *nbr_table_next(nbr_table_t *table, item_t *item); +int nbr_table_register(nbr_table_t *table, nbr_table_callback *callback); +nbr_table_item_t *nbr_table_head(nbr_table_t *table); +nbr_table_item_t *nbr_table_next(nbr_table_t *table, nbr_table_item_t *item); /** @} */ /** \name Neighbor tables: add and get data */ /** @{ */ -item_t *nbr_table_add_lladdr(nbr_table_t *table, const rimeaddr_t *lladdr); -item_t *nbr_table_get_from_lladdr(nbr_table_t *table, const rimeaddr_t *lladdr); +nbr_table_item_t *nbr_table_add_lladdr(nbr_table_t *table, const rimeaddr_t *lladdr); +nbr_table_item_t *nbr_table_get_from_lladdr(nbr_table_t *table, const rimeaddr_t *lladdr); /** @} */ /** \name Neighbor tables: set flags (unused, locked, unlocked) */ /** @{ */ -int nbr_table_remove(nbr_table_t *table, item_t *item); -int nbr_table_lock(nbr_table_t *table, item_t *item); -int nbr_table_unlock(nbr_table_t *table, item_t *item); +int nbr_table_remove(nbr_table_t *table, nbr_table_item_t *item); +int nbr_table_lock(nbr_table_t *table, nbr_table_item_t *item); +int nbr_table_unlock(nbr_table_t *table, nbr_table_item_t *item); /** @} */ /** \name Neighbor tables: address manipulation */ /** @{ */ -rimeaddr_t *nbr_table_get_lladdr(nbr_table_t *table, item_t *item); +rimeaddr_t *nbr_table_get_lladdr(nbr_table_t *table, nbr_table_item_t *item); /** @} */ -#endif /* _NEIGHBOR_TABLE_H_ */ +#endif /* _NBR_TABLE_H_ */ diff --git a/core/net/rpl/rpl-dag.c b/core/net/rpl/rpl-dag.c index 74f0d3cf0..0150e093a 100644 --- a/core/net/rpl/rpl-dag.c +++ b/core/net/rpl/rpl-dag.c @@ -45,7 +45,7 @@ #include "net/rpl/rpl-private.h" #include "net/uip.h" #include "net/uip-nd6.h" -#include "net/neighbor-table.h" +#include "net/nbr-table.h" #include "lib/list.h" #include "lib/memb.h" #include "sys/ctimer.h" @@ -72,7 +72,7 @@ static rpl_of_t * const objective_functions[] = {&RPL_OF}; /*---------------------------------------------------------------------------*/ /* Per-parent RPL information */ -NEIGHBOR_TABLE(rpl_parent_t, rpl_parents); +NBR_TABLE(rpl_parent_t, rpl_parents); /*---------------------------------------------------------------------------*/ /* Allocate instance table. */ rpl_instance_t instance_table[RPL_MAX_INSTANCES]; @@ -81,7 +81,7 @@ rpl_instance_t *default_instance; void rpl_dag_init() { - nbr_table_register(rpl_parents, (remove_callback_func *)rpl_remove_parent); + nbr_table_register(rpl_parents, (nbr_table_callback *)rpl_remove_parent); } /*---------------------------------------------------------------------------*/ rpl_rank_t diff --git a/core/net/rpl/rpl-mrhof.c b/core/net/rpl/rpl-mrhof.c index 5f7e85f42..c34ea0074 100644 --- a/core/net/rpl/rpl-mrhof.c +++ b/core/net/rpl/rpl-mrhof.c @@ -45,7 +45,7 @@ */ #include "net/rpl/rpl-private.h" -#include "net/neighbor-table.h" +#include "net/nbr-table.h" #define DEBUG DEBUG_NONE #include "net/uip-debug.h" diff --git a/core/net/uip-ds6-neighbor.c b/core/net/uip-ds6-nbr.c similarity index 98% rename from core/net/uip-ds6-neighbor.c rename to core/net/uip-ds6-nbr.c index 89371baf4..1826285c1 100644 --- a/core/net/uip-ds6-neighbor.c +++ b/core/net/uip-ds6-nbr.c @@ -49,7 +49,7 @@ #include "lib/list.h" #include "net/rime/rimeaddr.h" #include "net/packetbuf.h" -#include "net/uip-ds6-neighbor.h" +#include "net/uip-ds6-nbr.h" #define DEBUG DEBUG_NONE #include "net/uip-debug.h" @@ -68,13 +68,13 @@ void LINK_NEIGHBOR_CALLBACK(const rimeaddr_t *addr, int status, int numtx); #define LINK_NEIGHBOR_CALLBACK(addr, status, numtx) #endif /* UIP_CONF_DS6_LINK_NEIGHBOR_CALLBACK */ -NEIGHBOR_TABLE_GLOBAL(uip_ds6_nbr_t, ds6_neighbors); +NBR_TABLE_GLOBAL(uip_ds6_nbr_t, ds6_neighbors); /*---------------------------------------------------------------------------*/ void uip_ds6_neighbors_init(void) { - nbr_table_register(ds6_neighbors, (remove_callback_func *)uip_ds6_nbr_rm); + nbr_table_register(ds6_neighbors, (nbr_table_callback *)uip_ds6_nbr_rm); } /*---------------------------------------------------------------------------*/ uip_ds6_nbr_t * diff --git a/core/net/uip-ds6-neighbor.h b/core/net/uip-ds6-nbr.h similarity index 90% rename from core/net/uip-ds6-neighbor.h rename to core/net/uip-ds6-nbr.h index 4de23cb03..9371255ff 100644 --- a/core/net/uip-ds6-neighbor.h +++ b/core/net/uip-ds6-nbr.h @@ -46,14 +46,25 @@ #ifndef __UIP_DS6_NEIGHBOR_H__ #define __UIP_DS6_NEIGHBOR_H__ +#include "net/uip.h" +#include "net/nbr-table.h" +#include "sys/stimer.h" #include "net/uip-ds6.h" -#include "net/neighbor-table.h" +#include "net/nbr-table.h" #if UIP_CONF_IPV6_QUEUE_PKT #include "net/uip-packetqueue.h" #endif /*UIP_CONF_QUEUE_PKT */ -NEIGHBOR_TABLE_DECLARE(ds6_neighbors); +/*--------------------------------------------------*/ +/** \brief Possible states for the nbr cache entries */ +#define NBR_INCOMPLETE 0 +#define NBR_REACHABLE 1 +#define NBR_STALE 2 +#define NBR_DELAY 3 +#define NBR_PROBE 4 + +NBR_TABLE_DECLARE(ds6_neighbors); /** \brief An entry in the nbr cache */ typedef struct uip_ds6_nbr { diff --git a/core/net/uip-ds6-route.c b/core/net/uip-ds6-route.c index e5c6faaa3..3aefa14bf 100644 --- a/core/net/uip-ds6-route.c +++ b/core/net/uip-ds6-route.c @@ -34,7 +34,7 @@ #include "lib/list.h" #include "lib/memb.h" -#include "net/neighbor-table.h" +#include "net/nbr-table.h" #if UIP_CONF_IPV6 @@ -42,7 +42,7 @@ void uip_ds6_route_rm_routelist(list_t nbr_table_get_from_lladdr); -NEIGHBOR_TABLE(uip_ds6_route_t *, nbr_routes); +NBR_TABLE(uip_ds6_route_t *, nbr_routes); MEMB(routememb, uip_ds6_route_t, UIP_DS6_ROUTE_NB); LIST(defaultrouterlist); @@ -100,7 +100,7 @@ void uip_ds6_route_init(void) { memb_init(&routememb); - nbr_table_register(nbr_routes, (remove_callback_func *)uip_ds6_route_rm_routelist); + nbr_table_register(nbr_routes, (nbr_table_callback *)uip_ds6_route_rm_routelist); memb_init(&defaultroutermemb); list_init(defaultrouterlist); diff --git a/core/net/uip-ds6.c b/core/net/uip-ds6.c index 41e97bfd6..6e4b86f71 100644 --- a/core/net/uip-ds6.c +++ b/core/net/uip-ds6.c @@ -96,7 +96,7 @@ uip_ds6_init(void) PRINTF("Init of IPv6 data structures\n"); PRINTF("%u neighbors\n%u default routers\n%u prefixes\n%u routes\n%u unicast addresses\n%u multicast addresses\n%u anycast addresses\n", - NEIGHBOR_TABLE_MAX_NEIGHBORS, UIP_DS6_DEFRT_NB, UIP_DS6_PREFIX_NB, UIP_DS6_ROUTE_NB, + NBR_TABLE_MAX_NEIGHBORS, UIP_DS6_DEFRT_NB, UIP_DS6_PREFIX_NB, UIP_DS6_ROUTE_NB, UIP_DS6_ADDR_NB, UIP_DS6_MADDR_NB, UIP_DS6_AADDR_NB); memset(uip_ds6_prefix_list, 0, sizeof(uip_ds6_prefix_list)); memset(&uip_ds6_if, 0, sizeof(uip_ds6_if)); diff --git a/core/net/uip-ds6.h b/core/net/uip-ds6.h index 1ee6b176f..1d6c2e759 100644 --- a/core/net/uip-ds6.h +++ b/core/net/uip-ds6.h @@ -47,7 +47,7 @@ /* The size of uip_ds6_addr_t depends on UIP_ND6_DEF_MAXDADNS. Include uip-nd6.h to define it. */ #include "net/uip-nd6.h" #include "net/uip-ds6-route.h" -#include "net/uip-ds6-neighbor.h" +#include "net/uip-ds6-nbr.h" /*--------------------------------------------------*/ /** Configuration. For all tables (Neighbor cache, Prefix List, Routing Table, @@ -119,14 +119,6 @@ #define UIP_DS6_LL_NUD UIP_CONF_DS6_LL_NUD #endif -/*--------------------------------------------------*/ -/** \brief Possible states for the nbr cache entries */ -#define NBR_INCOMPLETE 0 -#define NBR_REACHABLE 1 -#define NBR_STALE 2 -#define NBR_DELAY 3 -#define NBR_PROBE 4 - /** \brief Possible states for the an address (RFC 4862) */ #define ADDR_TENTATIVE 0 #define ADDR_PREFERRED 1 diff --git a/examples/er-rest-example/project-conf.h b/examples/er-rest-example/project-conf.h index ff76fde14..8f6ddd062 100644 --- a/examples/er-rest-example/project-conf.h +++ b/examples/er-rest-example/project-conf.h @@ -73,8 +73,8 @@ */ /* Save some memory for the sky platform. */ -#undef NEIGHBOR_CONF_MAX_NEIGHBORS -#define NEIGHBOR_CONF_MAX_NEIGHBORS 10 +#undef NBR_TABLE_CONF_MAX_NEIGHBORS +#define NBR_TABLE_CONF_MAX_NEIGHBORS 10 #undef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 10 diff --git a/examples/ipv6/json-ws/project-conf.h b/examples/ipv6/json-ws/project-conf.h index d67f1bbba..38e5426a7 100644 --- a/examples/ipv6/json-ws/project-conf.h +++ b/examples/ipv6/json-ws/project-conf.h @@ -54,8 +54,8 @@ #undef QUEUEBUF_CONF_NUM #define QUEUEBUF_CONF_NUM 4 -#undef NEIGHBOR_CONF_MAX_NEIGHBORS -#define NEIGHBOR_CONF_MAX_NEIGHBORS 7 +#undef NBR_TABLE_CONF_MAX_NEIGHBORS +#define NBR_TABLE_CONF_MAX_NEIGHBORS 7 #undef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 7 diff --git a/examples/udp-stream/project-conf.h b/examples/udp-stream/project-conf.h index f4357d5ca..d65e2d486 100644 --- a/examples/udp-stream/project-conf.h +++ b/examples/udp-stream/project-conf.h @@ -33,8 +33,8 @@ /* Free some code and RAM space */ #define UIP_CONF_TCP 0 -#undef NEIGHBOR_CONF_MAX_NEIGHBORS -#define NEIGHBOR_CONF_MAX_NEIGHBORS 8 +#undef NBR_TABLE_CONF_MAX_NEIGHBORS +#define NBR_TABLE_CONF_MAX_NEIGHBORS 8 #undef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 8 diff --git a/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-cgi.c b/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-cgi.c index 58c1f9649..5a11a52da 100644 --- a/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-cgi.c +++ b/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-cgi.c @@ -335,7 +335,7 @@ uint16_t numprinted; numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrb); } //if (j==0) numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrn); - numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf,NEIGHBOR_TABLE_MAX_NEIGHBORS-j); + numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf,NBR_TABLE_MAX_NEIGHBORS-j); return numprinted; } /*---------------------------------------------------------------------------*/ diff --git a/platform/avr-atmega128rfa1/contiki-conf.h b/platform/avr-atmega128rfa1/contiki-conf.h index 09c3f6679..ad5fc05c7 100644 --- a/platform/avr-atmega128rfa1/contiki-conf.h +++ b/platform/avr-atmega128rfa1/contiki-conf.h @@ -221,7 +221,7 @@ typedef unsigned short uip_stats_t; /* 25 bytes per UDP connection */ #define UIP_CONF_UDP_CONNS 10 /* See uip-ds6.h */ -#define NEIGHBOR_CONF_MAX_NEIGHBORS 20 +#define NBR_TABLE_CONF_MAX_NEIGHBORS 20 #define UIP_CONF_DS6_DEFRT_NBU 2 #define UIP_CONF_DS6_PREFIX_NBU 3 #define UIP_CONF_MAX_ROUTES 20 @@ -266,7 +266,7 @@ typedef unsigned short uip_stats_t; #define UIP_CONF_MAX_CONNECTIONS 2 #define UIP_CONF_MAX_LISTENPORTS 4 #define UIP_CONF_UDP_CONNS 5 -#define NEIGHBOR_CONF_MAX_NEIGHBORS 20 +#define NBR_TABLE_CONF_MAX_NEIGHBORS 20 #define UIP_CONF_DS6_DEFRT_NBU 2 #define UIP_CONF_DS6_PREFIX_NBU 3 #define UIP_CONF_MAX_ROUTES 4 @@ -302,7 +302,7 @@ typedef unsigned short uip_stats_t; #define UIP_CONF_MAX_CONNECTIONS 2 #define UIP_CONF_MAX_LISTENPORTS 4 #define UIP_CONF_UDP_CONNS 5 -#define NEIGHBOR_CONF_MAX_NEIGHBORS 4 +#define NBR_TABLE_CONF_MAX_NEIGHBORS 4 #define UIP_CONF_DS6_DEFRT_NBU 2 #define UIP_CONF_DS6_PREFIX_NBU 3 #define UIP_CONF_MAX_ROUTES 4 diff --git a/platform/avr-atmega128rfa1/contiki-main.c b/platform/avr-atmega128rfa1/contiki-main.c index cecc176db..2bdf759ff 100644 --- a/platform/avr-atmega128rfa1/contiki-main.c +++ b/platform/avr-atmega128rfa1/contiki-main.c @@ -527,7 +527,7 @@ extern uip_ds6_netif_t uip_ds6_if; PRINTF("\n"); } } - PRINTF("\nNeighbors [%u max]\n",NEIGHBOR_TABLE_MAX_NEIGHBORS); + PRINTF("\nNeighbors [%u max]\n",NBR_TABLE_MAX_NEIGHBORS); for(nbr = nbr_table_head(ds6_neighbors); nbr != NULL; diff --git a/platform/avr-raven/apps/raven-webserver/httpd-cgi.c b/platform/avr-raven/apps/raven-webserver/httpd-cgi.c index d6961f17d..f085991bf 100644 --- a/platform/avr-raven/apps/raven-webserver/httpd-cgi.c +++ b/platform/avr-raven/apps/raven-webserver/httpd-cgi.c @@ -337,7 +337,7 @@ uip_ds6_nbr_t *nbr; numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrb); } //if (j==0) numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrn); - numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf,NEIGHBOR_TABLE_MAX_NEIGHBORS-j); + numprinted += httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_addrf,NBR_TABLE_MAX_NEIGHBORS-j); return numprinted; } /*---------------------------------------------------------------------------*/ diff --git a/platform/avr-raven/contiki-conf.h b/platform/avr-raven/contiki-conf.h index c1b58c75f..1ec239c18 100644 --- a/platform/avr-raven/contiki-conf.h +++ b/platform/avr-raven/contiki-conf.h @@ -238,7 +238,7 @@ typedef unsigned short uip_stats_t; /* 25 bytes per UDP connection */ #define UIP_CONF_UDP_CONNS 10 /* See uip-ds6.h */ -#define NEIGHBOR_CONF_MAX_NEIGHBORS 20 +#define NBR_TABLE_CONF_MAX_NEIGHBORS 20 #define UIP_CONF_DS6_DEFRT_NBU 2 #define UIP_CONF_DS6_PREFIX_NBU 3 #define UIP_CONF_MAX_ROUTES 20 @@ -281,7 +281,7 @@ typedef unsigned short uip_stats_t; #define UIP_CONF_MAX_CONNECTIONS 2 #define UIP_CONF_MAX_LISTENPORTS 2 #define UIP_CONF_UDP_CONNS 4 -#define NEIGHBOR_CONF_MAX_NEIGHBORS 10 +#define NBR_TABLE_CONF_MAX_NEIGHBORS 10 #define UIP_CONF_DS6_DEFRT_NBU 2 #define UIP_CONF_DS6_PREFIX_NBU 2 #define UIP_CONF_MAX_ROUTES 4 @@ -314,7 +314,7 @@ typedef unsigned short uip_stats_t; #define UIP_CONF_MAX_CONNECTIONS 2 #define UIP_CONF_MAX_LISTENPORTS 4 #define UIP_CONF_UDP_CONNS 5 -#define NEIGHBOR_CONF_MAX_NEIGHBORS 4 +#define NBR_TABLE_CONF_MAX_NEIGHBORS 4 #define UIP_CONF_DS6_DEFRT_NBU 2 #define UIP_CONF_DS6_PREFIX_NBU 3 #define UIP_CONF_MAX_ROUTES 4 diff --git a/platform/avr-raven/contiki-raven-main.c b/platform/avr-raven/contiki-raven-main.c index 6294c68a2..7f7a4603e 100644 --- a/platform/avr-raven/contiki-raven-main.c +++ b/platform/avr-raven/contiki-raven-main.c @@ -523,7 +523,7 @@ extern uip_ds6_netif_t uip_ds6_if; PRINTF("\n"); } } - PRINTF("\nNeighbors [%u max]\n",NEIGHBOR_TABLE_MAX_NEIGHBORS); + PRINTF("\nNeighbors [%u max]\n",NBR_TABLE_MAX_NEIGHBORS); for(nbr = nbr_table_head(ds6_neighbors); nbr != NULL; nbr = nbr_table_next(ds6_neighbors, nbr)) { diff --git a/platform/avr-ravenusb/cdc_task.c b/platform/avr-ravenusb/cdc_task.c index 47da86baa..8456e9cf1 100644 --- a/platform/avr-ravenusb/cdc_task.c +++ b/platform/avr-ravenusb/cdc_task.c @@ -590,7 +590,7 @@ extern uip_ds6_netif_t uip_ds6_if; PRINTF_P(PSTR("\n\r")); } } - PRINTF_P(PSTR("\n\rNeighbors [%u max]\n\r"),NEIGHBOR_TABLE_MAX_NEIGHBORS); + PRINTF_P(PSTR("\n\rNeighbors [%u max]\n\r"),NBR_TABLE_MAX_NEIGHBORS); for(nbr = nbr_table_head(ds6_neighbors); nbr != NULL; diff --git a/platform/avr-ravenusb/contiki-conf.h b/platform/avr-ravenusb/contiki-conf.h index 26a1aebf4..459fc58e1 100644 --- a/platform/avr-ravenusb/contiki-conf.h +++ b/platform/avr-ravenusb/contiki-conf.h @@ -232,7 +232,7 @@ extern void mac_log_802_15_4_rx(const uint8_t* buffer, size_t total_len); #endif /* UIP_CONF_IPV6 */ /* See uip-ds6.h */ -#define NEIGHBOR_CONF_MAX_NEIGHBORS 2 +#define NBR_TABLE_CONF_MAX_NEIGHBORS 2 #define UIP_CONF_DS6_DEFRT_NBU 2 #define UIP_CONF_DS6_PREFIX_NBU 3 #define UIP_CONF_MAX_ROUTES 2 @@ -360,8 +360,8 @@ typedef unsigned short uip_stats_t; #define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8 #undef QUEUEBUF_CONF_NUM #define QUEUEBUF_CONF_NUM 8 -#undef NEIGHBOR_CONF_MAX_NEIGHBORS -#define NEIGHBOR_CONF_MAX_NEIGHBORS 5 +#undef NBR_TABLE_CONF_MAX_NEIGHBORS +#define NBR_TABLE_CONF_MAX_NEIGHBORS 5 #undef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 5 @@ -409,7 +409,7 @@ typedef unsigned short uip_stats_t; #endif #define RPL_CONF_STATS 0 #define UIP_CONF_BUFFER_SIZE 1300 -//#define NEIGHBOR_CONF_MAX_NEIGHBORS 12 +//#define NBR_TABLE_CONF_MAX_NEIGHBORS 12 //#define UIP_CONF_MAX_ROUTES 12 #ifdef RPL_BORDER_ROUTER @@ -446,8 +446,8 @@ typedef unsigned short uip_stats_t; #define UIP_CONF_TCP 1 #define UIP_CONF_TCP_MSS 48 #define UIP_CONF_RECEIVE_WINDOW 48 -#undef NEIGHBOR_CONF_MAX_NEIGHBORS -#define NEIGHBOR_CONF_MAX_NEIGHBORS 5 +#undef NBR_TABLE_CONF_MAX_NEIGHBORS +#define NBR_TABLE_CONF_MAX_NEIGHBORS 5 #undef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 5 #undef UIP_CONF_MAX_CONNECTIONS diff --git a/platform/avr-ravenusb/contiki-raven-main.c b/platform/avr-ravenusb/contiki-raven-main.c index 929ca56b6..212426498 100644 --- a/platform/avr-ravenusb/contiki-raven-main.c +++ b/platform/avr-ravenusb/contiki-raven-main.c @@ -665,7 +665,7 @@ extern uip_ds6_netif_t uip_ds6_if; PRINTA("\n"); } } - PRINTA("\nNeighbors [%u max]\n",NEIGHBOR_TABLE_MAX_NEIGHBORS); + PRINTA("\nNeighbors [%u max]\n",NBR_TABLE_MAX_NEIGHBORS); for(nbr = nbr_table_head(ds6_neighbors); nbr != NULL; diff --git a/platform/avr-ravenusb/httpd-simple-avr.c b/platform/avr-ravenusb/httpd-simple-avr.c index 7c2ac9b03..3d36076eb 100644 --- a/platform/avr-ravenusb/httpd-simple-avr.c +++ b/platform/avr-ravenusb/httpd-simple-avr.c @@ -255,7 +255,7 @@ PT_THREAD(generate_routes(struct httpd_state *s)) #if UIP_CONF_IPV6 //allow ip4 builds blen = 0; - ADD("

Neighbors [%u max]

",NEIGHBOR_CONF_MAX_NEIGHBORS); + ADD("

Neighbors [%u max]

",NBR_TABLE_CONF_MAX_NEIGHBORS); PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf); blen = 0; uip_ds6_nbr_t *nbr; diff --git a/platform/cc2530dk/contiki-conf.h b/platform/cc2530dk/contiki-conf.h index 51a0faa9f..313fd669f 100644 --- a/platform/cc2530dk/contiki-conf.h +++ b/platform/cc2530dk/contiki-conf.h @@ -232,8 +232,8 @@ #define UIP_CONF_ND6_REACHABLE_TIME 600000 #define UIP_CONF_ND6_RETRANS_TIMER 10000 -#ifndef NEIGHBOR_CONF_MAX_NEIGHBORS -#define NEIGHBOR_CONF_MAX_NEIGHBORS 4 /* Handle n Neighbors */ +#ifndef NBR_TABLE_CONF_MAX_NEIGHBORS +#define NBR_TABLE_CONF_MAX_NEIGHBORS 4 /* Handle n Neighbors */ #endif #ifndef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 4 /* Handle n Routes */ diff --git a/platform/cc2538dk/contiki-conf.h b/platform/cc2538dk/contiki-conf.h index 779f32904..1d0d6c226 100644 --- a/platform/cc2538dk/contiki-conf.h +++ b/platform/cc2538dk/contiki-conf.h @@ -341,8 +341,8 @@ typedef uint32_t rtimer_clock_t; #define UIP_CONF_ND6_REACHABLE_TIME 600000 #define UIP_CONF_ND6_RETRANS_TIMER 10000 -#ifndef NEIGHBOR_CONF_MAX_NEIGHBORS -#define NEIGHBOR_CONF_MAX_NEIGHBORS 20 +#ifndef NBR_TABLE_CONF_MAX_NEIGHBORS +#define NBR_TABLE_CONF_MAX_NEIGHBORS 20 #endif #ifndef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 20 diff --git a/platform/cooja/contiki-conf.h b/platform/cooja/contiki-conf.h index 07141aa13..217432c18 100644 --- a/platform/cooja/contiki-conf.h +++ b/platform/cooja/contiki-conf.h @@ -129,9 +129,9 @@ #endif /* UIP_CONF_IPV6_RPL */ /* configure number of neighbors and routes */ -#ifndef NEIGHBOR_CONF_MAX_NEIGHBORS -#define NEIGHBOR_CONF_MAX_NEIGHBORS 300 -#endif /* NEIGHBOR_CONF_MAX_NEIGHBORS */ +#ifndef NBR_TABLE_CONF_MAX_NEIGHBORS +#define NBR_TABLE_CONF_MAX_NEIGHBORS 300 +#endif /* NBR_TABLE_CONF_MAX_NEIGHBORS */ #ifndef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 300 #endif /* UIP_CONF_MAX_ROUTES */ diff --git a/platform/econotag/contiki-conf.h b/platform/econotag/contiki-conf.h index a9d5d00d5..3d3019113 100644 --- a/platform/econotag/contiki-conf.h +++ b/platform/econotag/contiki-conf.h @@ -142,7 +142,7 @@ #define XMAC_CONF_COMPOWER 0 #define CXMAC_CONF_COMPOWER 0 -#define COLLECT_NEIGHBOR_CONF_MAX_NEIGHBORS 32 +#define COLLECT_NBR_TABLE_CONF_MAX_NEIGHBORS 32 #endif /* WITH_UIP6 */ @@ -184,7 +184,7 @@ #define UIP_CONF_IPV6_RPL 1 #endif -#define NEIGHBOR_CONF_MAX_NEIGHBORS 30 +#define NBR_TABLE_CONF_MAX_NEIGHBORS 30 #define UIP_CONF_MAX_ROUTES 30 #define UIP_CONF_ND6_SEND_RA 0 diff --git a/platform/exp5438/contiki-conf.h b/platform/exp5438/contiki-conf.h index af0e60624..fc7eb8133 100644 --- a/platform/exp5438/contiki-conf.h +++ b/platform/exp5438/contiki-conf.h @@ -137,9 +137,9 @@ #endif /* UIP_CONF_IPV6_RPL */ /* configure number of neighbors and routes */ -#ifndef NEIGHBOR_CONF_MAX_NEIGHBORS -#define NEIGHBOR_CONF_MAX_NEIGHBORS 30 -#endif /* NEIGHBOR_CONF_MAX_NEIGHBORS */ +#ifndef NBR_TABLE_CONF_MAX_NEIGHBORS +#define NBR_TABLE_CONF_MAX_NEIGHBORS 30 +#endif /* NBR_TABLE_CONF_MAX_NEIGHBORS */ #ifndef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 30 #endif /* UIP_CONF_MAX_ROUTES */ diff --git a/platform/iris/contiki-conf.h b/platform/iris/contiki-conf.h index 267173de1..7adf62a6d 100644 --- a/platform/iris/contiki-conf.h +++ b/platform/iris/contiki-conf.h @@ -79,7 +79,7 @@ #define CONTIKIMAC_CONF_ANNOUNCEMENTS 0 #define CONTIKIMAC_CONF_COMPOWER 1 -#define COLLECT_NEIGHBOR_CONF_MAX_NEIGHBORS 32 +#define COLLECT_NBR_TABLE_CONF_MAX_NEIGHBORS 32 #endif /* WITH_UIP6 */ @@ -113,11 +113,11 @@ #define UIP_CONF_IPV6_RPL 1 /* configure number of neighbors and routes */ -#define NEIGHBOR_CONF_MAX_NEIGHBORS 5 +#define NBR_TABLE_CONF_MAX_NEIGHBORS 5 #define UIP_CONF_MAX_ROUTES 5 #define RPL_CONF_MAX_PARENTS 4 -#define NEIGHBOR_CONF_MAX_NEIGHBORS 8 +#define NBR_TABLE_CONF_MAX_NEIGHBORS 8 #define UIP_CONF_ND6_SEND_RA 0 #define UIP_CONF_ND6_REACHABLE_TIME 600000 diff --git a/platform/mbxxx/contiki-conf.h b/platform/mbxxx/contiki-conf.h index 3a2513c19..60f4c3b5b 100644 --- a/platform/mbxxx/contiki-conf.h +++ b/platform/mbxxx/contiki-conf.h @@ -108,7 +108,7 @@ #define ENERGEST_CONF_ON 0 #define QUEUEBUF_CONF_NUM 2 #define QUEUEBUF_CONF_REF_NUM 0 -#define NEIGHBOR_CONF_MAX_NEIGHBORS 4 +#define NBR_TABLE_CONF_MAX_NEIGHBORS 4 #define UIP_CONF_DS6_ROUTE_NBU 4 #define RPL_CONF_MAX_PARENTS_PER_DAG 4 #define RPL_CONF_MAX_INSTANCES 1 diff --git a/platform/micaz/contiki-conf.h b/platform/micaz/contiki-conf.h index 19294e518..b4aadf206 100644 --- a/platform/micaz/contiki-conf.h +++ b/platform/micaz/contiki-conf.h @@ -84,7 +84,7 @@ #define CONTIKIMAC_CONF_ANNOUNCEMENTS 0 #define CONTIKIMAC_CONF_COMPOWER 1 -#define COLLECT_NEIGHBOR_CONF_MAX_NEIGHBORS 32 +#define COLLECT_NBR_TABLE_CONF_MAX_NEIGHBORS 32 #endif /* WITH_UIP6 */ @@ -118,11 +118,11 @@ #define UIP_CONF_IPV6_RPL 1 /* configure number of neighbors and routes */ -#define NEIGHBOR_CONF_MAX_NEIGHBORS 5 +#define NBR_TABLE_CONF_MAX_NEIGHBORS 5 #define UIP_CONF_MAX_ROUTES 5 #define RPL_CONF_MAX_PARENTS 4 -#define NEIGHBOR_CONF_MAX_NEIGHBORS 8 +#define NBR_TABLE_CONF_MAX_NEIGHBORS 8 #define UIP_CONF_ND6_SEND_RA 0 #define UIP_CONF_ND6_REACHABLE_TIME 600000 diff --git a/platform/minimal-net/contiki-conf.h b/platform/minimal-net/contiki-conf.h index fb78993bd..7fc897886 100644 --- a/platform/minimal-net/contiki-conf.h +++ b/platform/minimal-net/contiki-conf.h @@ -161,7 +161,7 @@ typedef unsigned short uip_stats_t; //#define UIP_CONF_NETIF_MAX_ADDRESSES 5 //#define UIP_CONF_ND6_MAX_PREFIXES 3 //#define UIP_CONF_ND6_MAX_DEFROUTERS 2 -#define NEIGHBOR_CONF_MAX_NEIGHBORS 100 +#define NBR_TABLE_CONF_MAX_NEIGHBORS 100 #define UIP_CONF_DS6_DEFRT_NBU 2 #define UIP_CONF_DS6_PREFIX_NBU 5 #define UIP_CONF_MAX_ROUTES 100 diff --git a/platform/native/contiki-conf.h b/platform/native/contiki-conf.h index 763fffe6b..4b425097c 100644 --- a/platform/native/contiki-conf.h +++ b/platform/native/contiki-conf.h @@ -129,9 +129,9 @@ typedef unsigned short uip_stats_t; #define UIP_CONF_ICMP6 1 /* configure number of neighbors and routes */ -#ifndef NEIGHBOR_CONF_MAX_NEIGHBORS -#define NEIGHBOR_CONF_MAX_NEIGHBORS 30 -#endif /* NEIGHBOR_CONF_MAX_NEIGHBORS */ +#ifndef NBR_TABLE_CONF_MAX_NEIGHBORS +#define NBR_TABLE_CONF_MAX_NEIGHBORS 30 +#endif /* NBR_TABLE_CONF_MAX_NEIGHBORS */ #ifndef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 30 #endif /* UIP_CONF_MAX_ROUTES */ diff --git a/platform/redbee-dev/contiki-conf.h b/platform/redbee-dev/contiki-conf.h index a25669a30..dceb1490d 100644 --- a/platform/redbee-dev/contiki-conf.h +++ b/platform/redbee-dev/contiki-conf.h @@ -141,7 +141,7 @@ typedef unsigned long rtimer_clock_t; #define XMAC_CONF_COMPOWER 0 #define CXMAC_CONF_COMPOWER 0 -#define COLLECT_NEIGHBOR_CONF_MAX_NEIGHBORS 32 +#define COLLECT_NBR_TABLE_CONF_MAX_NEIGHBORS 32 #endif /* WITH_UIP6 */ @@ -178,7 +178,7 @@ typedef unsigned long rtimer_clock_t; #define UIP_CONF_ROUTER 1 #define UIP_CONF_IPV6_RPL 1 -#define NEIGHBOR_CONF_MAX_NEIGHBORS 30 +#define NBR_TABLE_CONF_MAX_NEIGHBORS 30 #define UIP_CONF_MAX_ROUTES 30 #define UIP_CONF_ND6_SEND_RA 0 diff --git a/platform/redbee-econotag/contiki-conf.h b/platform/redbee-econotag/contiki-conf.h index 08eab1282..5cd8295dc 100644 --- a/platform/redbee-econotag/contiki-conf.h +++ b/platform/redbee-econotag/contiki-conf.h @@ -159,7 +159,7 @@ typedef unsigned long rtimer_clock_t; #define XMAC_CONF_COMPOWER 0 #define CXMAC_CONF_COMPOWER 0 -#define COLLECT_NEIGHBOR_CONF_MAX_NEIGHBORS 32 +#define COLLECT_NBR_TABLE_CONF_MAX_NEIGHBORS 32 #endif /* WITH_UIP6 */ @@ -196,7 +196,7 @@ typedef unsigned long rtimer_clock_t; #define UIP_CONF_ROUTER 1 #define UIP_CONF_IPV6_RPL 1 -#define NEIGHBOR_CONF_MAX_NEIGHBORS 30 +#define NBR_TABLE_CONF_MAX_NEIGHBORS 30 #define UIP_CONF_MAX_ROUTES 30 #define UIP_CONF_ND6_SEND_RA 0 diff --git a/platform/redbee-econotag/contiki-mc1322x-main.c b/platform/redbee-econotag/contiki-mc1322x-main.c index 9ad210ef2..611d7f998 100644 --- a/platform/redbee-econotag/contiki-mc1322x-main.c +++ b/platform/redbee-econotag/contiki-mc1322x-main.c @@ -603,7 +603,7 @@ extern uip_ds6_netif_t uip_ds6_if; printf("\n"); } } - printf("\nNeighbors [%u max]\n",NEIGHBOR_TABLE_MAX_NEIGHBORS); + printf("\nNeighbors [%u max]\n",NBR_TABLE_MAX_NEIGHBORS); uip_ds6_nbr_t *nbr; for(nbr = nbr_table_head(ds6_neighbors); nbr != NULL; diff --git a/platform/seedeye/contiki-conf.h b/platform/seedeye/contiki-conf.h index 2bb2db3d7..02d37128f 100644 --- a/platform/seedeye/contiki-conf.h +++ b/platform/seedeye/contiki-conf.h @@ -97,7 +97,7 @@ typedef uint32_t rtimer_clock_t; /* IPv6 configuration options */ #define UIP_CONF_IPV6 1 -#define NEIGHBOR_CONF_MAX_NEIGHBORS 20 /* number of neighbors */ +#define NBR_TABLE_CONF_MAX_NEIGHBORS 20 /* number of neighbors */ #define UIP_CONF_DS6_ROUTE_NBU 20 /* number of routes */ #define UIP_CONF_ND6_SEND_RA 0 #define UIP_CONF_ND6_REACHABLE_TIME 600000 diff --git a/platform/sensinode/contiki-conf.h b/platform/sensinode/contiki-conf.h index d176284a7..f3a2a468e 100644 --- a/platform/sensinode/contiki-conf.h +++ b/platform/sensinode/contiki-conf.h @@ -230,8 +230,8 @@ #define UIP_CONF_ND6_REACHABLE_TIME 600000 #define UIP_CONF_ND6_RETRANS_TIMER 10000 -#ifndef NEIGHBOR_CONF_MAX_NEIGHBORS -#define NEIGHBOR_CONF_MAX_NEIGHBORS 4 /* Handle n Neighbors */ +#ifndef NBR_TABLE_CONF_MAX_NEIGHBORS +#define NBR_TABLE_CONF_MAX_NEIGHBORS 4 /* Handle n Neighbors */ #endif #ifndef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 4 /* Handle n Routes */ diff --git a/platform/sky/contiki-conf.h b/platform/sky/contiki-conf.h index 9c3bd202e..b151f9c51 100644 --- a/platform/sky/contiki-conf.h +++ b/platform/sky/contiki-conf.h @@ -137,9 +137,9 @@ #endif /* UIP_CONF_IPV6_RPL */ /* configure number of neighbors and routes */ -#ifndef NEIGHBOR_CONF_MAX_NEIGHBORS -#define NEIGHBOR_CONF_MAX_NEIGHBORS 20 -#endif /* NEIGHBOR_CONF_MAX_NEIGHBORS */ +#ifndef NBR_TABLE_CONF_MAX_NEIGHBORS +#define NBR_TABLE_CONF_MAX_NEIGHBORS 20 +#endif /* NBR_TABLE_CONF_MAX_NEIGHBORS */ #ifndef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 20 #endif /* UIP_CONF_MAX_ROUTES */ diff --git a/platform/stk500/contiki-conf.h b/platform/stk500/contiki-conf.h index 46491d44e..6bb4a00a8 100644 --- a/platform/stk500/contiki-conf.h +++ b/platform/stk500/contiki-conf.h @@ -45,7 +45,7 @@ void clock_adjust_ticks(clock_time_t howmany); //#define UIP_CONF_IPV6_RPL 0 /* See uip-ds6.h */ -#define NEIGHBOR_CONF_MAX_NEIGHBORS 20 +#define NBR_TABLE_CONF_MAX_NEIGHBORS 20 #define UIP_CONF_DS6_DEFRT_NBU 2 #define UIP_CONF_DS6_PREFIX_NBU 3 #define UIP_CONF_MAX_ROUTES 20 diff --git a/platform/win32/contiki-conf.h b/platform/win32/contiki-conf.h index 66af5f47c..d145d6b00 100644 --- a/platform/win32/contiki-conf.h +++ b/platform/win32/contiki-conf.h @@ -63,7 +63,7 @@ typedef unsigned short uip_stats_t; #define UIP_CONF_TCP_SPLIT 1 #if UIP_CONF_IPV6 #define UIP_CONF_IP_FORWARD 0 -#define NEIGHBOR_CONF_MAX_NEIGHBORS 100 +#define NBR_TABLE_CONF_MAX_NEIGHBORS 100 #define UIP_CONF_DS6_DEFRT_NBU 2 #define UIP_CONF_DS6_PREFIX_NBU 5 #define UIP_CONF_MAX_ROUTES 100 diff --git a/platform/wismote/contiki-conf.h b/platform/wismote/contiki-conf.h index 9678b9d24..f0491ef00 100644 --- a/platform/wismote/contiki-conf.h +++ b/platform/wismote/contiki-conf.h @@ -133,9 +133,9 @@ #endif /* UIP_CONF_IPV6_RPL */ /* configure number of neighbors and routes */ -#ifndef NEIGHBOR_CONF_MAX_NEIGHBORS -#define NEIGHBOR_CONF_MAX_NEIGHBORS 30 -#endif /* NEIGHBOR_CONF_MAX_NEIGHBORS */ +#ifndef NBR_TABLE_CONF_MAX_NEIGHBORS +#define NBR_TABLE_CONF_MAX_NEIGHBORS 30 +#endif /* NBR_TABLE_CONF_MAX_NEIGHBORS */ #ifndef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 30 #endif /* UIP_CONF_MAX_ROUTES */ diff --git a/platform/z1/contiki-conf.h b/platform/z1/contiki-conf.h index 44a7f1f71..b5a9d57b2 100644 --- a/platform/z1/contiki-conf.h +++ b/platform/z1/contiki-conf.h @@ -84,7 +84,7 @@ #define XMAC_CONF_COMPOWER 1 #define CXMAC_CONF_COMPOWER 1 -#define COLLECT_NEIGHBOR_CONF_MAX_NEIGHBORS 32 +#define COLLECT_NBR_TABLE_CONF_MAX_NEIGHBORS 32 #define QUEUEBUF_CONF_NUM 8 @@ -134,7 +134,7 @@ #define UIP_CONF_IPV6_RPL 1 /* Handle 10 neighbors */ -#define NEIGHBOR_CONF_MAX_NEIGHBORS 15 +#define NBR_TABLE_CONF_MAX_NEIGHBORS 15 /* Handle 10 routes */ #define UIP_CONF_MAX_ROUTES 15 diff --git a/platform/z1sp/contiki-conf.h b/platform/z1sp/contiki-conf.h index ca818c212..0e4fa7b06 100644 --- a/platform/z1sp/contiki-conf.h +++ b/platform/z1sp/contiki-conf.h @@ -78,7 +78,7 @@ #define XMAC_CONF_COMPOWER 1 #define CXMAC_CONF_COMPOWER 1 -#define COLLECT_NEIGHBOR_CONF_MAX_NEIGHBORS 32 +#define COLLECT_NBR_TABLE_CONF_MAX_NEIGHBORS 32 #define QUEUEBUF_CONF_NUM 8 @@ -133,7 +133,7 @@ #define UIP_CONF_IPV6_RPL 1 /* Handle 10 neighbors */ -#define NEIGHBOR_CONF_MAX_NEIGHBORS 15 +#define NBR_TABLE_CONF_MAX_NEIGHBORS 15 /* Handle 10 routes */ #define UIP_CONF_MAX_ROUTES 15 From 82e8eb420d8a58e951c83df6901b7b505ce69040 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 11 Aug 2013 23:42:51 +0200 Subject: [PATCH 10/29] Added and updated debugging printouts and reformatted code to make it a little easier to read. --- core/net/rpl/rpl-dag.c | 21 ++++++++++++++++++++- core/net/rpl/rpl-icmp6.c | 17 +++++++++++++---- core/net/rpl/rpl.c | 2 ++ core/net/uip-debug.c | 4 ++++ 4 files changed, 39 insertions(+), 5 deletions(-) diff --git a/core/net/rpl/rpl-dag.c b/core/net/rpl/rpl-dag.c index 0150e093a..220d9facc 100644 --- a/core/net/rpl/rpl-dag.c +++ b/core/net/rpl/rpl-dag.c @@ -106,6 +106,20 @@ static void rpl_set_preferred_parent(rpl_dag_t *dag, rpl_parent_t *p) { if(dag != NULL && dag->preferred_parent != p) { + PRINTF("RPL: rpl_set_preferred_parent "); + if(p != NULL) { + PRINT6ADDR(rpl_get_parent_ipaddr(p)); + } else { + PRINTF("NULL"); + } + PRINTF(" used to be "); + if(dag->preferred_parent != NULL) { + PRINT6ADDR(rpl_get_parent_ipaddr(dag->preferred_parent)); + } else { + PRINTF("NULL"); + } + PRINTF("\n"); + /* Always keep the preferred parent locked, so it remains in the * neighbor table. */ nbr_table_unlock(rpl_parents, dag->preferred_parent); @@ -288,11 +302,13 @@ rpl_repair_root(uint8_t instance_id) instance = rpl_get_instance(instance_id); if(instance == NULL || instance->current_dag->rank != ROOT_RANK(instance)) { + PRINTF("RPL: rpl_repair_root triggered but not root\n"); return 0; } RPL_LOLLIPOP_INCREMENT(instance->current_dag->version); RPL_LOLLIPOP_INCREMENT(instance->dtsn_out); + PRINTF("RPL: rpl_repair_root initiating global repair with version %d\n", instance->current_dag->version); rpl_reset_dio_timer(instance); return 1; } @@ -514,6 +530,7 @@ rpl_add_parent(rpl_dag_t *dag, rpl_dio_t *dio, uip_ipaddr_t *addr) * Typically, the parent is added upon receiving a DIO. */ uip_lladdr_t *lladdr = uip_ds6_nbr_lladdr_from_ipaddr(addr); + PRINTF("RPL: rpl_add_parent lladdr %p\n", lladdr); if(lladdr != NULL) { /* Add parent in rpl_parents */ p = nbr_table_add_lladdr(rpl_parents, (rimeaddr_t *)lladdr); @@ -990,6 +1007,7 @@ global_repair(uip_ipaddr_t *from, rpl_dag_t *dag, rpl_dio_t *dio) } else { dag->rank = dag->instance->of->calculate_rank(p, 0); dag->min_rank = dag->rank; + PRINTF("RPL: rpl_process_parent_event global repair\n"); rpl_process_parent_event(dag->instance, p); } @@ -1031,6 +1049,7 @@ rpl_recalculate_ranks(void) while(p != NULL) { if(p->dag != NULL && p->dag->instance && p->updated) { p->updated = 0; + PRINTF("RPL: rpl_process_parent_event recalculate_ranks\n"); if(!rpl_process_parent_event(p->dag->instance, p)) { PRINTF("RPL: A parent was dropped\n"); } @@ -1210,7 +1229,7 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio) PRINTF(", rank %u, min_rank %u, ", instance->current_dag->rank, instance->current_dag->min_rank); PRINTF("parent rank %u, parent etx %u, link metric %u, instance etx %u\n", - p->rank, p->mc.obj.etx, p->link_metric, instance->mc.obj.etx); + p->rank, -1/*p->mc.obj.etx*/, p->link_metric, instance->mc.obj.etx); /* We have allocated a candidate parent; process the DIO further. */ diff --git a/core/net/rpl/rpl-icmp6.c b/core/net/rpl/rpl-icmp6.c index dee62fcff..2b9c87476 100644 --- a/core/net/rpl/rpl-icmp6.c +++ b/core/net/rpl/rpl-icmp6.c @@ -663,8 +663,13 @@ dao_input(void) rep = uip_ds6_route_lookup(&prefix); if(lifetime == RPL_ZERO_LIFETIME) { + PRINTF("RPL: No-Path DAO received\n"); /* No-Path DAO received; invoke the route purging routine. */ - if(rep != NULL && rep->state.nopath_received == 0 && rep->length == prefixlen && uip_ipaddr_cmp(uip_ds6_route_nexthop(rep), &dao_sender_addr)) { + if(rep != NULL && + rep->state.nopath_received == 0 && + rep->length == prefixlen && + uip_ds6_route_nexthop(rep) != NULL && + uip_ipaddr_cmp(uip_ds6_route_nexthop(rep), &dao_sender_addr)) { PRINTF("RPL: Setting expiration timer for prefix "); PRINT6ADDR(&prefix); PRINTF("\n"); @@ -677,12 +682,15 @@ dao_input(void) learned_from = uip_is_addr_mcast(&dao_sender_addr) ? RPL_ROUTE_FROM_MULTICAST_DAO : RPL_ROUTE_FROM_UNICAST_DAO; + PRINTF("RPL: DAO from %s\n", + learned_from == RPL_ROUTE_FROM_UNICAST_DAO? "unicast": "multicast"); if(learned_from == RPL_ROUTE_FROM_UNICAST_DAO) { /* Check whether this is a DAO forwarding loop. */ p = rpl_find_parent(dag, &dao_sender_addr); /* check if this is a new DAO registration with an "illegal" rank */ /* if we already route to this node it is likely */ - if(p != NULL && DAG_RANK(p->rank, instance) < DAG_RANK(dag->rank, instance)) { + if(p != NULL && + DAG_RANK(p->rank, instance) < DAG_RANK(dag->rank, instance)) { PRINTF("RPL: Loop detected when receiving a unicast DAO from a node with a lower rank! (%u < %u)\n", DAG_RANK(p->rank, instance), DAG_RANK(dag->rank, instance)); p->rank = INFINITE_RANK; @@ -691,6 +699,7 @@ dao_input(void) } } + PRINTF("RPL: adding DAO route\n"); rep = rpl_add_route(dag, &prefix, prefixlen, &dao_sender_addr); if(rep == NULL) { RPL_STAT(rpl_stats.mem_overflows++); @@ -704,7 +713,7 @@ dao_input(void) if(learned_from == RPL_ROUTE_FROM_UNICAST_DAO) { if(dag->preferred_parent) { PRINTF("RPL: Forwarding DAO to parent "); - PRINT6ADDR(&dag->preferred_parent->addr); + PRINT6ADDR(rpl_get_parent_ipaddr(dag->preferred_parent)); PRINTF("\n"); uip_icmp6_send(rpl_get_parent_ipaddr(dag->preferred_parent), ICMP6_RPL, RPL_CODE_DAO, buffer_length); @@ -789,7 +798,7 @@ dao_output_target(rpl_parent_t *parent, uip_ipaddr_t *prefix, uint8_t lifetime) PRINTF("RPL: Sending DAO with prefix "); PRINT6ADDR(prefix); PRINTF(" to "); - PRINT6ADDR(&parent->addr); + PRINT6ADDR(rpl_get_parent_ipaddr(parent)); PRINTF("\n"); uip_icmp6_send(rpl_get_parent_ipaddr(parent), ICMP6_RPL, RPL_CODE_DAO, pos); diff --git a/core/net/rpl/rpl.c b/core/net/rpl/rpl.c index cf01c286a..4ff9b1c6a 100644 --- a/core/net/rpl/rpl.c +++ b/core/net/rpl/rpl.c @@ -183,6 +183,7 @@ rpl_link_neighbor_callback(const rimeaddr_t *addr, int status, int numtx) parent = rpl_find_parent_any_dag(instance, &ipaddr); if(parent != NULL) { /* Trigger DAG rank recalculation. */ + PRINTF("RPL: rpl_link_neighbor_callback triggering update\n"); parent->updated = 1; if(instance->of->neighbor_link_callback != NULL) { instance->of->neighbor_link_callback(parent, status, numtx); @@ -208,6 +209,7 @@ rpl_ipv6_neighbor_callback(uip_ds6_nbr_t *nbr) if(p != NULL) { p->rank = INFINITE_RANK; /* Trigger DAG rank recalculation. */ + PRINTF("RPL: rpl_ipv6_neighbor_callback infinite rank\n"); p->updated = 1; } } diff --git a/core/net/uip-debug.c b/core/net/uip-debug.c index bc611f383..9a4f0cb48 100644 --- a/core/net/uip-debug.c +++ b/core/net/uip-debug.c @@ -43,6 +43,10 @@ void uip_debug_ipaddr_print(const uip_ipaddr_t *addr) { + if(addr == NULL || addr->u8 == NULL) { + printf("(NULL IP addr)"); + return; + } #if UIP_CONF_IPV6 uint16_t a; unsigned int i; From b42ccaed1bead2466ce9a6ad07668aa6109df50b Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 11 Aug 2013 23:46:26 +0200 Subject: [PATCH 11/29] Added function prototypes to a number of functions with void arguments --- core/net/nbr-table.c | 2 +- core/net/rpl/rpl-dag.c | 2 +- core/net/uip-ds6-nbr.c | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/core/net/nbr-table.c b/core/net/nbr-table.c index 74028d573..f5d53c333 100644 --- a/core/net/nbr-table.c +++ b/core/net/nbr-table.c @@ -157,7 +157,7 @@ nbr_set_bit(uint8_t *bitmap, nbr_table_t *table, nbr_table_item_t *item, int val } /*---------------------------------------------------------------------------*/ static nbr_table_key_t * -nbr_table_allocate() +nbr_table_allocate(void) { nbr_table_key_t *key; int least_used_count = 0; diff --git a/core/net/rpl/rpl-dag.c b/core/net/rpl/rpl-dag.c index 220d9facc..3b1e01c73 100644 --- a/core/net/rpl/rpl-dag.c +++ b/core/net/rpl/rpl-dag.c @@ -79,7 +79,7 @@ rpl_instance_t instance_table[RPL_MAX_INSTANCES]; rpl_instance_t *default_instance; /*---------------------------------------------------------------------------*/ void -rpl_dag_init() +rpl_dag_init(void) { nbr_table_register(rpl_parents, (nbr_table_callback *)rpl_remove_parent); } diff --git a/core/net/uip-ds6-nbr.c b/core/net/uip-ds6-nbr.c index 1826285c1..22d3a9f3c 100644 --- a/core/net/uip-ds6-nbr.c +++ b/core/net/uip-ds6-nbr.c @@ -200,10 +200,9 @@ uip_ds6_link_neighbor_callback(int status, int numtx) #endif /* UIP_DS6_LL_NUD */ } - /*---------------------------------------------------------------------------*/ void -uip_ds6_neighbor_periodic() +uip_ds6_neighbor_periodic(void) { /* Periodic processing on neighbors */ uip_ds6_nbr_t *nbr = nbr_table_head(ds6_neighbors); From c52fc2fd19d4fc6dce46e906039146001736d706 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Mon, 12 Aug 2013 00:19:12 +0200 Subject: [PATCH 12/29] Defensive programming: check for the argument being NULL. --- core/net/rpl/rpl-dag.c | 4 ++++ core/net/rpl/rpl-icmp6.c | 18 ++++++++++++++++++ core/net/uip-ds6-nbr.c | 10 ++++++---- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/core/net/rpl/rpl-dag.c b/core/net/rpl/rpl-dag.c index 3b1e01c73..379461a0b 100644 --- a/core/net/rpl/rpl-dag.c +++ b/core/net/rpl/rpl-dag.c @@ -1022,6 +1022,10 @@ rpl_local_repair(rpl_instance_t *instance) { int i; + if(instance == NULL) { + PRINTF("RPL: local repair requested for instance NULL\n"); + return; + } PRINTF("RPL: Starting a local instance repair\n"); for(i = 0; i < RPL_MAX_DAG_PER_INSTANCE; i++) { if(instance->dag_table[i].used) { diff --git a/core/net/rpl/rpl-icmp6.c b/core/net/rpl/rpl-icmp6.c index 2b9c87476..2b773c5de 100644 --- a/core/net/rpl/rpl-icmp6.c +++ b/core/net/rpl/rpl-icmp6.c @@ -750,9 +750,27 @@ dao_output_target(rpl_parent_t *parent, uip_ipaddr_t *prefix, uint8_t lifetime) /* Destination Advertisement Object */ + if(parent == NULL) { + PRINTF("RPL dao_output_target error parent NULL\n"); + return; + } + dag = parent->dag; + if(dag == NULL) { + PRINTF("RPL dao_output_target error dag NULL\n"); + return; + } + instance = dag->instance; + if(instance == NULL) { + PRINTF("RPL dao_output_target error instance NULL\n"); + return; + } + if(prefix == NULL) { + PRINTF("RPL dao_output_target error prefix NULL\n"); + return; + } #ifdef RPL_DEBUG_DAO_OUTPUT RPL_DEBUG_DAO_OUTPUT(parent); #endif diff --git a/core/net/uip-ds6-nbr.c b/core/net/uip-ds6-nbr.c index 22d3a9f3c..5d7b05ba8 100644 --- a/core/net/uip-ds6-nbr.c +++ b/core/net/uip-ds6-nbr.c @@ -143,11 +143,13 @@ uip_ds6_nbr_t * uip_ds6_nbr_lookup(uip_ipaddr_t *ipaddr) { uip_ds6_nbr_t *nbr = nbr_table_head(ds6_neighbors); - while(nbr != NULL) { - if(uip_ipaddr_cmp(&nbr->ipaddr, ipaddr)) { - return nbr; + if(ipaddr != NULL) { + while(nbr != NULL) { + if(uip_ipaddr_cmp(&nbr->ipaddr, ipaddr)) { + return nbr; + } + nbr = nbr_table_next(ds6_neighbors, nbr); } - nbr = nbr_table_next(ds6_neighbors, nbr); } return NULL; } From 9a74ada90c02a13787b413313fa76812a9b5ce68 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 11 Aug 2013 23:50:37 +0200 Subject: [PATCH 13/29] Added a function rpl_get_parent_link_metric() for obtaining the link metric of a given parent --- core/net/rpl/rpl-dag.c | 11 +++++++++++ core/net/rpl/rpl.h | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/core/net/rpl/rpl-dag.c b/core/net/rpl/rpl-dag.c index 379461a0b..826c7152b 100644 --- a/core/net/rpl/rpl-dag.c +++ b/core/net/rpl/rpl-dag.c @@ -95,6 +95,17 @@ rpl_get_parent_rank(uip_lladdr_t *addr) } } /*---------------------------------------------------------------------------*/ +uint16_t +rpl_get_parent_link_metric(uip_lladdr_t *addr) +{ + rpl_parent_t *p = nbr_table_get_from_lladdr(rpl_parents, (rimeaddr_t *)addr); + if(p != NULL) { + return p->link_metric; + } else { + return 0; + } +} +/*---------------------------------------------------------------------------*/ uip_ipaddr_t * rpl_get_parent_ipaddr(rpl_parent_t *p) { diff --git a/core/net/rpl/rpl.h b/core/net/rpl/rpl.h index 6109874ef..689e2063b 100644 --- a/core/net/rpl/rpl.h +++ b/core/net/rpl/rpl.h @@ -244,6 +244,7 @@ void rpl_remove_header(void); uint8_t rpl_invert_header(void); uip_ipaddr_t *rpl_get_parent_ipaddr(rpl_parent_t *nbr); rpl_rank_t rpl_get_parent_rank(uip_lladdr_t *addr); -void rpl_dag_init(); +uint16_t rpl_get_parent_link_metric(uip_lladdr_t *addr); +void rpl_dag_init(void); /*---------------------------------------------------------------------------*/ #endif /* RPL_H */ From a027832f940c8c1cfbc39235f71854deaf7371c8 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 11 Aug 2013 23:53:36 +0200 Subject: [PATCH 14/29] Fixed a bunch of compiler warnings --- core/net/rpl/rpl-dag.c | 5 ++++- core/net/rpl/rpl-ext-header.c | 2 -- core/net/rpl/rpl-icmp6.c | 11 +++++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/core/net/rpl/rpl-dag.c b/core/net/rpl/rpl-dag.c index 826c7152b..f2ea37806 100644 --- a/core/net/rpl/rpl-dag.c +++ b/core/net/rpl/rpl-dag.c @@ -1076,10 +1076,13 @@ rpl_recalculate_ranks(void) int rpl_process_parent_event(rpl_instance_t *instance, rpl_parent_t *p) { - rpl_rank_t old_rank; int return_value; +#if DEBUG + rpl_rank_t old_rank; old_rank = instance->current_dag->rank; +#endif /* DEBUG */ + return_value = 1; if(!acceptable_rank(p->dag, p->rank)) { diff --git a/core/net/rpl/rpl-ext-header.c b/core/net/rpl/rpl-ext-header.c index 95221a82d..96c709f71 100644 --- a/core/net/rpl/rpl-ext-header.c +++ b/core/net/rpl/rpl-ext-header.c @@ -255,10 +255,8 @@ rpl_update_header_final(uip_ipaddr_t *addr) void rpl_remove_header(void) { - int last_uip_ext_len; uint8_t temp_len; - last_uip_ext_len = uip_ext_len; uip_ext_len = 0; PRINTF("RPL: Verifying the presence of the RPL header option\n"); diff --git a/core/net/rpl/rpl-icmp6.c b/core/net/rpl/rpl-icmp6.c index 2b773c5de..362d1a2d8 100644 --- a/core/net/rpl/rpl-icmp6.c +++ b/core/net/rpl/rpl-icmp6.c @@ -575,8 +575,10 @@ dao_input(void) uint8_t prefixlen; uint8_t flags; uint8_t subopt_type; + /* uint8_t pathcontrol; uint8_t pathsequence; + */ uip_ipaddr_t prefix; uip_ds6_route_t *rep; uint8_t buffer_length; @@ -628,8 +630,7 @@ dao_input(void) } /* Check if there are any RPL options present. */ - i = pos; - for(; i < buffer_length; i += len) { + for(i = pos; i < buffer_length; i += len) { subopt_type = buffer[i]; if(subopt_type == RPL_OPTION_PAD1) { len = 1; @@ -647,8 +648,8 @@ dao_input(void) break; case RPL_OPTION_TRANSIT: /* The path sequence and control are ignored. */ - pathcontrol = buffer[i + 3]; - pathsequence = buffer[i + 4]; + /* pathcontrol = buffer[i + 3]; + pathsequence = buffer[i + 4];*/ lifetime = buffer[i + 5]; /* The parent address is also ignored. */ break; @@ -825,6 +826,7 @@ dao_output_target(rpl_parent_t *parent, uip_ipaddr_t *prefix, uint8_t lifetime) static void dao_ack_input(void) { +#if DEBUG unsigned char *buffer; uint8_t buffer_length; uint8_t instance_id; @@ -842,6 +844,7 @@ dao_ack_input(void) sequence, status); PRINT6ADDR(&UIP_IP_BUF->srcipaddr); PRINTF("\n"); +#endif /* DEBUG */ } /*---------------------------------------------------------------------------*/ void From 08761dfd8a9dd4751e701d8c10175a8172519514 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 11 Aug 2013 23:55:08 +0200 Subject: [PATCH 15/29] Added a function uip_ds6_nbr_num() for getting the number of neighbors --- core/net/uip-ds6-nbr.c | 14 ++++++++++++++ core/net/uip-ds6-nbr.h | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/core/net/uip-ds6-nbr.c b/core/net/uip-ds6-nbr.c index 5d7b05ba8..43a16f4f4 100644 --- a/core/net/uip-ds6-nbr.c +++ b/core/net/uip-ds6-nbr.c @@ -137,7 +137,21 @@ uip_ds6_nbr_get_ll(uip_ds6_nbr_t *nbr) { return (uip_lladdr_t *)nbr_table_get_lladdr(ds6_neighbors, nbr); } +/*---------------------------------------------------------------------------*/ +int +uip_ds6_nbr_num(void) +{ + uip_ds6_nbr_t *nbr; + int num; + num = 0; + for(nbr = nbr_table_head(ds6_neighbors); + nbr != NULL; + nbr = nbr_table_next(ds6_neighbors, nbr)) { + num++; + } + return num; +} /*---------------------------------------------------------------------------*/ uip_ds6_nbr_t * uip_ds6_nbr_lookup(uip_ipaddr_t *ipaddr) diff --git a/core/net/uip-ds6-nbr.h b/core/net/uip-ds6-nbr.h index 9371255ff..18251e189 100644 --- a/core/net/uip-ds6-nbr.h +++ b/core/net/uip-ds6-nbr.h @@ -93,7 +93,8 @@ uip_ds6_nbr_t *uip_ds6_nbr_ll_lookup(uip_lladdr_t *lladdr); uip_ipaddr_t *uip_ds6_nbr_ipaddr_from_lladdr(uip_lladdr_t *lladdr); uip_lladdr_t *uip_ds6_nbr_lladdr_from_ipaddr(uip_ipaddr_t *ipaddr); void uip_ds6_link_neighbor_callback(int status, int numtx); -void uip_ds6_neighbor_periodic(); +void uip_ds6_neighbor_periodic(void); +int uip_ds6_nbr_num(void); /** * \brief From abb3ef9b3b849521e268252f1b3e45cd9ceebc2c Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Mon, 12 Aug 2013 00:01:07 +0200 Subject: [PATCH 16/29] Bugfix: don't set the parent if the dag is NULL --- core/net/rpl/rpl-dag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/net/rpl/rpl-dag.c b/core/net/rpl/rpl-dag.c index f2ea37806..5719c811f 100644 --- a/core/net/rpl/rpl-dag.c +++ b/core/net/rpl/rpl-dag.c @@ -135,8 +135,8 @@ rpl_set_preferred_parent(rpl_dag_t *dag, rpl_parent_t *p) * neighbor table. */ nbr_table_unlock(rpl_parents, dag->preferred_parent); nbr_table_lock(rpl_parents, p); + dag->preferred_parent = p; } - dag->preferred_parent = p; } /*---------------------------------------------------------------------------*/ /* Greater-than function for the lollipop counter. */ From d830e9df3fff6d4e284c7f3c75de5eae71918087 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Mon, 12 Aug 2013 00:06:12 +0200 Subject: [PATCH 17/29] Implement forwarding error handling: if a packet changes direction, we set the FWD_ERR flag. If we see the FWD_ERR flag, we drop the route that we sent it to. If we are the root node, we also initiate a global repair. --- core/net/rpl/rpl-ext-header.c | 64 +++++++++++++++++++++++++---------- 1 file changed, 47 insertions(+), 17 deletions(-) diff --git a/core/net/rpl/rpl-ext-header.c b/core/net/rpl/rpl-ext-header.c index 96c709f71..2bd0cb77c 100644 --- a/core/net/rpl/rpl-ext-header.c +++ b/core/net/rpl/rpl-ext-header.c @@ -75,12 +75,6 @@ rpl_verify_header(int uip_ext_opt_offset) return 1; } - if(UIP_EXT_HDR_OPT_RPL_BUF->flags & RPL_HDR_OPT_FWD_ERR) { - PRINTF("RPL: Forward error!\n"); - /* We should try to repair it, not implemented for the moment */ - return 2; - } - instance = rpl_get_instance(UIP_EXT_HDR_OPT_RPL_BUF->instance); if(instance == NULL) { PRINTF("RPL: Unknown instance: %u\n", @@ -88,6 +82,31 @@ rpl_verify_header(int uip_ext_opt_offset) return 1; } + if(UIP_EXT_HDR_OPT_RPL_BUF->flags & RPL_HDR_OPT_FWD_ERR) { + PRINTF("RPL: Forward error!\n"); + /* We should try to repair it by removing the neighbor that caused + the packet to be forwareded in the first place. We drop any + routes that go through the neighbor that sent the packet to + us. */ + uip_ds6_route_t *route; + route = uip_ds6_route_lookup(&UIP_IP_BUF->destipaddr); + if(route != NULL) { + uip_ds6_route_rm(route); + + /* If we are the root and just needed to remove a DAO route, + chances are that the network needs to be repaired. The + rpl_repair_root() function will cause a global repair if we + happen to be the root node of the dag. */ + PRINTF("RPL: initiate global repair\n"); + rpl_repair_root(instance->instance_id); + } + + /* Remove the forwarding error flag and return 0 to let the packet + be forwarded again. */ + UIP_EXT_HDR_OPT_RPL_BUF->flags &= ~RPL_HDR_OPT_FWD_ERR; + return 0; + } + if(!instance->current_dag->joined) { PRINTF("RPL: No DAG in the instance\n"); return 1; @@ -191,18 +210,29 @@ rpl_update_header_empty(void) PRINTF("RPL: Updating RPL option\n"); UIP_EXT_HDR_OPT_RPL_BUF->senderrank = instance->current_dag->rank; - - /* Set the down extension flag correctly as described in Section - 11.2 of RFC6550. If the packet progresses along a DAO route, - the down flag should be set. */ - - if(uip_ds6_route_lookup(&UIP_IP_BUF->destipaddr) == NULL) { - /* No route was found, so this packet will go towards the RPL - root. If so, we should not set the down flag. */ - UIP_EXT_HDR_OPT_RPL_BUF->flags &= ~RPL_HDR_OPT_DOWN; + /* Check the direction of the down flag, as per Section 11.2.2.3, + which states that if a packet is going down it should in + general not go back up again. If this happens, a + RPL_HDR_OPT_FWD_ERR should be flagged. */ + if((UIP_EXT_HDR_OPT_RPL_BUF->flags & RPL_HDR_OPT_DOWN)) { + if(uip_ds6_route_lookup(&UIP_IP_BUF->destipaddr) == NULL) { + UIP_EXT_HDR_OPT_RPL_BUF->flags |= RPL_HDR_OPT_FWD_ERR; + PRINTF("RPL forwarding error\n"); + } } else { - /* A DAO route was found so we set the down flag. */ - UIP_EXT_HDR_OPT_RPL_BUF->flags |= RPL_HDR_OPT_DOWN; + /* Set the down extension flag correctly as described in Section + 11.2 of RFC6550. If the packet progresses along a DAO route, + the down flag should be set. */ + if(uip_ds6_route_lookup(&UIP_IP_BUF->destipaddr) == NULL) { + /* No route was found, so this packet will go towards the RPL + root. If so, we should not set the down flag. */ + UIP_EXT_HDR_OPT_RPL_BUF->flags &= ~RPL_HDR_OPT_DOWN; + PRINTF("RPL option going up\n"); + } else { + /* A DAO route was found so we set the down flag. */ + UIP_EXT_HDR_OPT_RPL_BUF->flags |= RPL_HDR_OPT_DOWN; + PRINTF("RPL option going down\n"); + } } uip_ext_len = last_uip_ext_len; From 34119b7ef22cb2ed44ae54c889a2177678371ec0 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Mon, 12 Aug 2013 00:07:13 +0200 Subject: [PATCH 18/29] Poor man's loop reparation: reset the DIO timer and hope the neighbor learns a better route. --- core/net/rpl/rpl-ext-header.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/net/rpl/rpl-ext-header.c b/core/net/rpl/rpl-ext-header.c index 2bd0cb77c..3b7851c81 100644 --- a/core/net/rpl/rpl-ext-header.c +++ b/core/net/rpl/rpl-ext-header.c @@ -132,7 +132,9 @@ rpl_verify_header(int uip_ext_opt_offset) if(UIP_EXT_HDR_OPT_RPL_BUF->flags & RPL_HDR_OPT_RANK_ERR) { PRINTF("RPL: Rank error signalled in RPL option!\n"); /* We should try to repair it, not implemented for the moment */ - return 3; + rpl_reset_dio_timer(instance); + /* Forward the packet anyway. */ + return 0; } PRINTF("RPL: Single error tolerated\n"); UIP_EXT_HDR_OPT_RPL_BUF->flags |= RPL_HDR_OPT_RANK_ERR; From e5a6565137fb868b85293085345847217f4145a0 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Mon, 12 Aug 2013 00:11:09 +0200 Subject: [PATCH 19/29] Loop detection via DAO: if we get a DAO from a parent, that parent thinks we are its parent. We poison it and recalulate our parents. --- core/net/rpl/rpl-icmp6.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/net/rpl/rpl-icmp6.c b/core/net/rpl/rpl-icmp6.c index 362d1a2d8..06f727e3a 100644 --- a/core/net/rpl/rpl-icmp6.c +++ b/core/net/rpl/rpl-icmp6.c @@ -698,6 +698,14 @@ dao_input(void) p->updated = 1; return; } + + /* If we get the DAO from our parent, we also have a loop. */ + if(p != NULL && p == dag->preferred_parent) { + PRINTF("RPL: Loop detected when receiving a unicast DAO from our parent\n"); + p->rank = INFINITE_RANK; + p->updated = 1; + return; + } } PRINTF("RPL: adding DAO route\n"); From 4d0ecaae0284b9d1f85b5186c1b4829b5b450d34 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Mon, 12 Aug 2013 00:11:48 +0200 Subject: [PATCH 20/29] Make sure our parent's IP address isn't NULL. --- core/net/rpl/rpl-icmp6.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/net/rpl/rpl-icmp6.c b/core/net/rpl/rpl-icmp6.c index 06f727e3a..1f3009555 100644 --- a/core/net/rpl/rpl-icmp6.c +++ b/core/net/rpl/rpl-icmp6.c @@ -720,7 +720,8 @@ dao_input(void) rep->state.learned_from = learned_from; if(learned_from == RPL_ROUTE_FROM_UNICAST_DAO) { - if(dag->preferred_parent) { + if(dag->preferred_parent != NULL && + rpl_get_parent_ipaddr(dag->preferred_parent) != NULL) { PRINTF("RPL: Forwarding DAO to parent "); PRINT6ADDR(rpl_get_parent_ipaddr(dag->preferred_parent)); PRINTF("\n"); @@ -828,7 +829,9 @@ dao_output_target(rpl_parent_t *parent, uip_ipaddr_t *prefix, uint8_t lifetime) PRINT6ADDR(rpl_get_parent_ipaddr(parent)); PRINTF("\n"); - uip_icmp6_send(rpl_get_parent_ipaddr(parent), ICMP6_RPL, RPL_CODE_DAO, pos); + if(rpl_get_parent_ipaddr(parent) != NULL) { + uip_icmp6_send(rpl_get_parent_ipaddr(parent), ICMP6_RPL, RPL_CODE_DAO, pos); + } } /*---------------------------------------------------------------------------*/ static void From d0a939afb071e5db384293ec361ea05fa714ba13 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Mon, 12 Aug 2013 00:12:29 +0200 Subject: [PATCH 21/29] Bugfix: must multiply with ETX divisor to turn into fixed-point format. --- core/net/rpl/rpl-mrhof.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/net/rpl/rpl-mrhof.c b/core/net/rpl/rpl-mrhof.c index c34ea0074..9fdc82f05 100644 --- a/core/net/rpl/rpl-mrhof.c +++ b/core/net/rpl/rpl-mrhof.c @@ -113,11 +113,11 @@ neighbor_link_callback(rpl_parent_t *p, int status, int numtx) /* Do not penalize the ETX when collisions or transmission errors occur. */ if(status == MAC_TX_OK || status == MAC_TX_NOACK) { int recorded_etx = p->link_metric; - int packet_etx = numtx; + int packet_etx = numtx * RPL_DAG_MC_ETX_DIVISOR; int new_etx; if(status == MAC_TX_NOACK) { - packet_etx = MAX_LINK_METRIC; + packet_etx = MAX_LINK_METRIC * RPL_DAG_MC_ETX_DIVISOR; } new_etx = ((uint16_t)recorded_etx * ETX_ALPHA + From 8dc4e4696847a2ee5029516a331c8d48b1d1a6b5 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Mon, 12 Aug 2013 00:18:27 +0200 Subject: [PATCH 22/29] Check if the nexthop neighbor for a given route has disappeared. If so, we drop the route too. If we happen to be the RPL root, we also initiate a global repair as the neighbor may moved. --- core/net/tcpip.c | 69 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 56 insertions(+), 13 deletions(-) diff --git a/core/net/tcpip.c b/core/net/tcpip.c index cf22a0556..5a94a1688 100644 --- a/core/net/tcpip.c +++ b/core/net/tcpip.c @@ -561,14 +561,22 @@ tcpip_ipv6_output(void) if(!uip_is_addr_mcast(&UIP_IP_BUF->destipaddr)) { /* Next hop determination */ nbr = NULL; + + /* We first check if the destination address is on our immediate + link. If so, we simply use the destination address as our + nexthop address. */ if(uip_ds6_is_addr_onlink(&UIP_IP_BUF->destipaddr)){ nexthop = &UIP_IP_BUF->destipaddr; } else { - uip_ds6_route_t* locrt; - locrt = uip_ds6_route_lookup(&UIP_IP_BUF->destipaddr); - if(locrt == NULL) { + uip_ds6_route_t *route; + /* Check if we have a route to the destination address. */ + route = uip_ds6_route_lookup(&UIP_IP_BUF->destipaddr); + + /* No route was found - we send to the default route instead. */ + if(route == NULL) { PRINTF("tcpip_ipv6_output: no route found, using default route\n"); - if((nexthop = uip_ds6_defrt_choose()) == NULL) { + nexthop = uip_ds6_defrt_choose(); + if(nexthop == NULL) { #ifdef UIP_FALLBACK_INTERFACE PRINTF("FALLBACK: removing ext hdrs & setting proto %d %d\n", uip_ext_len, *((uint8_t *)UIP_IP_BUF + 40)); @@ -586,26 +594,61 @@ tcpip_ipv6_output(void) uip_len = 0; return; } + } else { - nexthop = uip_ds6_route_nexthop(locrt); + /* A route was found, so we look up the nexthop neighbor for + the route. */ + nexthop = uip_ds6_route_nexthop(route); + + /* If the nexthop is dead, for example because the neighbor + never responded to link-layer acks, we drop its route. */ + if(nexthop == NULL) { +#if UIP_CONF_IPV6_RPL + /* If we are running RPL, and if we are the root of the + network, we'll trigger a global repair berfore we remove + the route. */ + rpl_dag_t *dag; + rpl_instance_t *instance; + + dag = (rpl_dag_t *)route->state.dag; + if(dag != NULL) { + instance = dag->instance; + + rpl_repair_root(instance->instance_id); + } +#endif /* UIP_CONF_RPL */ + uip_ds6_route_rm(route); + + /* We don't have a nexthop to send the packet to, so we drop + it. */ + return; + } } - if(nexthop != NULL) { - PRINTF("tcpip_ipv6_output: next hop "); - PRINT6ADDR(nexthop); - PRINTF("\n"); #if TCPIP_CONF_ANNOTATE_TRANSMISSIONS - printf("#L %u 1; red\n", nexthop->u8[sizeof(uip_ipaddr_t) - 1]); -#endif /* TCPIP_CONF_ANNOTATE_TRANSMISSIONS */ + if(nexthop != NULL) { + static uint8_t annotate_last; + static uint8_t annotate_has_last = 0; + + if(annotate_has_last) { + printf("#L %u 0; red\n", annotate_last); + } + printf("#L %u 1; red\n", nexthop->u8[sizeof(uip_ipaddr_t) - 1]); + annotate_last = nexthop->u8[sizeof(uip_ipaddr_t) - 1]; + annotate_has_last = 1; } +#endif /* TCPIP_CONF_ANNOTATE_TRANSMISSIONS */ } + /* End of next hop determination */ + #if UIP_CONF_IPV6_RPL if(rpl_update_header_final(nexthop)) { uip_len = 0; return; } #endif /* UIP_CONF_IPV6_RPL */ - if((nbr = uip_ds6_nbr_lookup(nexthop)) == NULL) { + nbr = uip_ds6_nbr_lookup(nexthop); + if(nbr == NULL) { #if UIP_ND6_SEND_NA if((nbr = uip_ds6_nbr_add(nexthop, NULL, 0, NBR_INCOMPLETE)) == NULL) { uip_len = 0; @@ -679,8 +722,8 @@ tcpip_ipv6_output(void) uip_len = 0; return; } + return; } - /* Multicast IP destination address. */ tcpip_output(NULL); uip_len = 0; From bfd7e5f25be12ee4f71d3767fbd49b19a1995775 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Mon, 12 Aug 2013 00:22:21 +0200 Subject: [PATCH 23/29] Fixed a few bugs in the route handling code. While bughunting, rewrote parts of the code to make its intention clearer. Also added a bunch of comments to make the logic of the code more evident. --- core/net/uip-ds6-route.c | 203 +++++++++++++++++++++++++++++++-------- core/net/uip-ds6-route.h | 13 ++- 2 files changed, 176 insertions(+), 40 deletions(-) diff --git a/core/net/uip-ds6-route.c b/core/net/uip-ds6-route.c index 3aefa14bf..917ee266e 100644 --- a/core/net/uip-ds6-route.c +++ b/core/net/uip-ds6-route.c @@ -40,11 +40,22 @@ #include -void uip_ds6_route_rm_routelist(list_t nbr_table_get_from_lladdr); +/* The nbr_routes holds a neighbor table to be able to maintain + information about what routes go through what neighbor. This + neighbor table is registered with the central nbr-table repository + so that it will be maintained along with the rest of the neighbor + tables in the system. */ +NBR_TABLE(struct uip_ds6_route_neighbor_routes, nbr_routes); -NBR_TABLE(uip_ds6_route_t *, nbr_routes); +/* Each route is repressented by a uip_ds6_route_t structure and + memory for each route is allocated from the routememb memory + block. These routes are maintained on lists of route entries that + are attached to each neighbor, via the nbr_routes neighbor + table. */ MEMB(routememb, uip_ds6_route_t, UIP_DS6_ROUTE_NB); +/* Default routes are held on the defaultrouterlist and their + structures are allocated from the defaultroutermemb memory block.*/ LIST(defaultrouterlist); MEMB(defaultroutermemb, uip_ds6_defrt_t, UIP_DS6_DEFRT_NB); @@ -58,6 +69,35 @@ static int num_routes = 0; #define DEBUG DEBUG_NONE #include "net/uip-debug.h" +static void rm_routelist_callback(nbr_table_item_t *ptr); +/*---------------------------------------------------------------------------*/ +#if DEBUG != DEBUG_NONE +static void +assert_nbr_routes_list_sane(void) +{ + uip_ds6_route_t *r; + int count; + + /* Check if the route list has an infinite loop. */ + for(r = uip_ds6_route_head(), + count = 0; + r != NULL && + count < UIP_DS6_ROUTE_NB; + r = uip_ds6_route_next(r), + count++); + + if(count >= UIP_DS6_ROUTE_NB) { + printf("uip-ds6-route.c: assert_nbr_routes_list_sane route list is in infinite loop\n"); + } + + /* Make sure that the route list has as many entries as the + num_routes vairable. */ + if(count < num_routes) { + printf("uip-ds6-route.c: assert_nbr_routes_list_sane too few entries on route list: should be %d, is %d, max %d\n", + num_routes, count, UIP_CONF_MAX_ROUTES); + } +} +#endif /* DEBUG != DEBUG_NONE */ /*---------------------------------------------------------------------------*/ #if UIP_DS6_NOTIFICATIONS static void @@ -100,7 +140,8 @@ void uip_ds6_route_init(void) { memb_init(&routememb); - nbr_table_register(nbr_routes, (nbr_table_callback *)uip_ds6_route_rm_routelist); + nbr_table_register(nbr_routes, + (nbr_table_callback *)rm_routelist_callback); memb_init(&defaultroutermemb); list_init(defaultrouterlist); @@ -114,7 +155,7 @@ static uip_lladdr_t * uip_ds6_route_nexthop_lladdr(uip_ds6_route_t *route) { if(route != NULL) { - return (uip_lladdr_t *)nbr_table_get_lladdr(nbr_routes, route->route_list); + return (uip_lladdr_t *)nbr_table_get_lladdr(nbr_routes, route->routes); } else { return NULL; } @@ -133,9 +174,14 @@ uip_ds6_route_nexthop(uip_ds6_route_t *route) uip_ds6_route_t * uip_ds6_route_head(void) { - list_t nbr_route_list = nbr_table_head(nbr_routes); - if(nbr_route_list != NULL) { - return list_head((list_t)nbr_route_list); + struct uip_ds6_route_neighbor_routes *routes; + + routes = (struct uip_ds6_route_neighbor_routes *)nbr_table_head(nbr_routes); + if(routes != NULL) { + if(list_head(routes->route_list) == NULL) { + PRINTF("uip_ds6_route_head lead_head(nbr_route_list) is NULL\n"); + } + return list_head(routes->route_list); } else { return NULL; } @@ -149,9 +195,11 @@ uip_ds6_route_next(uip_ds6_route_t *r) if(n != NULL) { return n; } else { - list_t nbr_route_list = nbr_table_next(nbr_routes, r->route_list); - if(nbr_route_list != NULL) { - return list_head((list_t)nbr_route_list); + struct uip_ds6_route_neighbor_routes *routes; + routes = (struct uip_ds6_route_neighbor_routes *) + nbr_table_next(nbr_routes, r->routes); + if(routes != NULL) { + return list_head(routes->route_list); } } } @@ -207,7 +255,10 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length, uip_ipaddr_t *nexthop) { uip_ds6_route_t *r; - list_t nbr_route_list; + +#if DEBUG != DEBUG_NONE + assert_nbr_routes_list_sane(); +#endif /* DEBUG != DEBUG_NONE */ /* Get link-layer address of next hop, make sure it is in neighbor table */ uip_lladdr_t *nexthop_lladdr = uip_ds6_nbr_lladdr_from_ipaddr(nexthop); @@ -218,9 +269,6 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length, return NULL; } - /* Get routing entry list of this neighbor */ - nbr_route_list = nbr_table_get_from_lladdr(nbr_routes, (rimeaddr_t *)nexthop_lladdr); - /* First make sure that we don't add a route twice. If we find an existing route for our destination, we'll just update the old one. */ @@ -230,34 +278,56 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length, PRINT6ADDR(ipaddr); PRINTF("\n"); } else { + struct uip_ds6_route_neighbor_routes *routes; /* If there is no routing entry, create one */ - if(nbr_route_list == NULL) { - nbr_route_list = nbr_table_add_lladdr(nbr_routes, (rimeaddr_t *)nexthop_lladdr); - if(nbr_route_list == NULL) { - PRINTF("uip_ds6_route_add: could not allocate memory (route list) for new route to "); + + /* Every neighbor on our neighbor table holds a struct + uip_ds6_route_neighbor_routes which holds a list of routes that + go through the neighbor. We add our route entry to this list. + + We first check to see if we already have this neighbor in our + nbr_route table. If so, the neighbor already has a route entry + list. + */ + routes = nbr_table_get_from_lladdr(nbr_routes, + (rimeaddr_t *)nexthop_lladdr); + + if(routes == NULL) { + /* If the neighbor did not have an entry in our neighbor table, + we create one. The nbr_table_add_lladdr() function returns a + pointer to a pointer that we may use for our own purposes. We + initialize this pointer with the list of routing entries that + are attached to this neighbor. */ + routes = nbr_table_add_lladdr(nbr_routes, + (rimeaddr_t *)nexthop_lladdr); + if(routes == NULL) { + PRINTF("uip_ds6_route_add: could not allocate a neighbor table entri for new route to "); PRINT6ADDR(ipaddr); PRINTF(", dropping it\n"); return NULL; } - list_init((list_t)nbr_route_list); + LIST_STRUCT_INIT(routes, route_list); } - /* Allocate a routing entry and add the route to the list */ + /* Allocate a routing entry and populate it. */ r = memb_alloc(&routememb); + if(r == NULL) { PRINTF("uip_ds6_route_add: could not allocate memory for new route to "); PRINT6ADDR(ipaddr); PRINTF(", dropping it\n"); return NULL; } + + /* Add the route to this neighbor */ - list_add((list_t)nbr_route_list, r); + list_add(routes->route_list, r); num_routes++; PRINTF("uip_ds6_route_add num %d\n", num_routes); + r->routes = routes; } - r->route_list = nbr_route_list; uip_ipaddr_copy(&(r->ipaddr), ipaddr); r->length = length; @@ -276,6 +346,9 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length, call_route_callback(UIP_DS6_NOTIFICATION_ROUTE_ADD, ipaddr, nexthop); #endif +#if DEBUG != DEBUG_NONE + assert_nbr_routes_list_sane(); +#endif /* DEBUG != DEBUG_NONE */ return r; } @@ -283,13 +356,22 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length, void uip_ds6_route_rm(uip_ds6_route_t *route) { - if(route != NULL && route->route_list != NULL) { +#if DEBUG != DEBUG_NONE + assert_nbr_routes_list_sane(); +#endif /* DEBUG != DEBUG_NONE */ + if(route != NULL && route->routes != NULL) { - if(list_head((list_t)route->route_list) == NULL) { - /* If this was the only route using this neighbor, remove the neibhor from the table */ - nbr_table_remove(nbr_routes, route->route_list); + PRINTF("uip_ds6_route_rm: removing route: "); + PRINT6ADDR(&route->ipaddr); + PRINTF("\n"); + + list_remove(route->routes->route_list, route); + if(list_head(route->routes->route_list) == NULL) { + /* If this was the only route using this neighbor, remove the + neibhor from the table */ + PRINTF("uip_ds6_route_rm: removing neighbor too\n"); + nbr_table_remove(nbr_routes, route->routes->route_list); } - list_remove((list_t)route->route_list, route); memb_free(&routememb, route); num_routes--; @@ -300,13 +382,19 @@ uip_ds6_route_rm(uip_ds6_route_t *route) call_route_callback(UIP_DS6_NOTIFICATION_ROUTE_RM, &route->ipaddr, uip_ds6_route_nexthop(route)); #endif -#if (DEBUG & DEBUG_ANNOTATE) == DEBUG_ANNOTATE +#if 0 //(DEBUG & DEBUG_ANNOTATE) == DEBUG_ANNOTATE /* we need to check if this was the last route towards "nexthop" */ /* if so - remove that link (annotation) */ + uip_ds6_route_t *r; for(r = uip_ds6_route_head(); r != NULL; r = uip_ds6_route_next(r)) { - if(uip_ipaddr_cmp(uip_ds6_route_nexthop(r), uip_ds6_route_nexthop(route))) { + uip_ipaddr_t *nextr, *nextroute; + nextr = uip_ds6_route_nexthop(r); + nextroute = uip_ds6_route_nexthop(route); + if(nextr != NULL && + nextroute != NULL && + uip_ipaddr_cmp(nextr, nextroute)) { /* we found another link using the specific nexthop, so keep the #L */ return; } @@ -314,30 +402,51 @@ uip_ds6_route_rm(uip_ds6_route_t *route) ANNOTATE("#L %u 0\n", uip_ds6_route_nexthop(route)->u8[sizeof(uip_ipaddr_t) - 1]); #endif } + +#if DEBUG != DEBUG_NONE + assert_nbr_routes_list_sane(); +#endif /* DEBUG != DEBUG_NONE */ return; } /*---------------------------------------------------------------------------*/ -void -uip_ds6_route_rm_routelist(list_t nbr_route_list) +static void +rm_routelist(struct uip_ds6_route_neighbor_routes *routes) { - if(nbr_route_list != NULL) { +#if DEBUG != DEBUG_NONE + assert_nbr_routes_list_sane(); +#endif /* DEBUG != DEBUG_NONE */ + PRINTF("uip_ds6_route_rm_routelist\n"); + if(routes != NULL && routes->route_list != NULL) { uip_ds6_route_t *r; - r = list_head((list_t)nbr_route_list); + r = list_head(routes->route_list); while(r != NULL) { uip_ds6_route_rm(r); - r = list_head((list_t)nbr_route_list); + r = list_head(routes->route_list); } - nbr_table_remove(nbr_routes, nbr_route_list); + nbr_table_remove(nbr_routes, routes); } +#if DEBUG != DEBUG_NONE + assert_nbr_routes_list_sane(); +#endif /* DEBUG != DEBUG_NONE */ +} +/*---------------------------------------------------------------------------*/ +static void +rm_routelist_callback(nbr_table_item_t *ptr) +{ + rm_routelist((struct uip_ds6_route_neighbor_routes *)ptr); } /*---------------------------------------------------------------------------*/ void uip_ds6_route_rm_by_nexthop(uip_ipaddr_t *nexthop) { /* Get routing entry list of this neighbor */ - uip_lladdr_t *nexthop_lladdr = uip_ds6_nbr_lladdr_from_ipaddr(nexthop); - list_t nbr_route_list = nbr_table_get_from_lladdr(nbr_routes, (rimeaddr_t *)nexthop_lladdr); - uip_ds6_route_rm_routelist(nbr_route_list); + uip_lladdr_t *nexthop_lladdr; + struct uip_ds6_route_neighbor_routes *routes; + + nexthop_lladdr = uip_ds6_nbr_lladdr_from_ipaddr(nexthop); + routes = nbr_table_get_from_lladdr(nbr_routes, + (rimeaddr_t *)nexthop_lladdr); + rm_routelist(routes); } /*---------------------------------------------------------------------------*/ uip_ds6_defrt_t * @@ -345,6 +454,11 @@ uip_ds6_defrt_add(uip_ipaddr_t *ipaddr, unsigned long interval) { uip_ds6_defrt_t *d; +#if DEBUG != DEBUG_NONE + assert_nbr_routes_list_sane(); +#endif /* DEBUG != DEBUG_NONE */ + + PRINTF("uip_ds6_defrt_add\n"); d = uip_ds6_defrt_lookup(ipaddr); if(d == NULL) { d = memb_alloc(&defaultroutermemb); @@ -376,6 +490,10 @@ uip_ds6_defrt_add(uip_ipaddr_t *ipaddr, unsigned long interval) call_route_callback(UIP_DS6_NOTIFICATION_DEFRT_ADD, ipaddr, ipaddr); #endif +#if DEBUG != DEBUG_NONE + assert_nbr_routes_list_sane(); +#endif /* DEBUG != DEBUG_NONE */ + return d; } /*---------------------------------------------------------------------------*/ @@ -383,6 +501,11 @@ void uip_ds6_defrt_rm(uip_ds6_defrt_t *defrt) { uip_ds6_defrt_t *d; + +#if DEBUG != DEBUG_NONE + assert_nbr_routes_list_sane(); +#endif /* DEBUG != DEBUG_NONE */ + /* Make sure that the defrt is in the list before we remove it. */ for(d = list_head(defaultrouterlist); d != NULL; @@ -399,6 +522,10 @@ uip_ds6_defrt_rm(uip_ds6_defrt_t *defrt) return; } } +#if DEBUG != DEBUG_NONE + assert_nbr_routes_list_sane(); +#endif /* DEBUG != DEBUG_NONE */ + } /*---------------------------------------------------------------------------*/ uip_ds6_defrt_t * diff --git a/core/net/uip-ds6-route.h b/core/net/uip-ds6-route.h index ba672adf1..35e7e60d0 100644 --- a/core/net/uip-ds6-route.h +++ b/core/net/uip-ds6-route.h @@ -92,12 +92,21 @@ typedef struct rpl_route_entry { } rpl_route_entry_t; #endif /* UIP_DS6_ROUTE_STATE_TYPE */ - +/** \brief The neighbor routes hold a list of routing table entries + that are attached to a specific neihbor. */ +struct uip_ds6_route_neighbor_routes { + LIST_STRUCT(route_list); +}; /** \brief An entry in the routing table */ typedef struct uip_ds6_route { struct uip_ds6_route *next; - list_t route_list; /* The list the routing entry belongs to. */ + /* Each route entry belongs to a specific neighbor. That neighbor + holds a list of all routing entries that go through it. The + routes field point to the uip_ds6_route_neighbor_routes that + belong to the neighbor table entry that this routing table entry + uses. */ + struct uip_ds6_route_neighbor_routes *routes; uip_ipaddr_t ipaddr; #ifdef UIP_DS6_ROUTE_STATE_TYPE UIP_DS6_ROUTE_STATE_TYPE state; From b1e6890b32243b4df54c2cd1030733d2b16ba109 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 11 Aug 2013 22:46:14 +0200 Subject: [PATCH 24/29] Re-enabled the large network RPL test --- .../{x04-rpl-large-network.csc => 04-rpl-large-network.csc} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename regression-tests/12-rpl/{x04-rpl-large-network.csc => 04-rpl-large-network.csc} (100%) diff --git a/regression-tests/12-rpl/x04-rpl-large-network.csc b/regression-tests/12-rpl/04-rpl-large-network.csc similarity index 100% rename from regression-tests/12-rpl/x04-rpl-large-network.csc rename to regression-tests/12-rpl/04-rpl-large-network.csc From 6d386ffc8dbe46e2c9b331bcd2813ccbe23e6db5 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 11 Aug 2013 22:47:06 +0200 Subject: [PATCH 25/29] A RPL regression test that tests DAO routes going towards the sink and then down --- .../12-rpl/05-rpl-up-and-down-routes.csc | 344 ++++++++++++++++++ 1 file changed, 344 insertions(+) create mode 100644 regression-tests/12-rpl/05-rpl-up-and-down-routes.csc diff --git a/regression-tests/12-rpl/05-rpl-up-and-down-routes.csc b/regression-tests/12-rpl/05-rpl-up-and-down-routes.csc new file mode 100644 index 000000000..fa52feea8 --- /dev/null +++ b/regression-tests/12-rpl/05-rpl-up-and-down-routes.csc @@ -0,0 +1,344 @@ + + + [APPS_DIR]/mrm + [APPS_DIR]/mspsim + [APPS_DIR]/avrora + [APPS_DIR]/serial_socket + [APPS_DIR]/collect-view + [APPS_DIR]/powertracker + + My simulation + 123456 + 1000000 + + se.sics.cooja.radiomediums.UDGM + 50.0 + 50.0 + 1.0 + 1.0 + + + 40000 + + + se.sics.cooja.contikimote.ContikiMoteType + mtype743 + Sender + [CONFIG_DIR]/code/sender-node.c + make clean TARGET=cooja +make sender-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + se.sics.cooja.contikimote.ContikiMoteType + mtype452 + RPL root + [CONFIG_DIR]/code/root-node.c + make clean TARGET=cooja +make root-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + se.sics.cooja.contikimote.ContikiMoteType + mtype782 + Receiver + [CONFIG_DIR]/code/receiver-node.c + make clean TARGET=cooja +make receiver-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + + se.sics.cooja.interfaces.Position + -22.5728586847096 + 123.9358664968653 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 1 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype782 + + + + se.sics.cooja.interfaces.Position + 116.13379149678028 + 88.36698920455684 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 2 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype743 + + + + se.sics.cooja.interfaces.Position + -1.39303771455413 + 100.21446701029119 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 4 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype782 + + + + se.sics.cooja.interfaces.Position + 95.25095618820441 + 63.14998053005015 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 5 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype782 + + + + se.sics.cooja.interfaces.Position + 66.09378990830604 + 38.32698761608261 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 6 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype782 + + + + se.sics.cooja.interfaces.Position + 29.05630841762433 + 30.840688165838436 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 7 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype782 + + + + se.sics.cooja.interfaces.Position + 10.931583432822638 + 69.848248459216 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 8 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype782 + + + + se.sics.cooja.interfaces.Position + 0.0 + 0.0 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 3 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype452 + + + + se.sics.cooja.plugins.SimControl + 280 + 1 + 160 + 400 + 0 + + + se.sics.cooja.plugins.Visualizer + + se.sics.cooja.plugins.skins.IDVisualizerSkin + se.sics.cooja.plugins.skins.UDGMVisualizerSkin + se.sics.cooja.plugins.skins.GridVisualizerSkin + se.sics.cooja.plugins.skins.MoteTypeVisualizerSkin + 2.5379695437350276 0.0 0.0 2.5379695437350276 75.2726010197627 15.727272727272757 + + 400 + 2 + 400 + 1 + 1 + + + se.sics.cooja.plugins.LogListener + + + + 1184 + 3 + 240 + 402 + 162 + + + se.sics.cooja.plugins.Notes + + Enter notes here + true + + 904 + 4 + 160 + 680 + 0 + + + se.sics.cooja.plugins.ScriptRunner + + + true + + 962 + 0 + 596 + 603 + 43 + + + From 241a4e0100a6c54797dd6007829210a3ab3fe297 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 11 Aug 2013 22:47:35 +0200 Subject: [PATCH 26/29] A RPL regression test that tests that a RPL network survives a temporary root loss --- .../12-rpl/06-rpl-temporary-root-loss.csc | 344 ++++++++++++++++++ 1 file changed, 344 insertions(+) create mode 100644 regression-tests/12-rpl/06-rpl-temporary-root-loss.csc diff --git a/regression-tests/12-rpl/06-rpl-temporary-root-loss.csc b/regression-tests/12-rpl/06-rpl-temporary-root-loss.csc new file mode 100644 index 000000000..fa5c5cf65 --- /dev/null +++ b/regression-tests/12-rpl/06-rpl-temporary-root-loss.csc @@ -0,0 +1,344 @@ + + + [APPS_DIR]/mrm + [APPS_DIR]/mspsim + [APPS_DIR]/avrora + [APPS_DIR]/serial_socket + [APPS_DIR]/collect-view + [APPS_DIR]/powertracker + + My simulation + 123456 + 1000000 + + se.sics.cooja.radiomediums.UDGM + 50.0 + 50.0 + 1.0 + 1.0 + + + 40000 + + + se.sics.cooja.contikimote.ContikiMoteType + mtype951 + Sender + [CONFIG_DIR]/code/sender-node.c + make clean TARGET=cooja +make sender-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + se.sics.cooja.contikimote.ContikiMoteType + mtype170 + RPL root + [CONFIG_DIR]/code/root-node.c + make clean TARGET=cooja +make root-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + se.sics.cooja.contikimote.ContikiMoteType + mtype767 + Receiver + [CONFIG_DIR]/code/receiver-node.c + make clean TARGET=cooja +make receiver-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + + se.sics.cooja.interfaces.Position + -22.5728586847096 + 123.9358664968653 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 1 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype767 + + + + se.sics.cooja.interfaces.Position + 116.13379149678028 + 88.36698920455684 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 2 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype951 + + + + se.sics.cooja.interfaces.Position + -1.39303771455413 + 100.21446701029119 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 4 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype767 + + + + se.sics.cooja.interfaces.Position + 95.25095618820441 + 63.14998053005015 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 5 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype767 + + + + se.sics.cooja.interfaces.Position + 66.09378990830604 + 38.32698761608261 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 6 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype767 + + + + se.sics.cooja.interfaces.Position + 29.05630841762433 + 30.840688165838436 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 7 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype767 + + + + se.sics.cooja.interfaces.Position + 10.931583432822638 + 69.848248459216 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 8 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype767 + + + + se.sics.cooja.interfaces.Position + 0.0 + 0.0 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 3 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype170 + + + + se.sics.cooja.plugins.SimControl + 280 + 0 + 160 + 400 + 0 + + + se.sics.cooja.plugins.Visualizer + + se.sics.cooja.plugins.skins.IDVisualizerSkin + se.sics.cooja.plugins.skins.UDGMVisualizerSkin + se.sics.cooja.plugins.skins.GridVisualizerSkin + se.sics.cooja.plugins.skins.MoteTypeVisualizerSkin + 2.5379695437350276 0.0 0.0 2.5379695437350276 75.2726010197627 15.727272727272757 + + 400 + 2 + 400 + 1 + 1 + + + se.sics.cooja.plugins.LogListener + + + + 1184 + 3 + 240 + 402 + 162 + + + se.sics.cooja.plugins.Notes + + Enter notes here + true + + 904 + 4 + 160 + 680 + 0 + + + se.sics.cooja.plugins.ScriptRunner + + + true + + 962 + 1 + 596 + 603 + 43 + + + From 4cfefe80e43cdab9b27838bbd68e09768e3a5c64 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 11 Aug 2013 22:48:01 +0200 Subject: [PATCH 27/29] A RPL regression test that tests that the network survives a random rearrangement --- .../12-rpl/07-rpl-random-rearrangement.csc | 647 ++++++++++++++++++ 1 file changed, 647 insertions(+) create mode 100644 regression-tests/12-rpl/07-rpl-random-rearrangement.csc diff --git a/regression-tests/12-rpl/07-rpl-random-rearrangement.csc b/regression-tests/12-rpl/07-rpl-random-rearrangement.csc new file mode 100644 index 000000000..d5313703b --- /dev/null +++ b/regression-tests/12-rpl/07-rpl-random-rearrangement.csc @@ -0,0 +1,647 @@ + + + [APPS_DIR]/mrm + [APPS_DIR]/mspsim + [APPS_DIR]/avrora + [APPS_DIR]/serial_socket + [APPS_DIR]/collect-view + [APPS_DIR]/powertracker + + My simulation + 123456 + 1000000 + + se.sics.cooja.radiomediums.UDGM + 50.0 + 50.0 + 1.0 + 1.0 + + + 40000 + + + se.sics.cooja.contikimote.ContikiMoteType + mtype419 + Sender + [CONFIG_DIR]/code/sender-node.c + make clean TARGET=cooja +make sender-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + se.sics.cooja.contikimote.ContikiMoteType + mtype484 + RPL root + [CONFIG_DIR]/code/root-node.c + make clean TARGET=cooja +make root-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + se.sics.cooja.contikimote.ContikiMoteType + mtype718 + Receiver + [CONFIG_DIR]/code/receiver-node.c + make clean TARGET=cooja +make receiver-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + + se.sics.cooja.interfaces.Position + -0.4799968467515439 + 98.79087181374759 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 1 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype718 + + + + se.sics.cooja.interfaces.Position + 99.56423154395364 + 50.06466731257512 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 2 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype419 + + + + se.sics.cooja.interfaces.Position + -0.4799968467515439 + 0.30173505605854883 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 3 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype484 + + + + se.sics.cooja.interfaces.Position + 12.779318616702257 + 8.464865358169643 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 4 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype718 + + + + se.sics.cooja.interfaces.Position + 9.391922400291703 + 49.22878206790311 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 5 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype718 + + + + se.sics.cooja.interfaces.Position + 48.16367625505583 + 33.27520746599595 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 6 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype718 + + + + se.sics.cooja.interfaces.Position + 16.582742473429345 + 24.932911331640646 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 7 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype718 + + + + se.sics.cooja.interfaces.Position + 8.445564421140666 + 6.770205395698742 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 8 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype718 + + + + se.sics.cooja.interfaces.Position + 87.04968129458189 + 34.46536562612724 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 9 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype718 + + + + se.sics.cooja.interfaces.Position + 94.47123252519145 + 18.275940194868184 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 10 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype718 + + + + se.sics.cooja.interfaces.Position + 95.28044254364556 + 17.683438211793558 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 11 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype718 + + + + se.sics.cooja.interfaces.Position + 56.124622439456076 + 33.88966252832571 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 12 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype718 + + + + se.sics.cooja.interfaces.Position + 98.33149749474546 + 37.448034626592744 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 13 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype718 + + + + se.sics.cooja.interfaces.Position + 58.75337436025891 + 68.64082018992522 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 14 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype718 + + + + se.sics.cooja.interfaces.Position + 66.83816496627988 + 68.38008376830592 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 15 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype718 + + + + se.sics.cooja.interfaces.Position + 90.88648665466316 + 50.942053906416575 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 16 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype718 + + + + se.sics.cooja.interfaces.Position + 68.80089833632896 + 84.17294684073734 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 17 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype718 + + + + se.sics.cooja.interfaces.Position + 73.6760846183129 + 81.76699743886633 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 18 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype718 + + + + se.sics.cooja.interfaces.Position + 0.2960103456537466 + 98.5587829617092 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 19 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype718 + + + + se.sics.cooja.interfaces.Position + 8.130479493904208 + 57.642099520821645 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 20 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype718 + + + + se.sics.cooja.interfaces.Position + 30.550120982984865 + 85.58346736403402 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 21 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype718 + + + + se.sics.cooja.interfaces.Position + 29.65300377698182 + 63.50257213104861 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 22 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype718 + + + + se.sics.cooja.interfaces.Position + 34.92110687576687 + 70.71381297232249 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 23 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype718 + + + + se.sics.cooja.plugins.SimControl + 280 + 1 + 160 + 400 + 0 + + + se.sics.cooja.plugins.Visualizer + + se.sics.cooja.plugins.skins.IDVisualizerSkin + se.sics.cooja.plugins.skins.UDGMVisualizerSkin + se.sics.cooja.plugins.skins.GridVisualizerSkin + se.sics.cooja.plugins.skins.MoteTypeVisualizerSkin + 1.92914676942954 0.0 0.0 1.92914676942954 75.9259843662471 55.41790879138101 + + 400 + 2 + 400 + 1 + 1 + + + se.sics.cooja.plugins.LogListener + + + + + + 1184 + 3 + 500 + 402 + 162 + + + se.sics.cooja.plugins.Notes + + Enter notes here + true + + 904 + 4 + 160 + 680 + 0 + + + se.sics.cooja.plugins.ScriptRunner + + + true + + 612 + 0 + 726 + 953 + 43 + + + From 2af2478166b586ea461d65fa1958e6e6992880af Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 11 Aug 2013 22:49:09 +0200 Subject: [PATCH 28/29] A set of RPL regression tests that the RPL network is able to survive the replacement of one node. The different tests test different placements of the moving node, with a varying number of hops from the root --- .../12-rpl/08-rpl-dao-route-loss-0.csc | 362 ++++++++++++++++++ .../12-rpl/08-rpl-dao-route-loss-1.csc | 362 ++++++++++++++++++ .../12-rpl/08-rpl-dao-route-loss-2.csc | 362 ++++++++++++++++++ .../12-rpl/08-rpl-dao-route-loss-3.csc | 362 ++++++++++++++++++ .../12-rpl/08-rpl-dao-route-loss-4.csc | 362 ++++++++++++++++++ .../12-rpl/08-rpl-dao-route-loss-5.csc | 362 ++++++++++++++++++ 6 files changed, 2172 insertions(+) create mode 100644 regression-tests/12-rpl/08-rpl-dao-route-loss-0.csc create mode 100644 regression-tests/12-rpl/08-rpl-dao-route-loss-1.csc create mode 100644 regression-tests/12-rpl/08-rpl-dao-route-loss-2.csc create mode 100644 regression-tests/12-rpl/08-rpl-dao-route-loss-3.csc create mode 100644 regression-tests/12-rpl/08-rpl-dao-route-loss-4.csc create mode 100644 regression-tests/12-rpl/08-rpl-dao-route-loss-5.csc diff --git a/regression-tests/12-rpl/08-rpl-dao-route-loss-0.csc b/regression-tests/12-rpl/08-rpl-dao-route-loss-0.csc new file mode 100644 index 000000000..6672fbb2d --- /dev/null +++ b/regression-tests/12-rpl/08-rpl-dao-route-loss-0.csc @@ -0,0 +1,362 @@ + + + [APPS_DIR]/mrm + [APPS_DIR]/mspsim + [APPS_DIR]/avrora + [APPS_DIR]/serial_socket + [APPS_DIR]/collect-view + [APPS_DIR]/powertracker + + My simulation + 123456 + 1000000 + + se.sics.cooja.radiomediums.UDGM + 50.0 + 50.0 + 1.0 + 1.0 + + + 40000 + + + se.sics.cooja.contikimote.ContikiMoteType + mtype921 + Sender + [CONFIG_DIR]/code/sender-node.c + make clean TARGET=cooja +make sender-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + se.sics.cooja.contikimote.ContikiMoteType + mtype873 + RPL root + [CONFIG_DIR]/code/root-node.c + make clean TARGET=cooja +make root-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + se.sics.cooja.contikimote.ContikiMoteType + mtype812 + Receiver + [CONFIG_DIR]/code/receiver-node.c + make clean TARGET=cooja +make receiver-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + + se.sics.cooja.interfaces.Position + -7.199692787830563 + 98.21738321803603 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 1 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype812 + + + + se.sics.cooja.interfaces.Position + 116.13379149678028 + 88.36698920455684 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 2 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype921 + + + + se.sics.cooja.interfaces.Position + 12.0 + 68.0 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 4 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype812 + + + + se.sics.cooja.interfaces.Position + 95.25095618820441 + 63.14998053005015 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 5 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype812 + + + + se.sics.cooja.interfaces.Position + 66.09378990830604 + 38.32698761608261 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 6 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype812 + + + + se.sics.cooja.interfaces.Position + 29.05630841762433 + 30.840688165838436 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 7 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype812 + + + + se.sics.cooja.interfaces.Position + 58.0 + 108.0 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 8 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype812 + + + + se.sics.cooja.interfaces.Position + -40.352178879596096 + 102.66976131212861 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 3 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype873 + + + + se.sics.cooja.plugins.SimControl + 280 + 3 + 160 + 400 + 0 + + + se.sics.cooja.plugins.Visualizer + + se.sics.cooja.plugins.skins.IDVisualizerSkin + se.sics.cooja.plugins.skins.UDGMVisualizerSkin + se.sics.cooja.plugins.skins.GridVisualizerSkin + se.sics.cooja.plugins.skins.MoteTypeVisualizerSkin + 1.6480321712565114 0.0 0.0 1.6480321712565114 98.5016889738719 55.796930342384904 + + 400 + 0 + 400 + 1 + 1 + + + se.sics.cooja.plugins.LogListener + + + + + + 1184 + 2 + 500 + 402 + 162 + + + se.sics.cooja.plugins.Notes + + Enter notes here + true + + 904 + 4 + 160 + 680 + 0 + + + se.sics.cooja.plugins.ScriptRunner + + + true + + 612 + 1 + 726 + 953 + 43 + + + diff --git a/regression-tests/12-rpl/08-rpl-dao-route-loss-1.csc b/regression-tests/12-rpl/08-rpl-dao-route-loss-1.csc new file mode 100644 index 000000000..162b6014f --- /dev/null +++ b/regression-tests/12-rpl/08-rpl-dao-route-loss-1.csc @@ -0,0 +1,362 @@ + + + [APPS_DIR]/mrm + [APPS_DIR]/mspsim + [APPS_DIR]/avrora + [APPS_DIR]/serial_socket + [APPS_DIR]/collect-view + [APPS_DIR]/powertracker + + My simulation + 123456 + 1000000 + + se.sics.cooja.radiomediums.UDGM + 50.0 + 50.0 + 1.0 + 1.0 + + + 40000 + + + se.sics.cooja.contikimote.ContikiMoteType + mtype672 + Sender + [CONFIG_DIR]/code/sender-node.c + make clean TARGET=cooja +make sender-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + se.sics.cooja.contikimote.ContikiMoteType + mtype780 + RPL root + [CONFIG_DIR]/code/root-node.c + make clean TARGET=cooja +make root-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + se.sics.cooja.contikimote.ContikiMoteType + mtype36 + Receiver + [CONFIG_DIR]/code/receiver-node.c + make clean TARGET=cooja +make receiver-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + + se.sics.cooja.interfaces.Position + -7.199692787830563 + 98.21738321803603 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 1 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype36 + + + + se.sics.cooja.interfaces.Position + 116.13379149678028 + 88.36698920455684 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 2 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype672 + + + + se.sics.cooja.interfaces.Position + 12.0 + 68.0 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 4 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype36 + + + + se.sics.cooja.interfaces.Position + 95.25095618820441 + 63.14998053005015 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 5 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype36 + + + + se.sics.cooja.interfaces.Position + 66.09378990830604 + 38.32698761608261 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 6 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype36 + + + + se.sics.cooja.interfaces.Position + 29.05630841762433 + 30.840688165838436 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 7 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype36 + + + + se.sics.cooja.interfaces.Position + 58.0 + 108.0 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 8 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype36 + + + + se.sics.cooja.interfaces.Position + -25.71843353317142 + 43.05517674255262 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 3 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype780 + + + + se.sics.cooja.plugins.SimControl + 280 + 3 + 160 + 400 + 0 + + + se.sics.cooja.plugins.Visualizer + + se.sics.cooja.plugins.skins.IDVisualizerSkin + se.sics.cooja.plugins.skins.UDGMVisualizerSkin + se.sics.cooja.plugins.skins.GridVisualizerSkin + se.sics.cooja.plugins.skins.MoteTypeVisualizerSkin + 2.5379695437350276 0.0 0.0 2.5379695437350276 75.2726010197627 15.727272727272757 + + 400 + 2 + 400 + 1 + 1 + + + se.sics.cooja.plugins.LogListener + + + + + + 1184 + 1 + 500 + 402 + 162 + + + se.sics.cooja.plugins.Notes + + Enter notes here + true + + 904 + 4 + 160 + 680 + 0 + + + se.sics.cooja.plugins.ScriptRunner + + + true + + 612 + 0 + 726 + 953 + 43 + + + diff --git a/regression-tests/12-rpl/08-rpl-dao-route-loss-2.csc b/regression-tests/12-rpl/08-rpl-dao-route-loss-2.csc new file mode 100644 index 000000000..fc21d61a4 --- /dev/null +++ b/regression-tests/12-rpl/08-rpl-dao-route-loss-2.csc @@ -0,0 +1,362 @@ + + + [APPS_DIR]/mrm + [APPS_DIR]/mspsim + [APPS_DIR]/avrora + [APPS_DIR]/serial_socket + [APPS_DIR]/collect-view + [APPS_DIR]/powertracker + + My simulation + 123456 + 1000000 + + se.sics.cooja.radiomediums.UDGM + 50.0 + 50.0 + 1.0 + 1.0 + + + 40000 + + + se.sics.cooja.contikimote.ContikiMoteType + mtype672 + Sender + [CONFIG_DIR]/code/sender-node.c + make clean TARGET=cooja +make sender-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + se.sics.cooja.contikimote.ContikiMoteType + mtype780 + RPL root + [CONFIG_DIR]/code/root-node.c + make clean TARGET=cooja +make root-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + se.sics.cooja.contikimote.ContikiMoteType + mtype36 + Receiver + [CONFIG_DIR]/code/receiver-node.c + make clean TARGET=cooja +make receiver-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + + se.sics.cooja.interfaces.Position + -7.199692787830563 + 98.21738321803603 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 1 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype36 + + + + se.sics.cooja.interfaces.Position + 116.13379149678028 + 88.36698920455684 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 2 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype672 + + + + se.sics.cooja.interfaces.Position + 12.0 + 68.0 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 4 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype36 + + + + se.sics.cooja.interfaces.Position + 95.25095618820441 + 63.14998053005015 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 5 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype36 + + + + se.sics.cooja.interfaces.Position + 66.09378990830604 + 38.32698761608261 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 6 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype36 + + + + se.sics.cooja.interfaces.Position + 29.05630841762433 + 30.840688165838436 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 7 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype36 + + + + se.sics.cooja.interfaces.Position + 58.0 + 108.0 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 8 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype36 + + + + se.sics.cooja.interfaces.Position + 16.0472370839803 + 6.017695251870905 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 3 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype780 + + + + se.sics.cooja.plugins.SimControl + 280 + 3 + 160 + 400 + 0 + + + se.sics.cooja.plugins.Visualizer + + se.sics.cooja.plugins.skins.IDVisualizerSkin + se.sics.cooja.plugins.skins.UDGMVisualizerSkin + se.sics.cooja.plugins.skins.GridVisualizerSkin + se.sics.cooja.plugins.skins.MoteTypeVisualizerSkin + 2.5379695437350276 0.0 0.0 2.5379695437350276 75.2726010197627 15.727272727272757 + + 400 + 0 + 400 + 1 + 1 + + + se.sics.cooja.plugins.LogListener + + + + + + 1184 + 2 + 500 + 402 + 162 + + + se.sics.cooja.plugins.Notes + + Enter notes here + true + + 904 + 4 + 160 + 680 + 0 + + + se.sics.cooja.plugins.ScriptRunner + + + true + + 612 + 1 + 726 + 953 + 43 + + + diff --git a/regression-tests/12-rpl/08-rpl-dao-route-loss-3.csc b/regression-tests/12-rpl/08-rpl-dao-route-loss-3.csc new file mode 100644 index 000000000..da814c7b4 --- /dev/null +++ b/regression-tests/12-rpl/08-rpl-dao-route-loss-3.csc @@ -0,0 +1,362 @@ + + + [APPS_DIR]/mrm + [APPS_DIR]/mspsim + [APPS_DIR]/avrora + [APPS_DIR]/serial_socket + [APPS_DIR]/collect-view + [APPS_DIR]/powertracker + + My simulation + 123456 + 1000000 + + se.sics.cooja.radiomediums.UDGM + 50.0 + 50.0 + 1.0 + 1.0 + + + 40000 + + + se.sics.cooja.contikimote.ContikiMoteType + mtype672 + Sender + [CONFIG_DIR]/code/sender-node.c + make clean TARGET=cooja +make sender-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + se.sics.cooja.contikimote.ContikiMoteType + mtype780 + RPL root + [CONFIG_DIR]/code/root-node.c + make clean TARGET=cooja +make root-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + se.sics.cooja.contikimote.ContikiMoteType + mtype36 + Receiver + [CONFIG_DIR]/code/receiver-node.c + make clean TARGET=cooja +make receiver-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + + se.sics.cooja.interfaces.Position + -7.199692787830563 + 98.21738321803603 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 1 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype36 + + + + se.sics.cooja.interfaces.Position + 116.13379149678028 + 88.36698920455684 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 2 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype672 + + + + se.sics.cooja.interfaces.Position + 12.0 + 68.0 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 4 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype36 + + + + se.sics.cooja.interfaces.Position + 95.25095618820441 + 63.14998053005015 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 5 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype36 + + + + se.sics.cooja.interfaces.Position + 66.09378990830604 + 38.32698761608261 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 6 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype36 + + + + se.sics.cooja.interfaces.Position + 29.05630841762433 + 30.840688165838436 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 7 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype36 + + + + se.sics.cooja.interfaces.Position + 58.0 + 108.0 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 8 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype36 + + + + se.sics.cooja.interfaces.Position + 79.48377453078622 + 4.835647970253402 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 3 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype780 + + + + se.sics.cooja.plugins.SimControl + 280 + 3 + 160 + 400 + 0 + + + se.sics.cooja.plugins.Visualizer + + se.sics.cooja.plugins.skins.IDVisualizerSkin + se.sics.cooja.plugins.skins.UDGMVisualizerSkin + se.sics.cooja.plugins.skins.GridVisualizerSkin + se.sics.cooja.plugins.skins.MoteTypeVisualizerSkin + 2.5379695437350276 0.0 0.0 2.5379695437350276 70.27260101976269 60.72727272727276 + + 400 + 0 + 400 + 1 + 1 + + + se.sics.cooja.plugins.LogListener + + + + + + 1184 + 2 + 500 + 402 + 162 + + + se.sics.cooja.plugins.Notes + + Enter notes here + true + + 904 + 4 + 160 + 680 + 0 + + + se.sics.cooja.plugins.ScriptRunner + + + true + + 612 + 1 + 726 + 953 + 43 + + + diff --git a/regression-tests/12-rpl/08-rpl-dao-route-loss-4.csc b/regression-tests/12-rpl/08-rpl-dao-route-loss-4.csc new file mode 100644 index 000000000..2570f4bac --- /dev/null +++ b/regression-tests/12-rpl/08-rpl-dao-route-loss-4.csc @@ -0,0 +1,362 @@ + + + [APPS_DIR]/mrm + [APPS_DIR]/mspsim + [APPS_DIR]/avrora + [APPS_DIR]/serial_socket + [APPS_DIR]/collect-view + [APPS_DIR]/powertracker + + My simulation + 123456 + 1000000 + + se.sics.cooja.radiomediums.UDGM + 50.0 + 50.0 + 1.0 + 1.0 + + + 40000 + + + se.sics.cooja.contikimote.ContikiMoteType + mtype192 + Sender + [CONFIG_DIR]/code/sender-node.c + make clean TARGET=cooja +make sender-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + se.sics.cooja.contikimote.ContikiMoteType + mtype575 + RPL root + [CONFIG_DIR]/code/root-node.c + make clean TARGET=cooja +make root-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + se.sics.cooja.contikimote.ContikiMoteType + mtype912 + Receiver + [CONFIG_DIR]/code/receiver-node.c + make clean TARGET=cooja +make receiver-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + + se.sics.cooja.interfaces.Position + -7.199692787830563 + 98.21738321803603 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 1 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype912 + + + + se.sics.cooja.interfaces.Position + 116.13379149678028 + 88.36698920455684 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 2 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype192 + + + + se.sics.cooja.interfaces.Position + 12.0 + 68.0 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 4 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype912 + + + + se.sics.cooja.interfaces.Position + 95.25095618820441 + 63.14998053005015 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 5 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype912 + + + + se.sics.cooja.interfaces.Position + 66.09378990830604 + 38.32698761608261 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 6 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype912 + + + + se.sics.cooja.interfaces.Position + 29.05630841762433 + 30.840688165838436 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 7 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype912 + + + + se.sics.cooja.interfaces.Position + 58.0 + 108.0 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 8 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype912 + + + + se.sics.cooja.interfaces.Position + 122.82550819009461 + 29.658640884220933 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 3 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype575 + + + + se.sics.cooja.plugins.SimControl + 280 + 3 + 160 + 400 + 0 + + + se.sics.cooja.plugins.Visualizer + + se.sics.cooja.plugins.skins.IDVisualizerSkin + se.sics.cooja.plugins.skins.UDGMVisualizerSkin + se.sics.cooja.plugins.skins.GridVisualizerSkin + se.sics.cooja.plugins.skins.MoteTypeVisualizerSkin + 2.5379695437350276 0.0 0.0 2.5379695437350276 70.27260101976269 60.72727272727276 + + 400 + 0 + 400 + 1 + 1 + + + se.sics.cooja.plugins.LogListener + + + + + + 1184 + 2 + 500 + 402 + 162 + + + se.sics.cooja.plugins.Notes + + Enter notes here + true + + 904 + 4 + 160 + 680 + 0 + + + se.sics.cooja.plugins.ScriptRunner + + + true + + 612 + 1 + 726 + 953 + 43 + + + diff --git a/regression-tests/12-rpl/08-rpl-dao-route-loss-5.csc b/regression-tests/12-rpl/08-rpl-dao-route-loss-5.csc new file mode 100644 index 000000000..949113b89 --- /dev/null +++ b/regression-tests/12-rpl/08-rpl-dao-route-loss-5.csc @@ -0,0 +1,362 @@ + + + [APPS_DIR]/mrm + [APPS_DIR]/mspsim + [APPS_DIR]/avrora + [APPS_DIR]/serial_socket + [APPS_DIR]/collect-view + [APPS_DIR]/powertracker + + My simulation + 123456 + 1000000 + + se.sics.cooja.radiomediums.UDGM + 50.0 + 50.0 + 1.0 + 1.0 + + + 40000 + + + se.sics.cooja.contikimote.ContikiMoteType + mtype372 + Sender + [CONFIG_DIR]/code/sender-node.c + make clean TARGET=cooja +make sender-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + se.sics.cooja.contikimote.ContikiMoteType + mtype229 + RPL root + [CONFIG_DIR]/code/root-node.c + make clean TARGET=cooja +make root-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + se.sics.cooja.contikimote.ContikiMoteType + mtype424 + Receiver + [CONFIG_DIR]/code/receiver-node.c + make clean TARGET=cooja +make receiver-node.cooja TARGET=cooja + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.interfaces.RimeAddress + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiCFS + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.interfaces.MoteAttributes + false + + + + se.sics.cooja.interfaces.Position + -7.199692787830563 + 98.21738321803603 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 1 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype424 + + + + se.sics.cooja.interfaces.Position + 116.13379149678028 + 88.36698920455684 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 2 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype372 + + + + se.sics.cooja.interfaces.Position + 12.0 + 68.0 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 4 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype424 + + + + se.sics.cooja.interfaces.Position + 95.25095618820441 + 63.14998053005015 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 5 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype424 + + + + se.sics.cooja.interfaces.Position + 66.09378990830604 + 38.32698761608261 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 6 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype424 + + + + se.sics.cooja.interfaces.Position + 29.05630841762433 + 30.840688165838436 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 7 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype424 + + + + se.sics.cooja.interfaces.Position + 58.0 + 108.0 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 8 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype424 + + + + se.sics.cooja.interfaces.Position + 145.93059238811136 + 111.16474110935306 + 0.0 + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 3 + + + se.sics.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype229 + + + + se.sics.cooja.plugins.SimControl + 280 + 3 + 160 + 400 + 0 + + + se.sics.cooja.plugins.Visualizer + + se.sics.cooja.plugins.skins.IDVisualizerSkin + se.sics.cooja.plugins.skins.UDGMVisualizerSkin + se.sics.cooja.plugins.skins.GridVisualizerSkin + se.sics.cooja.plugins.skins.MoteTypeVisualizerSkin + 1.6480321712565114 0.0 0.0 1.6480321712565114 98.5016889738719 55.796930342384904 + + 400 + 0 + 400 + 1 + 1 + + + se.sics.cooja.plugins.LogListener + + + + + + 1184 + 2 + 500 + 402 + 162 + + + se.sics.cooja.plugins.Notes + + Enter notes here + true + + 904 + 4 + 160 + 680 + 0 + + + se.sics.cooja.plugins.ScriptRunner + + + true + + 612 + 1 + 726 + 953 + 43 + + + From 86e247025a71109774eb679f4c88904c2a8450a8 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Mon, 12 Aug 2013 13:02:44 +0200 Subject: [PATCH 29/29] Removed debugging printout that came before a local variable declaration, which seems to have broken sdcc --- core/net/rpl/rpl-ext-header.c | 1 - 1 file changed, 1 deletion(-) diff --git a/core/net/rpl/rpl-ext-header.c b/core/net/rpl/rpl-ext-header.c index 3b7851c81..b00b89d71 100644 --- a/core/net/rpl/rpl-ext-header.c +++ b/core/net/rpl/rpl-ext-header.c @@ -83,7 +83,6 @@ rpl_verify_header(int uip_ext_opt_offset) } if(UIP_EXT_HDR_OPT_RPL_BUF->flags & RPL_HDR_OPT_FWD_ERR) { - PRINTF("RPL: Forward error!\n"); /* We should try to repair it by removing the neighbor that caused the packet to be forwareded in the first place. We drop any routes that go through the neighbor that sent the packet to