diff options
author | Harald Welte <laforge@gnumonks.org> | 2016-06-19 18:06:02 +0200 |
---|---|---|
committer | Neels Hofmeyr <neels@hofmeyr.de> | 2017-08-27 03:52:44 +0200 |
commit | a43e0b4d9a036125dcb5ef55499259a343249b6d (patch) | |
tree | 1117cbcd1ee2d27e4dbf89fd17a378bdebcb9360 /src/libbsc | |
parent | 774a2a7e39ffc5094960a20df2d5c1f483facc9c (diff) |
Use libvlr in libmsc (large refactoring)
Original libvlr code is by Harald Welte <laforge@gnumonks.org>,
polished and tweaked by Neels Hofmeyr <nhofmeyr@sysmocom.de>.
This is a long series of trial-and-error development collapsed in one patch.
This may be split in smaller commits if reviewers prefer that. If we can keep
it as one, we have saved ourselves the additional separation work.
SMS:
The SQL based lookup of SMS for attached subscribers no longer works since the
SQL database no longer has the subscriber data. Replace with a round-robin on
the SMS recipient MSISDNs paired with a VLR subscriber RAM lookup whether the
subscriber is currently attached.
If there are many SMS for not-attached subscribers in the SMS database, this
will become inefficient: a DB hit returns a pending SMS, the RAM lookup will
reveal that the subscriber is not attached, after which the DB is hit for the
next SMS. It would become more efficient e.g. by having an MSISDN based hash
list for the VLR subscribers and by marking non-attached SMS recipients in the
SMS database so that they can be excluded with the SQL query already.
There is a sanity limit to do at most 100 db hits per attempt to find a pending
SMS. So if there are more than 100 stored SMS waiting for their recipients to
actually attach to the MSC, it may take more than one SMS queue trigger to
deliver SMS for subscribers that are actually attached.
This is not very beautiful, but is merely intended to carry us over to a time
when we have a proper separate SMSC entity.
Introduce gsm_subscriber_connection ref-counting in libmsc.
Remove/Disable VTY and CTRL commands to create subscribers, which is now a task
of the OsmoHLR. Adjust the python tests accordingly.
Remove VTY cmd subscriber-keep-in-ram.
Use OSMO_GSUP_PORT = 4222 instead of 2222. See
I4222e21686c823985be8ff1f16b1182be8ad6175.
So far use the LAC from conn->bts, will be replaced by conn->lac in
Id3705236350d5f69e447046b0a764bbabc3d493c.
Related: OS#1592 OS#1974
Change-Id: I639544a6cdda77a3aafc4e3446a55393f60e4050
Diffstat (limited to 'src/libbsc')
-rw-r--r-- | src/libbsc/abis_rsl.c | 4 | ||||
-rw-r--r-- | src/libbsc/bsc_api.c | 10 | ||||
-rw-r--r-- | src/libbsc/bsc_init.c | 7 | ||||
-rw-r--r-- | src/libbsc/bsc_vty.c | 40 | ||||
-rw-r--r-- | src/libbsc/handover_logic.c | 3 | ||||
-rw-r--r-- | src/libbsc/paging.c | 1 |
6 files changed, 37 insertions, 28 deletions
diff --git a/src/libbsc/abis_rsl.c b/src/libbsc/abis_rsl.c index 6ae790f6c..7ae3eebd9 100644 --- a/src/libbsc/abis_rsl.c +++ b/src/libbsc/abis_rsl.c @@ -160,7 +160,7 @@ static struct gsm_lchan *lchan_lookup(struct gsm_bts_trx *trx, uint8_t chan_nr, gsm_ts_and_pchan_name(lchan->ts), log_name, chan_nr); if (lchan->conn) - log_set_context(LOG_CTX_VLR_SUBSCR, lchan->conn->subscr); + log_set_context(LOG_CTX_VLR_SUBSCR, lchan->conn->vsub); return lchan; } @@ -1382,8 +1382,6 @@ static void print_meas_rep(struct gsm_lchan *lchan, struct gsm_meas_rep *mr) if (lchan && lchan->conn) { if (lchan->conn->bsub) name = bsc_subscr_name(lchan->conn->bsub); - else if (lchan->conn->subscr) - name = lchan->conn->subscr->imsi; else name = lchan->name; } diff --git a/src/libbsc/bsc_api.c b/src/libbsc/bsc_api.c index 7613cac90..947644eb3 100644 --- a/src/libbsc/bsc_api.c +++ b/src/libbsc/bsc_api.c @@ -32,6 +32,7 @@ #include <openbsc/debug.h> #include <openbsc/gsm_04_08.h> #include <openbsc/trau_mux.h> +#include <openbsc/vlr.h> #include <osmocom/gsm/protocol/gsm_08_08.h> #include <osmocom/gsm/gsm48.h> @@ -273,13 +274,14 @@ void bsc_subscr_con_free(struct gsm_subscriber_connection *conn) if (!conn) return; + if (conn->network->bsc_api->conn_cleanup) + conn->network->bsc_api->conn_cleanup(conn); - if (conn->subscr) { - subscr_put(conn->subscr); - conn->subscr = NULL; + if (conn->vsub) { + LOGP(DNM, LOGL_ERROR, "conn->vsub should have been cleared.\n"); + conn->vsub = NULL; } - if (conn->ho_lchan) { LOGP(DNM, LOGL_ERROR, "The ho_lchan should have been cleared.\n"); conn->ho_lchan->conn = NULL; diff --git a/src/libbsc/bsc_init.c b/src/libbsc/bsc_init.c index ec87a7bc7..b7135f1b1 100644 --- a/src/libbsc/bsc_init.c +++ b/src/libbsc/bsc_init.c @@ -38,6 +38,7 @@ #include <openbsc/e1_config.h> #include <openbsc/common_bsc.h> #include <openbsc/pcu_if.h> +#include <openbsc/osmo_msc.h> #include <limits.h> /* global pointer to the gsm network data structure */ @@ -512,6 +513,12 @@ int bsc_network_alloc(mncc_recv_cb_t mncc_recv) bsc_gsmnet->name_long = talloc_strdup(bsc_gsmnet, "OpenBSC"); bsc_gsmnet->name_short = talloc_strdup(bsc_gsmnet, "OpenBSC"); + /* TODO: move to libmsc when gsm_network is split between libbsc and + * libmsc */ + bsc_gsmnet->gsup_server_addr_str = talloc_strdup(bsc_gsmnet, + MSC_HLR_REMOTE_IP_DEFAULT); + bsc_gsmnet->gsup_server_port = MSC_HLR_REMOTE_PORT_DEFAULT; + return 0; } diff --git a/src/libbsc/bsc_vty.c b/src/libbsc/bsc_vty.c index 9fc289503..3bd56eafb 100644 --- a/src/libbsc/bsc_vty.c +++ b/src/libbsc/bsc_vty.c @@ -54,8 +54,8 @@ #include <openbsc/bsc_msc_data.h> #include <openbsc/osmo_bsc_rf.h> #include <openbsc/pcu_if.h> - #include <openbsc/common_cs.h> +#include <openbsc/vlr.h> #include <inttypes.h> @@ -173,10 +173,6 @@ static void net_dump_vty(struct vty *vty, struct gsm_network *net) if (net->authorized_reg_str) vty_out(vty, ", authorized regexp: %s", net->authorized_reg_str); vty_out(vty, "%s", VTY_NEWLINE); - vty_out(vty, " Auto create subscriber: %s%s", - net->auto_create_subscr ? "yes" : "no", VTY_NEWLINE); - vty_out(vty, " Auto assign extension: %s%s", - net->auto_assign_exten ? "yes" : "no", VTY_NEWLINE); vty_out(vty, " Location updating reject cause: %u%s", net->reject_cause, VTY_NEWLINE); vty_out(vty, " Encryption: A5/%u%s", net->a5_encryption, @@ -801,6 +797,9 @@ static int config_write_net(struct vty *vty) vty_out(vty, " location updating reject cause %u%s", gsmnet->reject_cause, VTY_NEWLINE); vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE); + vty_out(vty, " authentication %s%s", + gsmnet->authentication_required ? "required" : "optional", + VTY_NEWLINE); vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE); vty_out(vty, " paging any use tch %d%s", gsmnet->pag_any_tch, VTY_NEWLINE); vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode), @@ -833,8 +832,6 @@ static int config_write_net(struct vty *vty) vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE); vty_out(vty, " dyn_ts_allow_tch_f %d%s", gsmnet->dyn_ts_allow_tch_f ? 1 : 0, VTY_NEWLINE); - vty_out(vty, " subscriber-keep-in-ram %d%s", - gsmnet->subscr_group->keep_subscr, VTY_NEWLINE); if (gsmnet->tz.override != 0) { if (gsmnet->tz.dst) vty_out(vty, " timezone %d %d %d%s", @@ -1018,21 +1015,24 @@ DEFUN(show_ts, return CMD_SUCCESS; } -static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr) +static void subscr_dump_vty(struct vty *vty, struct vlr_subscr *vsub) { - vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id, - subscr->authorized, VTY_NEWLINE); - if (strlen(subscr->name)) - vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE); - if (strlen(subscr->extension)) - vty_out(vty, " Extension: %s%s", subscr->extension, + OSMO_ASSERT(vsub); + if (strlen(vsub->name)) + vty_out(vty, " Name: '%s'%s", vsub->name, VTY_NEWLINE); + if (strlen(vsub->msisdn)) + vty_out(vty, " Extension: %s%s", vsub->msisdn, + VTY_NEWLINE); + if (strlen(vsub->imsi)) + vty_out(vty, " IMSI: %s%s", vsub->imsi, VTY_NEWLINE); + if (vsub->tmsi != GSM_RESERVED_TMSI) + vty_out(vty, " TMSI: %08X%s", vsub->tmsi, VTY_NEWLINE); - vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE); - if (subscr->tmsi != GSM_RESERVED_TMSI) - vty_out(vty, " TMSI: %08X%s", subscr->tmsi, + if (vsub->tmsi_new != GSM_RESERVED_TMSI) + vty_out(vty, " new TMSI: %08X%s", vsub->tmsi_new, VTY_NEWLINE); - vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE); + vty_out(vty, " Use count: %u%s", vsub->use_count, VTY_NEWLINE); } static void bsc_subscr_dump_vty(struct vty *vty, struct bsc_subscr *bsub) @@ -1160,9 +1160,9 @@ static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan) vty_out(vty, " Channel Mode / Codec: %s%s", get_value_string(gsm48_cmode_names, lchan->tch_mode), VTY_NEWLINE); - if (lchan->conn && lchan->conn->subscr) { + if (lchan->conn && lchan->conn->vsub) { vty_out(vty, " Subscriber:%s", VTY_NEWLINE); - subscr_dump_vty(vty, lchan->conn->subscr); + subscr_dump_vty(vty, lchan->conn->vsub); } else vty_out(vty, " No Subscriber%s", VTY_NEWLINE); if (is_ipaccess_bts(lchan->ts->trx->bts)) { diff --git a/src/libbsc/handover_logic.c b/src/libbsc/handover_logic.c index 4dd913b15..c03563f6b 100644 --- a/src/libbsc/handover_logic.c +++ b/src/libbsc/handover_logic.c @@ -40,6 +40,7 @@ #include <osmocom/core/talloc.h> #include <openbsc/transaction.h> #include <openbsc/trau_mux.h> +#include <openbsc/vlr.h> struct bsc_handover { struct llist_head list; @@ -260,7 +261,7 @@ static int ho_gsm48_ho_compl(struct gsm_lchan *new_lchan) net = new_lchan->ts->trx->bts->network; LOGP(DHO, LOGL_INFO, "Subscriber %s HO from BTS %u->%u on ARFCN " - "%u->%u\n", subscr_name(ho->old_lchan->conn->subscr), + "%u->%u\n", vlr_subscr_name(ho->old_lchan->conn->vsub), ho->old_lchan->ts->trx->bts->nr, new_lchan->ts->trx->bts->nr, ho->old_lchan->ts->trx->arfcn, new_lchan->ts->trx->arfcn); diff --git a/src/libbsc/paging.c b/src/libbsc/paging.c index 78e39c558..8c1445cc6 100644 --- a/src/libbsc/paging.c +++ b/src/libbsc/paging.c @@ -50,6 +50,7 @@ #include <openbsc/gsm_data.h> #include <openbsc/chan_alloc.h> #include <openbsc/bsc_api.h> +#include <openbsc/vlr.h> void *tall_paging_ctx; |