summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe SAVE2013-02-12 18:31:59 +0100
committerJean-Philippe SAVE2013-02-14 15:55:27 +0100
commitc0863827016277068d27276ecbd31f8d71b1bf63 (patch)
tree609c22e4199f08cd9e3f7ad71df297c8d32f21a6
parent44901c27b9ef3a57eeb310b1d3e32c67c6604b47 (diff)
cesar/mac/common: fix the version field size in intervals_t, closes #2541
This commit is a cherry-pick of this one: d87f522ea3ab6b01de8aacc2df18079a48109d6f
-rw-r--r--cesar/ce/tx/test/src/test_mme.c21
-rw-r--r--cesar/mac/common/tonemap.h2
2 files changed, 21 insertions, 2 deletions
diff --git a/cesar/ce/tx/test/src/test_mme.c b/cesar/ce/tx/test/src/test_mme.c
index 5de5346158..82b9a41b27 100644
--- a/cesar/ce/tx/test/src/test_mme.c
+++ b/cesar/ce/tx/test/src/test_mme.c
@@ -202,7 +202,7 @@ mme_test_suite (test_t t, tonemask_info_t *default_tone_mask)
test_case_begin (t, "ce tx mme reception");
int i;
- uint intervals_version = 0;
+ u8 intervals_version = 0;
cp_mme_rx_t mme;
mme.peer.tei = peer_tei;
mme.mmtype = CM_CHAN_EST_IND;
@@ -688,6 +688,25 @@ mme_test_suite (test_t t, tonemask_info_t *default_tone_mask)
test_fail_if (sta->tx_tonemaps->intervals->version != intervals_version);
} test_end;
+ test_begin (t, "test version indicator overflow")
+ {
+ uint j;
+ sta->tx_tonemaps->intervals->version = 250;
+ /* First time we receive a MME from the CE, interval version is
+ * incremented twice. */
+ intervals_version = 252;
+
+ for (j=0; j<50; j++)
+ {
+ memset (mme_data, 0xFF, ETH_PACKET_MAX_SIZE);
+ ce_test_mme_cm_chan_est_ind_build_default (mme_data, &mme);
+ test_fail_if (ce_tx_cm_chan_est_ind_receive (&cp, &mme)
+ != CE_TX_MME_OK);
+ test_fail_if (sta->tx_tonemaps->intervals->version
+ != intervals_version++);
+ }
+ } test_end;
+
/* Clean. */
blk_release (sta);
dbg_check (mac_store_sta_remove (cp.mac_store, peer_tei));
diff --git a/cesar/mac/common/tonemap.h b/cesar/mac/common/tonemap.h
index 270f7096e4..d57d68a1d5 100644
--- a/cesar/mac/common/tonemap.h
+++ b/cesar/mac/common/tonemap.h
@@ -133,7 +133,7 @@ struct tonemap_intervals_t
* This change is handle by the mac_interval_commit_changes function which
* will update the version while swapping intervals list.
*/
- uint version;
+ u8 version;
/**
* Count of intervals.
* 0 is a valid number (0 intervals).