diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2019-08-29 17:21:00 +0200 |
---|---|---|
committer | pespin <pespin@sysmocom.de> | 2019-09-02 09:42:21 +0000 |
commit | 6dfb5fef4072c177fc58149d48cec74b7a501f47 (patch) | |
tree | b9c7f45cb75d437ac4e59a86eca1674d86639037 /src/gprs | |
parent | 259e303436e035a5d137c17978f2f8de4bd58328 (diff) |
Move lots of Iu/ranap specific code into its own file
RANAP related functionalities were splitted among several files
(gprs_gmm.c, gprs_sgsn.c and sgsn_libgtp.c). Let's move it into its own
file to shrink complexity/size of existing files.
It also allows to keep a lot of conditionally enabled code (BUILD_IU)
and its dependencies (osmo-iuh) together.
Change-Id: I549042aaff045a378de77d657cc396ee08f22f33
Diffstat (limited to 'src/gprs')
-rw-r--r-- | src/gprs/Makefile.am | 1 | ||||
-rw-r--r-- | src/gprs/gprs_gmm.c | 158 | ||||
-rw-r--r-- | src/gprs/gprs_ranap.c | 231 | ||||
-rw-r--r-- | src/gprs/gprs_sgsn.c | 4 | ||||
-rw-r--r-- | src/gprs/sgsn_libgtp.c | 74 | ||||
-rw-r--r-- | src/gprs/sgsn_main.c | 5 |
6 files changed, 240 insertions, 233 deletions
diff --git a/src/gprs/Makefile.am b/src/gprs/Makefile.am index ba5dfd617..384b893f3 100644 --- a/src/gprs/Makefile.am +++ b/src/gprs/Makefile.am @@ -62,6 +62,7 @@ osmo_gbproxy_LDADD = \ osmo_sgsn_SOURCES = \ gprs_gmm_attach.c \ gprs_gmm.c \ + gprs_ranap.c \ gprs_sgsn.c \ gprs_sndcp.c \ gprs_sndcp_comp.c \ diff --git a/src/gprs/gprs_gmm.c b/src/gprs/gprs_gmm.c index 00335e8a8..5700ee503 100644 --- a/src/gprs/gprs_gmm.c +++ b/src/gprs/gprs_gmm.c @@ -47,12 +47,6 @@ #include <osmocom/gprs/gprs_bssgp.h> -#ifdef BUILD_IU -#include <osmocom/ranap/ranap_ies_defs.h> -#include <osmocom/ranap/ranap_msg_factory.h> -#include <osmocom/ranap/iu_client.h> -#endif - #include <osmocom/sgsn/debug.h> #include <osmocom/sgsn/gprs_llc.h> #include <osmocom/sgsn/gprs_sgsn.h> @@ -63,6 +57,7 @@ #include <osmocom/sgsn/gprs_gmm_attach.h> #include <osmocom/sgsn/signal.h> #include <osmocom/sgsn/gprs_sndcp.h> +#include <osmocom/sgsn/gprs_ranap.h> #include <pdp.h> @@ -117,14 +112,6 @@ static const struct value_string gprs_pmm_state_names[] = { { 0, NULL } }; -/* On RANAP, Returns pointer to he associated ranap_ue_conn_ctx in msg, filled - * in by osmo-iuh's iu_recv_cb(). - * On Gb, returns NULL */ -#define MSG_IU_UE_CTX(msg) ((struct ranap_ue_conn_ctx *)(msg)->dst) -#define MSG_IU_UE_CTX_SET(msg, val) (msg)->dst = (val) - -static int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx); - static void mmctx_change_gtpu_endpoints_to_sgsn(struct sgsn_mm_ctx *mm_ctx) { struct sgsn_pdp_ctx *pdp; @@ -188,7 +175,7 @@ static void mmctx_state_timer_stop(struct sgsn_mm_ctx *mm, unsigned int T) mm->gb.state_T = 0; } -static void mmctx_set_pmm_state(struct sgsn_mm_ctx *ctx, enum gprs_pmm_state state) +void mmctx_set_pmm_state(struct sgsn_mm_ctx *ctx, enum gprs_pmm_state state) { OSMO_ASSERT(ctx->ran_type == MM_CTX_T_UTRAN_Iu); @@ -245,62 +232,6 @@ static void mmctx_set_mm_state(struct sgsn_mm_ctx *ctx, enum gprs_pmm_state stat ctx->pmm_state = state; } -#ifdef BUILD_IU -int sgsn_ranap_rab_ass_resp(struct sgsn_mm_ctx *ctx, RANAP_RAB_SetupOrModifiedItemIEs_t *setup_ies); -int sgsn_ranap_iu_event(struct ranap_ue_conn_ctx *ctx, enum ranap_iu_event_type type, void *data) -{ - struct sgsn_mm_ctx *mm; - int rc = -1; - - mm = sgsn_mm_ctx_by_ue_ctx(ctx); - -#define REQUIRE_MM \ - if (!mm) { \ - LOGIUP(ctx, LOGL_NOTICE, "Cannot find mm ctx for IU event %d\n", type); \ - return rc; \ - } - - switch (type) { - case RANAP_IU_EVENT_RAB_ASSIGN: - REQUIRE_MM - rc = sgsn_ranap_rab_ass_resp(mm, (RANAP_RAB_SetupOrModifiedItemIEs_t *)data); - break; - case RANAP_IU_EVENT_IU_RELEASE: - /* fall thru */ - case RANAP_IU_EVENT_LINK_INVALIDATED: - /* Clean up ranap_ue_conn_ctx here */ - if (mm) - LOGMMCTXP(LOGL_INFO, mm, "IU release for imsi %s\n", mm->imsi); - else - LOGIUP(ctx, LOGL_INFO, "IU release\n"); - if (mm && mm->pmm_state == PMM_CONNECTED) - mmctx_set_pmm_state(mm, PMM_IDLE); - rc = 0; - break; - case RANAP_IU_EVENT_SECURITY_MODE_COMPLETE: - REQUIRE_MM - /* Continue authentication here */ - mm->iu.ue_ctx->integrity_active = 1; - - /* FIXME: remove gmm_authorize */ - if (mm->pending_req != GSM48_MT_GMM_ATTACH_REQ) - gsm48_gmm_authorize(mm); - else - osmo_fsm_inst_dispatch(mm->gmm_att_req.fsm, E_IU_SECURITY_CMD_COMPLETE, NULL); - break; - default: - if (mm) - LOGMMCTXP(LOGL_NOTICE, mm, "Unknown event received: %i\n", type); - else - LOGIUP(ctx, LOGL_NOTICE, "Unknown event received: %i\n", type); - rc = -1; - break; - } - return rc; -} -#endif - - /* Our implementation, should be kept in SGSN */ static void mmctx_timer_cb(void *_mm); @@ -1078,21 +1009,8 @@ 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) -{ - 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); - } -} -#endif - /* Check if we can already authorize a subscriber */ -static int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx) +int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx) { #ifdef BUILD_IU int rc; @@ -2061,7 +1979,7 @@ static int gsm48_rx_gmm_status(struct sgsn_mm_ctx *mmctx, struct msgb *msg) } /* Rx GPRS Mobility Management. MMCTX can be NULL when called. On !Gb (Iu), llme is NULL */ -static int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg, +int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg, struct gprs_llc_llme *llme, bool drop_cipherable) { struct sgsn_signal_data sig_data; @@ -2933,7 +2851,7 @@ static void pdpctx_timer_cb(void *_pdp) /* GPRS Session Management */ -static int gsm0408_rcv_gsm(struct sgsn_mm_ctx *mmctx, struct msgb *msg, +int gsm0408_rcv_gsm(struct sgsn_mm_ctx *mmctx, struct msgb *msg, struct gprs_llc_llme *llme) { struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_gmmh(msg); @@ -3008,45 +2926,6 @@ int gsm0408_gprs_force_reattach(struct sgsn_mm_ctx *mmctx) return rc; } -/* Main entry point for incoming 04.08 GPRS messages from Iu */ -int gsm0408_gprs_rcvmsg_iu(struct msgb *msg, struct gprs_ra_id *ra_id, - uint16_t *sai) -{ - struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_gmmh(msg); - uint8_t pdisc = gsm48_hdr_pdisc(gh); - struct sgsn_mm_ctx *mmctx; - int rc = -EINVAL; - - mmctx = sgsn_mm_ctx_by_ue_ctx(MSG_IU_UE_CTX(msg)); - if (mmctx) { - rate_ctr_inc(&mmctx->ctrg->ctr[GMM_CTR_PKTS_SIG_IN]); - if (ra_id) - memcpy(&mmctx->ra, ra_id, sizeof(mmctx->ra)); - } - - /* MMCTX can be NULL */ - - switch (pdisc) { - case GSM48_PDISC_MM_GPRS: - rc = gsm0408_rcv_gmm(mmctx, msg, NULL, false); -#pragma message "set drop_cipherable arg for gsm0408_rcv_gmm() from IuPS?" - break; - case GSM48_PDISC_SM_GPRS: - rc = gsm0408_rcv_gsm(mmctx, msg, NULL); - break; - default: - LOGMMCTXP(LOGL_NOTICE, mmctx, - "Unknown GSM 04.08 discriminator 0x%02x: %s\n", - pdisc, osmo_hexdump((uint8_t *)gh, msgb_l3len(msg))); - /* FIXME: return status message */ - break; - } - - /* MMCTX can be invalid */ - - return rc; -} - /* Update the MM context state */ static void gsm0408_gprs_notify_pdu_gb(struct sgsn_mm_ctx *mmctx) { @@ -3154,30 +3033,3 @@ int gprs_gmm_rx_resume(struct gprs_ra_id *raid, uint32_t tlli, mmctx->gmm_state = GMM_REGISTERED_NORMAL; return 0; } - -#ifdef BUILD_IU -int iu_rab_act_ps(uint8_t rab_id, struct sgsn_pdp_ctx *pdp) -{ - struct msgb *msg; - struct sgsn_mm_ctx *mm = pdp->mm; - struct ranap_ue_conn_ctx *uectx; - uint32_t ggsn_ip; - bool use_x213_nsap; - - uectx = mm->iu.ue_ctx; - use_x213_nsap = (uectx->rab_assign_addr_enc == RANAP_NSAP_ADDR_ENC_X213); - - /* Get the IP address for ggsn user plane */ - memcpy(&ggsn_ip, pdp->lib->gsnru.v, pdp->lib->gsnru.l); - ggsn_ip = htonl(ggsn_ip); - - LOGP(DRANAP, LOGL_DEBUG, "Assigning RAB: rab_id=%d, ggsn_ip=%x," - " teid_gn=%x, use_x213_nsap=%d\n", - rab_id, ggsn_ip, pdp->lib->teid_gn, use_x213_nsap); - - msg = ranap_new_msg_rab_assign_data(rab_id, ggsn_ip, - pdp->lib->teid_gn, use_x213_nsap); - msg->l2h = msg->data; - return ranap_iu_rab_act(uectx, msg); -} -#endif diff --git a/src/gprs/gprs_ranap.c b/src/gprs/gprs_ranap.c new file mode 100644 index 000000000..e0470f609 --- /dev/null +++ b/src/gprs/gprs_ranap.c @@ -0,0 +1,231 @@ +/* Messages on the RANAP interface (Iu mode) */ + +/* (C) 2009-2015 by Harald Welte <laforge@gnumonks.org> + * (C) 2015 by Holger Hans Peter Freyther + * (C) 2019 by sysmocom s.f.m.c. GmbH <info@sysmocom.de> + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#include "bscconfig.h" + +#ifdef BUILD_IU + +#include <gtp.h> + +#include <osmocom/core/rate_ctr.h> + +#include <osmocom/ranap/ranap_common.h> + +#include <osmocom/sgsn/gprs_gmm.h> +#include <osmocom/sgsn/debug.h> +#include <osmocom/sgsn/sgsn.h> +#include <osmocom/sgsn/gprs_ranap.h> +#include <osmocom/sgsn/gprs_gmm_attach.h> + +/* Send RAB activation requests for all PDP contexts */ +void activate_pdp_rabs(struct sgsn_mm_ctx *ctx) +{ + 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); + } +} + +/* Callback for RAB assignment response */ +static int sgsn_ranap_rab_ass_resp(struct sgsn_mm_ctx *ctx, RANAP_RAB_SetupOrModifiedItemIEs_t *setup_ies) +{ + uint8_t rab_id; + bool require_pdp_update = false; + struct sgsn_pdp_ctx *pdp = NULL; + RANAP_RAB_SetupOrModifiedItem_t *item = &setup_ies->raB_SetupOrModifiedItem; + + rab_id = item->rAB_ID.buf[0]; + + pdp = sgsn_pdp_ctx_by_nsapi(ctx, rab_id); + if (!pdp) { + LOGP(DRANAP, LOGL_ERROR, "RAB Assignment Response for unknown RAB/NSAPI=%u\n", rab_id); + return -1; + } + + if (item->transportLayerAddress) { + LOGPC(DRANAP, LOGL_INFO, " Setup: (%u/%s)", rab_id, osmo_hexdump(item->transportLayerAddress->buf, + item->transportLayerAddress->size)); + switch (item->transportLayerAddress->size) { + case 7: + /* It must be IPv4 inside a X213 NSAP */ + memcpy(pdp->lib->gsnlu.v, &item->transportLayerAddress->buf[3], 4); + break; + case 4: + /* It must be a raw IPv4 address */ + memcpy(pdp->lib->gsnlu.v, item->transportLayerAddress->buf, 4); + break; + case 16: + /* TODO: It must be a raw IPv6 address */ + case 19: + /* TODO: It must be IPv6 inside a X213 NSAP */ + default: + LOGP(DRANAP, LOGL_ERROR, "RAB Assignment Resp: Unknown " + "transport layer address size %u\n", + item->transportLayerAddress->size); + return -1; + } + require_pdp_update = true; + } + + /* The TEI on the RNC side might have changed, too */ + if (item->iuTransportAssociation && + item->iuTransportAssociation->present == RANAP_IuTransportAssociation_PR_gTP_TEI && + item->iuTransportAssociation->choice.gTP_TEI.buf && + item->iuTransportAssociation->choice.gTP_TEI.size >= 4) { + uint32_t tei = osmo_load32be(item->iuTransportAssociation->choice.gTP_TEI.buf); + LOGP(DRANAP, LOGL_DEBUG, "Updating TEID on RNC side from 0x%08x to 0x%08x\n", + pdp->lib->teid_own, tei); + pdp->lib->teid_own = tei; + require_pdp_update = true; + } + + if (require_pdp_update) + gtp_update_context(pdp->ggsn->gsn, pdp->lib, pdp, &pdp->lib->hisaddr0); + + if (pdp->state != PDP_STATE_CR_CONF) { + send_act_pdp_cont_acc(pdp); + pdp->state = PDP_STATE_CR_CONF; + } + return 0; + +} + +int sgsn_ranap_iu_event(struct ranap_ue_conn_ctx *ctx, enum ranap_iu_event_type type, void *data) +{ + struct sgsn_mm_ctx *mm; + int rc = -1; + + mm = sgsn_mm_ctx_by_ue_ctx(ctx); + +#define REQUIRE_MM \ + if (!mm) { \ + LOGIUP(ctx, LOGL_NOTICE, "Cannot find mm ctx for IU event %d\n", type); \ + return rc; \ + } + + switch (type) { + case RANAP_IU_EVENT_RAB_ASSIGN: + REQUIRE_MM + rc = sgsn_ranap_rab_ass_resp(mm, (RANAP_RAB_SetupOrModifiedItemIEs_t *)data); + break; + case RANAP_IU_EVENT_IU_RELEASE: + /* fall thru */ + case RANAP_IU_EVENT_LINK_INVALIDATED: + /* Clean up ranap_ue_conn_ctx here */ + if (mm) + LOGMMCTXP(LOGL_INFO, mm, "IU release for imsi %s\n", mm->imsi); + else + LOGIUP(ctx, LOGL_INFO, "IU release\n"); + if (mm && mm->pmm_state == PMM_CONNECTED) + mmctx_set_pmm_state(mm, PMM_IDLE); + rc = 0; + break; + case RANAP_IU_EVENT_SECURITY_MODE_COMPLETE: + REQUIRE_MM + /* Continue authentication here */ + mm->iu.ue_ctx->integrity_active = 1; + + /* FIXME: remove gmm_authorize */ + if (mm->pending_req != GSM48_MT_GMM_ATTACH_REQ) + gsm48_gmm_authorize(mm); + else + osmo_fsm_inst_dispatch(mm->gmm_att_req.fsm, E_IU_SECURITY_CMD_COMPLETE, NULL); + break; + default: + if (mm) + LOGMMCTXP(LOGL_NOTICE, mm, "Unknown event received: %i\n", type); + else + LOGIUP(ctx, LOGL_NOTICE, "Unknown event received: %i\n", type); + rc = -1; + break; + } + return rc; +} + +int iu_rab_act_ps(uint8_t rab_id, struct sgsn_pdp_ctx *pdp) +{ + struct msgb *msg; + struct sgsn_mm_ctx *mm = pdp->mm; + struct ranap_ue_conn_ctx *uectx; + uint32_t ggsn_ip; + bool use_x213_nsap; + + uectx = mm->iu.ue_ctx; + use_x213_nsap = (uectx->rab_assign_addr_enc == RANAP_NSAP_ADDR_ENC_X213); + + /* Get the IP address for ggsn user plane */ + memcpy(&ggsn_ip, pdp->lib->gsnru.v, pdp->lib->gsnru.l); + ggsn_ip = htonl(ggsn_ip); + + LOGP(DRANAP, LOGL_DEBUG, "Assigning RAB: rab_id=%d, ggsn_ip=%x," + " teid_gn=%x, use_x213_nsap=%d\n", + rab_id, ggsn_ip, pdp->lib->teid_gn, use_x213_nsap); + + msg = ranap_new_msg_rab_assign_data(rab_id, ggsn_ip, + pdp->lib->teid_gn, use_x213_nsap); + msg->l2h = msg->data; + return ranap_iu_rab_act(uectx, msg); +} + + +/* Main entry point for incoming 04.08 GPRS messages from Iu */ +int gsm0408_gprs_rcvmsg_iu(struct msgb *msg, struct gprs_ra_id *ra_id, + uint16_t *sai) +{ + struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_gmmh(msg); + uint8_t pdisc = gsm48_hdr_pdisc(gh); + struct sgsn_mm_ctx *mmctx; + int rc = -EINVAL; + + mmctx = sgsn_mm_ctx_by_ue_ctx(MSG_IU_UE_CTX(msg)); + if (mmctx) { + rate_ctr_inc(&mmctx->ctrg->ctr[GMM_CTR_PKTS_SIG_IN]); + if (ra_id) + memcpy(&mmctx->ra, ra_id, sizeof(mmctx->ra)); + } + + /* MMCTX can be NULL */ + + switch (pdisc) { + case GSM48_PDISC_MM_GPRS: + rc = gsm0408_rcv_gmm(mmctx, msg, NULL, false); +#pragma message "set drop_cipherable arg for gsm0408_rcv_gmm() from IuPS?" + break; + case GSM48_PDISC_SM_GPRS: + rc = gsm0408_rcv_gsm(mmctx, msg, NULL); + break; + default: + LOGMMCTXP(LOGL_NOTICE, mmctx, + "Unknown GSM 04.08 discriminator 0x%02x: %s\n", + pdisc, osmo_hexdump((uint8_t *)gh, msgb_l3len(msg))); + /* FIXME: return status message */ + break; + } + + /* MMCTX can be invalid */ + + return rc; +} +#endif diff --git a/src/gprs/gprs_sgsn.c b/src/gprs/gprs_sgsn.c index 829204ea9..ee1902c2c 100644 --- a/src/gprs/gprs_sgsn.c +++ b/src/gprs/gprs_sgsn.c @@ -50,10 +50,6 @@ #include "../../bscconfig.h" -#if BUILD_IU -#include <osmocom/ranap/iu_client.h> -#endif - #define GPRS_LLME_CHECK_TICK 30 extern struct sgsn_instance *sgsn; diff --git a/src/gprs/sgsn_libgtp.c b/src/gprs/sgsn_libgtp.c index a8ad527bc..5e3f48f3f 100644 --- a/src/gprs/sgsn_libgtp.c +++ b/src/gprs/sgsn_libgtp.c @@ -50,11 +50,7 @@ #include <osmocom/sgsn/gprs_gmm.h> #include <osmocom/sgsn/gprs_subscriber.h> #include <osmocom/sgsn/gprs_sndcp.h> - -#ifdef BUILD_IU -#include <osmocom/ranap/iu_client.h> -#include <osmocom/ranap/ranap_ies_defs.h> -#endif +#include <osmocom/sgsn/gprs_ranap.h> #include <gtp.h> #include <pdp.h> @@ -359,7 +355,7 @@ static const struct cause_map gtp2sm_cause_map[] = { { 0, 0 } }; -static int send_act_pdp_cont_acc(struct sgsn_pdp_ctx *pctx) +int send_act_pdp_cont_acc(struct sgsn_pdp_ctx *pctx) { struct sgsn_signal_data sig_data; int rc; @@ -473,72 +469,6 @@ void sgsn_ggsn_echo_req(struct sgsn_ggsn_ctx *ggc) gtp_echo_req(ggc->gsn, ggc->gtp_version, ggc, &ggc->remote_addr); } -#ifdef BUILD_IU -/* Callback for RAB assignment response */ -int sgsn_ranap_rab_ass_resp(struct sgsn_mm_ctx *ctx, RANAP_RAB_SetupOrModifiedItemIEs_t *setup_ies) -{ - uint8_t rab_id; - bool require_pdp_update = false; - struct sgsn_pdp_ctx *pdp = NULL; - RANAP_RAB_SetupOrModifiedItem_t *item = &setup_ies->raB_SetupOrModifiedItem; - - rab_id = item->rAB_ID.buf[0]; - - pdp = sgsn_pdp_ctx_by_nsapi(ctx, rab_id); - if (!pdp) { - LOGP(DRANAP, LOGL_ERROR, "RAB Assignment Response for unknown RAB/NSAPI=%u\n", rab_id); - return -1; - } - - if (item->transportLayerAddress) { - LOGPC(DRANAP, LOGL_INFO, " Setup: (%u/%s)", rab_id, osmo_hexdump(item->transportLayerAddress->buf, - item->transportLayerAddress->size)); - switch (item->transportLayerAddress->size) { - case 7: - /* It must be IPv4 inside a X213 NSAP */ - memcpy(pdp->lib->gsnlu.v, &item->transportLayerAddress->buf[3], 4); - break; - case 4: - /* It must be a raw IPv4 address */ - memcpy(pdp->lib->gsnlu.v, item->transportLayerAddress->buf, 4); - break; - case 16: - /* TODO: It must be a raw IPv6 address */ - case 19: - /* TODO: It must be IPv6 inside a X213 NSAP */ - default: - LOGP(DRANAP, LOGL_ERROR, "RAB Assignment Resp: Unknown " - "transport layer address size %u\n", - item->transportLayerAddress->size); - return -1; - } - require_pdp_update = true; - } - - /* The TEI on the RNC side might have changed, too */ - if (item->iuTransportAssociation && - item->iuTransportAssociation->present == RANAP_IuTransportAssociation_PR_gTP_TEI && - item->iuTransportAssociation->choice.gTP_TEI.buf && - item->iuTransportAssociation->choice.gTP_TEI.size >= 4) { - uint32_t tei = osmo_load32be(item->iuTransportAssociation->choice.gTP_TEI.buf); - LOGP(DRANAP, LOGL_DEBUG, "Updating TEID on RNC side from 0x%08x to 0x%08x\n", - pdp->lib->teid_own, tei); - pdp->lib->teid_own = tei; - require_pdp_update = true; - } - - if (require_pdp_update) - gtp_update_context(pdp->ggsn->gsn, pdp->lib, pdp, &pdp->lib->hisaddr0); - - if (pdp->state != PDP_STATE_CR_CONF) { - send_act_pdp_cont_acc(pdp); - pdp->state = PDP_STATE_CR_CONF; - } - return 0; - -} -#endif - /* Confirmation of a PDP Context Delete */ static int delete_pdp_conf(struct pdp_t *pdp, void *cbp, int cause) { diff --git a/src/gprs/sgsn_main.c b/src/gprs/sgsn_main.c index 9f2e11179..eef5f8f22 100644 --- a/src/gprs/sgsn_main.c +++ b/src/gprs/sgsn_main.c @@ -57,6 +57,7 @@ #include <osmocom/sgsn/sgsn.h> #include <osmocom/sgsn/gprs_llc.h> #include <osmocom/sgsn/gprs_gmm.h> +#include <osmocom/sgsn/gprs_ranap.h> #include <osmocom/ctrl/control_if.h> #include <osmocom/ctrl/ports.h> @@ -354,10 +355,6 @@ static const struct log_info gprs_log_info = { .num_cat = ARRAY_SIZE(gprs_categories), }; -#if BUILD_IU -int sgsn_ranap_iu_event(struct ranap_ue_conn_ctx *ctx, enum ranap_iu_event_type type, void *data); -#endif - static bool file_exists(const char *path) { struct stat sb; |