From e20f836a07475e6653e609dc9c86c096fbb2f263 Mon Sep 17 00:00:00 2001 From: scipio Date: Sat, 27 Oct 2007 00:07:56 +0000 Subject: [PATCH] Fix bug in link estimator packet payload get. The old version considered the LE header when calculating a valid payload. THis is problematic if you receive a packet with a large footer, but want to send a packet with a large payload: the getPayload() would incorrectly only let you get a small payload and so return NULL. This is probably the first instance I've seen where clear() might have been useful.... --- tos/lib/net/4bitle/LinkEstimatorP.nc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tos/lib/net/4bitle/LinkEstimatorP.nc b/tos/lib/net/4bitle/LinkEstimatorP.nc index 86f5c64d..616d4418 100644 --- a/tos/lib/net/4bitle/LinkEstimatorP.nc +++ b/tos/lib/net/4bitle/LinkEstimatorP.nc @@ -690,9 +690,7 @@ implementation { // application payload pointer is just past the link estimation header command void* Packet.getPayload(message_t* msg, uint8_t len) { - linkest_header_t *hdr = getHeader(msg); - uint8_t footerLen = (hdr->flags & NUM_ENTRIES_FLAG) * sizeof(linkest_header_t); - void* payload = call SubPacket.getPayload(msg, len + footerLen); + void* payload = call SubPacket.getPayload(msg, len + sizeof(linkest_header_t)); if (payload != NULL) { payload += sizeof(linkest_header_t); } -- 2.39.2