pespin submitted this change.

View Change

Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve
hnb-test: parse LU Accept IEs after the LAI

The Location Updating Accept begins with the mandatory Location Area
Identification, a five octet V IE (3GPP TS 24.008 section 9.2.13). The
optional TLV IEs, among them the Mobile Identity carrying a new TMSI,
start after it.

hnb-test handed the whole message body to tlv_parse(), which read the
first LAI octet as an IEI and failed with
OSMO_TLVP_ERR_UNKNOWN_TLV_TYPE. The TMSI Reallocation Complete was
therefore never sent, and osmo-msc, which allocates a TMSI by default,
released the connection with a Location Updating Reject when its timer
expired.

Start the parser after the LAI, and read the identity type from the
Mobile Identity IE instead of the Network Name IE, which is not present
in this message and would have been dereferenced as NULL.

Change-Id: I2e1eb8e1bc3db5f20b04a3161713c8a47847c6dc
Signed-off-by: Andrei Gosman <andrei.gosman@gmail.com>
---
M tests/hnb-test.c
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tests/hnb-test.c b/tests/hnb-test.c
index 6eca9df..be9f170 100644
--- a/tests/hnb-test.c
+++ b/tests/hnb-test.c
@@ -298,14 +298,20 @@
int parse_res;

len -= (const char *)&gh->data[0] - (const char *)gh;
- parse_res = tlv_parse(&tp, &gsm48_mm_att_tlvdef, &gh->data[0], len, 0, 0);
+
+ /* The Location Area Identification is a mandatory V IE of five octets
+ * at the start of the message body (TS 24.008 section 9.2.13); the
+ * TLV parser must start after it, or it takes the first LAI octet for
+ * an unknown IEI and fails. */
+ parse_res = tlv_parse(&tp, &gsm48_mm_att_tlvdef, &gh->data[sizeof(*lai)],
+ len - sizeof(*lai), 0, 0);
if (parse_res <= 0) {
printf("Error parsing Location Update Accept message: %d\n", parse_res);
return -1;
}

if (TLVP_PRESENT(&tp, GSM48_IE_MOBILE_ID)) {
- uint8_t type = TLVP_VAL(&tp, GSM48_IE_NAME_SHORT)[0] & 0x0f;
+ uint8_t type = TLVP_VAL(&tp, GSM48_IE_MOBILE_ID)[0] & 0x0f;
if (type == GSM_MI_TYPE_TMSI)
*sent_tmsi = 1;
else *sent_tmsi = 0;

To view, visit change 43592. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Change-Id: I2e1eb8e1bc3db5f20b04a3161713c8a47847c6dc
Gerrit-Change-Number: 43592
Gerrit-PatchSet: 1
Gerrit-Owner: andrei.gosman@gmail.com <andrei.gosman@gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>