summaryrefslogtreecommitdiff
path: root/mac/sar/src/sar_mf.c
diff options
context:
space:
mode:
authorlaranjeiro2008-04-03 12:52:17 +0000
committerlaranjeiro2008-04-03 12:52:17 +0000
commit9589fd4a52c398cdb396dbe5672ffc4185da78bf (patch)
tree8ce7af92457500a51812ff78861f72fc8f4e7d75 /mac/sar/src/sar_mf.c
parent93df0c08a6af55d84089bfdd03b0b6dcbe99cc00 (diff)
Fixed a bug in the SAR, the MFL must contain the length of the ATS or
confounder if the MF contains it. Done in tx and rx. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@1747 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'mac/sar/src/sar_mf.c')
-rw-r--r--mac/sar/src/sar_mf.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/mac/sar/src/sar_mf.c b/mac/sar/src/sar_mf.c
index 36b0ebd2f5..6d1047ecb2 100644
--- a/mac/sar/src/sar_mf.c
+++ b/mac/sar/src/sar_mf.c
@@ -41,7 +41,7 @@ uint mf_get_type (pb_t * pb, uint offset)
* \param offset the offset to start reading
* \param payload_only request to return only the payload length if true.
*
- * \return length of the paylod with the header and icv
+ * \return length of the payload with the header and icv
*/
uint mf_get_length (pb_t *pb, uint offset, bool payload_only)
{
@@ -69,16 +69,20 @@ uint mf_get_length (pb_t *pb, uint offset, bool payload_only)
}
if (length < ETH_PACKET_MIN_SIZE || length
- > ETH_PACKET_MAX_SIZE)
+ > ETH_PACKET_MAX_SIZE + SAR_MF_ICV_SIZE)
return 0;
+
+ if (payload_only && (type > 1))
+ {
+ return length + 1 - SAR_MF_ATS_SIZE;
+ }
else if (payload_only)
+ {
return length + 1;
-
- switch (type) {
- case 0x1:
- return length + 7;
- default:
- return length + 11;
+ }
+ else
+ {
+ return length + 1 + SAR_MF_ICV_SIZE + SAR_MF_MFH_SIZE;
}
}