Add (dangerous) feature : use layer 2 acks instead of NUD in the IPv6 layer.
(Decrease packet numbers but dangerous if neighbors change their ips (not a problem in standard RPL with EUI-64 based addresses))
This commit is contained in:
parent
6ddd0bb190
commit
2ac91d53b5
3 changed files with 46 additions and 0 deletions
|
@ -39,6 +39,8 @@
|
||||||
|
|
||||||
#include "net/neighbor-info.h"
|
#include "net/neighbor-info.h"
|
||||||
#include "net/neighbor-attr.h"
|
#include "net/neighbor-attr.h"
|
||||||
|
#include "net/uip-ds6.h"
|
||||||
|
#include "net/uip-nd6.h"
|
||||||
|
|
||||||
#define DEBUG DEBUG_NONE
|
#define DEBUG DEBUG_NONE
|
||||||
#include "net/uip-debug.h"
|
#include "net/uip-debug.h"
|
||||||
|
@ -104,6 +106,9 @@ neighbor_info_packet_sent(int status, int numtx)
|
||||||
{
|
{
|
||||||
const rimeaddr_t *dest;
|
const rimeaddr_t *dest;
|
||||||
link_metric_t packet_metric;
|
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);
|
dest = packetbuf_addr(PACKETBUF_ADDR_RECEIVER);
|
||||||
if(rimeaddr_cmp(dest, &rimeaddr_null)) {
|
if(rimeaddr_cmp(dest, &rimeaddr_null)) {
|
||||||
|
@ -118,6 +123,21 @@ neighbor_info_packet_sent(int status, int numtx)
|
||||||
case MAC_TX_OK:
|
case MAC_TX_OK:
|
||||||
packet_metric = numtx;
|
packet_metric = numtx;
|
||||||
add_neighbor(dest);
|
add_neighbor(dest);
|
||||||
|
#if UIP_DS6_LL_NUD
|
||||||
|
nbr=uip_ds6_nbr_ll_lookup((uip_lladdr_t *) dest);
|
||||||
|
if (nbr!=NULL) {
|
||||||
|
PRINTF("neighbor-info : nbr state = %u\n",nbr->state);
|
||||||
|
} else {
|
||||||
|
PRINTF("neighbor-info : no nbr\n");
|
||||||
|
}
|
||||||
|
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 linklayer ack : ");
|
||||||
|
PRINTLLADDR((uip_lladdr_t *)dest);
|
||||||
|
PRINTF(" is reachable.\n");
|
||||||
|
}
|
||||||
|
#endif /* UIP_DS6_LL_NUD */
|
||||||
break;
|
break;
|
||||||
case MAC_TX_COLLISION:
|
case MAC_TX_COLLISION:
|
||||||
packet_metric = numtx;
|
packet_metric = numtx;
|
||||||
|
|
|
@ -369,6 +369,24 @@ uip_ds6_nbr_lookup(uip_ipaddr_t *ipaddr)
|
||||||
return NULL;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
uip_ds6_defrt_t *
|
uip_ds6_defrt_t *
|
||||||
uip_ds6_defrt_add(uip_ipaddr_t *ipaddr, unsigned long interval)
|
uip_ds6_defrt_add(uip_ipaddr_t *ipaddr, unsigned long interval)
|
||||||
|
|
|
@ -124,6 +124,13 @@
|
||||||
#endif
|
#endif
|
||||||
#define UIP_DS6_AADDR_NB UIP_DS6_AADDR_NBS + UIP_DS6_AADDR_NBU
|
#define UIP_DS6_AADDR_NB UIP_DS6_AADDR_NBS + UIP_DS6_AADDR_NBU
|
||||||
|
|
||||||
|
/*--------------------------------------------------*/
|
||||||
|
/* Should we use LinkLayer acks in NUD ?*/
|
||||||
|
#ifndef UIP_CONF_DS6_LL_NUD
|
||||||
|
#define UIP_DS6_LL_NUD 0
|
||||||
|
#else
|
||||||
|
#define UIP_DS6_LL_NUD UIP_CONF_DS6_LL_NUD
|
||||||
|
#endif
|
||||||
|
|
||||||
/*--------------------------------------------------*/
|
/*--------------------------------------------------*/
|
||||||
/** \brief Possible states for the nbr cache entries */
|
/** \brief Possible states for the nbr cache entries */
|
||||||
|
@ -312,6 +319,7 @@ uip_ds6_nbr_t *uip_ds6_nbr_add(uip_ipaddr_t *ipaddr, uip_lladdr_t *lladdr,
|
||||||
uint8_t isrouter, uint8_t state);
|
uint8_t isrouter, uint8_t state);
|
||||||
void uip_ds6_nbr_rm(uip_ds6_nbr_t *nbr);
|
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_lookup(uip_ipaddr_t *ipaddr);
|
||||||
|
uip_ds6_nbr_t *uip_ds6_nbr_ll_lookup(uip_lladdr_t *lladdr);
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue