mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
synced 2025-11-03 05:23:43 +00:00
gprs/sgsn: Use RAB assignment response cb in PDP context activation
This commit is contained in:
committed by
Neels Hofmeyr
parent
8cd32937da
commit
3cc0836b1a
@@ -49,6 +49,8 @@
|
||||
#include <openbsc/gsm_subscriber.h>
|
||||
#include <openbsc/iu.h>
|
||||
|
||||
#include <osmocom/ranap/ranap_ies_defs.h>
|
||||
|
||||
#include <gtp.h>
|
||||
#include <pdp.h>
|
||||
|
||||
@@ -308,6 +310,19 @@ static const struct cause_map gtp2sm_cause_map[] = {
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static int send_act_pdp_cont_acc(struct sgsn_pdp_ctx *pctx)
|
||||
{
|
||||
struct sgsn_signal_data sig_data;
|
||||
|
||||
/* Inform others about it */
|
||||
memset(&sig_data, 0, sizeof(sig_data));
|
||||
sig_data.pdp = pctx;
|
||||
osmo_signal_dispatch(SS_SGSN, S_SGSN_PDP_ACT, &sig_data);
|
||||
|
||||
/* Send PDP CTX ACT to MS */
|
||||
return gsm48_tx_gsm_act_pdp_acc(pctx);
|
||||
}
|
||||
|
||||
/* The GGSN has confirmed the creation of a PDP Context */
|
||||
static int create_pdp_conf(struct pdp_t *pdp, void *cbp, int cause)
|
||||
{
|
||||
@@ -377,17 +392,39 @@ reject:
|
||||
return EOF;
|
||||
}
|
||||
|
||||
int send_act_pdp_cont_acc(struct sgsn_pdp_ctx *pctx)
|
||||
/* Callback for RAB assignment response */
|
||||
int sgsn_ranap_rab_ass_resp(struct ue_conn_ctx *ctx, uint8_t rab_id, RANAP_RAB_SetupOrModifiedItemIEs_t *setup_ies)
|
||||
{
|
||||
struct sgsn_signal_data sig_data;
|
||||
int rc = -1;
|
||||
struct sgsn_mm_ctx *mm;
|
||||
struct sgsn_pdp_ctx *pdp = NULL;
|
||||
uint32_t gtp_tei;
|
||||
RANAP_RAB_SetupOrModifiedItem_t *item = &setup_ies->raB_SetupOrModifiedItem;
|
||||
|
||||
/* Inform others about it */
|
||||
memset(&sig_data, 0, sizeof(sig_data));
|
||||
sig_data.pdp = pctx;
|
||||
osmo_signal_dispatch(SS_SGSN, S_SGSN_PDP_ACT, &sig_data);
|
||||
mm = sgsn_mm_ctx_by_ue_ctx(ctx);
|
||||
/* XXX: Error handling */
|
||||
|
||||
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) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (item->transportLayerAddress) {
|
||||
|
||||
LOGPC(DRANAP, LOGL_INFO, " Setup: (%u/%s)", rab_id, osmo_hexdump(item->transportLayerAddress->buf,
|
||||
item->transportLayerAddress->size));
|
||||
memcpy(pdp->lib->gsnlu.v, &item->transportLayerAddress->buf[3], 4);
|
||||
gtp_update_context(pdp->ggsn->gsn, pdp->lib, pdp, &pdp->lib->hisaddr0);
|
||||
|
||||
}
|
||||
|
||||
send_act_pdp_cont_acc(pdp);
|
||||
return 0;
|
||||
|
||||
/* Send PDP CTX ACT to MS */
|
||||
return gsm48_tx_gsm_act_pdp_acc(pctx);
|
||||
}
|
||||
|
||||
/* Confirmation of a PDP Context Delete */
|
||||
|
||||
@@ -305,6 +305,8 @@ static const struct log_info gprs_log_info = {
|
||||
|
||||
int asn_debug;
|
||||
|
||||
int sgsn_ranap_rab_ass_resp(struct ue_conn_ctx *ctx, uint8_t rab_id, RANAP_RAB_SetupOrModifiedItemIEs_t *setup_ies);
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct ctrl_handle *ctrl;
|
||||
@@ -420,7 +422,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
asn_debug = 0;
|
||||
iu_init(tall_bsc_ctx, "127.0.0.2", 14001, NULL, gsm0408_gprs_rcvmsg_iu);
|
||||
iu_init(tall_bsc_ctx, "127.0.0.2", 14001, NULL, gsm0408_gprs_rcvmsg_iu, sgsn_ranap_rab_ass_resp);
|
||||
|
||||
if (daemonize) {
|
||||
rc = osmo_daemonize();
|
||||
|
||||
Reference in New Issue
Block a user