aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-10-12 02:55:31 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-03-16 15:32:32 +0100
commit1ad6a2e515bbc3a73a283eb104feb899086a24a3 (patch)
tree7c91bf3c846174d2107fb9cbfb7096ec2273806b
parent7cb4778a1c02cbdd25beba45b049e217939c6c08 (diff)
IuCS, IuPS: move flag to use X.213 NSAP addr into ue_conn_ctx
The future perspective is to remember the preferred RAB Transport Layer Address encoding for each 3G cell that is connected, so store per UE conn instead of globally hardcoding. Add rab_assign_addr_enc member to ue_conn_ctx. Thus the iu_rab_act_cs() and iu_rab_act_ps() functions no longer need the explicit use_x213_nsap argument. Add include/openbsc/common.h in order to define the enum nsap_addr_enc, in a separate file to be able to easily include it in all of libmsc, libiu and gprs/* without creating include cycles. Set the rab_assign_addr_enc when an MM ctx is created for iu, and whenever the ue_conn_ctx for an Iu MM ctx is updated. This looks a bit clumsy so far, the hope is that there will be a nice way to setup the ue_conn_ctx prior to that. Change-Id: I49bb5736df7bdfdd55d3e7b74ee559595cfd2f7d
-rw-r--r--openbsc/include/openbsc/Makefile.am1
-rw-r--r--openbsc/include/openbsc/common.h6
-rw-r--r--openbsc/include/openbsc/gprs_gmm.h2
-rw-r--r--openbsc/include/openbsc/iu.h1
-rw-r--r--openbsc/src/gprs/gprs_gmm.c6
-rw-r--r--openbsc/src/gprs/sgsn_libgtp.c2
-rw-r--r--openbsc/src/libmsc/msc_ifaces.c8
7 files changed, 19 insertions, 7 deletions
diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am
index 2ba03a3b2..704696659 100644
--- a/openbsc/include/openbsc/Makefile.am
+++ b/openbsc/include/openbsc/Makefile.am
@@ -14,6 +14,7 @@ noinst_HEADERS = \
bss.h \
bts_ipaccess_nanobts_omlattr.h \
chan_alloc.h \
+ common.h \
common_bsc.h \
common_cs.h \
crc24.h \
diff --git a/openbsc/include/openbsc/common.h b/openbsc/include/openbsc/common.h
new file mode 100644
index 000000000..d91b3d39e
--- /dev/null
+++ b/openbsc/include/openbsc/common.h
@@ -0,0 +1,6 @@
+#pragma once
+
+enum nsap_addr_enc {
+ NSAP_ADDR_ENC_X213,
+ NSAP_ADDR_ENC_V4RAW,
+};
diff --git a/openbsc/include/openbsc/gprs_gmm.h b/openbsc/include/openbsc/gprs_gmm.h
index d210a3547..c38e49f0d 100644
--- a/openbsc/include/openbsc/gprs_gmm.h
+++ b/openbsc/include/openbsc/gprs_gmm.h
@@ -30,6 +30,6 @@ int gprs_gmm_rx_resume(struct gprs_ra_id *raid, uint32_t tlli,
time_t gprs_max_time_to_idle(void);
-int iu_rab_act_ps(uint8_t rab_id, struct sgsn_pdp_ctx *pdp, bool use_x213_nsap);
+int iu_rab_act_ps(uint8_t rab_id, struct sgsn_pdp_ctx *pdp);
#endif /* _GPRS_GMM_H */
diff --git a/openbsc/include/openbsc/iu.h b/openbsc/include/openbsc/iu.h
index dd962bf9f..a82d53066 100644
--- a/openbsc/include/openbsc/iu.h
+++ b/openbsc/include/openbsc/iu.h
@@ -25,6 +25,7 @@ struct ue_conn_ctx {
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 {
diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c
index 5aa22dca5..cedd2da70 100644
--- a/openbsc/src/gprs/gprs_gmm.c
+++ b/openbsc/src/gprs/gprs_gmm.c
@@ -980,7 +980,7 @@ void activate_pdp_rabs(struct sgsn_mm_ctx *ctx)
if (ctx->ran_type != MM_CTX_T_UTRAN_Iu)
return;
llist_for_each_entry(pdp, &ctx->pdp_list, list) {
- iu_rab_act_ps(pdp->nsapi, pdp, 1);
+ iu_rab_act_ps(pdp->nsapi, pdp);
}
}
#endif
@@ -2928,14 +2928,16 @@ int gprs_gmm_rx_resume(struct gprs_ra_id *raid, uint32_t tlli,
}
#ifdef BUILD_IU
-int iu_rab_act_ps(uint8_t rab_id, struct sgsn_pdp_ctx *pdp, bool use_x213_nsap)
+int iu_rab_act_ps(uint8_t rab_id, struct sgsn_pdp_ctx *pdp)
{
struct msgb *msg;
struct sgsn_mm_ctx *mm = pdp->mm;
struct ue_conn_ctx *uectx;
uint32_t ggsn_ip;
+ bool use_x213_nsap;
uectx = mm->iu.ue_ctx;
+ use_x213_nsap = (uectx->rab_assign_addr_enc == NSAP_ADDR_ENC_X213);
/* Get the IP address for ggsn user plane */
memcpy(&ggsn_ip, pdp->lib->gsnru.v, pdp->lib->gsnru.l);
diff --git a/openbsc/src/gprs/sgsn_libgtp.c b/openbsc/src/gprs/sgsn_libgtp.c
index 2a863e0fc..0ffdd3bbd 100644
--- a/openbsc/src/gprs/sgsn_libgtp.c
+++ b/openbsc/src/gprs/sgsn_libgtp.c
@@ -407,7 +407,7 @@ static int create_pdp_conf(struct pdp_t *pdp, void *cbp, int cause)
} else if (pctx->mm->ran_type == MM_CTX_T_UTRAN_Iu) {
#ifdef BUILD_IU
/* Activate a radio bearer */
- iu_rab_act_ps(pdp->nsapi, pctx, 1);
+ iu_rab_act_ps(pdp->nsapi, pctx);
return 0;
#else
return -ENOTSUP;
diff --git a/openbsc/src/libmsc/msc_ifaces.c b/openbsc/src/libmsc/msc_ifaces.c
index 412177566..ea68af9cb 100644
--- a/openbsc/src/libmsc/msc_ifaces.c
+++ b/openbsc/src/libmsc/msc_ifaces.c
@@ -111,10 +111,12 @@ int msc_tx_common_id(struct gsm_subscriber_connection *conn)
#ifdef BUILD_IU
static int iu_rab_act_cs(struct ue_conn_ctx *uectx, uint8_t rab_id,
- uint32_t rtp_ip, uint16_t rtp_port,
- bool use_x213_nsap)
+ uint32_t rtp_ip, uint16_t rtp_port)
{
struct msgb *msg;
+ bool use_x213_nsap;
+
+ use_x213_nsap = (uectx->rab_assign_addr_enc == NSAP_ADDR_ENC_X213);
LOGP(DIUCS, LOGL_DEBUG, "Assigning RAB: rab_id=%d, rtp=%x:%u,"
" use_x213_nsap=%d\n", rab_id, rtp_ip, rtp_port, use_x213_nsap);
@@ -154,7 +156,7 @@ static int conn_iu_rab_act_cs(struct gsm_trans *trans)
mgcpgw_client_remote_addr_n(conn->network->mgcpgw.client);
return iu_rab_act_cs(uectx, conn->iu.rab_id, rtp_ip,
- conn->iu.mgcp_rtp_port_ue, 1);
+ conn->iu.mgcp_rtp_port_ue);
/* use_x213_nsap == 0 for ip.access nano3G */
}
#endif