aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-10-12 01:39:25 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-02-23 20:28:56 +0100
commitc502611d537f87785e72b451104395e7da809d2d (patch)
treea1b9cba048da01522eaed159d65daacca19a37be /openbsc/src
parentdfcd63110a7fe2c7e3c3a08a296bf2e044631d2d (diff)
IuCS and IuPS: add VTY config for RAB Assignment address kind
To accomodate the ip.access nano3G without having to recompile, make the RAB Assignment's Transport Layer Address IE's format configurable, in both osmo-cscn and osmo-sgsn. The long term perspective is to somehow detect which address encoding a given 3G cell prefers, but for the time being just configure it globally and set each ue_conn_ctx to the global setting upon creation. Add VTY command to iu_vty.c, with args passed to iu_vty_init() to insert at an arbitrary VTY node, so that it can be used both for osmo-cscn and osmo-sgsn. Add generic iu_vty_config_write() to write out the config. Call iu_vty_init() from cscn_vty_init(); cscn_vty_init() is in libmsc, hence linking of osmo-cscn now needs libiu to come after libmsc, so move that further down. Change-Id: I93728314742b327336f3fb6de98e6457f687e1f9
Diffstat (limited to 'openbsc/src')
-rw-r--r--openbsc/src/gprs/gprs_gmm.c4
-rw-r--r--openbsc/src/gprs/gprs_sgsn.c1
-rw-r--r--openbsc/src/gprs/sgsn_vty.c10
-rw-r--r--openbsc/src/libiu/iu_vty.c55
-rw-r--r--openbsc/src/libmsc/cscn_vty.c5
-rw-r--r--openbsc/src/libmsc/iucs.c1
-rw-r--r--openbsc/src/osmo-cscn/Makefile.am2
7 files changed, 74 insertions, 4 deletions
diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c
index 41f6fd090..fd2e321a0 100644
--- a/openbsc/src/gprs/gprs_gmm.c
+++ b/openbsc/src/gprs/gprs_gmm.c
@@ -292,6 +292,10 @@ static void msgid2mmctx(struct sgsn_mm_ctx *mm, const struct msgb *msg)
mm->gb.nsei = msgb_nsei(msg);
/* In case a Iu connection is reconnected we need to update the ue ctx */
mm->iu.ue_ctx = msg->dst;
+ if (mm->ran_type == MM_CTX_T_UTRAN_Iu
+ && mm->iu.ue_ctx)
+ mm->iu.ue_ctx->rab_assign_addr_enc =
+ sgsn->cfg.iu.rab_assign_addr_enc;
}
/* Store BVCI/NSEI in MM context */
diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c
index 260e032a8..e5c4fefb2 100644
--- a/openbsc/src/gprs/gprs_sgsn.c
+++ b/openbsc/src/gprs/gprs_sgsn.c
@@ -247,6 +247,7 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_alloc_iu(void *uectx)
ctx->ran_type = MM_CTX_T_UTRAN_Iu;
ctx->iu.ue_ctx = uectx;
+ ctx->iu.ue_ctx->rab_assign_addr_enc = sgsn->cfg.iu.rab_assign_addr_enc;
ctx->iu.new_key = 1;
ctx->gmm_state = GMM_DEREGISTERED;
ctx->pmm_state = PMM_DETACHED;
diff --git a/openbsc/src/gprs/sgsn_vty.c b/openbsc/src/gprs/sgsn_vty.c
index d7fd388b0..f0d61884a 100644
--- a/openbsc/src/gprs/sgsn_vty.c
+++ b/openbsc/src/gprs/sgsn_vty.c
@@ -44,6 +44,12 @@
#include <pdp.h>
+#include "../../bscconfig.h"
+
+#ifdef BUILD_IU
+#include <openbsc/iu.h>
+#endif
+
static struct sgsn_config *g_cfg = NULL;
const struct value_string sgsn_auth_pol_strs[] = {
@@ -297,6 +303,8 @@ static int config_write_sgsn(struct vty *vty)
} else
vty_out(vty, " no compression v42bis%s", VTY_NEWLINE);
+ iu_vty_config_write(vty, " ");
+
return CMD_SUCCESS;
}
@@ -1288,7 +1296,7 @@ int sgsn_vty_init(struct sgsn_config *cfg)
install_element(SGSN_NODE, &cfg_comp_v42bisp_cmd);
#ifdef BUILD_IU
- iu_vty_init();
+ iu_vty_init(SGSN_NODE, &g_cfg->iu.rab_assign_addr_enc);
#endif
return 0;
}
diff --git a/openbsc/src/libiu/iu_vty.c b/openbsc/src/libiu/iu_vty.c
index cfa02ea6c..73ad126ba 100644
--- a/openbsc/src/libiu/iu_vty.c
+++ b/openbsc/src/libiu/iu_vty.c
@@ -18,12 +18,16 @@
*/
#include <stdlib.h>
+#include <string.h>
+#include <osmocom/core/logging.h>
#include <osmocom/vty/command.h>
#include <osmocom/vty/logging.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)",
@@ -48,8 +52,57 @@ DEFUN(logging_asn_xer_print,
return CMD_SUCCESS;
}
-void iu_vty_init(void)
+DEFUN(cfg_iu_rab_assign_addr_enc, cfg_iu_rab_assign_addr_enc_cmd,
+ "iu rab-assign-addr-enc (x213|v4raw)",
+ "Iu interface protocol options\n"
+ "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;
+}
+
+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;
+ }
+
+ 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);
}
diff --git a/openbsc/src/libmsc/cscn_vty.c b/openbsc/src/libmsc/cscn_vty.c
index 9b1def59f..9d6c137c2 100644
--- a/openbsc/src/libmsc/cscn_vty.c
+++ b/openbsc/src/libmsc/cscn_vty.c
@@ -26,10 +26,11 @@
#include <inttypes.h>
#include <osmocom/vty/command.h>
-#include <openbsc/vty.h>
+#include <openbsc/vty.h>
#include <openbsc/gsm_data.h>
#include <openbsc/gsm_subscriber.h>
+#include <openbsc/iu.h>
static struct cmd_node cscn_node = {
CSCN_NODE,
@@ -123,6 +124,7 @@ static int config_write_cscn(struct vty *vty)
gsmnet->avoid_tmsi ? "no " : "", VTY_NEWLINE);
mgcpgw_client_config_write(vty, " ");
+ iu_vty_config_write(vty, " ");
return CMD_SUCCESS;
}
@@ -175,4 +177,5 @@ void cscn_vty_init(struct gsm_network *cscn_network)
install_element(CSCN_NODE, &cfg_cscn_assign_tmsi_cmd);
install_element(CSCN_NODE, &cfg_cscn_no_assign_tmsi_cmd);
mgcpgw_client_vty_init(CSCN_NODE, &cscn_network->mgcpgw.conf);
+ iu_vty_init(CSCN_NODE, &cscn_network->iu.rab_assign_addr_enc);
}
diff --git a/openbsc/src/libmsc/iucs.c b/openbsc/src/libmsc/iucs.c
index 16a918b35..8393e1f4a 100644
--- a/openbsc/src/libmsc/iucs.c
+++ b/openbsc/src/libmsc/iucs.c
@@ -25,6 +25,7 @@ static struct gsm_subscriber_connection *subscr_conn_allocate_iu(struct gsm_netw
conn->network = network;
conn->via_iface = IFACE_IU;
conn->iu.ue_ctx = ue;
+ conn->iu.ue_ctx->rab_assign_addr_enc = network->iu.rab_assign_addr_enc;
conn->lac = lac;
llist_add_tail(&conn->entry, &network->subscr_conns);
diff --git a/openbsc/src/osmo-cscn/Makefile.am b/openbsc/src/osmo-cscn/Makefile.am
index ee4ac581c..3c2707ebb 100644
--- a/openbsc/src/osmo-cscn/Makefile.am
+++ b/openbsc/src/osmo-cscn/Makefile.am
@@ -37,9 +37,9 @@ osmo_cscn_SOURCES = \
$(NULL)
osmo_cscn_LDADD = \
- $(top_builddir)/src/libiu/libiu.a \
$(top_builddir)/src/libmsc/libmsc.a \
$(top_builddir)/src/libcommon-cs/libcommon-cs.a \
+ $(top_builddir)/src/libiu/libiu.a \
$(top_builddir)/src/libtrau/libtrau.a \
$(top_builddir)/src/libcommon/libcommon.a \
$(top_builddir)/src/libmgcp/libmgcp.a \