From: scipio Date: Sat, 27 Oct 2007 00:07:56 +0000 (+0000) Subject: Fix bug in link estimator packet payload get. The old version X-Git-Tag: release_tinyos_2_1_0_0~680 X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=commitdiff_plain;h=e20f836a07475e6653e609dc9c86c096fbb2f263;hp=582af5c7806051948123e61bba4fc0cfc2c17462;p=tinyos-2.x.git 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.... --- 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); }