* Set sender and receiver packet attributes on incoming packets

* Added link layer destination check
This commit is contained in:
nifi 2009-10-19 11:25:54 +00:00
parent 10c873018d
commit ae226c5917

View File

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: lpp.c,v 1.25 2009/09/09 21:09:23 adamdunkels Exp $
* $Id: lpp.c,v 1.26 2009/10/19 11:25:54 nifi Exp $
*/
/**
@ -734,6 +734,18 @@ read_packet(void)
}
} else if(hdr->type == TYPE_DATA) {
if(!rimeaddr_cmp(&hdr->receiver, &rimeaddr_null)) {
if(!rimeaddr_cmp(&hdr->receiver, &rimeaddr_node_addr)) {
/* Not broadcast or for us */
PRINTF("%d.%d: data not for us from %d.%d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
hdr->sender.u8[0], hdr->sender.u8[1]);
return 0;
}
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, &hdr->receiver);
}
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &hdr->sender);
PRINTF("%d.%d: got data from %d.%d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
hdr->sender.u8[0], hdr->sender.u8[1]);