Fixed alignment problem on the MSP430, where the LPP header may be misaligned

This commit is contained in:
adamdunkels 2009-03-31 17:39:54 +00:00
parent dc8338d248
commit 04101aae36

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: lpp.c,v 1.14 2009/03/31 14:44:13 nvt-se Exp $
* $Id: lpp.c,v 1.15 2009/03/31 17:39:54 adamdunkels Exp $
*/
/**
@ -251,22 +251,21 @@ dutycycle(void *ptr)
static int
send_packet(void)
{
struct lpp_hdr *hdr;
struct lpp_hdr hdr;
clock_time_t timeout;
packetbuf_hdralloc(sizeof(struct lpp_hdr));
hdr = packetbuf_hdrptr();
rimeaddr_copy(&hdr.sender, &rimeaddr_node_addr);
rimeaddr_copy(&hdr.receiver, packetbuf_addr(PACKETBUF_ADDR_RECEIVER));
hdr.type = TYPE_DATA;
rimeaddr_copy(&hdr->sender, &rimeaddr_node_addr);
rimeaddr_copy(&hdr->receiver, packetbuf_addr(PACKETBUF_ADDR_RECEIVER));
hdr->type = TYPE_DATA;
packetbuf_hdralloc(sizeof(struct lpp_hdr));
memcpy(packetbuf_hdrptr(), &hdr, sizeof(struct lpp_hdr));
packetbuf_compact();
PRINTF("%d.%d: queueing packet to %d.%d, channel %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
hdr->receiver.u8[0], hdr->receiver.u8[1],
hdr.receiver.u8[0], hdr.receiver.u8[1],
packetbuf_attr(PACKETBUF_ATTR_CHANNEL));
if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) == PACKETBUF_ATTR_PACKET_TYPE_ACK) {
/* Immediately send ACKs - we're assuming that the other node is
listening. */
@ -283,7 +282,7 @@ send_packet(void)
} else {
list_add(queued_packets_list, i);
timeout = UNICAST_TIMEOUT;
if(rimeaddr_cmp(&hdr->receiver, &rimeaddr_null)) {
if(rimeaddr_cmp(&hdr.receiver, &rimeaddr_null)) {
timeout = PACKET_LIFETIME;
}
ctimer_set(&i->timer, timeout, remove_queued_packet, i);