Added optional address filtering

This commit is contained in:
Niclas Finne 2011-06-15 17:51:57 +02:00
parent e8a96dc202
commit 28b0479c06

View file

@ -52,6 +52,12 @@
#define PRINTF(...)
#endif
#ifdef NULLRDC_CONF_ADDRESS_FILTER
#define NULLRDC_ADDRESS_FILTER NULLRDC_CONF_ADDRESS_FILTER
#else
#define NULLRDC_ADDRESS_FILTER 1
#endif /* NULLRDC_CONF_ADDRESS_FILTER */
#ifndef NULLRDC_802154_AUTOACK
#ifdef NULLRDC_CONF_802154_AUTOACK
#define NULLRDC_802154_AUTOACK NULLRDC_CONF_802154_AUTOACK
@ -206,6 +212,13 @@ packet_input(void)
#endif /* NULLRDC_802154_AUTOACK */
if(NETSTACK_FRAMER.parse() == 0) {
PRINTF("nullrdc: failed to parse %u\n", packetbuf_datalen());
#if NULLRDC_ADDRESS_FILTER
} else if(!rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&rimeaddr_node_addr) &&
!rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&rimeaddr_null)) {
PRINTF("nullrdc: not for us\n");
#endif /* NULLRDC_ADDRESS_FILTER */
} else {
#if NULLRDC_802154_AUTOACK || NULLRDC_802154_AUTOACK_HW
/* Check for duplicate packet by comparing the sequence number