summaryrefslogtreecommitdiff
path: root/cesar/cp
diff options
context:
space:
mode:
authorNélio Laranjeiro2011-04-05 16:26:30 +0200
committerNélio Laranjeiro2011-04-12 17:55:41 +0200
commit54e523e0a8948a0cdfddafcce04a88fda2a07f4e (patch)
treeea3d5b4672adbd7caf1b4e68d29da0d6182efa41 /cesar/cp
parent892767bd357caf5a62ab44f4099a4301f3865661 (diff)
cesar/cp/cl_interf: authorize MME with MMEType 0, closes #2438
Diffstat (limited to 'cesar/cp')
-rw-r--r--cesar/cp/cl_interf/test/src/test-cl-interf.c3
-rw-r--r--cesar/cp/msg/src/msg.c5
-rw-r--r--cesar/cp/msg/test/src/test-msg-read-header.c5
3 files changed, 8 insertions, 5 deletions
diff --git a/cesar/cp/cl_interf/test/src/test-cl-interf.c b/cesar/cp/cl_interf/test/src/test-cl-interf.c
index 2893f468f5..b0581f0bc2 100644
--- a/cesar/cp/cl_interf/test/src/test-cl-interf.c
+++ b/cesar/cp/cl_interf/test/src/test-cl-interf.c
@@ -533,7 +533,8 @@ cp_msg_mme_read_header (cp_t *ctx, u8 *mme, uint length, cp_tei_t tei,
bitstream_access (&mme_rx->bitstream, fmi, 16);
// Verify some data.
- if ((mmv != HPAV_MMV1) || (swap16(mtype) != HPAV_MTYPE_MME))
+ if ((mmv > HPAV_MMV_MAX)
+ || (swap16(mtype) != HPAV_MTYPE_MME))
{
slab_release (mme_rx);
mme_rx = NULL;
diff --git a/cesar/cp/msg/src/msg.c b/cesar/cp/msg/src/msg.c
index ce9b44af71..64a28034b2 100644
--- a/cesar/cp/msg/src/msg.c
+++ b/cesar/cp/msg/src/msg.c
@@ -1046,7 +1046,8 @@ cp_msg_mme_read_header_initialised (cp_mme_rx_t *mme, uint *fmi,
bitstream_access (&mme->bitstream, fmi, 16);
// Verify some data.
- if ((mme->mmv != HPAV_MMV1) || (swap16(mtype) != HPAV_MTYPE_MME))
+ if ((mme->mmv > HPAV_MMV_MAX)
+ || (swap16(mtype) != HPAV_MTYPE_MME))
{
return false;
}
@@ -1269,7 +1270,7 @@ cp_msg_mme_read_header_enc (cp_t *ctx, cp_mme_rx_t *mme)
bitstream_access (&mme->bitstream, &mtype, 16);
bitstream_access (&mme->bitstream, &mmv, 8);
- if ((mmv != HPAV_MMV1)
+ if ((mmv > HPAV_MMV_MAX)
|| (mtype != swap16(HPAV_MTYPE_MME))
|| (oda != cp_sta_own_data_get_mac_address (ctx))
|| (osa != mme->peer.mac)
diff --git a/cesar/cp/msg/test/src/test-msg-read-header.c b/cesar/cp/msg/test/src/test-msg-read-header.c
index 4443a16153..8da2b3789e 100644
--- a/cesar/cp/msg/test/src/test-msg-read-header.c
+++ b/cesar/cp/msg/test/src/test-msg-read-header.c
@@ -197,7 +197,7 @@ test_case_msg_read_header_mme_without_vlan (test_t test)
test_end;
slab_release (mme);
- test_case_begin (test, "TEST 3");
+ test_case_begin (test, "TEST 3 - MMV == 0");
bitstream_init (&bitstream, buffer, 23, BITSTREAM_WRITE);
data = 0x123456789ABCull;
@@ -218,7 +218,8 @@ test_case_msg_read_header_mme_without_vlan (test_t test)
test_begin (test, "Read a MME without vlan")
{
- test_fail_if (mme != NULL, "Shall be null");
+ test_fail_unless (mme);
+ slab_release (mme);
}
test_end;