handled some warnings
[sys/net/sixlowpan/sixlowip.c] * pointer in ipv6_process() for PROTO_NUM_NONE out-commented * val = 0 as initial value [sys/net/sixlowpan/sixlowmac.c] * included and initialized hwtimer [sys/net/sixlowpan/sixlownd.c sys/net/sixlowpan/sixlownd.h] * initialized abro_version in recv_rtr_adv() * ARO state according to draft-6lowpan-hc-16
This commit is contained in:
parent
6263e59867
commit
2c20f8fafd
@ -112,7 +112,7 @@ void ipv6_process(void){
|
||||
}
|
||||
case(PROTO_NUM_NONE):{
|
||||
//printf("Packet with no Header following the IPv6 Header received\n");
|
||||
uint8_t *ptr = get_payload_buf(ipv6_ext_hdr_len);
|
||||
//uint8_t *ptr = get_payload_buf(ipv6_ext_hdr_len);
|
||||
printf("hello\n");
|
||||
}
|
||||
default:
|
||||
@ -243,7 +243,7 @@ void ipv6_get_saddr(ipv6_addr_t *src, ipv6_addr_t *dst){
|
||||
}
|
||||
|
||||
uint8_t ipv6_get_addr_match(ipv6_addr_t *src, ipv6_addr_t *dst){
|
||||
uint8_t val, xor;
|
||||
uint8_t val = 0, xor;
|
||||
for(int i = 0; i < 16; i++){
|
||||
/* if bytes are equal add 8 */
|
||||
if(src->uint8[i] == dst->uint8[i]){
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
#include "sixlownd.h"
|
||||
#include "sixlowpan.h"
|
||||
#include <ltc4150.h>
|
||||
#include <hwtimer.h>
|
||||
#include "thread.h"
|
||||
#include "msg.h"
|
||||
#include "radio/radio.h"
|
||||
@ -192,6 +193,7 @@ void send_ieee802154_frame(ieee_802154_long_t *addr, uint8_t *payload,
|
||||
void sixlowmac_init(transceiver_type_t type){
|
||||
int recv_pid = thread_create(radio_stack_buffer, RADIO_STACK_SIZE,
|
||||
PRIORITY_MAIN-2, CREATE_STACKTEST, recv_ieee802154_frame , "radio");
|
||||
hwtimer_init();
|
||||
transceiver_type = type;
|
||||
transceiver_init(transceiver_type);
|
||||
transceiver_start();
|
||||
|
||||
@ -390,7 +390,7 @@ void recv_rtr_adv(void){
|
||||
|
||||
int8_t trigger_ns = -1;
|
||||
int8_t abro_found = 0;
|
||||
int16_t abro_version;
|
||||
int16_t abro_version = 0; // later replaced, just to supress warnings
|
||||
ipv6_addr_t abro_addr;
|
||||
|
||||
lowpan_context_t *found_contexts[LOWPAN_CONTEXT_MAX];
|
||||
@ -624,7 +624,7 @@ void recv_nbr_sol(void){
|
||||
|
||||
uint8_t send_na = 0;
|
||||
uint8_t sllao_set = 0;
|
||||
uint8_t aro_state;
|
||||
uint8_t aro_state = OPT_ARO_STATE_SUCCESS;
|
||||
|
||||
/* check whick options are set, we need that because an aro
|
||||
* option condition is that a sllao option is set. thus that we don't
|
||||
@ -714,11 +714,10 @@ void recv_nbr_sol(void){
|
||||
nbr_entry = nbr_cache_search(&(ipv6_buf->srcaddr));
|
||||
if(nbr_entry == NULL){
|
||||
/* create neighbor cache */
|
||||
nbr_cache_add(&ipv6_buf->srcaddr,
|
||||
&(opt_aro_buf->eui64),0,
|
||||
NBR_STATUS_STALE, NBR_CACHE_TYPE_TEN,
|
||||
opt_aro_buf->reg_ltime, NULL);
|
||||
aro_state = 0;
|
||||
aro_state = nbr_cache_add(&ipv6_buf->srcaddr,
|
||||
&(opt_aro_buf->eui64),0,
|
||||
NBR_STATUS_STALE, NBR_CACHE_TYPE_TEN,
|
||||
opt_aro_buf->reg_ltime, NULL);
|
||||
} else {
|
||||
if(memcmp(&(nbr_entry->addr.uint16[4]),
|
||||
&(opt_aro_buf->eui64.uint16[0]),8) == 0){
|
||||
@ -733,10 +732,11 @@ void recv_nbr_sol(void){
|
||||
nbr_entry->isrouter = 0;
|
||||
memcpy(&(nbr_entry->addr.uint8[0]),
|
||||
&(ipv6_buf->srcaddr.uint8[0]),16);
|
||||
}
|
||||
}
|
||||
aro_state = OPT_ARO_STATE_SUCCESS;
|
||||
} else {
|
||||
// duplicate found
|
||||
aro_state = 1;
|
||||
aro_state = OPT_ARO_STATE_DUP_ADDR;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -989,25 +989,28 @@ nbr_cache_t * nbr_cache_search(ipv6_addr_t *ipaddr){
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void nbr_cache_add(ipv6_addr_t *ipaddr, ieee_802154_long_t *laddr,
|
||||
uint8_t nbr_cache_add(ipv6_addr_t *ipaddr, ieee_802154_long_t *laddr,
|
||||
uint8_t isrouter, uint8_t state, uint8_t type,
|
||||
uint16_t ltime, ieee_802154_short_t *saddr){
|
||||
if(nbr_count == NBR_CACHE_SIZE){
|
||||
printf("ERROR: neighbor cache full\n");
|
||||
} else {
|
||||
memcpy(&(nbr_cache[nbr_count].addr), ipaddr, 16);
|
||||
memcpy(&(nbr_cache[nbr_count].laddr), laddr, 8);
|
||||
nbr_cache[nbr_count].isrouter = isrouter;
|
||||
nbr_cache[nbr_count].state = state;
|
||||
nbr_cache[nbr_count].type = type;
|
||||
|
||||
timex_t t;
|
||||
t.seconds = ltime;
|
||||
//vtimer_set_wakeup(&(nbr_cache[nbr_count].ltime), t,
|
||||
// nd_nbr_cache_rem_pid);
|
||||
|
||||
nbr_count++;
|
||||
return OPT_ARO_STATE_NBR_CACHE_FULL;
|
||||
}
|
||||
|
||||
memcpy(&(nbr_cache[nbr_count].addr), ipaddr, 16);
|
||||
memcpy(&(nbr_cache[nbr_count].laddr), laddr, 8);
|
||||
nbr_cache[nbr_count].isrouter = isrouter;
|
||||
nbr_cache[nbr_count].state = state;
|
||||
nbr_cache[nbr_count].type = type;
|
||||
|
||||
timex_t t;
|
||||
t.seconds = ltime;
|
||||
//vtimer_set_wakeup(&(nbr_cache[nbr_count].ltime), t,
|
||||
// nd_nbr_cache_rem_pid);
|
||||
|
||||
nbr_count++;
|
||||
|
||||
return OPT_ARO_STATE_SUCCESS;
|
||||
}
|
||||
|
||||
void nbr_cache_auto_rem(void){
|
||||
|
||||
@ -51,6 +51,9 @@
|
||||
#define OPT_ARO_LEN 2
|
||||
#define OPT_ARO_HDR_LEN 16
|
||||
#define OPT_ARO_LTIME 300 // geeigneten wert finden
|
||||
#define OPT_ARO_STATE_SUCCESS 0
|
||||
#define OPT_ARO_STATE_DUP_ADDR 1
|
||||
#define OPT_ARO_STATE_NBR_CACHE_FULL 2
|
||||
/* 6lowpan context option */
|
||||
#define OPT_6CO_TYPE 32
|
||||
#define OPT_6CO_MIN_LEN 2
|
||||
@ -221,7 +224,7 @@ abr_cache_t *abr_update_cache(
|
||||
lowpan_context_t **contexts, uint8_t contexts_num,
|
||||
plist_t **prefixes, uint8_t prefixes_num);
|
||||
nbr_cache_t * nbr_cache_search(ipv6_addr_t *ipaddr);
|
||||
void nbr_cache_add(ipv6_addr_t *ipaddr, ieee_802154_long_t *laddr,
|
||||
uint8_t nbr_cache_add(ipv6_addr_t *ipaddr, ieee_802154_long_t *laddr,
|
||||
uint8_t isrouter, uint8_t state, uint8_t type,
|
||||
uint16_t ltime, ieee_802154_short_t *saddr);
|
||||
void nbr_cache_auto_rem(void);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user