aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libiu/iu.c
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2016-02-15 13:58:35 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-03-03 16:19:10 +0100
commit711333c1137137508912000cc9e4398cf205c341 (patch)
tree2947300dd37bbbba441068dd3c5f743d0dd7fa23 /openbsc/src/libiu/iu.c
parent91f04dfe3a6cc685ae2dc16f7b47aa22c1e56ae2 (diff)
sgsn_iu: Parse the RAB assignemnt response and get pdp ctx form it
The RAB assignment response includes the gtp teid that we sent along in the assignment request. Retrieve the correct pdp context from there and activate it.
Diffstat (limited to 'openbsc/src/libiu/iu.c')
-rw-r--r--openbsc/src/libiu/iu.c41
1 files changed, 28 insertions, 13 deletions
diff --git a/openbsc/src/libiu/iu.c b/openbsc/src/libiu/iu.c
index 41425df3a..33583aa82 100644
--- a/openbsc/src/libiu/iu.c
+++ b/openbsc/src/libiu/iu.c
@@ -101,8 +101,6 @@ int iu_rab_act_ps(struct sgsn_pdp_ctx *pdp)
uint32_t ggsn_ip;
uectx = mm->iu.ue_ctx;
- uectx->pdp = pdp;
-
/* Get the IP address for ggsn user plane */
memcpy(&ggsn_ip, pdp->lib->gsnru.v, pdp->lib->gsnru.l);
@@ -257,27 +255,44 @@ int send_act_pdp_cont_acc(struct sgsn_pdp_ctx *pctx);
static int ranap_handle_co_rab_ass_resp(struct ue_conn_ctx *ctx, RANAP_RAB_AssignmentResponseIEs_t *ies)
{
- int rc;
+ struct sgsn_mm_ctx *mm;
+ struct sgsn_pdp_ctx *pdp = NULL;
+ int i, rc;
+ uint8_t rab_id;
+ uint32_t gtp_tei;
+
+ mm = sgsn_mm_ctx_by_ue_ctx(ctx);
+ /* XXX: Error handling */
LOGP(DRANAP, LOGL_INFO, "RAB Asignment Response:");
- if (0) {
-// if (ies->presenceMask & RAB_ASSIGNMENTRESPONSEIES_RANAP_RAB_SETUPORMODIFIEDLIST_PRESENT) {
+ if (ies->presenceMask & RAB_ASSIGNMENTRESPONSEIES_RANAP_RAB_SETUPORMODIFIEDLIST_PRESENT) {
+ RANAP_IE_t *ranap_ie = ies->raB_SetupOrModifiedList.raB_SetupOrModifiedList_ies.list.array[0];
RANAP_RAB_SetupOrModifiedItemIEs_t setup_ies;
RANAP_RAB_SetupOrModifiedItem_t *item = &setup_ies.raB_SetupOrModifiedItem;
- rc = ranap_decode_rab_setupormodifieditemies(&setup_ies,
- (ANY_t *)&ies->raB_SetupOrModifiedList);
+ rc = ranap_decode_rab_setupormodifieditemies(&setup_ies, &ranap_ie->value);
+
+ rab_id = item->rAB_ID.buf[0];
+ if (item->iuTransportAssociation->present == RANAP_IuTransportAssociation_PR_gTP_TEI) {
+ gtp_tei = asn1str_to_u32(&item->iuTransportAssociation->choice.gTP_TEI);
+ pdp = sgsn_pdp_ctx_by_tei(mm, gtp_tei);
+ }
+
+ if (!pdp) {
+ ranap_free_rab_setupormodifieditemies(&setup_ies);
+ return -1;
+ }
+
if (item->transportLayerAddress) {
- uint8_t rab_id = item->rAB_ID.buf[0];
- LOGPC(DRANAP, LOGL_INFO, " Setup: (%u/%s)",
- rab_id,
- osmo_hexdump(item->transportLayerAddress->buf,
- item->transportLayerAddress->size));
+
+ LOGPC(DRANAP, LOGL_INFO, " Setup: (%u/%s)", rab_id, osmo_hexdump(item->transportLayerAddress->buf,
+ item->transportLayerAddress->size));
}
+ ranap_free_rab_setupormodifieditemies(&setup_ies);
}
LOGPC(DRANAP, LOGL_INFO, "\n");
- send_act_pdp_cont_acc(ctx->pdp);
+ send_act_pdp_cont_acc(pdp);
return rc;
}