Change in osmo-iuh[master]: Discard the existing HNB+ContextID to SCCP Connection ID mapping on N...

Mykola Shchetinin gerrit-no-reply at lists.osmocom.org
Tue May 7 13:36:17 UTC 2019


Mykola Shchetinin has uploaded this change for review. ( https://gerrit.osmocom.org/13896


Change subject: Discard the existing HNB+ContextID to SCCP Connection ID mapping on N-CONNECT.
......................................................................

Discard the existing HNB+ContextID to SCCP Connection ID mapping on N-CONNECT.

After a period of inactivity the phone sends a GMM Service Request again in an
InitialUE-Request message which triggers a new connection to be created. The
problem is that a new SCCP connection wasn't created but a new ranap_ue_conn_ctx
was allocated. As a result, the following message (SecurityModeComplete) uses
the old SCCP connection and the wrong ranap_ue_conn_ctx (old) is selected.

hnbgw_rua.c: rua_to_scu: in case of OSMO_SCU_PRIM_N_CONNECT deactivate the
existing hnbgw_context_map to force the context_map_alloc_by_hnb to allocate a
new one.

context_map.c/.h: Create function context_map_find_by_hnb. It replaces part of
context_map_alloc_by_hnb's functionality.

Fixes: OS#3936
Change-Id: If85d45dc0c5c6f1a9dbfed6c3752f00ff7b541f2
---
M include/osmocom/iuh/context_map.h
M src/context_map.c
M src/hnbgw_rua.c
3 files changed, 35 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/96/13896/1

diff --git a/include/osmocom/iuh/context_map.h b/include/osmocom/iuh/context_map.h
index 6279b91..29eb64a 100644
--- a/include/osmocom/iuh/context_map.h
+++ b/include/osmocom/iuh/context_map.h
@@ -37,6 +37,10 @@
 	enum hnbgw_context_map_state state;
 };
 
+struct hnbgw_context_map *
+context_map_find_by_hnb(struct hnb_context *hnb, uint32_t rua_ctx_id,
+			bool is_ps,
+			struct hnbgw_cnlink *cn_if_new);
 
 struct hnbgw_context_map *
 context_map_alloc_by_hnb(struct hnb_context *hnb, uint32_t rua_ctx_id,
diff --git a/src/context_map.c b/src/context_map.c
index dc555bf..d13eea3 100644
--- a/src/context_map.c
+++ b/src/context_map.c
@@ -63,11 +63,13 @@
 	return -1;
 }
 
-/* Map from a HNB + ContextID to the SCCP-side Connection ID */
+/* Map from a HNB + ContextID to the SCCP-side Connection ID.
+ * Return NULL if not found.
+ */
 struct hnbgw_context_map *
-context_map_alloc_by_hnb(struct hnb_context *hnb, uint32_t rua_ctx_id,
-			 bool is_ps,
-			 struct hnbgw_cnlink *cn_if_new)
+context_map_find_by_hnb(struct hnb_context *hnb, uint32_t rua_ctx_id,
+			bool is_ps,
+			struct hnbgw_cnlink *cn_if_new)
 {
 	struct hnbgw_context_map *map;
 	uint32_t new_scu_conn_id;
@@ -84,6 +86,25 @@
 		}
 	}
 
+	return NULL;
+}
+
+/* Map from a HNB + ContextID to the SCCP-side Connection ID.
+ * Find an existing one or allocate a new one if not found.
+ */
+struct hnbgw_context_map *
+context_map_alloc_by_hnb(struct hnb_context *hnb, uint32_t rua_ctx_id,
+			 bool is_ps,
+			 struct hnbgw_cnlink *cn_if_new)
+{
+	struct hnbgw_context_map *map;
+	uint32_t new_scu_conn_id;
+
+	map = context_map_find_by_hnb(hnb, rua_ctx_id, is_ps, cn_if_new);
+
+	if (map)
+		return map;
+
 	if (alloc_cn_conn_id(cn_if_new, &new_scu_conn_id) < 0) {
 		LOGP(DMAIN, LOGL_ERROR, "Unable to allocate CN connection ID\n");
 		return NULL;
diff --git a/src/hnbgw_rua.c b/src/hnbgw_rua.c
index 40d1d94..f225f1a 100644
--- a/src/hnbgw_rua.c
+++ b/src/hnbgw_rua.c
@@ -220,6 +220,12 @@
 		       osmo_sccp_addr_dump(remote_addr),
 		       context_id);
 		break;
+	case OSMO_SCU_PRIM_N_CONNECT:
+		map = context_map_find_by_hnb(hnb, context_id, is_ps, cn);
+		if (map) {
+			/* Forcing context_map_alloc_by_hnb to allocate a new "map" */
+			context_map_deactivate(map);
+		}
 	default:
 		map = context_map_alloc_by_hnb(hnb, context_id, is_ps, cn);
 		OSMO_ASSERT(map);

-- 
To view, visit https://gerrit.osmocom.org/13896
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: If85d45dc0c5c6f1a9dbfed6c3752f00ff7b541f2
Gerrit-Change-Number: 13896
Gerrit-PatchSet: 1
Gerrit-Owner: Mykola Shchetinin <mykola at pentonet.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190507/5e81c53d/attachment.html>


More information about the gerrit-log mailing list