[PATCH] openbsc[vlr_3G]: IuPS adjustments

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/.

daniel gerrit-no-reply at lists.osmocom.org
Mon May 8 12:39:24 UTC 2017


Review at  https://gerrit.osmocom.org/2531

IuPS adjustments

SGSN: Don't indicate GERAN in Iu mode PDP CTX ACT REQ to GGSN

sgsn_ranap_iu_event: handle some events without valid MM context

sgsn init: pass sgsn_config pointer to sgsn_vty_init(), not sgsn_parse_config

IuPS: cosmetic: explicitly check RAN type; move comment

Change-Id: I8375ba42dd47d7ccd9ce9290767d6f8653a23b94
---
M openbsc/include/openbsc/sgsn.h
M openbsc/src/gprs/gprs_gmm.c
M openbsc/src/gprs/sgsn_libgtp.c
M openbsc/src/gprs/sgsn_main.c
M openbsc/src/gprs/sgsn_vty.c
5 files changed, 46 insertions(+), 23 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/31/2531/1

diff --git a/openbsc/include/openbsc/sgsn.h b/openbsc/include/openbsc/sgsn.h
index 1ede2c9..1ed1583 100644
--- a/openbsc/include/openbsc/sgsn.h
+++ b/openbsc/include/openbsc/sgsn.h
@@ -140,8 +140,8 @@
 
 /* sgsn_vty.c */
 
-int sgsn_vty_init(void);
-int sgsn_parse_config(const char *config_file, struct sgsn_config *cfg);
+int sgsn_vty_init(struct sgsn_config *cfg);
+int sgsn_parse_config(const char *config_file);
 
 /* sgsn.c */
 
diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c
index eb4cb1a..1e0568b 100644
--- a/openbsc/src/gprs/gprs_gmm.c
+++ b/openbsc/src/gprs/gprs_gmm.c
@@ -180,25 +180,33 @@
 	int rc = -1;
 
 	mm = sgsn_mm_ctx_by_ue_ctx(ctx);
-	if (!mm) {
-		LOGP(DRANAP, LOGL_NOTICE, "Cannot find mm ctx for IU event %i!\n", type);
-		return rc;
+
+#define REQUIRE_MM \
+	if (!mm) { \
+		LOGP(DRANAP, LOGL_NOTICE, "Cannot find mm ctx for IU event %i!\n", type); \
+		return rc; \
 	}
 
 	switch (type) {
 	case IU_EVENT_RAB_ASSIGN:
+		REQUIRE_MM
 		rc = sgsn_ranap_rab_ass_resp(mm, (RANAP_RAB_SetupOrModifiedItemIEs_t *)data);
 		break;
 	case IU_EVENT_IU_RELEASE:
 		/* fall thru */
 	case IU_EVENT_LINK_INVALIDATED:
 		/* Clean up ue_conn_ctx here */
-		LOGMMCTXP(LOGL_INFO, mm, "IU release for imsi %s\n", mm->imsi);
-		if (mm->pmm_state == PMM_CONNECTED)
+		if (mm)
+			LOGMMCTXP(LOGL_INFO, mm, "IU release for imsi %s\n", mm->imsi);
+		else
+			LOGMMCTXP(LOGL_INFO, mm, "IU release for UE conn 0x%x\n",
+				  ctx->conn_id);
+		if (mm && mm->pmm_state == PMM_CONNECTED)
 			mmctx_set_pmm_state(mm, PMM_IDLE);
 		rc = 0;
 		break;
 	case IU_EVENT_SECURITY_MODE_COMPLETE:
+		REQUIRE_MM
 		/* Continue authentication here */
 		mm->iu.ue_ctx->integrity_active = 1;
 		rc = gsm48_gmm_authorize(mm);
@@ -965,10 +973,12 @@
 static int gsm48_tx_gmm_ra_upd_ack(struct sgsn_mm_ctx *mm);
 
 #ifdef BUILD_IU
+/* Send RAB activation requests for all PDP contexts */
 void activate_pdp_rabs(struct sgsn_mm_ctx *ctx)
 {
-	/* Send RAB activation requests for all PDP contexts */
 	struct sgsn_pdp_ctx *pdp;
+	if (ctx->ran_type != MM_CTX_T_UTRAN_Iu)
+		return;
 	llist_for_each_entry(pdp, &ctx->pdp_list, list) {
 		iu_rab_act_ps(pdp->nsapi, pdp, 1);
 	}
diff --git a/openbsc/src/gprs/sgsn_libgtp.c b/openbsc/src/gprs/sgsn_libgtp.c
index c26abc9..2a863e0 100644
--- a/openbsc/src/gprs/sgsn_libgtp.c
+++ b/openbsc/src/gprs/sgsn_libgtp.c
@@ -247,12 +247,8 @@
 	memcpy(pdp->gsnlu.v, &sgsn->cfg.gtp_listenaddr.sin_addr,
 		sizeof(sgsn->cfg.gtp_listenaddr.sin_addr));
 
-	/* Assume we are a GERAN system */
-	pdp->rattype.l = 1;
-	pdp->rattype.v[0] = 2;
-	pdp->rattype_given = 1;
-
-	/* Include RAI and ULI all the time */
+	/* Routing Area Identifier with LAC and RAC fixed values, as
+	 * requested in 29.006 7.3.1 */
 	pdp->rai_given = 1;
 	pdp->rai.l = 6;
 	raid = mmctx->ra;
@@ -260,10 +256,24 @@
 	raid.rac = 0xFF;
 	gsm48_construct_ra(pdp->rai.v, &raid);
 
-	pdp->userloc_given = 1;
-	pdp->userloc.l = 8;
-	pdp->userloc.v[0] = 0; /* CGI for GERAN */
-	bssgp_create_cell_id(&pdp->userloc.v[1], &mmctx->ra, mmctx->gb.cell_id);
+	pdp->rattype.l = 1;
+	pdp->rattype_given = 1;
+
+	switch (mmctx->ran_type) {
+	case MM_CTX_T_GERAN_Gb:
+	case MM_CTX_T_GERAN_Iu:
+		pdp->rattype.v[0] = 2;
+		/* User Location Information */
+		pdp->userloc_given = 1;
+		pdp->userloc.l = 8;
+		pdp->userloc.v[0] = 0; /* CGI for GERAN */
+		bssgp_create_cell_id(&pdp->userloc.v[1], &mmctx->ra, mmctx->gb.cell_id);
+		break;
+	case MM_CTX_T_UTRAN_Iu:
+		pdp->rattype.v[0] = 1;
+		/* FIXME: Optional User Location Information with SAI */
+		break;
+	}
 
 	/* include the IMEI(SV) */
 	pdp->imeisv_given = 1;
diff --git a/openbsc/src/gprs/sgsn_main.c b/openbsc/src/gprs/sgsn_main.c
index 04f2825..221ee79 100644
--- a/openbsc/src/gprs/sgsn_main.c
+++ b/openbsc/src/gprs/sgsn_main.c
@@ -347,7 +347,7 @@
 	vty_init(&vty_info);
 	logging_vty_add_cmds(NULL);
 	osmo_stats_vty_add_cmds(&gprs_log_info);
-	sgsn_vty_init();
+	sgsn_vty_init(&sgsn_inst.cfg);
 	ctrl_vty_init(tall_bsc_ctx);
 #ifdef BUILD_IU
 	iu_vty_init(&asn_debug);
@@ -379,7 +379,7 @@
 	sgsn_cdr_init(&sgsn_inst);
 	/* FIXME: register signal handler for SS_L_NS */
 
-	rc = sgsn_parse_config(sgsn_inst.config_file, &sgsn_inst.cfg);
+	rc = sgsn_parse_config(sgsn_inst.config_file);
 	if (rc < 0) {
 		LOGP(DGPRS, LOGL_FATAL, "Error in config file\n");
 		exit(2);
diff --git a/openbsc/src/gprs/sgsn_vty.c b/openbsc/src/gprs/sgsn_vty.c
index d42a165..522533a 100644
--- a/openbsc/src/gprs/sgsn_vty.c
+++ b/openbsc/src/gprs/sgsn_vty.c
@@ -1221,8 +1221,10 @@
 	return CMD_SUCCESS;
 }
 
-int sgsn_vty_init(void)
+int sgsn_vty_init(struct sgsn_config *cfg)
 {
+	g_cfg = cfg;
+
 	install_element_ve(&show_sgsn_cmd);
 	//install_element_ve(&show_mmctx_tlli_cmd);
 	install_element_ve(&show_mmctx_imsi_cmd);
@@ -1284,11 +1286,12 @@
 	return 0;
 }
 
-int sgsn_parse_config(const char *config_file, struct sgsn_config *cfg)
+int sgsn_parse_config(const char *config_file)
 {
 	int rc;
 
-	g_cfg = cfg;
+	/* make sure sgsn_vty_init() was called before this */
+	OSMO_ASSERT(g_cfg);
 
 	g_cfg->timers.T3312 = GSM0408_T3312_SECS;
 	g_cfg->timers.T3322 = GSM0408_T3322_SECS;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8375ba42dd47d7ccd9ce9290767d6f8653a23b94
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: vlr_3G
Gerrit-Owner: daniel <dwillmann at sysmocom.de>



More information about the gerrit-log mailing list