move libiu to osmo-iuh/libosmo-ranap
Remove libiu here, use the functions from libosmo-ranap instead, by applying the ranap_ / RANAP_ prefix. Corresponding change-id in osmo-iuh.git is I6a3f7ad15be03fb94689b4af6ccfa828c25f45c0 To be able to run the msc_vlr tests for RAN_UTRAN_IU without Iu client headers available, add iu_dummy.h, containing mere function signatures that match iu_dummy.c and a mostly empty struct ranap_ue_conn_ctx. Make sure we can build with and without --enable-iu: include osmo-iuh headers only with --enable-iu. Change-Id: Ib8c4fcdb4766c5e575618b95ce16dce51063206b
This commit is contained in:
parent
6d82bec2c8
commit
00e82d61ab
|
@ -233,7 +233,6 @@ AC_OUTPUT(
|
||||||
src/libmgcp/Makefile
|
src/libmgcp/Makefile
|
||||||
src/libcommon/Makefile
|
src/libcommon/Makefile
|
||||||
src/libfilter/Makefile
|
src/libfilter/Makefile
|
||||||
src/libiu/Makefile
|
|
||||||
src/libcommon-cs/Makefile
|
src/libcommon-cs/Makefile
|
||||||
src/osmo-msc/Makefile
|
src/osmo-msc/Makefile
|
||||||
src/osmo-bsc/Makefile
|
src/osmo-bsc/Makefile
|
||||||
|
|
|
@ -49,9 +49,9 @@ noinst_HEADERS = \
|
||||||
handover.h \
|
handover.h \
|
||||||
handover_decision.h \
|
handover_decision.h \
|
||||||
ipaccess.h \
|
ipaccess.h \
|
||||||
iu.h \
|
|
||||||
iucs.h \
|
iucs.h \
|
||||||
iucs_ranap.h \
|
iucs_ranap.h \
|
||||||
|
iu_dummy.h \
|
||||||
meas_feed.h \
|
meas_feed.h \
|
||||||
meas_rep.h \
|
meas_rep.h \
|
||||||
mgcp.h \
|
mgcp.h \
|
||||||
|
|
|
@ -117,7 +117,7 @@ struct service_info {
|
||||||
uint16_t pdp_status;
|
uint16_t pdp_status;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ue_conn_ctx;
|
struct ranap_ue_conn_ctx;
|
||||||
|
|
||||||
/* According to TS 03.60, Table 5: SGSN MM and PDP Contexts */
|
/* According to TS 03.60, Table 5: SGSN MM and PDP Contexts */
|
||||||
/* Extended by 3GPP TS 23.060, Table 6: SGSN MM and PDP Contexts */
|
/* Extended by 3GPP TS 23.060, Table 6: SGSN MM and PDP Contexts */
|
||||||
|
@ -159,7 +159,7 @@ struct sgsn_mm_ctx {
|
||||||
/* CSG Subscription Data */
|
/* CSG Subscription Data */
|
||||||
/* LIPA Allowed */
|
/* LIPA Allowed */
|
||||||
/* Voice Support Match Indicator */
|
/* Voice Support Match Indicator */
|
||||||
struct ue_conn_ctx *ue_ctx;
|
struct ranap_ue_conn_ctx *ue_ctx;
|
||||||
struct service_info service;
|
struct service_info service;
|
||||||
} iu;
|
} iu;
|
||||||
/* VLR number */
|
/* VLR number */
|
||||||
|
|
|
@ -30,7 +30,7 @@ struct gsm_subscriber_group;
|
||||||
struct bsc_subscr;
|
struct bsc_subscr;
|
||||||
struct vlr_instance;
|
struct vlr_instance;
|
||||||
struct vlr_subscr;
|
struct vlr_subscr;
|
||||||
struct ue_conn_ctx;
|
struct ranap_ue_conn_ctx;
|
||||||
|
|
||||||
#define OBSC_LINKID_CB(__msgb) (__msgb)->cb[3]
|
#define OBSC_LINKID_CB(__msgb) (__msgb)->cb[3]
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ struct gsm_subscriber_connection {
|
||||||
|
|
||||||
/* which Iu-CS connection, if any. */
|
/* which Iu-CS connection, if any. */
|
||||||
struct {
|
struct {
|
||||||
struct ue_conn_ctx *ue_ctx;
|
struct ranap_ue_conn_ctx *ue_ctx;
|
||||||
uint8_t rab_id;
|
uint8_t rab_id;
|
||||||
} iu;
|
} iu;
|
||||||
|
|
||||||
|
@ -493,7 +493,7 @@ struct gsm_network {
|
||||||
struct {
|
struct {
|
||||||
/* CS7 instance id number (set via VTY) */
|
/* CS7 instance id number (set via VTY) */
|
||||||
uint32_t cs7_instance;
|
uint32_t cs7_instance;
|
||||||
enum nsap_addr_enc rab_assign_addr_enc;
|
int rab_assign_addr_enc;
|
||||||
struct osmo_sccp_instance *sccp;
|
struct osmo_sccp_instance *sccp;
|
||||||
} iu;
|
} iu;
|
||||||
|
|
||||||
|
|
|
@ -1,77 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include <osmocom/core/linuxlist.h>
|
|
||||||
#include <osmocom/gsm/gsm48.h>
|
|
||||||
#include <osmocom/sigtran/sccp_sap.h>
|
|
||||||
|
|
||||||
#include <openbsc/common.h>
|
|
||||||
|
|
||||||
struct sgsn_pdp_ctx;
|
|
||||||
struct msgb;
|
|
||||||
struct gsm_auth_tuple;
|
|
||||||
struct osmo_sccp_addr;
|
|
||||||
struct osmo_ss7_instance;
|
|
||||||
|
|
||||||
struct RANAP_RAB_SetupOrModifiedItemIEs_s;
|
|
||||||
struct RANAP_GlobalRNC_ID;
|
|
||||||
struct RANAP_Cause;
|
|
||||||
|
|
||||||
/* Debugging switches from asn1c and osmo-iuh */
|
|
||||||
extern int asn_debug;
|
|
||||||
extern int asn1_xer_print;
|
|
||||||
|
|
||||||
struct ue_conn_ctx {
|
|
||||||
struct llist_head list;
|
|
||||||
/* TODO: It's not needed to store the full SCCP address for each
|
|
||||||
* UE. Rather than that, a pointer to the RNC should be far
|
|
||||||
* sufficient */
|
|
||||||
struct osmo_sccp_addr sccp_addr;
|
|
||||||
uint32_t conn_id;
|
|
||||||
int integrity_active;
|
|
||||||
struct gprs_ra_id ra_id;
|
|
||||||
enum nsap_addr_enc rab_assign_addr_enc;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum iu_event_type {
|
|
||||||
IU_EVENT_RAB_ASSIGN,
|
|
||||||
IU_EVENT_SECURITY_MODE_COMPLETE,
|
|
||||||
IU_EVENT_IU_RELEASE, /* An actual Iu Release message was received */
|
|
||||||
IU_EVENT_LINK_INVALIDATED, /* A SUA link was lost or closed down */
|
|
||||||
};
|
|
||||||
|
|
||||||
extern const struct value_string iu_event_type_names[];
|
|
||||||
static inline const char *iu_event_type_str(enum iu_event_type e)
|
|
||||||
{
|
|
||||||
return get_value_string(iu_event_type_names, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Implementations of iu_recv_cb_t shall find the ue_conn_ctx in msg->dst. */
|
|
||||||
typedef int (* iu_recv_cb_t )(struct msgb *msg, struct gprs_ra_id *ra_id,
|
|
||||||
uint16_t *sai);
|
|
||||||
|
|
||||||
typedef int (* iu_event_cb_t )(struct ue_conn_ctx *ue_ctx,
|
|
||||||
enum iu_event_type type, void *data);
|
|
||||||
|
|
||||||
typedef int (* iu_rab_ass_resp_cb_t )(struct ue_conn_ctx *ue_ctx, uint8_t rab_id,
|
|
||||||
struct RANAP_RAB_SetupOrModifiedItemIEs_s *setup_ies);
|
|
||||||
|
|
||||||
int iu_init(void *ctx, struct osmo_sccp_instance *sccp,
|
|
||||||
iu_recv_cb_t iu_recv_cb, iu_event_cb_t iu_event_cb);
|
|
||||||
|
|
||||||
int iu_tx(struct msgb *msg, uint8_t sapi);
|
|
||||||
|
|
||||||
int iu_page_cs(const char *imsi, const uint32_t *tmsi, uint16_t lac);
|
|
||||||
int iu_page_ps(const char *imsi, const uint32_t *ptmsi, uint16_t lac, uint8_t rac);
|
|
||||||
|
|
||||||
int iu_rab_act(struct ue_conn_ctx *ue_ctx, struct msgb *msg);
|
|
||||||
int iu_rab_deact(struct ue_conn_ctx *ue_ctx, uint8_t rab_id);
|
|
||||||
int iu_tx_sec_mode_cmd(struct ue_conn_ctx *uectx, struct gsm_auth_tuple *tp,
|
|
||||||
int send_ck, int new_key);
|
|
||||||
int iu_tx_common_id(struct ue_conn_ctx *ue_ctx, const char *imsi);
|
|
||||||
int iu_tx_release(struct ue_conn_ctx *ctx, const struct RANAP_Cause *cause);
|
|
||||||
|
|
||||||
void iu_vty_init(int iu_parent_node, enum nsap_addr_enc *rab_assign_addr_enc);
|
|
||||||
int iu_vty_config_write(struct vty *vty, const char *indent);
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
/* Trivial switch-off of external Iu dependencies,
|
||||||
|
* allowing to run full unit tests even when built without Iu support. */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (C) 2016,2017 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
|
||||||
|
*
|
||||||
|
* Author: Neels Hofmeyr <nhofmeyr@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 <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include <osmocom/core/linuxlist.h>
|
||||||
|
|
||||||
|
struct msgb;
|
||||||
|
struct gsm_auth_tuple;
|
||||||
|
struct RANAP_Cause;
|
||||||
|
struct osmo_auth_vector;
|
||||||
|
|
||||||
|
struct ranap_ue_conn_ctx {
|
||||||
|
struct llist_head list;
|
||||||
|
uint32_t conn_id;
|
||||||
|
};
|
||||||
|
|
||||||
|
int ranap_iu_tx(struct msgb *msg, uint8_t sapi);
|
||||||
|
int ranap_iu_tx_sec_mode_cmd(struct ranap_ue_conn_ctx *uectx, struct osmo_auth_vector *vec,
|
||||||
|
int send_ck);
|
||||||
|
int ranap_iu_page_cs(const char *imsi, const uint32_t *tmsi, uint16_t lac);
|
||||||
|
int ranap_iu_page_ps(const char *imsi, const uint32_t *ptmsi, uint16_t lac, uint8_t rac);
|
||||||
|
struct msgb *ranap_new_msg_rab_assign_voice(uint8_t rab_id, uint32_t rtp_ip,
|
||||||
|
uint16_t rtp_port,
|
||||||
|
bool use_x213_nsap);
|
||||||
|
int ranap_iu_rab_act(struct ranap_ue_conn_ctx *ue_ctx, struct msgb *msg);
|
||||||
|
int ranap_iu_tx_common_id(struct ranap_ue_conn_ctx *uectx, const char *imsi);
|
||||||
|
int ranap_iu_tx_release(struct ranap_ue_conn_ctx *ctx, const struct RANAP_Cause *cause);
|
|
@ -4,4 +4,4 @@ int gsm0408_rcvmsg_iucs(struct gsm_network *network, struct msgb *msg,
|
||||||
uint16_t *lac);
|
uint16_t *lac);
|
||||||
|
|
||||||
struct gsm_subscriber_connection *subscr_conn_lookup_iu(struct gsm_network *network,
|
struct gsm_subscriber_connection *subscr_conn_lookup_iu(struct gsm_network *network,
|
||||||
struct ue_conn_ctx *ue);
|
struct ranap_ue_conn_ctx *ue);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
struct gsm_network;
|
struct gsm_network;
|
||||||
struct ue_conn_ctx;
|
struct ranap_ue_conn_ctx;
|
||||||
|
|
||||||
int iucs_rx_ranap_event(struct gsm_network *network,
|
int iucs_rx_ranap_event(struct gsm_network *network,
|
||||||
struct ue_conn_ctx *ue_ctx, int type, void *data);
|
struct ranap_ue_conn_ctx *ue_ctx, int type, void *data);
|
||||||
|
|
|
@ -112,7 +112,7 @@ struct sgsn_config {
|
||||||
} dcomp_v42bis;
|
} dcomp_v42bis;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
enum nsap_addr_enc rab_assign_addr_enc;
|
int rab_assign_addr_enc;
|
||||||
} iu;
|
} iu;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -31,13 +31,6 @@ SUBDIRS = \
|
||||||
libcommon-cs \
|
libcommon-cs \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
# Conditional Libraries
|
|
||||||
if BUILD_IU
|
|
||||||
SUBDIRS += \
|
|
||||||
libiu \
|
|
||||||
$(NULL)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Programs
|
# Programs
|
||||||
SUBDIRS += \
|
SUBDIRS += \
|
||||||
osmo-msc \
|
osmo-msc \
|
||||||
|
|
|
@ -106,7 +106,6 @@ osmo_sgsn_LDADD = \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
if BUILD_IU
|
if BUILD_IU
|
||||||
osmo_sgsn_LDADD += \
|
osmo_sgsn_LDADD += \
|
||||||
$(top_builddir)/src/libiu/libiu.a \
|
|
||||||
$(LIBOSMOSIGTRAN_LIBS) \
|
$(LIBOSMOSIGTRAN_LIBS) \
|
||||||
$(LIBOSMORANAP_LIBS) \
|
$(LIBOSMORANAP_LIBS) \
|
||||||
$(LIBASN1C_LIBS) \
|
$(LIBASN1C_LIBS) \
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
#ifdef BUILD_IU
|
#ifdef BUILD_IU
|
||||||
#include <osmocom/ranap/ranap_ies_defs.h>
|
#include <osmocom/ranap/ranap_ies_defs.h>
|
||||||
#include <osmocom/ranap/ranap_msg_factory.h>
|
#include <osmocom/ranap/ranap_msg_factory.h>
|
||||||
|
#include <osmocom/ranap/iu_client.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <openbsc/debug.h>
|
#include <openbsc/debug.h>
|
||||||
|
@ -67,7 +68,6 @@
|
||||||
#include <openbsc/gprs_subscriber.h>
|
#include <openbsc/gprs_subscriber.h>
|
||||||
#include <openbsc/sgsn.h>
|
#include <openbsc/sgsn.h>
|
||||||
#include <openbsc/signal.h>
|
#include <openbsc/signal.h>
|
||||||
#include <openbsc/iu.h>
|
|
||||||
#include <openbsc/gprs_sndcp.h>
|
#include <openbsc/gprs_sndcp.h>
|
||||||
|
|
||||||
#include <pdp.h>
|
#include <pdp.h>
|
||||||
|
@ -174,7 +174,7 @@ void mmctx_set_mm_state(struct sgsn_mm_ctx *ctx, enum gprs_pmm_state state)
|
||||||
|
|
||||||
#ifdef BUILD_IU
|
#ifdef BUILD_IU
|
||||||
int sgsn_ranap_rab_ass_resp(struct sgsn_mm_ctx *ctx, RANAP_RAB_SetupOrModifiedItemIEs_t *setup_ies);
|
int sgsn_ranap_rab_ass_resp(struct sgsn_mm_ctx *ctx, RANAP_RAB_SetupOrModifiedItemIEs_t *setup_ies);
|
||||||
int sgsn_ranap_iu_event(struct ue_conn_ctx *ctx, enum iu_event_type type, void *data)
|
int sgsn_ranap_iu_event(struct ranap_ue_conn_ctx *ctx, enum ranap_iu_event_type type, void *data)
|
||||||
{
|
{
|
||||||
struct sgsn_mm_ctx *mm;
|
struct sgsn_mm_ctx *mm;
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
|
@ -188,14 +188,14 @@ int sgsn_ranap_iu_event(struct ue_conn_ctx *ctx, enum iu_event_type type, void *
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case IU_EVENT_RAB_ASSIGN:
|
case RANAP_IU_EVENT_RAB_ASSIGN:
|
||||||
REQUIRE_MM
|
REQUIRE_MM
|
||||||
rc = sgsn_ranap_rab_ass_resp(mm, (RANAP_RAB_SetupOrModifiedItemIEs_t *)data);
|
rc = sgsn_ranap_rab_ass_resp(mm, (RANAP_RAB_SetupOrModifiedItemIEs_t *)data);
|
||||||
break;
|
break;
|
||||||
case IU_EVENT_IU_RELEASE:
|
case RANAP_IU_EVENT_IU_RELEASE:
|
||||||
/* fall thru */
|
/* fall thru */
|
||||||
case IU_EVENT_LINK_INVALIDATED:
|
case RANAP_IU_EVENT_LINK_INVALIDATED:
|
||||||
/* Clean up ue_conn_ctx here */
|
/* Clean up ranap_ue_conn_ctx here */
|
||||||
if (mm)
|
if (mm)
|
||||||
LOGMMCTXP(LOGL_INFO, mm, "IU release for imsi %s\n", mm->imsi);
|
LOGMMCTXP(LOGL_INFO, mm, "IU release for imsi %s\n", mm->imsi);
|
||||||
else
|
else
|
||||||
|
@ -205,7 +205,7 @@ int sgsn_ranap_iu_event(struct ue_conn_ctx *ctx, enum iu_event_type type, void *
|
||||||
mmctx_set_pmm_state(mm, PMM_IDLE);
|
mmctx_set_pmm_state(mm, PMM_IDLE);
|
||||||
rc = 0;
|
rc = 0;
|
||||||
break;
|
break;
|
||||||
case IU_EVENT_SECURITY_MODE_COMPLETE:
|
case RANAP_IU_EVENT_SECURITY_MODE_COMPLETE:
|
||||||
REQUIRE_MM
|
REQUIRE_MM
|
||||||
/* Continue authentication here */
|
/* Continue authentication here */
|
||||||
mm->iu.ue_ctx->integrity_active = 1;
|
mm->iu.ue_ctx->integrity_active = 1;
|
||||||
|
@ -262,16 +262,16 @@ static int gsm48_gmm_sendmsg(struct msgb *msg, int command,
|
||||||
rate_ctr_inc(&mm->ctrg->ctr[GMM_CTR_PKTS_SIG_OUT]);
|
rate_ctr_inc(&mm->ctrg->ctr[GMM_CTR_PKTS_SIG_OUT]);
|
||||||
#ifdef BUILD_IU
|
#ifdef BUILD_IU
|
||||||
if (mm->ran_type == MM_CTX_T_UTRAN_Iu)
|
if (mm->ran_type == MM_CTX_T_UTRAN_Iu)
|
||||||
return iu_tx(msg, GPRS_SAPI_GMM);
|
return ranap_iu_tx(msg, GPRS_SAPI_GMM);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BUILD_IU
|
#ifdef BUILD_IU
|
||||||
/* In Iu mode, msg->dst contains the ue_conn_ctx pointer, in Gb mode
|
/* In Iu mode, msg->dst contains the ranap_ue_conn_ctx pointer, in Gb mode
|
||||||
* dst is empty. */
|
* dst is empty. */
|
||||||
/* FIXME: have a more explicit indicator for Iu messages */
|
/* FIXME: have a more explicit indicator for Iu messages */
|
||||||
if (msg->dst)
|
if (msg->dst)
|
||||||
return iu_tx(msg, GPRS_SAPI_GMM);
|
return ranap_iu_tx(msg, GPRS_SAPI_GMM);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* caller needs to provide TLLI, BVCI and NSEI */
|
/* caller needs to provide TLLI, BVCI and NSEI */
|
||||||
|
@ -296,9 +296,12 @@ static void msgid2mmctx(struct sgsn_mm_ctx *mm, const struct msgb *msg)
|
||||||
/* In case a Iu connection is reconnected we need to update the ue ctx */
|
/* In case a Iu connection is reconnected we need to update the ue ctx */
|
||||||
mm->iu.ue_ctx = msg->dst;
|
mm->iu.ue_ctx = msg->dst;
|
||||||
if (mm->ran_type == MM_CTX_T_UTRAN_Iu
|
if (mm->ran_type == MM_CTX_T_UTRAN_Iu
|
||||||
&& mm->iu.ue_ctx)
|
&& mm->iu.ue_ctx) {
|
||||||
|
#ifdef BUILD_IU
|
||||||
mm->iu.ue_ctx->rab_assign_addr_enc =
|
mm->iu.ue_ctx->rab_assign_addr_enc =
|
||||||
sgsn->cfg.iu.rab_assign_addr_enc;
|
sgsn->cfg.iu.rab_assign_addr_enc;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store BVCI/NSEI in MM context */
|
/* Store BVCI/NSEI in MM context */
|
||||||
|
@ -1048,7 +1051,7 @@ static int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx)
|
||||||
/* The MS is authorized */
|
/* The MS is authorized */
|
||||||
#ifdef BUILD_IU
|
#ifdef BUILD_IU
|
||||||
if (ctx->ran_type == MM_CTX_T_UTRAN_Iu && !ctx->iu.ue_ctx->integrity_active) {
|
if (ctx->ran_type == MM_CTX_T_UTRAN_Iu && !ctx->iu.ue_ctx->integrity_active) {
|
||||||
rc = iu_tx_sec_mode_cmd(ctx->iu.ue_ctx, &ctx->auth_triplet, 0, ctx->iu.new_key);
|
rc = ranap_iu_tx_sec_mode_cmd(ctx->iu.ue_ctx, &ctx->auth_triplet.vec, 0, ctx->iu.new_key);
|
||||||
ctx->iu.new_key = 0;
|
ctx->iu.new_key = 0;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -1259,14 +1262,20 @@ static int gsm48_rx_gmm_att_req(struct sgsn_mm_ctx *ctx, struct msgb *msg,
|
||||||
* with a foreign TLLI (P-TMSI that was allocated to the MS before),
|
* with a foreign TLLI (P-TMSI that was allocated to the MS before),
|
||||||
* or with random TLLI. */
|
* or with random TLLI. */
|
||||||
|
|
||||||
/* In Iu mode, msg->dst contains the ue_conn_ctx pointer, in Gb mode
|
/* In Iu mode, msg->dst contains the ranap_ue_conn_ctx pointer, in Gb mode
|
||||||
* dst is empty. */
|
* dst is empty. */
|
||||||
/* FIXME: have a more explicit indicator for Iu messages */
|
/* FIXME: have a more explicit indicator for Iu messages */
|
||||||
if (!msg->dst) {
|
if (!msg->dst) {
|
||||||
/* Gb mode */
|
/* Gb mode */
|
||||||
cid = bssgp_parse_cell_id(&ra_id, msgb_bcid(msg));
|
cid = bssgp_parse_cell_id(&ra_id, msgb_bcid(msg));
|
||||||
} else
|
} else {
|
||||||
ra_id = ((struct ue_conn_ctx*)msg->dst)->ra_id;
|
#ifdef BUILD_IU
|
||||||
|
ra_id = ((struct ranap_ue_conn_ctx*)msg->dst)->ra_id;
|
||||||
|
#else
|
||||||
|
LOGMMCTXP(LOGL_ERROR, ctx, "Cannot handle Iu Attach Request, built without Iu support\n");
|
||||||
|
return -ENOTSUP;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* MS network capability 10.5.5.12 */
|
/* MS network capability 10.5.5.12 */
|
||||||
msnc_len = *cur++;
|
msnc_len = *cur++;
|
||||||
|
@ -1627,7 +1636,7 @@ static int gsm48_rx_gmm_ra_upd_req(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
|
||||||
* is an optimization to avoid the RA reject (impl detached)
|
* is an optimization to avoid the RA reject (impl detached)
|
||||||
* below, which will cause a new attach cycle. */
|
* below, which will cause a new attach cycle. */
|
||||||
/* Look-up the MM context based on old RA-ID and TLLI */
|
/* Look-up the MM context based on old RA-ID and TLLI */
|
||||||
/* In Iu mode, msg->dst contains the ue_conn_ctx pointer, in Gb
|
/* In Iu mode, msg->dst contains the ranap_ue_conn_ctx pointer, in Gb
|
||||||
* mode dst is empty. */
|
* mode dst is empty. */
|
||||||
/* FIXME: have a more explicit indicator for Iu messages */
|
/* FIXME: have a more explicit indicator for Iu messages */
|
||||||
if (!msg->dst) {
|
if (!msg->dst) {
|
||||||
|
@ -2905,12 +2914,12 @@ int iu_rab_act_ps(uint8_t rab_id, struct sgsn_pdp_ctx *pdp)
|
||||||
{
|
{
|
||||||
struct msgb *msg;
|
struct msgb *msg;
|
||||||
struct sgsn_mm_ctx *mm = pdp->mm;
|
struct sgsn_mm_ctx *mm = pdp->mm;
|
||||||
struct ue_conn_ctx *uectx;
|
struct ranap_ue_conn_ctx *uectx;
|
||||||
uint32_t ggsn_ip;
|
uint32_t ggsn_ip;
|
||||||
bool use_x213_nsap;
|
bool use_x213_nsap;
|
||||||
|
|
||||||
uectx = mm->iu.ue_ctx;
|
uectx = mm->iu.ue_ctx;
|
||||||
use_x213_nsap = (uectx->rab_assign_addr_enc == NSAP_ADDR_ENC_X213);
|
use_x213_nsap = (uectx->rab_assign_addr_enc == RANAP_NSAP_ADDR_ENC_X213);
|
||||||
|
|
||||||
/* Get the IP address for ggsn user plane */
|
/* Get the IP address for ggsn user plane */
|
||||||
memcpy(&ggsn_ip, pdp->lib->gsnru.v, pdp->lib->gsnru.l);
|
memcpy(&ggsn_ip, pdp->lib->gsnru.v, pdp->lib->gsnru.l);
|
||||||
|
@ -2923,6 +2932,6 @@ int iu_rab_act_ps(uint8_t rab_id, struct sgsn_pdp_ctx *pdp)
|
||||||
msg = ranap_new_msg_rab_assign_data(rab_id, ggsn_ip,
|
msg = ranap_new_msg_rab_assign_data(rab_id, ggsn_ip,
|
||||||
pdp->lib->teid_gn, use_x213_nsap);
|
pdp->lib->teid_gn, use_x213_nsap);
|
||||||
msg->l2h = msg->data;
|
msg->l2h = msg->data;
|
||||||
return iu_rab_act(uectx, msg);
|
return ranap_iu_rab_act(uectx, msg);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
#include <openbsc/gprs_utils.h>
|
#include <openbsc/gprs_utils.h>
|
||||||
#include <openbsc/signal.h>
|
#include <openbsc/signal.h>
|
||||||
#include "openbsc/gprs_llc.h"
|
#include "openbsc/gprs_llc.h"
|
||||||
#include <openbsc/iu.h>
|
|
||||||
|
|
||||||
#include <pdp.h>
|
#include <pdp.h>
|
||||||
|
|
||||||
|
@ -48,6 +47,12 @@
|
||||||
|
|
||||||
#include <openssl/rand.h>
|
#include <openssl/rand.h>
|
||||||
|
|
||||||
|
#include "../../bscconfig.h"
|
||||||
|
|
||||||
|
#if BUILD_IU
|
||||||
|
#include <osmocom/ranap/iu_client.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define GPRS_LLME_CHECK_TICK 30
|
#define GPRS_LLME_CHECK_TICK 30
|
||||||
|
|
||||||
extern struct sgsn_instance *sgsn;
|
extern struct sgsn_instance *sgsn;
|
||||||
|
@ -246,6 +251,7 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_alloc_gb(uint32_t tlli,
|
||||||
/* Allocate a new SGSN MM context */
|
/* Allocate a new SGSN MM context */
|
||||||
struct sgsn_mm_ctx *sgsn_mm_ctx_alloc_iu(void *uectx)
|
struct sgsn_mm_ctx *sgsn_mm_ctx_alloc_iu(void *uectx)
|
||||||
{
|
{
|
||||||
|
#if BUILD_IU
|
||||||
struct sgsn_mm_ctx *ctx;
|
struct sgsn_mm_ctx *ctx;
|
||||||
|
|
||||||
ctx = talloc_zero(tall_bsc_ctx, struct sgsn_mm_ctx);
|
ctx = talloc_zero(tall_bsc_ctx, struct sgsn_mm_ctx);
|
||||||
|
@ -274,6 +280,9 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_alloc_iu(void *uectx)
|
||||||
llist_add(&ctx->list, &sgsn_mm_ctxts);
|
llist_add(&ctx->list, &sgsn_mm_ctxts);
|
||||||
|
|
||||||
return ctx;
|
return ctx;
|
||||||
|
#else
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
#include <openbsc/gprs_sndcp.h>
|
#include <openbsc/gprs_sndcp.h>
|
||||||
|
|
||||||
#ifdef BUILD_IU
|
#ifdef BUILD_IU
|
||||||
#include <openbsc/iu.h>
|
#include <osmocom/ranap/iu_client.h>
|
||||||
#include <osmocom/ranap/ranap_ies_defs.h>
|
#include <osmocom/ranap/ranap_ies_defs.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -548,7 +548,7 @@ static int delete_pdp_conf(struct pdp_t *pdp, void *cbp, int cause)
|
||||||
} else {
|
} else {
|
||||||
#ifdef BUILD_IU
|
#ifdef BUILD_IU
|
||||||
/* Deactivate radio bearer */
|
/* Deactivate radio bearer */
|
||||||
iu_rab_deact(pctx->mm->iu.ue_ctx, 1);
|
ranap_iu_rab_deact(pctx->mm->iu.ue_ctx, 1);
|
||||||
#else
|
#else
|
||||||
return -ENOTSUP;
|
return -ENOTSUP;
|
||||||
#endif
|
#endif
|
||||||
|
@ -687,7 +687,7 @@ static int cb_data_ind(struct pdp_t *lib, void *packet, unsigned int len)
|
||||||
#ifdef BUILD_IU
|
#ifdef BUILD_IU
|
||||||
/* Ignore the packet for now and page the UE to get the RAB
|
/* Ignore the packet for now and page the UE to get the RAB
|
||||||
* reestablished */
|
* reestablished */
|
||||||
iu_page_ps(mm->imsi, &mm->p_tmsi, mm->ra.lac, mm->ra.rac);
|
ranap_iu_page_ps(mm->imsi, &mm->p_tmsi, mm->ra.lac, mm->ra.rac);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -58,7 +58,6 @@
|
||||||
#include <openbsc/sgsn.h>
|
#include <openbsc/sgsn.h>
|
||||||
#include <openbsc/gprs_llc.h>
|
#include <openbsc/gprs_llc.h>
|
||||||
#include <openbsc/gprs_gmm.h>
|
#include <openbsc/gprs_gmm.h>
|
||||||
#include <openbsc/iu.h>
|
|
||||||
|
|
||||||
#include <osmocom/ctrl/control_if.h>
|
#include <osmocom/ctrl/control_if.h>
|
||||||
#include <osmocom/ctrl/ports.h>
|
#include <osmocom/ctrl/ports.h>
|
||||||
|
@ -69,6 +68,10 @@
|
||||||
|
|
||||||
#include "../../bscconfig.h"
|
#include "../../bscconfig.h"
|
||||||
|
|
||||||
|
#if BUILD_IU
|
||||||
|
#include <osmocom/ranap/iu_client.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
||||||
|
@ -322,7 +325,7 @@ static const struct log_info gprs_log_info = {
|
||||||
.num_cat = ARRAY_SIZE(gprs_categories),
|
.num_cat = ARRAY_SIZE(gprs_categories),
|
||||||
};
|
};
|
||||||
|
|
||||||
int sgsn_ranap_iu_event(struct ue_conn_ctx *ctx, enum iu_event_type type, void *data);
|
int sgsn_ranap_iu_event(struct ue_conn_ctx *ctx, enum ranap_iu_event_type type, void *data);
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
@ -451,7 +454,7 @@ int main(int argc, char **argv)
|
||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
iu_init(tall_bsc_ctx, sccp, gsm0408_gprs_rcvmsg_iu, sgsn_ranap_iu_event);
|
ranap_iu_init(tall_bsc_ctx, DRANAP, "OsmoSGSN-IuPS", sccp, gsm0408_gprs_rcvmsg_iu, sgsn_ranap_iu_event);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (daemonize) {
|
if (daemonize) {
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
#include "../../bscconfig.h"
|
#include "../../bscconfig.h"
|
||||||
|
|
||||||
#ifdef BUILD_IU
|
#ifdef BUILD_IU
|
||||||
#include <openbsc/iu.h>
|
#include <osmocom/ranap/iu_client.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct sgsn_config *g_cfg = NULL;
|
static struct sgsn_config *g_cfg = NULL;
|
||||||
|
@ -291,7 +291,7 @@ static int config_write_sgsn(struct vty *vty)
|
||||||
vty_out(vty, " no compression v42bis%s", VTY_NEWLINE);
|
vty_out(vty, " no compression v42bis%s", VTY_NEWLINE);
|
||||||
|
|
||||||
#ifdef BUILD_IU
|
#ifdef BUILD_IU
|
||||||
iu_vty_config_write(vty, " ");
|
ranap_iu_vty_config_write(vty, " ");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
|
@ -1285,7 +1285,7 @@ int sgsn_vty_init(struct sgsn_config *cfg)
|
||||||
install_element(SGSN_NODE, &cfg_comp_v42bisp_cmd);
|
install_element(SGSN_NODE, &cfg_comp_v42bisp_cmd);
|
||||||
|
|
||||||
#ifdef BUILD_IU
|
#ifdef BUILD_IU
|
||||||
iu_vty_init(SGSN_NODE, &g_cfg->iu.rab_assign_addr_enc);
|
ranap_iu_vty_init(SGSN_NODE, &g_cfg->iu.rab_assign_addr_enc);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
AM_CPPFLAGS = \
|
|
||||||
$(all_includes) \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_builddir) \
|
|
||||||
$(NULL)
|
|
||||||
|
|
||||||
AM_CFLAGS = \
|
|
||||||
-Wall \
|
|
||||||
$(COVERAGE_CFLAGS) \
|
|
||||||
$(LIBCRYPTO_CFLAGS) \
|
|
||||||
$(LIBASN1C_CFLAGS) \
|
|
||||||
$(LIBOSMOCORE_CFLAGS) \
|
|
||||||
$(LIBOSMOVTY_CFLAGS) \
|
|
||||||
$(LIBOSMOGSM_CFLAGS) \
|
|
||||||
$(LIBOSMOABIS_CFLAGS) \
|
|
||||||
$(LIBOSMOSIGTRAN_CFLAGS) \
|
|
||||||
$(LIBOSMORANAP_CFLAGS) \
|
|
||||||
$(NULL)
|
|
||||||
|
|
||||||
noinst_LIBRARIES = \
|
|
||||||
libiu.a \
|
|
||||||
$(NULL)
|
|
||||||
|
|
||||||
libiu_a_SOURCES = \
|
|
||||||
iu.c \
|
|
||||||
iu_vty.c \
|
|
||||||
$(NULL)
|
|
||||||
|
|
771
src/libiu/iu.c
771
src/libiu/iu.c
|
@ -1,771 +0,0 @@
|
||||||
/* Common parts of IuCS and IuPS interfaces implementation */
|
|
||||||
|
|
||||||
/* (C) 2016 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 <stdint.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include <osmocom/core/select.h>
|
|
||||||
#include <osmocom/core/prim.h>
|
|
||||||
#include <osmocom/core/talloc.h>
|
|
||||||
#include <osmocom/core/logging.h>
|
|
||||||
#include <osmocom/core/application.h>
|
|
||||||
#include <osmocom/core/utils.h>
|
|
||||||
#include <osmocom/vty/logging.h>
|
|
||||||
|
|
||||||
#include <osmocom/gsm/gsm48.h>
|
|
||||||
#include <osmocom/gprs/gprs_msgb.h>
|
|
||||||
|
|
||||||
#include <osmocom/sigtran/osmo_ss7.h>
|
|
||||||
#include <osmocom/sigtran/sccp_sap.h>
|
|
||||||
#include <osmocom/sigtran/sccp_helpers.h>
|
|
||||||
#include <osmocom/sigtran/protocol/m3ua.h>
|
|
||||||
|
|
||||||
#include <openbsc/gprs_sgsn.h>
|
|
||||||
#include <openbsc/iu.h>
|
|
||||||
#include <openbsc/debug.h>
|
|
||||||
|
|
||||||
#include <pdp.h>
|
|
||||||
|
|
||||||
#include <osmocom/ranap/ranap_ies_defs.h>
|
|
||||||
#include <osmocom/ranap/ranap_common.h>
|
|
||||||
#include <osmocom/ranap/ranap_common_cn.h>
|
|
||||||
#include <osmocom/ranap/ranap_msg_factory.h>
|
|
||||||
|
|
||||||
#include <asn1c/asn1helpers.h>
|
|
||||||
|
|
||||||
/* Parsed global RNC id. See also struct RANAP_GlobalRNC_ID, and note that the
|
|
||||||
* PLMN identity is a BCD representation of the MCC and MNC.
|
|
||||||
* See iu_grnc_id_parse(). */
|
|
||||||
struct iu_grnc_id {
|
|
||||||
uint16_t mcc;
|
|
||||||
uint16_t mnc;
|
|
||||||
uint16_t rnc_id;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* A remote RNC (Radio Network Controller, like BSC but for UMTS) that has
|
|
||||||
* called us and is currently reachable at the given osmo_sccp_addr. So, when we
|
|
||||||
* know a LAC for a subscriber, we can page it at the RNC matching that LAC or
|
|
||||||
* RAC. An HNB-GW typically presents itself as if it were a single RNC, even
|
|
||||||
* though it may have several RNCs in hNodeBs connected to it. Those will then
|
|
||||||
* share the same RNC id, which they actually receive and adopt from the HNB-GW
|
|
||||||
* in the HNBAP HNB REGISTER ACCEPT message. */
|
|
||||||
struct iu_rnc {
|
|
||||||
struct llist_head entry;
|
|
||||||
|
|
||||||
uint16_t rnc_id;
|
|
||||||
uint16_t lac; /* Location Area Code (used for CS and PS) */
|
|
||||||
uint8_t rac; /* Routing Area Code (used for PS only) */
|
|
||||||
struct osmo_sccp_addr sccp_addr;
|
|
||||||
};
|
|
||||||
|
|
||||||
void *talloc_iu_ctx;
|
|
||||||
|
|
||||||
/* Implement the extern asn_debug from libasn1c to indicate whether to print
|
|
||||||
* asn.1 debug messages (see libasn1c). */
|
|
||||||
int asn_debug = 0;
|
|
||||||
|
|
||||||
/* Implement the extern asn1_xer_print to indicate whether the ASN.1 binary
|
|
||||||
* code decoded and encoded during Iu communication should be logged to stderr
|
|
||||||
* (see asn.1 generated code in osmo-iuh). */
|
|
||||||
int asn1_xer_print = 0;
|
|
||||||
|
|
||||||
void *talloc_asn1_ctx;
|
|
||||||
|
|
||||||
iu_recv_cb_t global_iu_recv_cb = NULL;
|
|
||||||
iu_event_cb_t global_iu_event_cb = NULL;
|
|
||||||
|
|
||||||
static LLIST_HEAD(ue_conn_ctx_list);
|
|
||||||
static LLIST_HEAD(rnc_list);
|
|
||||||
|
|
||||||
static struct osmo_sccp_instance *g_sccp;
|
|
||||||
static struct osmo_sccp_user *g_scu;
|
|
||||||
|
|
||||||
const struct value_string iu_event_type_names[] = {
|
|
||||||
OSMO_VALUE_STRING(IU_EVENT_RAB_ASSIGN),
|
|
||||||
OSMO_VALUE_STRING(IU_EVENT_SECURITY_MODE_COMPLETE),
|
|
||||||
OSMO_VALUE_STRING(IU_EVENT_IU_RELEASE),
|
|
||||||
OSMO_VALUE_STRING(IU_EVENT_LINK_INVALIDATED),
|
|
||||||
{ 0, NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ue_conn_ctx *ue_conn_ctx_alloc(struct osmo_sccp_addr *addr, uint32_t conn_id)
|
|
||||||
{
|
|
||||||
struct ue_conn_ctx *ctx = talloc_zero(talloc_iu_ctx, struct ue_conn_ctx);
|
|
||||||
|
|
||||||
ctx->sccp_addr = *addr;
|
|
||||||
ctx->conn_id = conn_id;
|
|
||||||
llist_add(&ctx->list, &ue_conn_ctx_list);
|
|
||||||
|
|
||||||
return ctx;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ue_conn_ctx *ue_conn_ctx_find(uint32_t conn_id)
|
|
||||||
{
|
|
||||||
struct ue_conn_ctx *ctx;
|
|
||||||
|
|
||||||
llist_for_each_entry(ctx, &ue_conn_ctx_list, list) {
|
|
||||||
if (ctx->conn_id == conn_id)
|
|
||||||
return ctx;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct iu_rnc *iu_rnc_alloc(uint16_t rnc_id, uint16_t lac, uint8_t rac,
|
|
||||||
struct osmo_sccp_addr *addr)
|
|
||||||
{
|
|
||||||
struct iu_rnc *rnc = talloc_zero(talloc_iu_ctx, struct iu_rnc);
|
|
||||||
|
|
||||||
rnc->rnc_id = rnc_id;
|
|
||||||
rnc->lac = lac;
|
|
||||||
rnc->rac = rac;
|
|
||||||
rnc->sccp_addr = *addr;
|
|
||||||
llist_add(&rnc->entry, &rnc_list);
|
|
||||||
|
|
||||||
LOGP(DRANAP, LOGL_NOTICE, "New RNC %d (LAC=%d RAC=%d)\n",
|
|
||||||
rnc->rnc_id, rnc->lac, rnc->rac);
|
|
||||||
|
|
||||||
return rnc;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct iu_rnc *iu_rnc_register(uint16_t rnc_id, uint16_t lac,
|
|
||||||
uint8_t rac, struct osmo_sccp_addr *addr)
|
|
||||||
{
|
|
||||||
struct iu_rnc *rnc;
|
|
||||||
llist_for_each_entry(rnc, &rnc_list, entry) {
|
|
||||||
if (rnc->rnc_id != rnc_id)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* We have this RNC Id registered already. Make sure that the
|
|
||||||
* details match. */
|
|
||||||
|
|
||||||
/* TODO should a mismatch be an error? */
|
|
||||||
if (rnc->lac != lac || rnc->rac != rac)
|
|
||||||
LOGP(DRANAP, LOGL_NOTICE, "RNC %d changes its details:"
|
|
||||||
" LAC=%d RAC=%d --> LAC=%d RAC=%d\n",
|
|
||||||
rnc->rnc_id, rnc->lac, rnc->rac,
|
|
||||||
lac, rac);
|
|
||||||
rnc->lac = lac;
|
|
||||||
rnc->rac = rac;
|
|
||||||
|
|
||||||
if (addr && memcmp(&rnc->sccp_addr, addr, sizeof(*addr)))
|
|
||||||
LOGP(DRANAP, LOGL_NOTICE, "RNC %d on New SCCP Addr %s"
|
|
||||||
" (LAC=%d RAC=%d)\n",
|
|
||||||
rnc->rnc_id, osmo_sccp_addr_dump(addr), rnc->lac, rnc->rac);
|
|
||||||
rnc->sccp_addr = *addr;
|
|
||||||
return rnc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Not found, make a new one. */
|
|
||||||
return iu_rnc_alloc(rnc_id, lac, rac, addr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* RANAP handling
|
|
||||||
***********************************************************************/
|
|
||||||
|
|
||||||
int iu_rab_act(struct ue_conn_ctx *ue_ctx, struct msgb *msg)
|
|
||||||
{
|
|
||||||
struct osmo_scu_prim *prim;
|
|
||||||
|
|
||||||
/* wrap RANAP message in SCCP N-DATA.req */
|
|
||||||
prim = (struct osmo_scu_prim *) msgb_push(msg, sizeof(*prim));
|
|
||||||
prim->u.data.conn_id = ue_ctx->conn_id;
|
|
||||||
osmo_prim_init(&prim->oph,
|
|
||||||
SCCP_SAP_USER,
|
|
||||||
OSMO_SCU_PRIM_N_DATA,
|
|
||||||
PRIM_OP_REQUEST,
|
|
||||||
msg);
|
|
||||||
return osmo_sccp_user_sap_down(g_scu, &prim->oph);
|
|
||||||
}
|
|
||||||
|
|
||||||
int iu_rab_deact(struct ue_conn_ctx *ue_ctx, uint8_t rab_id)
|
|
||||||
{
|
|
||||||
/* FIXME */
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int iu_tx_sec_mode_cmd(struct ue_conn_ctx *uectx, struct gsm_auth_tuple *tp,
|
|
||||||
int send_ck, int new_key)
|
|
||||||
{
|
|
||||||
struct osmo_scu_prim *prim;
|
|
||||||
struct msgb *msg;
|
|
||||||
|
|
||||||
/* create RANAP message */
|
|
||||||
msg = ranap_new_msg_sec_mod_cmd(tp->vec.ik, send_ck? tp->vec.ck : NULL,
|
|
||||||
new_key ? RANAP_KeyStatus_new : RANAP_KeyStatus_old);
|
|
||||||
msg->l2h = msg->data;
|
|
||||||
/* wrap RANAP message in SCCP N-DATA.req */
|
|
||||||
prim = (struct osmo_scu_prim *) msgb_push(msg, sizeof(*prim));
|
|
||||||
prim->u.data.conn_id = uectx->conn_id;
|
|
||||||
osmo_prim_init(&prim->oph, SCCP_SAP_USER,
|
|
||||||
OSMO_SCU_PRIM_N_DATA,
|
|
||||||
PRIM_OP_REQUEST, msg);
|
|
||||||
osmo_sccp_user_sap_down(g_scu, &prim->oph);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int iu_tx_common_id(struct ue_conn_ctx *uectx, const char *imsi)
|
|
||||||
{
|
|
||||||
struct msgb *msg;
|
|
||||||
struct osmo_scu_prim *prim;
|
|
||||||
|
|
||||||
LOGP(DRANAP, LOGL_INFO, "Transmitting RANAP CommonID (SCCP conn_id %u)\n",
|
|
||||||
uectx->conn_id);
|
|
||||||
|
|
||||||
msg = ranap_new_msg_common_id(imsi);
|
|
||||||
msg->l2h = msg->data;
|
|
||||||
prim = (struct osmo_scu_prim *) msgb_push(msg, sizeof(*prim));
|
|
||||||
prim->u.data.conn_id = uectx->conn_id;
|
|
||||||
osmo_prim_init(&prim->oph, SCCP_SAP_USER,
|
|
||||||
OSMO_SCU_PRIM_N_DATA,
|
|
||||||
PRIM_OP_REQUEST, msg);
|
|
||||||
osmo_sccp_user_sap_down(g_scu, &prim->oph);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int iu_grnc_id_parse(struct iu_grnc_id *dst,
|
|
||||||
struct RANAP_GlobalRNC_ID *src)
|
|
||||||
{
|
|
||||||
/* The size is coming from arbitrary sender, check it gracefully */
|
|
||||||
if (src->pLMNidentity.size != 3) {
|
|
||||||
LOGP(DRANAP, LOGL_ERROR, "Invalid PLMN Identity size:"
|
|
||||||
" should be 3, is %d\n", src->pLMNidentity.size);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
gsm48_mcc_mnc_from_bcd(&src->pLMNidentity.buf[0],
|
|
||||||
&dst->mcc, &dst->mnc);
|
|
||||||
dst->rnc_id = (uint16_t)src->rNC_ID;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
-- not used at present --
|
|
||||||
static int iu_grnc_id_compose(struct iu_grnc_id *src,
|
|
||||||
struct RANAP_GlobalRNC_ID *dst)
|
|
||||||
{
|
|
||||||
/* The caller must ensure proper size */
|
|
||||||
OSMO_ASSERT(dst->pLMNidentity.size == 3);
|
|
||||||
gsm48_mcc_mnc_to_bcd(&dst->pLMNidentity.buf[0],
|
|
||||||
src->mcc, src->mnc);
|
|
||||||
dst->rNC_ID = src->rnc_id;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int ranap_handle_co_initial_ue(void *ctx, RANAP_InitialUE_MessageIEs_t *ies)
|
|
||||||
{
|
|
||||||
struct ue_conn_ctx *ue_conn = ctx;
|
|
||||||
struct gprs_ra_id ra_id;
|
|
||||||
struct iu_grnc_id grnc_id;
|
|
||||||
uint16_t sai;
|
|
||||||
struct msgb *msg = msgb_alloc(256, "RANAP->NAS");
|
|
||||||
|
|
||||||
if (ranap_parse_lai(&ra_id, &ies->lai) != 0) {
|
|
||||||
LOGP(DRANAP, LOGL_ERROR, "Failed to parse RANAP LAI IE\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ies->presenceMask & INITIALUE_MESSAGEIES_RANAP_RAC_PRESENT) {
|
|
||||||
ra_id.rac = asn1str_to_u8(&ies->rac);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iu_grnc_id_parse(&grnc_id, &ies->globalRNC_ID) != 0) {
|
|
||||||
LOGP(DRANAP, LOGL_ERROR,
|
|
||||||
"Failed to parse RANAP Global-RNC-ID IE\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
sai = asn1str_to_u16(&ies->sai.sAC);
|
|
||||||
msgb_gmmh(msg) = msgb_put(msg, ies->nas_pdu.size);
|
|
||||||
memcpy(msgb_gmmh(msg), ies->nas_pdu.buf, ies->nas_pdu.size);
|
|
||||||
|
|
||||||
/* Make sure we know the RNC Id and LAC+RAC coming in on this connection. */
|
|
||||||
iu_rnc_register(grnc_id.rnc_id, ra_id.lac, ra_id.rac, &ue_conn->sccp_addr);
|
|
||||||
ue_conn->ra_id = ra_id;
|
|
||||||
|
|
||||||
/* Feed into the MM layer */
|
|
||||||
msg->dst = ctx;
|
|
||||||
global_iu_recv_cb(msg, &ra_id, &sai);
|
|
||||||
|
|
||||||
msgb_free(msg);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ranap_handle_co_dt(void *ctx, RANAP_DirectTransferIEs_t *ies)
|
|
||||||
{
|
|
||||||
struct gprs_ra_id _ra_id, *ra_id = NULL;
|
|
||||||
uint16_t _sai, *sai = NULL;
|
|
||||||
struct msgb *msg = msgb_alloc(256, "RANAP->NAS");
|
|
||||||
|
|
||||||
if (ies->presenceMask & DIRECTTRANSFERIES_RANAP_LAI_PRESENT) {
|
|
||||||
if (ranap_parse_lai(&_ra_id, &ies->lai) != 0) {
|
|
||||||
LOGP(DRANAP, LOGL_ERROR, "Failed to parse RANAP LAI IE\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
ra_id = &_ra_id;
|
|
||||||
if (ies->presenceMask & DIRECTTRANSFERIES_RANAP_RAC_PRESENT) {
|
|
||||||
_ra_id.rac = asn1str_to_u8(&ies->rac);
|
|
||||||
}
|
|
||||||
if (ies->presenceMask & DIRECTTRANSFERIES_RANAP_SAI_PRESENT) {
|
|
||||||
_sai = asn1str_to_u16(&ies->sai.sAC);
|
|
||||||
sai = &_sai;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
msgb_gmmh(msg) = msgb_put(msg, ies->nas_pdu.size);
|
|
||||||
memcpy(msgb_gmmh(msg), ies->nas_pdu.buf, ies->nas_pdu.size);
|
|
||||||
|
|
||||||
/* Feed into the MM/CC/SMS-CP layer */
|
|
||||||
msg->dst = ctx;
|
|
||||||
global_iu_recv_cb(msg, ra_id, sai);
|
|
||||||
|
|
||||||
msgb_free(msg);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ranap_handle_co_err_ind(void *ctx, RANAP_ErrorIndicationIEs_t *ies)
|
|
||||||
{
|
|
||||||
if (ies->presenceMask & ERRORINDICATIONIES_RANAP_CAUSE_PRESENT)
|
|
||||||
LOGP(DRANAP, LOGL_ERROR, "Rx Error Indication (%s)\n",
|
|
||||||
ranap_cause_str(&ies->cause));
|
|
||||||
else
|
|
||||||
LOGP(DRANAP, LOGL_ERROR, "Rx Error Indication\n");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int iu_tx(struct msgb *msg_nas, uint8_t sapi)
|
|
||||||
{
|
|
||||||
struct ue_conn_ctx *uectx = msg_nas->dst;
|
|
||||||
struct msgb *msg;
|
|
||||||
struct osmo_scu_prim *prim;
|
|
||||||
|
|
||||||
LOGP(DRANAP, LOGL_INFO, "Transmitting L3 Message as RANAP DT (SCCP conn_id %u)\n",
|
|
||||||
uectx->conn_id);
|
|
||||||
|
|
||||||
msg = ranap_new_msg_dt(sapi, msg_nas->data, msgb_length(msg_nas));
|
|
||||||
msgb_free(msg_nas);
|
|
||||||
msg->l2h = msg->data;
|
|
||||||
prim = (struct osmo_scu_prim *) msgb_push(msg, sizeof(*prim));
|
|
||||||
prim->u.data.conn_id = uectx->conn_id;
|
|
||||||
osmo_prim_init(&prim->oph, SCCP_SAP_USER,
|
|
||||||
OSMO_SCU_PRIM_N_DATA,
|
|
||||||
PRIM_OP_REQUEST, msg);
|
|
||||||
osmo_sccp_user_sap_down(g_scu, &prim->oph);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Send Iu Release for the given UE connection.
|
|
||||||
* If cause is NULL, the standard "No remaining RAB" cause is sent, otherwise
|
|
||||||
* the provided cause. */
|
|
||||||
int iu_tx_release(struct ue_conn_ctx *ctx, const struct RANAP_Cause *cause)
|
|
||||||
{
|
|
||||||
struct msgb *msg;
|
|
||||||
struct osmo_scu_prim *prim;
|
|
||||||
static const struct RANAP_Cause default_cause = {
|
|
||||||
.present = RANAP_Cause_PR_radioNetwork,
|
|
||||||
.choice.radioNetwork = RANAP_CauseRadioNetwork_no_remaining_rab,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!cause)
|
|
||||||
cause = &default_cause;
|
|
||||||
|
|
||||||
LOGP(DRANAP, LOGL_INFO, "Transmitting Iu Release (SCCP conn_id %u)\n",
|
|
||||||
ctx->conn_id);
|
|
||||||
|
|
||||||
msg = ranap_new_msg_iu_rel_cmd(cause);
|
|
||||||
msg->l2h = msg->data;
|
|
||||||
prim = (struct osmo_scu_prim *) msgb_push(msg, sizeof(*prim));
|
|
||||||
prim->u.data.conn_id = ctx->conn_id;
|
|
||||||
osmo_prim_init(&prim->oph, SCCP_SAP_USER,
|
|
||||||
OSMO_SCU_PRIM_N_DATA,
|
|
||||||
PRIM_OP_REQUEST, msg);
|
|
||||||
return osmo_sccp_user_sap_down(g_scu, &prim->oph);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ranap_handle_co_iu_rel_req(struct ue_conn_ctx *ctx, RANAP_Iu_ReleaseRequestIEs_t *ies)
|
|
||||||
{
|
|
||||||
LOGP(DRANAP, LOGL_INFO, "Received Iu Release Request, Sending Release Command\n");
|
|
||||||
iu_tx_release(ctx, &ies->cause);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ranap_handle_co_rab_ass_resp(struct ue_conn_ctx *ctx, RANAP_RAB_AssignmentResponseIEs_t *ies)
|
|
||||||
{
|
|
||||||
int rc = -1;
|
|
||||||
|
|
||||||
LOGP(DRANAP, LOGL_INFO,
|
|
||||||
"Rx RAB Assignment Response for UE conn_id %u\n", ctx->conn_id);
|
|
||||||
if (ies->presenceMask & RAB_ASSIGNMENTRESPONSEIES_RANAP_RAB_SETUPORMODIFIEDLIST_PRESENT) {
|
|
||||||
/* TODO: Iterate over list of SetupOrModifiedList IEs and handle each one */
|
|
||||||
RANAP_IE_t *ranap_ie = ies->raB_SetupOrModifiedList.raB_SetupOrModifiedList_ies.list.array[0];
|
|
||||||
RANAP_RAB_SetupOrModifiedItemIEs_t setup_ies;
|
|
||||||
|
|
||||||
rc = ranap_decode_rab_setupormodifieditemies_fromlist(&setup_ies, &ranap_ie->value);
|
|
||||||
if (rc) {
|
|
||||||
LOGP(DRANAP, LOGL_ERROR, "Error in ranap_decode_rab_setupormodifieditemies()\n");
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = global_iu_event_cb(ctx, IU_EVENT_RAB_ASSIGN, &setup_ies);
|
|
||||||
|
|
||||||
ranap_free_rab_setupormodifieditemies(&setup_ies);
|
|
||||||
}
|
|
||||||
/* FIXME: handle RAB Ass failure? */
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Entry point for connection-oriented RANAP message */
|
|
||||||
static void cn_ranap_handle_co(void *ctx, ranap_message *message)
|
|
||||||
{
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
LOGP(DRANAP, LOGL_NOTICE, "handle_co(dir=%u, proc=%u)\n", message->direction, message->procedureCode);
|
|
||||||
|
|
||||||
switch (message->direction) {
|
|
||||||
case RANAP_RANAP_PDU_PR_initiatingMessage:
|
|
||||||
switch (message->procedureCode) {
|
|
||||||
case RANAP_ProcedureCode_id_InitialUE_Message:
|
|
||||||
rc = ranap_handle_co_initial_ue(ctx, &message->msg.initialUE_MessageIEs);
|
|
||||||
break;
|
|
||||||
case RANAP_ProcedureCode_id_DirectTransfer:
|
|
||||||
rc = ranap_handle_co_dt(ctx, &message->msg.directTransferIEs);
|
|
||||||
break;
|
|
||||||
case RANAP_ProcedureCode_id_ErrorIndication:
|
|
||||||
rc = ranap_handle_co_err_ind(ctx, &message->msg.errorIndicationIEs);
|
|
||||||
break;
|
|
||||||
case RANAP_ProcedureCode_id_Iu_ReleaseRequest:
|
|
||||||
/* Iu Release Request */
|
|
||||||
rc = ranap_handle_co_iu_rel_req(ctx, &message->msg.iu_ReleaseRequestIEs);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
LOGP(DRANAP, LOGL_ERROR, "Received Initiating Message: unknown Procedure Code %d\n",
|
|
||||||
message->procedureCode);
|
|
||||||
rc = -1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RANAP_RANAP_PDU_PR_successfulOutcome:
|
|
||||||
switch (message->procedureCode) {
|
|
||||||
case RANAP_ProcedureCode_id_SecurityModeControl:
|
|
||||||
/* Security Mode Complete */
|
|
||||||
rc = global_iu_event_cb(ctx, IU_EVENT_SECURITY_MODE_COMPLETE, NULL);
|
|
||||||
break;
|
|
||||||
case RANAP_ProcedureCode_id_Iu_Release:
|
|
||||||
/* Iu Release Complete */
|
|
||||||
rc = global_iu_event_cb(ctx, IU_EVENT_IU_RELEASE, NULL);
|
|
||||||
if (rc) {
|
|
||||||
LOGP(DRANAP, LOGL_ERROR, "Iu Release event: Iu Event callback returned %d\n",
|
|
||||||
rc);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
LOGP(DRANAP, LOGL_ERROR, "Received Successful Outcome: unknown Procedure Code %d\n",
|
|
||||||
message->procedureCode);
|
|
||||||
rc = -1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RANAP_RANAP_PDU_PR_outcome:
|
|
||||||
switch (message->procedureCode) {
|
|
||||||
case RANAP_ProcedureCode_id_RAB_Assignment:
|
|
||||||
/* RAB Assignment Response */
|
|
||||||
rc = ranap_handle_co_rab_ass_resp(ctx, &message->msg.raB_AssignmentResponseIEs);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
LOGP(DRANAP, LOGL_ERROR, "Received Outcome: unknown Procedure Code %d\n",
|
|
||||||
message->procedureCode);
|
|
||||||
rc = -1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RANAP_RANAP_PDU_PR_unsuccessfulOutcome:
|
|
||||||
default:
|
|
||||||
LOGP(DRANAP, LOGL_ERROR, "Received Unsuccessful Outcome: Procedure Code %d\n",
|
|
||||||
message->procedureCode);
|
|
||||||
rc = -1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rc) {
|
|
||||||
LOGP(DRANAP, LOGL_ERROR, "Error in cn_ranap_handle_co (%d)\n",
|
|
||||||
rc);
|
|
||||||
/* TODO handling of the error? */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ranap_handle_cl_reset_req(void *ctx, RANAP_ResetIEs_t *ies)
|
|
||||||
{
|
|
||||||
/* FIXME: send reset response */
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ranap_handle_cl_err_ind(void *ctx, RANAP_ErrorIndicationIEs_t *ies)
|
|
||||||
{
|
|
||||||
if (ies->presenceMask & ERRORINDICATIONIES_RANAP_CAUSE_PRESENT)
|
|
||||||
LOGP(DRANAP, LOGL_ERROR, "Rx Error Indication (%s)\n",
|
|
||||||
ranap_cause_str(&ies->cause));
|
|
||||||
else
|
|
||||||
LOGP(DRANAP, LOGL_ERROR, "Rx Error Indication\n");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Entry point for connection-less RANAP message */
|
|
||||||
static void cn_ranap_handle_cl(void *ctx, ranap_message *message)
|
|
||||||
{
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
switch (message->direction) {
|
|
||||||
case RANAP_RANAP_PDU_PR_initiatingMessage:
|
|
||||||
switch (message->procedureCode) {
|
|
||||||
case RANAP_ProcedureCode_id_Reset:
|
|
||||||
/* received reset.req, send reset.resp */
|
|
||||||
rc = ranap_handle_cl_reset_req(ctx, &message->msg.resetIEs);
|
|
||||||
break;
|
|
||||||
case RANAP_ProcedureCode_id_ErrorIndication:
|
|
||||||
rc = ranap_handle_cl_err_ind(ctx, &message->msg.errorIndicationIEs);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
rc = -1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RANAP_RANAP_PDU_PR_successfulOutcome:
|
|
||||||
case RANAP_RANAP_PDU_PR_unsuccessfulOutcome:
|
|
||||||
case RANAP_RANAP_PDU_PR_outcome:
|
|
||||||
default:
|
|
||||||
rc = -1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rc) {
|
|
||||||
LOGP(DRANAP, LOGL_ERROR, "Error in cn_ranap_handle_cl (%d)\n",
|
|
||||||
rc);
|
|
||||||
/* TODO handling of the error? */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Paging
|
|
||||||
***********************************************************************/
|
|
||||||
|
|
||||||
struct osmo_sccp_addr local_sccp_addr = {
|
|
||||||
.presence = OSMO_SCCP_ADDR_T_SSN | OSMO_SCCP_ADDR_T_PC,
|
|
||||||
.ri = OSMO_SCCP_RI_SSN_PC,
|
|
||||||
.ssn = OSMO_SCCP_SSN_RANAP,
|
|
||||||
.pc = 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Send a paging command down a given SCCP User. tmsi and paging_cause are
|
|
||||||
* optional and may be passed NULL and 0, respectively, to disable their use.
|
|
||||||
* See enum RANAP_PagingCause.
|
|
||||||
*
|
|
||||||
* If TMSI is given, the IMSI is not sent over the air interface. Nevertheless,
|
|
||||||
* the IMSI is still required for resolution in the HNB-GW and/or(?) RNC. */
|
|
||||||
static int iu_tx_paging_cmd(struct osmo_sccp_addr *called_addr,
|
|
||||||
const char *imsi, const uint32_t *tmsi,
|
|
||||||
bool is_ps, uint32_t paging_cause)
|
|
||||||
{
|
|
||||||
struct msgb *msg;
|
|
||||||
msg = ranap_new_msg_paging_cmd(imsi, tmsi, is_ps? 1 : 0, paging_cause);
|
|
||||||
msg->l2h = msg->data;
|
|
||||||
osmo_sccp_tx_unitdata_msg(g_scu, &local_sccp_addr, called_addr, msg);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int iu_page(const char *imsi, const uint32_t *tmsi_or_ptimsi,
|
|
||||||
uint16_t lac, uint8_t rac, bool is_ps)
|
|
||||||
{
|
|
||||||
struct iu_rnc *rnc;
|
|
||||||
int pagings_sent = 0;
|
|
||||||
|
|
||||||
if (tmsi_or_ptimsi) {
|
|
||||||
LOGP(DRANAP, LOGL_DEBUG, "%s: Looking for RNCs to page for IMSI %s"
|
|
||||||
" (paging will use %s %x)\n",
|
|
||||||
is_ps? "IuPS" : "IuCS",
|
|
||||||
imsi,
|
|
||||||
is_ps? "PTMSI" : "TMSI",
|
|
||||||
*tmsi_or_ptimsi);
|
|
||||||
} else {
|
|
||||||
LOGP(DRANAP, LOGL_DEBUG, "%s: Looking for RNCs to page for IMSI %s"
|
|
||||||
" (paging will use IMSI)\n",
|
|
||||||
is_ps? "IuPS" : "IuCS",
|
|
||||||
imsi
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
llist_for_each_entry(rnc, &rnc_list, entry) {
|
|
||||||
if (rnc->lac != lac)
|
|
||||||
continue;
|
|
||||||
if (is_ps && rnc->rac != rac)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Found a match! */
|
|
||||||
if (iu_tx_paging_cmd(&rnc->sccp_addr, imsi, tmsi_or_ptimsi, is_ps, 0)
|
|
||||||
== 0) {
|
|
||||||
LOGP(DRANAP, LOGL_DEBUG,
|
|
||||||
"%s: Paged for IMSI %s on RNC %d, on SCCP addr %s\n",
|
|
||||||
is_ps? "IuPS" : "IuCS",
|
|
||||||
imsi, rnc->rnc_id, osmo_sccp_addr_dump(&rnc->sccp_addr));
|
|
||||||
pagings_sent ++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Some logging... */
|
|
||||||
if (pagings_sent > 0) {
|
|
||||||
LOGP(DRANAP, LOGL_DEBUG,
|
|
||||||
"%s: %d RNCs were paged for IMSI %s.\n",
|
|
||||||
is_ps? "IuPS" : "IuCS",
|
|
||||||
pagings_sent, imsi);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (is_ps) {
|
|
||||||
LOGP(DRANAP, LOGL_ERROR, "IuPS: Found no RNC to page for"
|
|
||||||
" LAC %d RAC %d (would have paged IMSI %s)\n",
|
|
||||||
lac, rac, imsi);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LOGP(DRANAP, LOGL_ERROR, "IuCS: Found no RNC to page for"
|
|
||||||
" LAC %d (would have paged IMSI %s)\n",
|
|
||||||
lac, imsi);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return pagings_sent;
|
|
||||||
}
|
|
||||||
|
|
||||||
int iu_page_cs(const char *imsi, const uint32_t *tmsi, uint16_t lac)
|
|
||||||
{
|
|
||||||
return iu_page(imsi, tmsi, lac, 0, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
int iu_page_ps(const char *imsi, const uint32_t *ptmsi, uint16_t lac, uint8_t rac)
|
|
||||||
{
|
|
||||||
return iu_page(imsi, ptmsi, lac, rac, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
*
|
|
||||||
***********************************************************************/
|
|
||||||
|
|
||||||
int tx_unitdata(struct osmo_sccp_user *scu);
|
|
||||||
int tx_conn_req(struct osmo_sccp_user *scu, uint32_t conn_id);
|
|
||||||
|
|
||||||
struct osmo_prim_hdr *make_conn_req(uint32_t conn_id);
|
|
||||||
struct osmo_prim_hdr *make_dt1_req(uint32_t conn_id, const uint8_t *data, unsigned int len);
|
|
||||||
|
|
||||||
struct osmo_prim_hdr *make_conn_resp(struct osmo_scu_connect_param *param)
|
|
||||||
{
|
|
||||||
struct msgb *msg = msgb_alloc(1024, "conn_resp");
|
|
||||||
struct osmo_scu_prim *prim;
|
|
||||||
|
|
||||||
prim = (struct osmo_scu_prim *) msgb_put(msg, sizeof(*prim));
|
|
||||||
osmo_prim_init(&prim->oph, SCCP_SAP_USER,
|
|
||||||
OSMO_SCU_PRIM_N_CONNECT,
|
|
||||||
PRIM_OP_RESPONSE, msg);
|
|
||||||
memcpy(&prim->u.connect, param, sizeof(prim->u.connect));
|
|
||||||
return &prim->oph;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int sccp_sap_up(struct osmo_prim_hdr *oph, void *_scu)
|
|
||||||
{
|
|
||||||
struct osmo_sccp_user *scu = _scu;
|
|
||||||
struct osmo_scu_prim *prim = (struct osmo_scu_prim *) oph;
|
|
||||||
struct osmo_prim_hdr *resp = NULL;
|
|
||||||
int rc;
|
|
||||||
struct ue_conn_ctx *ue;
|
|
||||||
|
|
||||||
DEBUGP(DRANAP, "sccp_sap_up(%s)\n", osmo_scu_prim_name(oph));
|
|
||||||
|
|
||||||
switch (OSMO_PRIM_HDR(oph)) {
|
|
||||||
case OSMO_PRIM(OSMO_SCU_PRIM_N_CONNECT, PRIM_OP_CONFIRM):
|
|
||||||
/* confirmation of outbound connection */
|
|
||||||
rc = -1;
|
|
||||||
break;
|
|
||||||
case OSMO_PRIM(OSMO_SCU_PRIM_N_CONNECT, PRIM_OP_INDICATION):
|
|
||||||
/* indication of new inbound connection request*/
|
|
||||||
DEBUGP(DRANAP, "N-CONNECT.ind(X->%u)\n", prim->u.connect.conn_id);
|
|
||||||
if (/* prim->u.connect.called_addr.ssn != OSMO_SCCP_SSN_RANAP || */
|
|
||||||
!msgb_l2(oph->msg) || msgb_l2len(oph->msg) == 0) {
|
|
||||||
LOGP(DRANAP, LOGL_NOTICE,
|
|
||||||
"Received invalid N-CONNECT.ind\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
ue = ue_conn_ctx_alloc(&prim->u.connect.calling_addr, prim->u.connect.conn_id);
|
|
||||||
/* first ensure the local SCCP socket is ACTIVE */
|
|
||||||
resp = make_conn_resp(&prim->u.connect);
|
|
||||||
osmo_sccp_user_sap_down(scu, resp);
|
|
||||||
/* then handle the RANAP payload */
|
|
||||||
rc = ranap_cn_rx_co(cn_ranap_handle_co, ue, msgb_l2(oph->msg), msgb_l2len(oph->msg));
|
|
||||||
break;
|
|
||||||
case OSMO_PRIM(OSMO_SCU_PRIM_N_DISCONNECT, PRIM_OP_INDICATION):
|
|
||||||
/* indication of disconnect */
|
|
||||||
DEBUGP(DRANAP, "N-DISCONNECT.ind(%u)\n",
|
|
||||||
prim->u.disconnect.conn_id);
|
|
||||||
ue = ue_conn_ctx_find(prim->u.disconnect.conn_id);
|
|
||||||
rc = ranap_cn_rx_co(cn_ranap_handle_co, ue, msgb_l2(oph->msg), msgb_l2len(oph->msg));
|
|
||||||
break;
|
|
||||||
case OSMO_PRIM(OSMO_SCU_PRIM_N_DATA, PRIM_OP_INDICATION):
|
|
||||||
/* connection-oriented data received */
|
|
||||||
DEBUGP(DRANAP, "N-DATA.ind(%u, %s)\n", prim->u.data.conn_id,
|
|
||||||
osmo_hexdump(msgb_l2(oph->msg), msgb_l2len(oph->msg)));
|
|
||||||
/* resolve UE context */
|
|
||||||
ue = ue_conn_ctx_find(prim->u.data.conn_id);
|
|
||||||
rc = ranap_cn_rx_co(cn_ranap_handle_co, ue, msgb_l2(oph->msg), msgb_l2len(oph->msg));
|
|
||||||
break;
|
|
||||||
case OSMO_PRIM(OSMO_SCU_PRIM_N_UNITDATA, PRIM_OP_INDICATION):
|
|
||||||
/* connection-less data received */
|
|
||||||
DEBUGP(DRANAP, "N-UNITDATA.ind(%s)\n",
|
|
||||||
osmo_hexdump(msgb_l2(oph->msg), msgb_l2len(oph->msg)));
|
|
||||||
rc = ranap_cn_rx_cl(cn_ranap_handle_cl, scu, msgb_l2(oph->msg), msgb_l2len(oph->msg));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
rc = -1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
msgb_free(oph->msg);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
int iu_init(void *ctx, struct osmo_sccp_instance *sccp,
|
|
||||||
iu_recv_cb_t iu_recv_cb, iu_event_cb_t iu_event_cb)
|
|
||||||
{
|
|
||||||
talloc_iu_ctx = talloc_named_const(ctx, 1, "iu");
|
|
||||||
talloc_asn1_ctx = talloc_named_const(talloc_iu_ctx, 1, "asn1");
|
|
||||||
|
|
||||||
global_iu_recv_cb = iu_recv_cb;
|
|
||||||
global_iu_event_cb = iu_event_cb;
|
|
||||||
g_sccp = sccp;
|
|
||||||
g_scu = osmo_sccp_user_bind(g_sccp, "OsmoMSC-Iu", sccp_sap_up, OSMO_SCCP_SSN_RANAP);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,133 +0,0 @@
|
||||||
/* OpenBSC Iu related interface to quagga VTY */
|
|
||||||
/* (C) 2016 by sysmocom s.m.f.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 <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <osmocom/core/logging.h>
|
|
||||||
#include <osmocom/vty/command.h>
|
|
||||||
#include <osmocom/vty/logging.h>
|
|
||||||
#include <osmocom/sigtran/osmo_ss7.h>
|
|
||||||
#include <osmocom/sigtran/sccp_sap.h>
|
|
||||||
|
|
||||||
#include <openbsc/iu.h>
|
|
||||||
|
|
||||||
static enum nsap_addr_enc *g_rab_assign_addr_enc = NULL;
|
|
||||||
|
|
||||||
DEFUN(logging_asn_debug,
|
|
||||||
logging_asn_debug_cmd,
|
|
||||||
"logging asn1-debug (1|0)",
|
|
||||||
LOGGING_STR
|
|
||||||
"Log ASN.1 debug messages to stderr\n"
|
|
||||||
"Log ASN.1 debug messages to stderr\n"
|
|
||||||
"Do not log ASN.1 debug messages to stderr\n")
|
|
||||||
{
|
|
||||||
asn_debug = atoi(argv[0]);
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUN(logging_asn_xer_print,
|
|
||||||
logging_asn_xer_print_cmd,
|
|
||||||
"logging asn1-xer-print (1|0)",
|
|
||||||
LOGGING_STR
|
|
||||||
"Log human readable representations of all ASN.1 messages to stderr\n"
|
|
||||||
"Log decoded ASN.1 messages to stderr\n"
|
|
||||||
"Do not log decoded ASN.1 messages to stderr\n")
|
|
||||||
{
|
|
||||||
asn1_xer_print = atoi(argv[0]);
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define IU_STR "Iu interface protocol options\n"
|
|
||||||
DEFUN(cfg_iu_rab_assign_addr_enc, cfg_iu_rab_assign_addr_enc_cmd,
|
|
||||||
"iu rab-assign-addr-enc (x213|v4raw)",
|
|
||||||
IU_STR
|
|
||||||
"Choose RAB Assignment's Transport Layer Address encoding\n"
|
|
||||||
"ITU-T X.213 compliant address encoding (default)\n"
|
|
||||||
"32bit length raw IPv4 address (for ip.access nano3G)\n")
|
|
||||||
{
|
|
||||||
if (!g_rab_assign_addr_enc) {
|
|
||||||
vty_out(vty, "%%RAB Assignment Transport Layer Address"
|
|
||||||
" encoding not available%s", VTY_NEWLINE);
|
|
||||||
return CMD_WARNING;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strcmp(argv[0], "v4raw") == 0)
|
|
||||||
*g_rab_assign_addr_enc = NSAP_ADDR_ENC_V4RAW;
|
|
||||||
else
|
|
||||||
*g_rab_assign_addr_enc = NSAP_ADDR_ENC_X213;
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern struct osmo_sccp_addr local_sccp_addr;
|
|
||||||
|
|
||||||
/* Note from the future: change-id Ib8c4fcdb4766c5e575618b95ce16dce51063206b will move this file to
|
|
||||||
* osmo-iuh, and there, change-id I3bb7fc1cd5261d214c6ba0cccfe95f637e6db087 will drop this vty command
|
|
||||||
* and use the point code defined via libosmo-sccp vty commands instead. */
|
|
||||||
DEFUN(cfg_iu_local_addr_pc, cfg_iu_local_addr_pc_cmd,
|
|
||||||
"iu local-address point-code PC",
|
|
||||||
IU_STR "Local SCCP Address\n" "Set local point code\n" "point code\n")
|
|
||||||
{
|
|
||||||
local_sccp_addr.presence = OSMO_SCCP_ADDR_T_PC | OSMO_SCCP_ADDR_T_SSN;
|
|
||||||
local_sccp_addr.ri = OSMO_SCCP_RI_SSN_PC;
|
|
||||||
local_sccp_addr.pc = osmo_ss7_pointcode_parse(NULL, argv[0]);
|
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO: GT address configuration, in line with 4.5.1.1.1 of TS 25.410 */
|
|
||||||
|
|
||||||
int iu_vty_config_write(struct vty *vty, const char *indent)
|
|
||||||
{
|
|
||||||
if (!g_rab_assign_addr_enc) {
|
|
||||||
vty_out(vty, "%%RAB Assignment Transport Layer Address"
|
|
||||||
" encoding not available%s", VTY_NEWLINE);
|
|
||||||
return CMD_WARNING;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (*g_rab_assign_addr_enc) {
|
|
||||||
case NSAP_ADDR_ENC_V4RAW:
|
|
||||||
vty_out(vty, "%siu rab-assign-addr-enc v4raw%s", indent,
|
|
||||||
VTY_NEWLINE);
|
|
||||||
break;
|
|
||||||
case NSAP_ADDR_ENC_X213:
|
|
||||||
/* default value, no need to write anything */
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
LOGP(0, LOGL_ERROR, "Invalid value for"
|
|
||||||
" net.iu.rab_assign_addr_enc: %d\n",
|
|
||||||
*g_rab_assign_addr_enc);
|
|
||||||
return CMD_WARNING;
|
|
||||||
}
|
|
||||||
|
|
||||||
vty_out(vty, "%siu local-address point-code %s%s", indent,
|
|
||||||
osmo_ss7_pointcode_print(NULL, local_sccp_addr.pc), VTY_NEWLINE);
|
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
void iu_vty_init(int iu_parent_node, enum nsap_addr_enc *rab_assign_addr_enc)
|
|
||||||
{
|
|
||||||
g_rab_assign_addr_enc = rab_assign_addr_enc;
|
|
||||||
|
|
||||||
install_element(CFG_LOG_NODE, &logging_asn_debug_cmd);
|
|
||||||
install_element(CFG_LOG_NODE, &logging_asn_xer_print_cmd);
|
|
||||||
install_element(iu_parent_node, &cfg_iu_rab_assign_addr_enc_cmd);
|
|
||||||
install_element(iu_parent_node, &cfg_iu_local_addr_pc_cmd);
|
|
||||||
}
|
|
|
@ -35,8 +35,6 @@ libmsc_a_SOURCES = \
|
||||||
gsm_04_14.c \
|
gsm_04_14.c \
|
||||||
gsm_04_80.c \
|
gsm_04_80.c \
|
||||||
gsm_subscriber.c \
|
gsm_subscriber.c \
|
||||||
iucs.c \
|
|
||||||
iucs_ranap.c \
|
|
||||||
mncc.c \
|
mncc.c \
|
||||||
mncc_builtin.c \
|
mncc_builtin.c \
|
||||||
mncc_sock.c \
|
mncc_sock.c \
|
||||||
|
@ -52,7 +50,12 @@ libmsc_a_SOURCES = \
|
||||||
meas_feed.c \
|
meas_feed.c \
|
||||||
subscr_conn.c \
|
subscr_conn.c \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
if !BUILD_IU
|
if BUILD_IU
|
||||||
|
libmsc_a_SOURCES += \
|
||||||
|
iucs.c \
|
||||||
|
iucs_ranap.c \
|
||||||
|
$(NULL)
|
||||||
|
else
|
||||||
libmsc_a_SOURCES += \
|
libmsc_a_SOURCES += \
|
||||||
iu_dummy.c \
|
iu_dummy.c \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
#include <openbsc/gsm_data.h>
|
#include <openbsc/gsm_data.h>
|
||||||
#include <openbsc/a_iface_bssap.h>
|
#include <openbsc/a_iface_bssap.h>
|
||||||
#include <openbsc/a_iface.h>
|
#include <openbsc/a_iface.h>
|
||||||
#include <openbsc/iu.h>
|
|
||||||
#include <openbsc/osmo_msc.h>
|
#include <openbsc/osmo_msc.h>
|
||||||
#include <osmocom/core/byteswap.h>
|
#include <osmocom/core/byteswap.h>
|
||||||
#include <openbsc/a_reset.h>
|
#include <openbsc/a_reset.h>
|
||||||
|
|
|
@ -72,13 +72,11 @@
|
||||||
#include <osmocom/core/utils.h>
|
#include <osmocom/core/utils.h>
|
||||||
#include <osmocom/gsm/tlv.h>
|
#include <osmocom/gsm/tlv.h>
|
||||||
#include <osmocom/crypt/auth.h>
|
#include <osmocom/crypt/auth.h>
|
||||||
|
|
||||||
#include <openbsc/msc_ifaces.h>
|
|
||||||
|
|
||||||
#ifdef BUILD_IU
|
#ifdef BUILD_IU
|
||||||
#include <openbsc/iu.h>
|
#include <osmocom/ranap/iu_client.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <openbsc/msc_ifaces.h>
|
||||||
#include <openbsc/a_iface.h>
|
#include <openbsc/a_iface.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -3412,7 +3410,7 @@ static int msc_vlr_set_ciph_mode(void *msc_conn_ref,
|
||||||
#ifdef BUILD_IU
|
#ifdef BUILD_IU
|
||||||
DEBUGP(DMM, "-> SECURITY MODE CONTROL %s\n",
|
DEBUGP(DMM, "-> SECURITY MODE CONTROL %s\n",
|
||||||
vlr_subscr_name(conn->vsub));
|
vlr_subscr_name(conn->vsub));
|
||||||
return iu_tx_sec_mode_cmd(conn->iu.ue_ctx, tuple, 0, 1);
|
return ranap_iu_tx_sec_mode_cmd(conn->iu.ue_ctx, &tuple->vec, 0, 1);
|
||||||
#else
|
#else
|
||||||
LOGP(DMM, LOGL_ERROR, "Cannot send Security Mode Control over RAN_UTRAN_IU,"
|
LOGP(DMM, LOGL_ERROR, "Cannot send Security Mode Control over RAN_UTRAN_IU,"
|
||||||
" built without Iu support\n");
|
" built without Iu support\n");
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "../../bscconfig.h"
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -32,6 +34,12 @@
|
||||||
|
|
||||||
#include <osmocom/vty/vty.h>
|
#include <osmocom/vty/vty.h>
|
||||||
|
|
||||||
|
#ifdef BUILD_IU
|
||||||
|
#include <osmocom/ranap/iu_client.h>
|
||||||
|
#else
|
||||||
|
#include <openbsc/iu_dummy.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <openbsc/gsm_subscriber.h>
|
#include <openbsc/gsm_subscriber.h>
|
||||||
#include <openbsc/gsm_04_08.h>
|
#include <openbsc/gsm_04_08.h>
|
||||||
#include <openbsc/debug.h>
|
#include <openbsc/debug.h>
|
||||||
|
@ -40,7 +48,6 @@
|
||||||
#include <openbsc/db.h>
|
#include <openbsc/db.h>
|
||||||
#include <openbsc/chan_alloc.h>
|
#include <openbsc/chan_alloc.h>
|
||||||
#include <openbsc/vlr.h>
|
#include <openbsc/vlr.h>
|
||||||
#include <openbsc/iu.h>
|
|
||||||
#include <openbsc/osmo_msc.h>
|
#include <openbsc/osmo_msc.h>
|
||||||
#include <openbsc/msc_ifaces.h>
|
#include <openbsc/msc_ifaces.h>
|
||||||
#include <openbsc/a_iface.h>
|
#include <openbsc/a_iface.h>
|
||||||
|
@ -108,10 +115,10 @@ int msc_paging_request(struct vlr_subscr *vsub)
|
||||||
case RAN_GERAN_A:
|
case RAN_GERAN_A:
|
||||||
return a_iface_tx_paging(vsub->imsi, vsub->tmsi, vsub->lac);
|
return a_iface_tx_paging(vsub->imsi, vsub->tmsi, vsub->lac);
|
||||||
case RAN_UTRAN_IU:
|
case RAN_UTRAN_IU:
|
||||||
return iu_page_cs(vsub->imsi,
|
return ranap_iu_page_cs(vsub->imsi,
|
||||||
vsub->tmsi == GSM_RESERVED_TMSI?
|
vsub->tmsi == GSM_RESERVED_TMSI?
|
||||||
NULL : &vsub->tmsi,
|
NULL : &vsub->tmsi,
|
||||||
vsub->lac);
|
vsub->lac);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,39 +26,39 @@
|
||||||
#include "../../bscconfig.h"
|
#include "../../bscconfig.h"
|
||||||
#ifndef BUILD_IU
|
#ifndef BUILD_IU
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <openbsc/iu_dummy.h>
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include <osmocom/core/logging.h>
|
#include <osmocom/core/logging.h>
|
||||||
#include <osmocom/vty/logging.h>
|
#include <osmocom/vty/logging.h>
|
||||||
#include <osmocom/core/msgb.h>
|
#include <osmocom/core/msgb.h>
|
||||||
|
|
||||||
struct msgb;
|
struct msgb;
|
||||||
struct ue_conn_ctx;
|
struct ranap_ue_conn_ctx;
|
||||||
struct gsm_auth_tuple;
|
struct gsm_auth_tuple;
|
||||||
struct RANAP_Cause;
|
struct RANAP_Cause;
|
||||||
|
struct osmo_auth_vector;
|
||||||
|
|
||||||
int iu_tx(struct msgb *msg, uint8_t sapi)
|
int ranap_iu_tx(struct msgb *msg, uint8_t sapi)
|
||||||
{
|
{
|
||||||
LOGP(DLGLOBAL, LOGL_INFO, "iu_tx() dummy called, NOT transmitting %d bytes: %s\n",
|
LOGP(DLGLOBAL, LOGL_INFO, "iu_tx() dummy called, NOT transmitting %d bytes: %s\n",
|
||||||
msg->len, osmo_hexdump(msg->data, msg->len));
|
msg->len, osmo_hexdump(msg->data, msg->len));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int iu_tx_sec_mode_cmd(struct ue_conn_ctx *uectx, struct gsm_auth_tuple *tp,
|
int ranap_iu_tx_sec_mode_cmd(struct ranap_ue_conn_ctx *uectx, struct osmo_auth_vector *vec,
|
||||||
int send_ck)
|
int send_ck)
|
||||||
{
|
{
|
||||||
LOGP(DLGLOBAL, LOGL_INFO, "iu_tx_sec_mode_cmd() dummy called, NOT transmitting Security Mode Command\n");
|
LOGP(DLGLOBAL, LOGL_INFO, "iu_tx_sec_mode_cmd() dummy called, NOT transmitting Security Mode Command\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int iu_page_cs(const char *imsi, const uint32_t *tmsi, uint16_t lac)
|
int ranap_iu_page_cs(const char *imsi, const uint32_t *tmsi, uint16_t lac)
|
||||||
{
|
{
|
||||||
LOGP(DLGLOBAL, LOGL_INFO, "iu_page_cs() dummy called, NOT paging\n");
|
LOGP(DLGLOBAL, LOGL_INFO, "iu_page_cs() dummy called, NOT paging\n");
|
||||||
return 23;
|
return 23;
|
||||||
}
|
}
|
||||||
|
|
||||||
int iu_page_ps(const char *imsi, const uint32_t *ptmsi, uint16_t lac, uint8_t rac)
|
int ranap_iu_page_ps(const char *imsi, const uint32_t *ptmsi, uint16_t lac, uint8_t rac)
|
||||||
{
|
{
|
||||||
LOGP(DLGLOBAL, LOGL_INFO, "iu_page_ps() dummy called, NOT paging\n");
|
LOGP(DLGLOBAL, LOGL_INFO, "iu_page_ps() dummy called, NOT paging\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -72,19 +72,19 @@ struct msgb *ranap_new_msg_rab_assign_voice(uint8_t rab_id, uint32_t rtp_ip,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int iu_rab_act(struct ue_conn_ctx *ue_ctx, struct msgb *msg)
|
int ranap_iu_rab_act(struct ranap_ue_conn_ctx *ue_ctx, struct msgb *msg)
|
||||||
{
|
{
|
||||||
LOGP(DLGLOBAL, LOGL_INFO, "iu_rab_act() dummy called, NOT activating RAB\n");
|
LOGP(DLGLOBAL, LOGL_INFO, "iu_rab_act() dummy called, NOT activating RAB\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int iu_tx_common_id(struct ue_conn_ctx *uectx, const char *imsi)
|
int ranap_iu_tx_common_id(struct ranap_ue_conn_ctx *uectx, const char *imsi)
|
||||||
{
|
{
|
||||||
LOGP(DLGLOBAL, LOGL_INFO, "iu_tx_common_id() dummy called, NOT sending CommonID\n");
|
LOGP(DLGLOBAL, LOGL_INFO, "iu_tx_common_id() dummy called, NOT sending CommonID\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int iu_tx_release(struct ue_conn_ctx *ctx, const struct RANAP_Cause *cause)
|
int ranap_iu_tx_release(struct ranap_ue_conn_ctx *ctx, const struct RANAP_Cause *cause)
|
||||||
{
|
{
|
||||||
LOGP(DLGLOBAL, LOGL_INFO, "iu_tx_release() dummy called, NOT sending Release\n");
|
LOGP(DLGLOBAL, LOGL_INFO, "iu_tx_release() dummy called, NOT sending Release\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -25,17 +25,17 @@
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
#include <osmocom/core/logging.h>
|
#include <osmocom/core/logging.h>
|
||||||
|
#include <osmocom/ranap/iu_client.h>
|
||||||
#include <openbsc/debug.h>
|
#include <openbsc/debug.h>
|
||||||
|
|
||||||
#include <openbsc/gsm_data.h>
|
#include <openbsc/gsm_data.h>
|
||||||
#include <openbsc/iu.h>
|
|
||||||
#include <openbsc/gsm_subscriber.h>
|
#include <openbsc/gsm_subscriber.h>
|
||||||
#include <openbsc/osmo_msc.h>
|
#include <openbsc/osmo_msc.h>
|
||||||
#include <openbsc/vlr.h>
|
#include <openbsc/vlr.h>
|
||||||
|
|
||||||
/* For A-interface see libbsc/bsc_api.c subscr_con_allocate() */
|
/* For A-interface see libbsc/bsc_api.c subscr_con_allocate() */
|
||||||
static struct gsm_subscriber_connection *subscr_conn_allocate_iu(struct gsm_network *network,
|
static struct gsm_subscriber_connection *subscr_conn_allocate_iu(struct gsm_network *network,
|
||||||
struct ue_conn_ctx *ue,
|
struct ranap_ue_conn_ctx *ue,
|
||||||
uint16_t lac)
|
uint16_t lac)
|
||||||
{
|
{
|
||||||
struct gsm_subscriber_connection *conn;
|
struct gsm_subscriber_connection *conn;
|
||||||
|
@ -57,7 +57,7 @@ static struct gsm_subscriber_connection *subscr_conn_allocate_iu(struct gsm_netw
|
||||||
return conn;
|
return conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int same_ue_conn(struct ue_conn_ctx *a, struct ue_conn_ctx *b)
|
static int same_ue_conn(struct ranap_ue_conn_ctx *a, struct ranap_ue_conn_ctx *b)
|
||||||
{
|
{
|
||||||
if (a == b)
|
if (a == b)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -103,7 +103,7 @@ static inline void log_subscribers(struct gsm_network *network)
|
||||||
* connection IDs, or return NULL if not found. */
|
* connection IDs, or return NULL if not found. */
|
||||||
struct gsm_subscriber_connection *subscr_conn_lookup_iu(
|
struct gsm_subscriber_connection *subscr_conn_lookup_iu(
|
||||||
struct gsm_network *network,
|
struct gsm_network *network,
|
||||||
struct ue_conn_ctx *ue)
|
struct ranap_ue_conn_ctx *ue)
|
||||||
{
|
{
|
||||||
struct gsm_subscriber_connection *conn;
|
struct gsm_subscriber_connection *conn;
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ struct gsm_subscriber_connection *subscr_conn_lookup_iu(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Receive MM/CC/... message from IuCS (SCCP user SAP).
|
/* Receive MM/CC/... message from IuCS (SCCP user SAP).
|
||||||
* msg->dst must reference a struct ue_conn_ctx, which identifies the peer that
|
* msg->dst must reference a struct ranap_ue_conn_ctx, which identifies the peer that
|
||||||
* sent the msg.
|
* sent the msg.
|
||||||
*
|
*
|
||||||
* For A-interface see libbsc/bsc_api.c gsm0408_rcvmsg(). */
|
* For A-interface see libbsc/bsc_api.c gsm0408_rcvmsg(). */
|
||||||
|
@ -134,10 +134,10 @@ int gsm0408_rcvmsg_iucs(struct gsm_network *network, struct msgb *msg,
|
||||||
uint16_t *lac)
|
uint16_t *lac)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct ue_conn_ctx *ue_ctx;
|
struct ranap_ue_conn_ctx *ue_ctx;
|
||||||
struct gsm_subscriber_connection *conn;
|
struct gsm_subscriber_connection *conn;
|
||||||
|
|
||||||
ue_ctx = (struct ue_conn_ctx*)msg->dst;
|
ue_ctx = (struct ranap_ue_conn_ctx*)msg->dst;
|
||||||
|
|
||||||
/* TODO: are there message types that could allow us to skip this
|
/* TODO: are there message types that could allow us to skip this
|
||||||
* search? */
|
* search? */
|
||||||
|
|
|
@ -27,11 +27,11 @@
|
||||||
#include <osmocom/core/logging.h>
|
#include <osmocom/core/logging.h>
|
||||||
|
|
||||||
#include <osmocom/ranap/ranap_ies_defs.h>
|
#include <osmocom/ranap/ranap_ies_defs.h>
|
||||||
|
#include <osmocom/ranap/iu_client.h>
|
||||||
|
|
||||||
#include <openbsc/debug.h>
|
#include <openbsc/debug.h>
|
||||||
#include <openbsc/gsm_data.h>
|
#include <openbsc/gsm_data.h>
|
||||||
#include <openbsc/gsm_subscriber.h>
|
#include <openbsc/gsm_subscriber.h>
|
||||||
#include <openbsc/iu.h>
|
|
||||||
#include <openbsc/iucs.h>
|
#include <openbsc/iucs.h>
|
||||||
#include <openbsc/vlr.h>
|
#include <openbsc/vlr.h>
|
||||||
#include <openbsc/iucs_ranap.h>
|
#include <openbsc/iucs_ranap.h>
|
||||||
|
@ -67,7 +67,7 @@ int iucs_rx_sec_mode_compl(struct gsm_subscriber_connection *conn,
|
||||||
}
|
}
|
||||||
|
|
||||||
int iucs_rx_ranap_event(struct gsm_network *network,
|
int iucs_rx_ranap_event(struct gsm_network *network,
|
||||||
struct ue_conn_ctx *ue_ctx, int type, void *data)
|
struct ranap_ue_conn_ctx *ue_ctx, int type, void *data)
|
||||||
{
|
{
|
||||||
struct gsm_subscriber_connection *conn;
|
struct gsm_subscriber_connection *conn;
|
||||||
|
|
||||||
|
@ -79,19 +79,19 @@ int iucs_rx_ranap_event(struct gsm_network *network,
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case IU_EVENT_IU_RELEASE:
|
case RANAP_IU_EVENT_IU_RELEASE:
|
||||||
case IU_EVENT_LINK_INVALIDATED:
|
case RANAP_IU_EVENT_LINK_INVALIDATED:
|
||||||
LOGP(DIUCS, LOGL_INFO, "IuCS release for %s\n",
|
LOGP(DIUCS, LOGL_INFO, "IuCS release for %s\n",
|
||||||
vlr_subscr_name(conn->vsub));
|
vlr_subscr_name(conn->vsub));
|
||||||
msc_subscr_conn_close(conn, 0);
|
msc_subscr_conn_close(conn, 0);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case IU_EVENT_SECURITY_MODE_COMPLETE:
|
case RANAP_IU_EVENT_SECURITY_MODE_COMPLETE:
|
||||||
LOGP(DIUCS, LOGL_INFO, "IuCS security mode complete for %s\n",
|
LOGP(DIUCS, LOGL_INFO, "IuCS security mode complete for %s\n",
|
||||||
vlr_subscr_name(conn->vsub));
|
vlr_subscr_name(conn->vsub));
|
||||||
return iucs_rx_sec_mode_compl(conn,
|
return iucs_rx_sec_mode_compl(conn,
|
||||||
(RANAP_SecurityModeCompleteIEs_t*)data);
|
(RANAP_SecurityModeCompleteIEs_t*)data);
|
||||||
case IU_EVENT_RAB_ASSIGN:
|
case RANAP_IU_EVENT_RAB_ASSIGN:
|
||||||
return iucs_rx_rab_assign(conn,
|
return iucs_rx_rab_assign(conn,
|
||||||
(RANAP_RAB_SetupOrModifiedItemIEs_t*)data);
|
(RANAP_RAB_SetupOrModifiedItemIEs_t*)data);
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <openbsc/debug.h>
|
#include <openbsc/debug.h>
|
||||||
#include <openbsc/gsm_data.h>
|
#include <openbsc/gsm_data.h>
|
||||||
#include <openbsc/msc_ifaces.h>
|
#include <openbsc/msc_ifaces.h>
|
||||||
#include <openbsc/iu.h>
|
|
||||||
#include <openbsc/gsm_subscriber.h>
|
#include <openbsc/gsm_subscriber.h>
|
||||||
#include <openbsc/transaction.h>
|
#include <openbsc/transaction.h>
|
||||||
#include <openbsc/mgcp.h>
|
#include <openbsc/mgcp.h>
|
||||||
|
@ -34,10 +33,13 @@
|
||||||
#include "../../bscconfig.h"
|
#include "../../bscconfig.h"
|
||||||
|
|
||||||
#ifdef BUILD_IU
|
#ifdef BUILD_IU
|
||||||
|
#include <osmocom/ranap/iu_client.h>
|
||||||
extern struct msgb *ranap_new_msg_rab_assign_voice(uint8_t rab_id,
|
extern struct msgb *ranap_new_msg_rab_assign_voice(uint8_t rab_id,
|
||||||
uint32_t rtp_ip,
|
uint32_t rtp_ip,
|
||||||
uint16_t rtp_port,
|
uint16_t rtp_port,
|
||||||
bool use_x213_nsap);
|
bool use_x213_nsap);
|
||||||
|
#else
|
||||||
|
#include <openbsc/iu_dummy.h>
|
||||||
#endif /* BUILD_IU */
|
#endif /* BUILD_IU */
|
||||||
|
|
||||||
static int msc_tx(struct gsm_subscriber_connection *conn, struct msgb *msg)
|
static int msc_tx(struct gsm_subscriber_connection *conn, struct msgb *msg)
|
||||||
|
@ -57,7 +59,7 @@ static int msc_tx(struct gsm_subscriber_connection *conn, struct msgb *msg)
|
||||||
|
|
||||||
case RAN_UTRAN_IU:
|
case RAN_UTRAN_IU:
|
||||||
msg->dst = conn->iu.ue_ctx;
|
msg->dst = conn->iu.ue_ctx;
|
||||||
return iu_tx(msg, 0);
|
return ranap_iu_tx(msg, 0);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
LOGP(DMSC, LOGL_ERROR,
|
LOGP(DMSC, LOGL_ERROR,
|
||||||
|
@ -134,10 +136,10 @@ int msc_tx_common_id(struct gsm_subscriber_connection *conn)
|
||||||
|
|
||||||
DEBUGP(DIUCS, "%s: tx CommonID %s\n",
|
DEBUGP(DIUCS, "%s: tx CommonID %s\n",
|
||||||
vlr_subscr_name(conn->vsub), conn->vsub->imsi);
|
vlr_subscr_name(conn->vsub), conn->vsub->imsi);
|
||||||
return iu_tx_common_id(conn->iu.ue_ctx, conn->vsub->imsi);
|
return ranap_iu_tx_common_id(conn->iu.ue_ctx, conn->vsub->imsi);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int iu_rab_act_cs(struct ue_conn_ctx *uectx, uint8_t rab_id,
|
static int iu_rab_act_cs(struct ranap_ue_conn_ctx *uectx, uint8_t rab_id,
|
||||||
uint32_t rtp_ip, uint16_t rtp_port)
|
uint32_t rtp_ip, uint16_t rtp_port)
|
||||||
{
|
{
|
||||||
#ifdef BUILD_IU
|
#ifdef BUILD_IU
|
||||||
|
@ -145,7 +147,7 @@ static int iu_rab_act_cs(struct ue_conn_ctx *uectx, uint8_t rab_id,
|
||||||
bool use_x213_nsap;
|
bool use_x213_nsap;
|
||||||
uint32_t conn_id = uectx->conn_id;
|
uint32_t conn_id = uectx->conn_id;
|
||||||
|
|
||||||
use_x213_nsap = (uectx->rab_assign_addr_enc == NSAP_ADDR_ENC_X213);
|
use_x213_nsap = (uectx->rab_assign_addr_enc == RANAP_NSAP_ADDR_ENC_X213);
|
||||||
|
|
||||||
LOGP(DIUCS, LOGL_DEBUG, "Assigning RAB: conn_id=%u, rab_id=%d,"
|
LOGP(DIUCS, LOGL_DEBUG, "Assigning RAB: conn_id=%u, rab_id=%d,"
|
||||||
" rtp=%x:%u, use_x213_nsap=%d\n", conn_id, rab_id, rtp_ip,
|
" rtp=%x:%u, use_x213_nsap=%d\n", conn_id, rab_id, rtp_ip,
|
||||||
|
@ -155,7 +157,7 @@ static int iu_rab_act_cs(struct ue_conn_ctx *uectx, uint8_t rab_id,
|
||||||
use_x213_nsap);
|
use_x213_nsap);
|
||||||
msg->l2h = msg->data;
|
msg->l2h = msg->data;
|
||||||
|
|
||||||
if (iu_rab_act(uectx, msg))
|
if (ranap_iu_rab_act(uectx, msg))
|
||||||
LOGP(DIUCS, LOGL_ERROR, "Failed to send RAB Assignment:"
|
LOGP(DIUCS, LOGL_ERROR, "Failed to send RAB Assignment:"
|
||||||
" conn_id=%d rab_id=%d rtp=%x:%u\n",
|
" conn_id=%d rab_id=%d rtp=%x:%u\n",
|
||||||
conn_id, rab_id, rtp_ip, rtp_port);
|
conn_id, rab_id, rtp_ip, rtp_port);
|
||||||
|
@ -170,7 +172,6 @@ static void mgcp_response_rab_act_cs_crcx(struct mgcp_response *r, void *priv)
|
||||||
{
|
{
|
||||||
struct gsm_trans *trans = priv;
|
struct gsm_trans *trans = priv;
|
||||||
struct gsm_subscriber_connection *conn = trans->conn;
|
struct gsm_subscriber_connection *conn = trans->conn;
|
||||||
struct ue_conn_ctx *uectx = conn->iu.ue_ctx;
|
|
||||||
uint32_t rtp_ip;
|
uint32_t rtp_ip;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
@ -195,7 +196,7 @@ static void mgcp_response_rab_act_cs_crcx(struct mgcp_response *r, void *priv)
|
||||||
|
|
||||||
if (trans->conn->via_ran == RAN_UTRAN_IU) {
|
if (trans->conn->via_ran == RAN_UTRAN_IU) {
|
||||||
/* Assign a voice channel via RANAP on 3G */
|
/* Assign a voice channel via RANAP on 3G */
|
||||||
if (iu_rab_act_cs(uectx, conn->iu.rab_id, rtp_ip, conn->rtp.port_subscr))
|
if (iu_rab_act_cs(conn->iu.ue_ctx, conn->iu.rab_id, rtp_ip, conn->rtp.port_subscr))
|
||||||
goto rab_act_cs_error;
|
goto rab_act_cs_error;
|
||||||
} else if (trans->conn->via_ran == RAN_GERAN_A) {
|
} else if (trans->conn->via_ran == RAN_GERAN_A) {
|
||||||
/* Assign a voice channel via A on 2G */
|
/* Assign a voice channel via A on 2G */
|
||||||
|
@ -234,7 +235,7 @@ int msc_call_assignment(struct gsm_trans *trans)
|
||||||
mgcp = conn->network->mgcpgw.client;
|
mgcp = conn->network->mgcpgw.client;
|
||||||
|
|
||||||
#ifdef BUILD_IU
|
#ifdef BUILD_IU
|
||||||
/* FIXME: HACK. where to scope the RAB Id? At the conn / subscriber / ue_conn_ctx? */
|
/* FIXME: HACK. where to scope the RAB Id? At the conn / subscriber / ranap_ue_conn_ctx? */
|
||||||
static uint8_t next_iu_rab_id = 1;
|
static uint8_t next_iu_rab_id = 1;
|
||||||
if (conn->via_ran == RAN_UTRAN_IU)
|
if (conn->via_ran == RAN_UTRAN_IU)
|
||||||
conn->iu.rab_id = next_iu_rab_id ++;
|
conn->iu.rab_id = next_iu_rab_id ++;
|
||||||
|
|
|
@ -23,15 +23,19 @@
|
||||||
/* NOTE: I would have liked to call this the MSC_NODE instead of the MSC_NODE,
|
/* NOTE: I would have liked to call this the MSC_NODE instead of the MSC_NODE,
|
||||||
* but MSC_NODE already exists to configure a remote MSC for osmo-bsc. */
|
* but MSC_NODE already exists to configure a remote MSC for osmo-bsc. */
|
||||||
|
|
||||||
|
#include "../../bscconfig.h"
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
#include <osmocom/vty/command.h>
|
#include <osmocom/vty/command.h>
|
||||||
|
#ifdef BUILD_IU
|
||||||
|
#include <osmocom/ranap/iu_client.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <openbsc/vty.h>
|
#include <openbsc/vty.h>
|
||||||
#include <openbsc/gsm_data.h>
|
#include <openbsc/gsm_data.h>
|
||||||
#include <openbsc/gsm_subscriber.h>
|
#include <openbsc/gsm_subscriber.h>
|
||||||
#include <openbsc/vlr.h>
|
#include <openbsc/vlr.h>
|
||||||
#include <openbsc/iu.h>
|
|
||||||
|
|
||||||
static struct cmd_node msc_node = {
|
static struct cmd_node msc_node = {
|
||||||
MSC_NODE,
|
MSC_NODE,
|
||||||
|
@ -99,7 +103,7 @@ static int config_write_msc(struct vty *vty)
|
||||||
|
|
||||||
mgcpgw_client_config_write(vty, " ");
|
mgcpgw_client_config_write(vty, " ");
|
||||||
#ifdef BUILD_IU
|
#ifdef BUILD_IU
|
||||||
iu_vty_config_write(vty, " ");
|
ranap_iu_vty_config_write(vty, " ");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
|
@ -153,6 +157,6 @@ void msc_vty_init(struct gsm_network *msc_network)
|
||||||
|
|
||||||
mgcpgw_client_vty_init(MSC_NODE, &msc_network->mgcpgw.conf);
|
mgcpgw_client_vty_init(MSC_NODE, &msc_network->mgcpgw.conf);
|
||||||
#ifdef BUILD_IU
|
#ifdef BUILD_IU
|
||||||
iu_vty_init(MSC_NODE, &msc_network->iu.rab_assign_addr_enc);
|
ranap_iu_vty_init(MSC_NODE, &msc_network->iu.rab_assign_addr_enc);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,11 +28,17 @@
|
||||||
#include <openbsc/db.h>
|
#include <openbsc/db.h>
|
||||||
#include <openbsc/vlr.h>
|
#include <openbsc/vlr.h>
|
||||||
#include <openbsc/osmo_msc.h>
|
#include <openbsc/osmo_msc.h>
|
||||||
#include <openbsc/iu.h>
|
|
||||||
#include <openbsc/a_iface.h>
|
#include <openbsc/a_iface.h>
|
||||||
|
|
||||||
#include <openbsc/gsm_04_11.h>
|
#include <openbsc/gsm_04_11.h>
|
||||||
|
|
||||||
|
#include "../../bscconfig.h"
|
||||||
|
#ifdef BUILD_IU
|
||||||
|
#include <osmocom/ranap/iu_client.h>
|
||||||
|
#else
|
||||||
|
#include <openbsc/iu_dummy.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Receive a SAPI-N-REJECT from BSC */
|
/* Receive a SAPI-N-REJECT from BSC */
|
||||||
void msc_sapi_n_reject(struct gsm_subscriber_connection *conn, int dlci)
|
void msc_sapi_n_reject(struct gsm_subscriber_connection *conn, int dlci)
|
||||||
{
|
{
|
||||||
|
@ -285,7 +291,7 @@ static void msc_subscr_conn_release_all(struct gsm_subscriber_connection *conn,
|
||||||
|
|
||||||
switch (conn->via_ran) {
|
switch (conn->via_ran) {
|
||||||
case RAN_UTRAN_IU:
|
case RAN_UTRAN_IU:
|
||||||
iu_tx_release(conn->iu.ue_ctx, NULL);
|
ranap_iu_tx_release(conn->iu.ue_ctx, NULL);
|
||||||
/* FIXME: keep the conn until the Iu Release Outcome is
|
/* FIXME: keep the conn until the Iu Release Outcome is
|
||||||
* received from the UE, or a timeout expires. For now, the log
|
* received from the UE, or a timeout expires. For now, the log
|
||||||
* says "unknown UE" for each release outcome. */
|
* says "unknown UE" for each release outcome. */
|
||||||
|
|
|
@ -30,10 +30,8 @@
|
||||||
#include <openbsc/debug.h>
|
#include <openbsc/debug.h>
|
||||||
#include <openbsc/transaction.h>
|
#include <openbsc/transaction.h>
|
||||||
#include <openbsc/signal.h>
|
#include <openbsc/signal.h>
|
||||||
#include <openbsc/iu.h>
|
|
||||||
#include <openbsc/a_iface.h>
|
#include <openbsc/a_iface.h>
|
||||||
|
|
||||||
|
|
||||||
#define SUBSCR_CONN_TIMEOUT 5 /* seconds */
|
#define SUBSCR_CONN_TIMEOUT 5 /* seconds */
|
||||||
|
|
||||||
static const struct value_string subscr_conn_fsm_event_names[] = {
|
static const struct value_string subscr_conn_fsm_event_names[] = {
|
||||||
|
|
|
@ -50,7 +50,6 @@ osmo_msc_LDADD = \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
if BUILD_IU
|
if BUILD_IU
|
||||||
osmo_msc_LDADD += \
|
osmo_msc_LDADD += \
|
||||||
$(top_builddir)/src/libiu/libiu.a \
|
|
||||||
$(LIBOSMORANAP_LIBS) \
|
$(LIBOSMORANAP_LIBS) \
|
||||||
$(LIBASN1C_LIBS) \
|
$(LIBASN1C_LIBS) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
|
@ -66,9 +66,11 @@
|
||||||
#include <osmocom/sigtran/osmo_ss7.h>
|
#include <osmocom/sigtran/osmo_ss7.h>
|
||||||
#include <openbsc/mgcpgw_client.h>
|
#include <openbsc/mgcpgw_client.h>
|
||||||
|
|
||||||
#include <openbsc/msc_ifaces.h>
|
#ifdef BUILD_IU
|
||||||
|
#include <osmocom/ranap/iu_client.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <openbsc/iu.h>
|
#include <openbsc/msc_ifaces.h>
|
||||||
#include <openbsc/iucs.h>
|
#include <openbsc/iucs.h>
|
||||||
#include <openbsc/iucs_ranap.h>
|
#include <openbsc/iucs_ranap.h>
|
||||||
#include <openbsc/a_iface.h>
|
#include <openbsc/a_iface.h>
|
||||||
|
@ -312,6 +314,7 @@ static struct vty_app_info msc_vty_info = {
|
||||||
.is_config_node = bsc_vty_is_config_node,
|
.is_config_node = bsc_vty_is_config_node,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef BUILD_IU
|
||||||
static int rcvmsg_iu_cs(struct msgb *msg, struct gprs_ra_id *ra_id, uint16_t *sai)
|
static int rcvmsg_iu_cs(struct msgb *msg, struct gprs_ra_id *ra_id, uint16_t *sai)
|
||||||
{
|
{
|
||||||
DEBUGP(DIUCS, "got IuCS message"
|
DEBUGP(DIUCS, "got IuCS message"
|
||||||
|
@ -326,14 +329,15 @@ static int rcvmsg_iu_cs(struct msgb *msg, struct gprs_ra_id *ra_id, uint16_t *sa
|
||||||
return gsm0408_rcvmsg_iucs(msc_network, msg, ra_id? &ra_id->lac : NULL);
|
return gsm0408_rcvmsg_iucs(msc_network, msg, ra_id? &ra_id->lac : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rx_iu_event(struct ue_conn_ctx *ctx, enum iu_event_type type,
|
static int rx_iu_event(struct ranap_ue_conn_ctx *ctx, enum ranap_iu_event_type type,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
DEBUGP(DIUCS, "got IuCS event %u: %s\n", type,
|
DEBUGP(DIUCS, "got IuCS event %u: %s\n", type,
|
||||||
iu_event_type_str(type));
|
ranap_iu_event_type_str(type));
|
||||||
|
|
||||||
return iucs_rx_ranap_event(msc_network, ctx, type, data);
|
return iucs_rx_ranap_event(msc_network, ctx, type, data);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#define DEFAULT_M3UA_REMOTE_IP "127.0.0.1"
|
#define DEFAULT_M3UA_REMOTE_IP "127.0.0.1"
|
||||||
#define DEFAULT_PC_A "0.23.1"
|
#define DEFAULT_PC_A "0.23.1"
|
||||||
|
@ -564,7 +568,7 @@ TODO: we probably want some of the _net_ ctrl commands from bsc_base_ctrl_cmds_i
|
||||||
|
|
||||||
#ifdef BUILD_IU
|
#ifdef BUILD_IU
|
||||||
/* Set up IuCS */
|
/* Set up IuCS */
|
||||||
iu_init(tall_msc_ctx, msc_network->iu.sccp, rcvmsg_iu_cs, rx_iu_event);
|
ranap_iu_init(tall_msc_ctx, DRANAP, "OsmoMSC-IuCS", msc_network->iu.sccp, rcvmsg_iu_cs, rx_iu_event);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Set up A interface */
|
/* Set up A interface */
|
||||||
|
|
|
@ -50,13 +50,6 @@ COMMON_LDADD = \
|
||||||
$(top_builddir)/src/libtrau/libtrau.a \
|
$(top_builddir)/src/libtrau/libtrau.a \
|
||||||
$(top_builddir)/src/libmgcp/libmgcp.a \
|
$(top_builddir)/src/libmgcp/libmgcp.a \
|
||||||
$(top_builddir)/src/libcommon/libcommon.a \
|
$(top_builddir)/src/libcommon/libcommon.a \
|
||||||
$(NULL)
|
|
||||||
if BUILD_IU
|
|
||||||
COMMON_LDADD += \
|
|
||||||
$(top_builddir)/src/libiu/libiu.a \
|
|
||||||
$(NULL)
|
|
||||||
endif
|
|
||||||
COMMON_LDADD += \
|
|
||||||
$(LIBSMPP34_LIBS) \
|
$(LIBSMPP34_LIBS) \
|
||||||
$(LIBOSMOCORE_LIBS) \
|
$(LIBOSMOCORE_LIBS) \
|
||||||
$(LIBOSMOGSM_LIBS) \
|
$(LIBOSMOGSM_LIBS) \
|
||||||
|
@ -76,10 +69,10 @@ COMMON_LDFLAGS = \
|
||||||
-Wl,--wrap=a_iface_tx_dtap \
|
-Wl,--wrap=a_iface_tx_dtap \
|
||||||
-Wl,--wrap=a_iface_tx_clear_cmd \
|
-Wl,--wrap=a_iface_tx_clear_cmd \
|
||||||
-Wl,--wrap=a_iface_tx_paging \
|
-Wl,--wrap=a_iface_tx_paging \
|
||||||
-Wl,--wrap=iu_tx \
|
-Wl,--wrap=ranap_iu_tx \
|
||||||
-Wl,--wrap=iu_tx_release \
|
-Wl,--wrap=ranap_iu_tx_release \
|
||||||
-Wl,--wrap=iu_tx_common_id \
|
-Wl,--wrap=ranap_iu_tx_common_id \
|
||||||
-Wl,--wrap=iu_page_cs \
|
-Wl,--wrap=ranap_iu_page_cs \
|
||||||
-Wl,--wrap=msc_stop_paging \
|
-Wl,--wrap=msc_stop_paging \
|
||||||
-Wl,--wrap=gsm340_gen_scts \
|
-Wl,--wrap=gsm340_gen_scts \
|
||||||
-Wl,--wrap=RAND_bytes \
|
-Wl,--wrap=RAND_bytes \
|
||||||
|
|
|
@ -34,8 +34,13 @@
|
||||||
#include <openbsc/gsm_04_11.h>
|
#include <openbsc/gsm_04_11.h>
|
||||||
#include <openbsc/bsc_subscriber.h>
|
#include <openbsc/bsc_subscriber.h>
|
||||||
#include <openbsc/debug.h>
|
#include <openbsc/debug.h>
|
||||||
#include <openbsc/iu.h>
|
|
||||||
|
#if BUILD_IU
|
||||||
#include <openbsc/iucs_ranap.h>
|
#include <openbsc/iucs_ranap.h>
|
||||||
|
#include <osmocom/ranap/iu_client.h>
|
||||||
|
#else
|
||||||
|
#include <openbsc/iu_dummy.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "msc_vlr_tests.h"
|
#include "msc_vlr_tests.h"
|
||||||
|
|
||||||
|
@ -152,8 +157,8 @@ struct gsm_subscriber_connection *conn_new(void)
|
||||||
conn->bts = the_bts;
|
conn->bts = the_bts;
|
||||||
conn->via_ran = rx_from_ran;
|
conn->via_ran = rx_from_ran;
|
||||||
if (conn->via_ran == RAN_UTRAN_IU) {
|
if (conn->via_ran == RAN_UTRAN_IU) {
|
||||||
struct ue_conn_ctx *ue_ctx = talloc_zero(conn, struct ue_conn_ctx);
|
struct ranap_ue_conn_ctx *ue_ctx = talloc_zero(conn, struct ranap_ue_conn_ctx);
|
||||||
*ue_ctx = (struct ue_conn_ctx){
|
*ue_ctx = (struct ranap_ue_conn_ctx){
|
||||||
.conn_id = 42,
|
.conn_id = 42,
|
||||||
};
|
};
|
||||||
conn->iu.ue_ctx = ue_ctx;
|
conn->iu.ue_ctx = ue_ctx;
|
||||||
|
@ -295,9 +300,9 @@ int _paging_sent(enum ran_type via_ran, const char *imsi, uint32_t tmsi, uint32_
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* override, requires '-Wl,--wrap=iu_page_cs' */
|
/* override, requires '-Wl,--wrap=ranap_iu_page_cs' */
|
||||||
int __real_iu_page_cs(const char *imsi, const uint32_t *tmsi, uint16_t lac);
|
int __real_ranap_iu_page_cs(const char *imsi, const uint32_t *tmsi, uint16_t lac);
|
||||||
int __wrap_iu_page_cs(const char *imsi, const uint32_t *tmsi, uint16_t lac)
|
int __wrap_ranap_iu_page_cs(const char *imsi, const uint32_t *tmsi, uint16_t lac)
|
||||||
{
|
{
|
||||||
return _paging_sent(RAN_UTRAN_IU, imsi, tmsi ? *tmsi : GSM_RESERVED_TMSI, lac);
|
return _paging_sent(RAN_UTRAN_IU, imsi, tmsi ? *tmsi : GSM_RESERVED_TMSI, lac);
|
||||||
}
|
}
|
||||||
|
@ -472,16 +477,16 @@ int _validate_dtap(struct msgb *msg, enum ran_type to_ran)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* override, requires '-Wl,--wrap=iu_tx' */
|
/* override, requires '-Wl,--wrap=ranap_iu_tx' */
|
||||||
int __real_iu_tx(struct msgb *msg, uint8_t sapi);
|
int __real_ranap_iu_tx(struct msgb *msg, uint8_t sapi);
|
||||||
int __wrap_iu_tx(struct msgb *msg, uint8_t sapi)
|
int __wrap_ranap_iu_tx(struct msgb *msg, uint8_t sapi)
|
||||||
{
|
{
|
||||||
return _validate_dtap(msg, RAN_UTRAN_IU);
|
return _validate_dtap(msg, RAN_UTRAN_IU);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* override, requires '-Wl,--wrap=iu_tx_release' */
|
/* override, requires '-Wl,--wrap=ranap_iu_tx_release' */
|
||||||
int __real_iu_tx_release(struct ue_conn_ctx *ctx, const struct RANAP_Cause *cause);
|
int __real_ranap_iu_tx_release(struct ranap_ue_conn_ctx *ctx, const struct RANAP_Cause *cause);
|
||||||
int __wrap_iu_tx_release(struct ue_conn_ctx *ctx, const struct RANAP_Cause *cause)
|
int __wrap_ranap_iu_tx_release(struct ranap_ue_conn_ctx *ctx, const struct RANAP_Cause *cause)
|
||||||
{
|
{
|
||||||
btw("Iu Release --%s--> MS", ran_type_name(RAN_UTRAN_IU));
|
btw("Iu Release --%s--> MS", ran_type_name(RAN_UTRAN_IU));
|
||||||
OSMO_ASSERT(iu_release_expected);
|
OSMO_ASSERT(iu_release_expected);
|
||||||
|
@ -491,8 +496,8 @@ int __wrap_iu_tx_release(struct ue_conn_ctx *ctx, const struct RANAP_Cause *caus
|
||||||
}
|
}
|
||||||
|
|
||||||
/* override, requires '-Wl,--wrap=iu_tx_common_id' */
|
/* override, requires '-Wl,--wrap=iu_tx_common_id' */
|
||||||
int __real_iu_tx_common_id(struct ue_conn_ctx *ue_ctx, const char *imsi);
|
int __real_ranap_iu_tx_common_id(struct ranap_ue_conn_ctx *ue_ctx, const char *imsi);
|
||||||
int __wrap_iu_tx_common_id(struct ue_conn_ctx *ue_ctx, const char *imsi)
|
int __wrap_ranap_iu_tx_common_id(struct ranap_ue_conn_ctx *ue_ctx, const char *imsi)
|
||||||
{
|
{
|
||||||
btw("Iu Common ID --%s--> MS (IMSI=%s)", ran_type_name(RAN_UTRAN_IU), imsi);
|
btw("Iu Common ID --%s--> MS (IMSI=%s)", ran_type_name(RAN_UTRAN_IU), imsi);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -74,7 +74,6 @@ sgsn_test_LDADD = \
|
||||||
|
|
||||||
if BUILD_IU
|
if BUILD_IU
|
||||||
sgsn_test_LDADD += \
|
sgsn_test_LDADD += \
|
||||||
$(top_builddir)/src/libiu/libiu.a \
|
|
||||||
$(LIBOSMORANAP_LIBS) \
|
$(LIBOSMORANAP_LIBS) \
|
||||||
$(LIBOSMOSIGTRAN_LIBS) \
|
$(LIBOSMOSIGTRAN_LIBS) \
|
||||||
$(LIBASN1C_LIBS) \
|
$(LIBASN1C_LIBS) \
|
||||||
|
|
|
@ -37,13 +37,6 @@ sms_queue_test_LDADD = \
|
||||||
$(top_builddir)/src/libmgcp/libmgcp.a \
|
$(top_builddir)/src/libmgcp/libmgcp.a \
|
||||||
$(top_builddir)/src/libcommon/libcommon.a \
|
$(top_builddir)/src/libcommon/libcommon.a \
|
||||||
$(top_builddir)/src/libcommon-cs/libcommon-cs.a \
|
$(top_builddir)/src/libcommon-cs/libcommon-cs.a \
|
||||||
$(NULL)
|
|
||||||
if BUILD_IU
|
|
||||||
sms_queue_test_LDADD += \
|
|
||||||
$(top_builddir)/src/libiu/libiu.a \
|
|
||||||
$(NULL)
|
|
||||||
endif
|
|
||||||
sms_queue_test_LDADD += \
|
|
||||||
$(LIBSMPP34_LIBS) \
|
$(LIBSMPP34_LIBS) \
|
||||||
$(LIBOSMOCORE_LIBS) \
|
$(LIBOSMOCORE_LIBS) \
|
||||||
$(LIBOSMOGSM_LIBS) \
|
$(LIBOSMOGSM_LIBS) \
|
||||||
|
|
Loading…
Reference in New Issue