]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Fix bug in link estimator packet payload get. The old version
authorscipio <scipio>
Sat, 27 Oct 2007 00:07:56 +0000 (00:07 +0000)
committerscipio <scipio>
Sat, 27 Oct 2007 00:07:56 +0000 (00:07 +0000)
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

index 86f5c64dc178cd774aa3462ae53aa8bc0077eb83..616d44184afd3dab59676c4bbeda1fb9e53092f3 100644 (file)
@@ -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);
     }