gprs: Use different RAB IDs for activation

This commit is contained in:
Daniel Willmann
2016-04-08 12:14:56 +02:00
parent 42024336fe
commit 5e007d9445
4 changed files with 29 additions and 9 deletions

View File

@@ -149,6 +149,7 @@ struct sgsn_mm_ctx {
void *ue_ctx;
struct service_info service;
int integrity_active;
uint8_t rab_id;
} iu;
/* VLR number */
uint32_t new_sgsn_addr;
@@ -225,6 +226,7 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli(uint32_t tlli,
struct sgsn_mm_ctx *sgsn_mm_ctx_by_ptmsi(uint32_t tmsi);
struct sgsn_mm_ctx *sgsn_mm_ctx_by_imsi(const char *imsi);
struct sgsn_mm_ctx *sgsn_mm_ctx_by_ue_ctx(const void *uectx);
uint8_t rab_id_from_mm_ctx(struct sgsn_mm_ctx *mm);
/* look-up by matching TLLI and P-TMSI (think twice before using this) */
struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli_and_ptmsi(uint32_t tlli,

View File

@@ -698,9 +698,23 @@ 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);
void activate_pdp_rabs(struct sgsn_mm_ctx *ctx)
{
/* Send RAB activation requests for all PDP contexts */
if (ctx->iu.service.type == 1) {
struct sgsn_pdp_ctx *pdp;
uint8_t rab_id;
llist_for_each_entry(pdp, &ctx->pdp_list, list) {
rab_id = rab_id_from_mm_ctx(ctx);
iu_rab_act_ps(rab_id, pdp);
}
}
}
/* Check if we can already authorize a subscriber */
static int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx)
{
int rc;
#ifndef PTMSI_ALLOC
struct sgsn_signal_data sig_data;
#endif
@@ -783,15 +797,11 @@ static int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx)
/* TODO: PMM State transition */
ctx->pending_req = 0;
/* Send RAB activation requests for all PDP contexts */
if (ctx->iu.service.type == 1) {
struct sgsn_pdp_ctx *pdp;
llist_for_each_entry(pdp, &ctx->pdp_list, list) {
iu_rab_act_ps(1, pdp);
}
}
rc = gsm48_tx_gmm_service_ack(ctx);
return gsm48_tx_gmm_service_ack(ctx);
activate_pdp_rabs(ctx);
return rc;
case GSM48_MT_GMM_RA_UPD_REQ:
/* Send RA UPDATE ACCEPT */
return gsm48_tx_gmm_ra_upd_ack(ctx);

View File

@@ -105,6 +105,10 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_by_ue_ctx(const void *uectx)
return NULL;
}
uint8_t rab_id_from_mm_ctx(struct sgsn_mm_ctx *mm)
{
return mm->iu.rab_id++;
}
/* look-up a SGSN MM context based on TLLI + RAI */
struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli(uint32_t tlli,
@@ -204,6 +208,7 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_alloc_iu(void *uectx)
ctx->ran_type = MM_CTX_T_UTRAN_Iu;
ctx->iu.ue_ctx = uectx;
ctx->iu.rab_id = 1;
ctx->mm_state = GMM_DEREGISTERED;
ctx->auth_triplet.key_seq = GSM_KEY_SEQ_INVAL;
ctx->ctrg = rate_ctr_group_alloc(ctx, &mmctx_ctrg_desc, 0);

View File

@@ -370,7 +370,10 @@ static int create_pdp_conf(struct pdp_t *pdp, void *cbp, int cause)
return send_act_pdp_cont_acc(pctx);
} else {
/* Activate a radio bearer */
iu_rab_act_ps(1, pctx);
uint8_t rab_id;
rab_id = rab_id_from_mm_ctx(pctx);
iu_rab_act_ps(rab_id, pctx);
return 0;
}