diff options
author | Harald Welte <laforge@gnumonks.org> | 2016-05-02 08:34:57 +0200 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2017-05-08 13:45:11 +0200 |
commit | 227bbf2f61bd927e7ff0512b8ffc7cd54c4e33ef (patch) | |
tree | 02568711f506d208daa00ae507049fbb51a9d050 /openbsc/src | |
parent | 07d403cae51ecec5f8f079ccc80c6bd92c35f818 (diff) |
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
Diffstat (limited to 'openbsc/src')
-rw-r--r-- | openbsc/src/gprs/gprs_gmm.c | 22 | ||||
-rw-r--r-- | openbsc/src/gprs/sgsn_libgtp.c | 30 | ||||
-rw-r--r-- | openbsc/src/gprs/sgsn_main.c | 4 | ||||
-rw-r--r-- | openbsc/src/gprs/sgsn_vty.c | 9 |
4 files changed, 44 insertions, 21 deletions
diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c index eb4cb1a0e..1e0568b2c 100644 --- a/openbsc/src/gprs/gprs_gmm.c +++ b/openbsc/src/gprs/gprs_gmm.c @@ -180,25 +180,33 @@ int sgsn_ranap_iu_event(struct ue_conn_ctx *ctx, enum iu_event_type type, void * 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_service_rej(struct sgsn_mm_ctx *mm, 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 c26abc992..2a863e0fc 100644 --- a/openbsc/src/gprs/sgsn_libgtp.c +++ b/openbsc/src/gprs/sgsn_libgtp.c @@ -247,12 +247,8 @@ struct sgsn_pdp_ctx *sgsn_create_pdp_ctx(struct sgsn_ggsn_ctx *ggsn, 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 @@ struct sgsn_pdp_ctx *sgsn_create_pdp_ctx(struct sgsn_ggsn_ctx *ggsn, 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 04f2825f7..221ee7976 100644 --- a/openbsc/src/gprs/sgsn_main.c +++ b/openbsc/src/gprs/sgsn_main.c @@ -347,7 +347,7 @@ int main(int argc, char **argv) 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 @@ int main(int argc, char **argv) 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 e09a0296b..1cefe37cf 100644 --- a/openbsc/src/gprs/sgsn_vty.c +++ b/openbsc/src/gprs/sgsn_vty.c @@ -1222,8 +1222,10 @@ DEFUN(cfg_comp_v42bisp, cfg_comp_v42bisp_cmd, 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); @@ -1285,11 +1287,12 @@ int sgsn_vty_init(void) 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; |