[MERGED] osmo-iuh[master]: hnbgw: UE context: add handling by tmsi identification

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Tue Sep 27 05:55:56 UTC 2016


Harald Welte has submitted this change and it was merged.

Change subject: hnbgw: UE context: add handling by tmsi identification
......................................................................


hnbgw: UE context: add handling by tmsi identification

To prepare for an upcoming commit that accepts TMSI identification upon UE
Register Requests:

Add tmsi arg to ue_context_alloc().
Add ue_context_by_tmsi().

This is aimed at the ip.access nano3G femto cell, as it apparently feeds
whichever identification the UE sends through to HNBAP (TMSI+LAI, pTMSI+RAI),
instead of an IMSI as expected.

See the upcoming commit that enables accepting TMSI identities for further
detail.

Change-Id: I138458443319cc4cbea5ee7906cf5dd72d582130
---
M include/osmocom/iuh/hnbgw.h
M src/hnbgw.c
M src/hnbgw_hnbap.c
3 files changed, 23 insertions(+), 6 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/iuh/hnbgw.h b/include/osmocom/iuh/hnbgw.h
index 21a9602..bee7fb6 100644
--- a/include/osmocom/iuh/hnbgw.h
+++ b/include/osmocom/iuh/hnbgw.h
@@ -101,8 +101,7 @@
 	/*! Unique Context ID for this UE */
 	uint32_t context_id;
 	char imsi[16+1];
-	/* TODO: track TMSI, for HNBAP UE Register Request with TMSI,
-	 * seen with ip.access nano3G femto cell */
+	uint32_t tmsi;
 	/*! UE is serviced via this HNB */
 	struct hnb_context *hnb;
 };
@@ -139,7 +138,9 @@
 
 struct ue_context *ue_context_by_id(struct hnb_gw *gw, uint32_t id);
 struct ue_context *ue_context_by_imsi(struct hnb_gw *gw, const char *imsi);
-struct ue_context *ue_context_alloc(struct hnb_context *hnb, const char *imsi);
+struct ue_context *ue_context_by_tmsi(struct hnb_gw *gw, uint32_t tmsi);
+struct ue_context *ue_context_alloc(struct hnb_context *hnb, const char *imsi,
+				    uint32_t tmsi);
 void ue_context_free(struct ue_context *ue);
 
 struct hnb_context *hnb_context_alloc(struct hnb_gw *gw, struct osmo_stream_srv_link *link, int new_fd);
diff --git a/src/hnbgw.c b/src/hnbgw.c
index 8c860b1..c326b12 100644
--- a/src/hnbgw.c
+++ b/src/hnbgw.c
@@ -111,6 +111,17 @@
 	return NULL;
 }
 
+struct ue_context *ue_context_by_tmsi(struct hnb_gw *gw, uint32_t tmsi)
+{
+	struct ue_context *ue;
+
+	llist_for_each_entry(ue, &gw->ue_list, list) {
+		if (ue->tmsi == tmsi)
+			return ue;
+	}
+	return NULL;
+}
+
 void ue_context_free_by_hnb(struct hnb_gw *gw, const struct hnb_context *hnb)
 {
 	struct ue_context *ue, *tmp;
@@ -132,7 +143,8 @@
 	return id;
 }
 
-struct ue_context *ue_context_alloc(struct hnb_context *hnb, const char *imsi)
+struct ue_context *ue_context_alloc(struct hnb_context *hnb, const char *imsi,
+				    uint32_t tmsi)
 {
 	struct ue_context *ue;
 
@@ -141,7 +153,11 @@
 		return NULL;
 
 	ue->hnb = hnb;
-	strncpy(ue->imsi, imsi, sizeof(ue->imsi));
+	if (imsi)
+		strncpy(ue->imsi, imsi, sizeof(ue->imsi));
+	else
+		ue->imsi[0] = '\0';
+	ue->tmsi = tmsi;
 	ue->context_id = get_next_ue_ctx_id(hnb->gw);
 	llist_add_tail(&ue->list, &hnb->gw->ue_list);
 
diff --git a/src/hnbgw_hnbap.c b/src/hnbgw_hnbap.c
index ae0d16c..78f4692 100644
--- a/src/hnbgw_hnbap.c
+++ b/src/hnbgw_hnbap.c
@@ -327,7 +327,7 @@
 
 	ue = ue_context_by_imsi(ctx->gw, imsi);
 	if (!ue)
-		ue = ue_context_alloc(ctx, imsi);
+		ue = ue_context_alloc(ctx, imsi, 0);
 
 	hnbap_free_ueregisterrequesties(&ies);
 	/* Send UERegisterAccept */

-- 
To view, visit https://gerrit.osmocom.org/909
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I138458443319cc4cbea5ee7906cf5dd72d582130
Gerrit-PatchSet: 3
Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list