IuPS: redirect Iu in various places, link Iu in sgsn-test
In gsm48_gmm_sendmsg(), redirect to iu_tx() for both cases of MM context present or not. In gsm48_rx_gmm_att_req(), compose an MM context marked as Iu for messages coming in from a ue_conn_ctx (passed in msg->dst). Also make sure cid is initialized to avoid introducing a compiler warning. In gsm48_rx_gmm_ra_upd_req(), look up an Iu MM context based on the presence of the ue_conn_ctx in msg->dst. In sgsn-test, add libiu and libasn1c, libosmo-sigtran, libosmo-ranap, which are now needed for an --enable-iu build. Change-Id: Ia47ffbfa6fa0f5a0cd76a379c57ef42faa0d80e3
This commit is contained in:
parent
6292c8d44d
commit
61329d45b8
|
@ -185,8 +185,21 @@ time_t gprs_max_time_to_idle(void)
|
|||
static int gsm48_gmm_sendmsg(struct msgb *msg, int command,
|
||||
struct sgsn_mm_ctx *mm, bool encryptable)
|
||||
{
|
||||
if (mm)
|
||||
if (mm) {
|
||||
rate_ctr_inc(&mm->ctrg->ctr[GMM_CTR_PKTS_SIG_OUT]);
|
||||
#ifdef BUILD_IU
|
||||
if (mm->ran_type == MM_CTX_T_UTRAN_Iu)
|
||||
return iu_tx(msg, GPRS_SAPI_GMM);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef BUILD_IU
|
||||
/* In Iu mode, msg->dst contains the ue_conn_ctx pointer, in Gb mode
|
||||
* dst is empty. */
|
||||
/* FIXME: have a more explicit indicator for Iu messages */
|
||||
if (msg->dst)
|
||||
return iu_tx(msg, GPRS_SAPI_GMM);
|
||||
#endif
|
||||
|
||||
/* caller needs to provide TLLI, BVCI and NSEI */
|
||||
return gprs_llc_tx_ui(msg, GPRS_SAPI_GMM, command, mm, encryptable);
|
||||
|
@ -907,7 +920,7 @@ static int gsm48_rx_gmm_att_req(struct sgsn_mm_ctx *ctx, struct msgb *msg,
|
|||
uint32_t tmsi;
|
||||
char mi_string[GSM48_MI_SIZE];
|
||||
struct gprs_ra_id ra_id;
|
||||
uint16_t cid;
|
||||
uint16_t cid = 0;
|
||||
enum gsm48_gmm_cause reject_cause;
|
||||
int rc;
|
||||
|
||||
|
@ -918,7 +931,13 @@ 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),
|
||||
* or with random TLLI. */
|
||||
|
||||
/* In Iu mode, msg->dst contains the ue_conn_ctx pointer, in Gb mode
|
||||
* dst is empty. */
|
||||
/* FIXME: have a more explicit indicator for Iu messages */
|
||||
if (!msg->dst) {
|
||||
/* Gb mode */
|
||||
cid = bssgp_parse_cell_id(&ra_id, msgb_bcid(msg));
|
||||
}
|
||||
|
||||
/* MS network capability 10.5.5.12 */
|
||||
msnc_len = *cur++;
|
||||
|
@ -972,6 +991,9 @@ static int gsm48_rx_gmm_att_req(struct sgsn_mm_ctx *ctx, struct msgb *msg,
|
|||
#if 0
|
||||
return gsm48_tx_gmm_att_rej(msg, GMM_CAUSE_IMSI_UNKNOWN);
|
||||
#else
|
||||
if (msg->dst)
|
||||
ctx = sgsn_mm_ctx_alloc_iu(msg->dst);
|
||||
else
|
||||
ctx = sgsn_mm_ctx_alloc(0, &ra_id);
|
||||
if (!ctx) {
|
||||
reject_cause = GMM_CAUSE_NET_FAIL;
|
||||
|
@ -995,6 +1017,9 @@ static int gsm48_rx_gmm_att_req(struct sgsn_mm_ctx *ctx, struct msgb *msg,
|
|||
if (!ctx) {
|
||||
/* Allocate a context as most of our code expects one.
|
||||
* Context will not have an IMSI ultil ID RESP is received */
|
||||
if (msg->dst)
|
||||
ctx = sgsn_mm_ctx_alloc_iu(msg->dst);
|
||||
else
|
||||
ctx = sgsn_mm_ctx_alloc(msgb_tlli(msg), &ra_id);
|
||||
ctx->p_tmsi = tmsi;
|
||||
}
|
||||
|
@ -1272,7 +1297,31 @@ 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)
|
||||
* below, which will cause a new attach cycle. */
|
||||
/* 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
|
||||
* mode dst is empty. */
|
||||
/* FIXME: have a more explicit indicator for Iu messages */
|
||||
if (!msg->dst) {
|
||||
mmctx = sgsn_mm_ctx_by_tlli_and_ptmsi(msgb_tlli(msg), &old_ra_id);
|
||||
} else if (TLVP_PRESENT(&tp, GSM48_IE_GMM_ALLOC_PTMSI)) {
|
||||
#ifdef BUILD_IU
|
||||
/* In Iu mode search only for ptmsi */
|
||||
char mi_string[GSM48_MI_SIZE];
|
||||
uint8_t mi_len = TLVP_LEN(&tp, GSM48_IE_GMM_ALLOC_PTMSI);
|
||||
uint8_t *mi = TLVP_VAL(&tp, GSM48_IE_GMM_ALLOC_PTMSI);
|
||||
uint8_t mi_type = *mi & GSM_MI_TYPE_MASK;
|
||||
uint32_t tmsi;
|
||||
|
||||
gsm48_mi_to_string(mi_string, sizeof(mi_string), mi, mi_len);
|
||||
|
||||
if (mi_type == GSM_MI_TYPE_TMSI) {
|
||||
memcpy(&tmsi, mi+1, 4);
|
||||
tmsi = ntohl(tmsi);
|
||||
mmctx = sgsn_mm_ctx_by_ptmsi(tmsi);
|
||||
}
|
||||
#else
|
||||
goto rejected;
|
||||
#endif
|
||||
}
|
||||
if (mmctx) {
|
||||
LOGMMCTXP(LOGL_INFO, mmctx,
|
||||
"Looked up by matching TLLI and P_TMSI. "
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include
|
||||
AM_CFLAGS=-Wall -ggdb3 $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBCARES_CFLAGS)
|
||||
if BUILD_IU
|
||||
AM_CFLAGS += $(LIBASN1C_CFLAGS) $(LIBOSMOSIGTRAN_CFLAGS) $(LIBOSMORANAP_CFLAGS)
|
||||
endif
|
||||
|
||||
EXTRA_DIST = sgsn_test.ok
|
||||
|
||||
|
@ -39,4 +42,11 @@ sgsn_test_LDADD = \
|
|||
$(LIBCARES_LIBS) \
|
||||
$(LIBCRYPTO_LIBS) \
|
||||
-lgtp -lrt
|
||||
if BUILD_IU
|
||||
sgsn_test_LDADD += \
|
||||
$(top_builddir)/src/libiu/libiu.a \
|
||||
$(LIBOSMORANAP_LIBS) \
|
||||
$(LIBOSMOSIGTRAN_LIBS) \
|
||||
$(LIBASN1C_LIBS)
|
||||
endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue