2008-12-23 20:25:15 +00:00
|
|
|
#ifndef _GSM_DATA_H
|
|
|
|
#define _GSM_DATA_H
|
|
|
|
|
2011-05-24 11:25:38 +00:00
|
|
|
#include <stdint.h>
|
2016-05-24 12:23:27 +00:00
|
|
|
#include <regex.h>
|
|
|
|
#include <sys/types.h>
|
2016-06-30 08:25:49 +00:00
|
|
|
#include <stdbool.h>
|
2011-05-24 11:25:38 +00:00
|
|
|
|
|
|
|
#include <osmocom/core/timer.h>
|
2016-07-12 13:42:02 +00:00
|
|
|
#include <osmocom/core/rate_ctr.h>
|
2011-05-25 11:10:08 +00:00
|
|
|
#include <osmocom/core/select.h>
|
2016-07-12 13:42:02 +00:00
|
|
|
#include <osmocom/core/stats.h>
|
2017-09-15 09:22:30 +00:00
|
|
|
#include <osmocom/gsm/gsm48.h>
|
2016-04-20 11:13:19 +00:00
|
|
|
#include <osmocom/crypt/auth.h>
|
2011-05-24 11:25:38 +00:00
|
|
|
|
2017-09-03 23:03:58 +00:00
|
|
|
#include <osmocom/mgcp_client/mgcp_client.h>
|
2011-05-25 10:33:33 +00:00
|
|
|
|
2018-11-30 00:46:51 +00:00
|
|
|
#include <osmocom/msc/msc_common.h>
|
|
|
|
|
2018-01-24 23:07:33 +00:00
|
|
|
#include "gsm_data_shared.h"
|
|
|
|
|
2018-04-09 14:35:01 +00:00
|
|
|
/* TS 48.008 DLCI containing DCCH/ACCH + SAPI */
|
|
|
|
#define OMSC_LINKID_CB(__msgb) (__msgb)->cb[3]
|
2017-04-09 10:32:51 +00:00
|
|
|
|
2018-03-15 11:55:46 +00:00
|
|
|
#include "../../bscconfig.h"
|
|
|
|
#if BUILD_IU
|
|
|
|
#include <osmocom/ranap/iu_client.h>
|
|
|
|
#endif
|
|
|
|
|
2013-04-29 07:11:02 +00:00
|
|
|
/** annotations for msgb ownership */
|
|
|
|
#define __uses
|
|
|
|
|
2011-10-26 16:37:09 +00:00
|
|
|
struct mncc_sock_state;
|
2016-06-19 16:06:02 +00:00
|
|
|
struct vlr_instance;
|
|
|
|
struct vlr_subscr;
|
2011-10-26 16:37:09 +00:00
|
|
|
|
2017-01-09 23:49:56 +00:00
|
|
|
#define tmsi_from_string(str) strtoul(str, NULL, 10)
|
|
|
|
|
2016-08-02 09:34:11 +00:00
|
|
|
enum {
|
2016-07-12 13:42:02 +00:00
|
|
|
MSC_CTR_LOC_UPDATE_TYPE_ATTACH,
|
|
|
|
MSC_CTR_LOC_UPDATE_TYPE_NORMAL,
|
|
|
|
MSC_CTR_LOC_UPDATE_TYPE_PERIODIC,
|
|
|
|
MSC_CTR_LOC_UPDATE_TYPE_DETACH,
|
LU counters: count completion and failure, not messages sent
From a human admin viewpoint it doesn't make sense to count the messages sent:
When we use TMSIs, we first send a LU Accept with a new TMSI, and then expect
the MS to respond with a TMSI Realloc Complete message. When that fails to come
through, the LU actually ends in failure, even though a LU Accept was sent.
If a conn breaks/vanishes during LU, we cancel the LU without sending any reply
at all, so the failed LU would not be counted.
Instead, count Location Updating results, i.e. completion and failures.
(With the new VLR developments, LU counters need to be triggered in completely
different places, and this patch prepares for that by providing sensible
counters.)
Change-Id: I03f14c6a2f7ec5e1d3ba401e32082476fc7b0cc6
2016-05-09 11:18:03 +00:00
|
|
|
MSC_CTR_LOC_UPDATE_FAILED,
|
|
|
|
MSC_CTR_LOC_UPDATE_COMPLETED,
|
refactor subscr_conn and subscr_conn_fsm de-/alloc
Refactor:
1. Glue the gsm_subscriber_connection alloc to the subscr_conn_fsm.
2. Add separate AUTH_CIPH state to the FSM.
3. Use conn->use_count to trigger conn release.
4. Add separate RELEASING state to the FSM.
5. Add rate counters for each of the three Complete Layer 3 types.
Details:
1. Glue the gsm_subscriber_connection alloc to the subscr_conn_fsm.
Historically, a gsm_subscriber_connection was allocated in libbsc land, and
only upon Complete Layer 3 did libmsc add the fsm instance. After splitting
openbsc.git into a separate osmo-msc, this is no longer necessary, hence:
Closely tie gsm_subscriber_connection allocation to the subscr_conn_fsm
instance: talloc the conn as a child of the FSM instance, and discard the conn
as soon as the FSM terminates.
2. Add separate AUTH_CIPH state to the FSM.
Decoding the Complete Layer 3 message is distinctly separate from waiting for
the VLR FSMs to conclude. Use the NEW state as "we don't know if this is a
valid message yet", and the AUTH_CIPH state as "evaluating, don't release".
A profound effect of this: should we for any odd reason fail to leave the FSM's
NEW state, the conn will be released right at the end of msc_compl_l3(),
without needing to trigger release in each code path.
3. Use conn->use_count to trigger conn release.
Before, the FSM itself would hold a use count on the conn, and hence we would
need to ask it whether it is ready to release the conn yet by dispatching
events, to achieve a use_count decrement.
Instead, unite the FSM instance and conn, and do not hold a use count by the
FSM. Hence, trigger an FSM "UNUSED" event only when the use_count reaches zero.
As long as use counts are done correctly, the FSM will terminate correctly.
These exceptions:
- The new AUTH_CIPH state explicitly ignores UNUSED events, since we expect the
use count to reach zero while evaluating Authentication and Ciphering. (I
experimented with holding a use count by AUTH_CIPH onenter() and releasing by
onleave(), but the use count and thus the conn are released before the next
state can initiate transactions that would increment the use count again.
Same thing for the VLR FSMs holding a use count, they should be done before
we advance to the next state. The easiest is to simply expect zero use count
during the AUTH_CIPH state.)
- A CM Service Request means that even though the MSC would be through with all
it wants to do, we shall still wait for a request to follow from the MS.
Hence the FSM holds a use count on itself while a CM Service is pending.
- While waiting for a Release/Clear Complete, the FSM holds a use count on
itself.
4. Add separate RELEASING state to the FSM.
If we decide to release for other reasons than a use count reaching zero, we
still need to be able to wait for the msc_dtap() use count on the conn to
release.
(An upcoming patch will further use the RELEASING state to properly wait for
Clear Complete / Release Complete messages.)
5. Add rate counters for each of the three Complete Layer 3 types.
Besides LU, also count CM Service Request and Paging Response
acceptance/rejections. Without these counters, only very few of the auth+ciph
outcomes actually show in the counters.
Related: OS#3122
Change-Id: I55feb379e176a96a831e105b86202b17a0ffe889
2018-03-30 22:02:14 +00:00
|
|
|
MSC_CTR_CM_SERVICE_REQUEST_REJECTED,
|
|
|
|
MSC_CTR_CM_SERVICE_REQUEST_ACCEPTED,
|
|
|
|
MSC_CTR_PAGING_RESP_REJECTED,
|
|
|
|
MSC_CTR_PAGING_RESP_ACCEPTED,
|
2016-07-12 13:42:02 +00:00
|
|
|
MSC_CTR_SMS_SUBMITTED,
|
|
|
|
MSC_CTR_SMS_NO_RECEIVER,
|
|
|
|
MSC_CTR_SMS_DELIVERED,
|
|
|
|
MSC_CTR_SMS_RP_ERR_MEM,
|
|
|
|
MSC_CTR_SMS_RP_ERR_OTHER,
|
2016-08-21 18:16:33 +00:00
|
|
|
MSC_CTR_SMS_DELIVER_UNKNOWN_ERROR,
|
2016-07-12 13:42:02 +00:00
|
|
|
MSC_CTR_CALL_MO_SETUP,
|
|
|
|
MSC_CTR_CALL_MO_CONNECT_ACK,
|
|
|
|
MSC_CTR_CALL_MT_SETUP,
|
|
|
|
MSC_CTR_CALL_MT_CONNECT,
|
2016-08-23 05:32:27 +00:00
|
|
|
MSC_CTR_CALL_ACTIVE,
|
|
|
|
MSC_CTR_CALL_COMPLETE,
|
|
|
|
MSC_CTR_CALL_INCOMPLETE,
|
2018-06-22 20:32:20 +00:00
|
|
|
MSC_CTR_NC_SS_MO_REQUESTS,
|
|
|
|
MSC_CTR_NC_SS_MO_ESTABLISHED,
|
|
|
|
MSC_CTR_NC_SS_MT_REQUESTS,
|
|
|
|
MSC_CTR_NC_SS_MT_ESTABLISHED,
|
2018-11-02 15:01:03 +00:00
|
|
|
MSC_CTR_BSSMAP_CIPHER_MODE_REJECT,
|
|
|
|
MSC_CTR_BSSMAP_CIPHER_MODE_COMPLETE,
|
2016-07-12 13:42:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct rate_ctr_desc msc_ctr_description[] = {
|
2017-11-18 22:22:17 +00:00
|
|
|
[MSC_CTR_LOC_UPDATE_TYPE_ATTACH] = {"loc_update_type:attach", "Received location update imsi attach requests."},
|
|
|
|
[MSC_CTR_LOC_UPDATE_TYPE_NORMAL] = {"loc_update_type:normal", "Received location update normal requests."},
|
|
|
|
[MSC_CTR_LOC_UPDATE_TYPE_PERIODIC] = {"loc_update_type:periodic", "Received location update periodic requests."},
|
|
|
|
[MSC_CTR_LOC_UPDATE_TYPE_DETACH] = {"loc_update_type:detach", "Received location update detach indication."},
|
|
|
|
[MSC_CTR_LOC_UPDATE_FAILED] = {"loc_update_resp:failed", "Rejected location updates."},
|
|
|
|
[MSC_CTR_LOC_UPDATE_COMPLETED] = {"loc_update_resp:completed", "Successful location updates."},
|
refactor subscr_conn and subscr_conn_fsm de-/alloc
Refactor:
1. Glue the gsm_subscriber_connection alloc to the subscr_conn_fsm.
2. Add separate AUTH_CIPH state to the FSM.
3. Use conn->use_count to trigger conn release.
4. Add separate RELEASING state to the FSM.
5. Add rate counters for each of the three Complete Layer 3 types.
Details:
1. Glue the gsm_subscriber_connection alloc to the subscr_conn_fsm.
Historically, a gsm_subscriber_connection was allocated in libbsc land, and
only upon Complete Layer 3 did libmsc add the fsm instance. After splitting
openbsc.git into a separate osmo-msc, this is no longer necessary, hence:
Closely tie gsm_subscriber_connection allocation to the subscr_conn_fsm
instance: talloc the conn as a child of the FSM instance, and discard the conn
as soon as the FSM terminates.
2. Add separate AUTH_CIPH state to the FSM.
Decoding the Complete Layer 3 message is distinctly separate from waiting for
the VLR FSMs to conclude. Use the NEW state as "we don't know if this is a
valid message yet", and the AUTH_CIPH state as "evaluating, don't release".
A profound effect of this: should we for any odd reason fail to leave the FSM's
NEW state, the conn will be released right at the end of msc_compl_l3(),
without needing to trigger release in each code path.
3. Use conn->use_count to trigger conn release.
Before, the FSM itself would hold a use count on the conn, and hence we would
need to ask it whether it is ready to release the conn yet by dispatching
events, to achieve a use_count decrement.
Instead, unite the FSM instance and conn, and do not hold a use count by the
FSM. Hence, trigger an FSM "UNUSED" event only when the use_count reaches zero.
As long as use counts are done correctly, the FSM will terminate correctly.
These exceptions:
- The new AUTH_CIPH state explicitly ignores UNUSED events, since we expect the
use count to reach zero while evaluating Authentication and Ciphering. (I
experimented with holding a use count by AUTH_CIPH onenter() and releasing by
onleave(), but the use count and thus the conn are released before the next
state can initiate transactions that would increment the use count again.
Same thing for the VLR FSMs holding a use count, they should be done before
we advance to the next state. The easiest is to simply expect zero use count
during the AUTH_CIPH state.)
- A CM Service Request means that even though the MSC would be through with all
it wants to do, we shall still wait for a request to follow from the MS.
Hence the FSM holds a use count on itself while a CM Service is pending.
- While waiting for a Release/Clear Complete, the FSM holds a use count on
itself.
4. Add separate RELEASING state to the FSM.
If we decide to release for other reasons than a use count reaching zero, we
still need to be able to wait for the msc_dtap() use count on the conn to
release.
(An upcoming patch will further use the RELEASING state to properly wait for
Clear Complete / Release Complete messages.)
5. Add rate counters for each of the three Complete Layer 3 types.
Besides LU, also count CM Service Request and Paging Response
acceptance/rejections. Without these counters, only very few of the auth+ciph
outcomes actually show in the counters.
Related: OS#3122
Change-Id: I55feb379e176a96a831e105b86202b17a0ffe889
2018-03-30 22:02:14 +00:00
|
|
|
[MSC_CTR_CM_SERVICE_REQUEST_REJECTED] = {"cm_service_request:rejected", "Rejected CM Service Request."},
|
|
|
|
[MSC_CTR_CM_SERVICE_REQUEST_ACCEPTED] = {"cm_service_request:accepted", "Accepted CM Service Request."},
|
|
|
|
[MSC_CTR_PAGING_RESP_REJECTED] = {"paging_resp:rejected", "Rejected Paging Response."},
|
|
|
|
[MSC_CTR_PAGING_RESP_ACCEPTED] = {"paging_resp:accepted", "Accepted Paging Response."},
|
2017-11-18 22:22:17 +00:00
|
|
|
[MSC_CTR_SMS_SUBMITTED] = {"sms:submitted", "Received a RPDU from a MS (MO)."},
|
|
|
|
[MSC_CTR_SMS_NO_RECEIVER] = {"sms:no_receiver", "Counts SMS which couldn't routed because no receiver found."},
|
|
|
|
[MSC_CTR_SMS_DELIVERED] = {"sms:delivered", "Global SMS Deliver attempts."},
|
|
|
|
[MSC_CTR_SMS_RP_ERR_MEM] = {"sms:rp_err_mem", "CAUSE_MT_MEM_EXCEEDED errors of MS responses on a sms deliver attempt."},
|
|
|
|
[MSC_CTR_SMS_RP_ERR_OTHER] = {"sms:rp_err_other", "Other error of MS responses on a sms delive attempt."},
|
|
|
|
[MSC_CTR_SMS_DELIVER_UNKNOWN_ERROR] = {"sms:deliver_unknown_error", "Unknown error occured during sms delivery."},
|
2016-07-12 13:42:02 +00:00
|
|
|
/* FIXME: count also sms delivered */
|
2017-11-18 22:22:17 +00:00
|
|
|
[MSC_CTR_CALL_MO_SETUP] = {"call:mo_setup", "Received setup requests from a MS to init a MO call."},
|
|
|
|
[MSC_CTR_CALL_MO_CONNECT_ACK] = {"call:mo_connect_ack", "Received a connect ack from MS of a MO call. Call is now succesful connected up."},
|
|
|
|
[MSC_CTR_CALL_MT_SETUP] = {"call:mt_setup", "Sent setup requests to the MS (MT)."},
|
|
|
|
[MSC_CTR_CALL_MT_CONNECT] = {"call:mt_connect", "Sent a connect to the MS (MT)."},
|
|
|
|
[MSC_CTR_CALL_ACTIVE] = {"call:active", "Count total amount of calls that ever reached active state."},
|
|
|
|
[MSC_CTR_CALL_COMPLETE] = {"call:complete", "Count total amount of calls which got terminated by disconnect req or ind after reaching active state."},
|
|
|
|
[MSC_CTR_CALL_INCOMPLETE] = {"call:incomplete", "Count total amount of call which got terminated by any other reason after reaching active state."},
|
2018-06-22 20:32:20 +00:00
|
|
|
[MSC_CTR_NC_SS_MO_REQUESTS] = {"nc_ss:mo_requests", "Received MS-initiated call independent SS/USSD requests."},
|
|
|
|
[MSC_CTR_NC_SS_MO_ESTABLISHED] = {"nc_ss:mo_established", "Established MS-initiated call independent SS/USSD sessions."},
|
|
|
|
[MSC_CTR_NC_SS_MT_REQUESTS] = {"nc_ss:mt_requests", "Received network-initiated call independent SS/USSD requests."},
|
|
|
|
[MSC_CTR_NC_SS_MT_ESTABLISHED] = {"nc_ss:mt_established", "Established network-initiated call independent SS/USSD sessions."},
|
2018-11-02 15:01:03 +00:00
|
|
|
[MSC_CTR_BSSMAP_CIPHER_MODE_REJECT] = {"bssmap:cipher_mode_reject", "Number of CIPHER MODE REJECT messages processed by BSSMAP layer"},
|
|
|
|
[MSC_CTR_BSSMAP_CIPHER_MODE_COMPLETE] = {"bssmap:cipher_mode_complete", "Number of CIPHER MODE COMPLETE messages processed by BSSMAP layer"},
|
2016-08-02 09:34:11 +00:00
|
|
|
};
|
|
|
|
|
2016-07-12 13:42:02 +00:00
|
|
|
static const struct rate_ctr_group_desc msc_ctrg_desc = {
|
|
|
|
"msc",
|
|
|
|
"mobile switching center",
|
|
|
|
OSMO_STATS_CLASS_GLOBAL,
|
|
|
|
ARRAY_SIZE(msc_ctr_description),
|
|
|
|
msc_ctr_description,
|
2009-12-21 23:41:05 +00:00
|
|
|
};
|
|
|
|
|
fix paging: add timeout to discard unsuccessful paging
Currently, if there is no reply from the BSS / RNC, a subscriber will remain as
"already paged" forever, and is never going to be paged again. Even on IMSI
Detach, the pending request will keep a ref count on the vlr_subscr.
Add a paging timeout, as gsm_network->paging_timeout and in the VTY on the
'msc' node as 'paging timeout (default|<1-65535>'. (There is a 'network' /
'T3113' in OsmoBSC, but to not confuse the two, give this a different name.)
Add test_ms_timeout_paging() test to verify the timeout works.
I hit this while testing Paging across multiple hNodeB, when a UE lost
connection to the hNodeB. I noticed that no matter how long I wait, no Paging
is sent out anymore, and found this embarrassing issue. Good grief...
The choice of 10 seconds is taken from https://osmocom.org/issues/2756
Change-Id: I2db6f1e2ad341cf9c2cc7a21ec2fca0bae5b2db5
2017-12-15 02:02:27 +00:00
|
|
|
#define MSC_PAGING_RESPONSE_TIMER_DEFAULT 10
|
2009-12-01 12:06:54 +00:00
|
|
|
|
2016-05-10 11:29:33 +00:00
|
|
|
struct gsm_tz {
|
|
|
|
int override; /* if 0, use system's time zone instead. */
|
|
|
|
int hr; /* hour */
|
|
|
|
int mn; /* minute */
|
|
|
|
int dst; /* daylight savings */
|
|
|
|
};
|
|
|
|
|
2008-12-23 20:25:15 +00:00
|
|
|
struct gsm_network {
|
mscsplit: various preparations to separate MSC from BSC
Disable large parts of the code that depend on BSC presence. The code sections
disabled by #if BEFORE_MSCSPLIT shall be modified or dropped in the course of
adding the A-interface.
Don't set msg->lchan nor msg->dst.
Don't use lchan in libmsc.
Decouple lac from bts.
Prepare entry/exit point for MSC -> BSC and MSC -> RNC communication:
Add msc_ifaces.[hc], a_iface.c, with a general msc_tx_dtap() to redirect to
different interfaces depending on the actual subscriber connection.
While iu_tx() is going to be functional fairly soon, the a_tx() is going to be
just a dummy for some time (see comment).
Add Iu specific fields in gsm_subscriber_connection: the UE connection pointer
and an indicator for the Integrity Protection status on Iu (to be fully
implemented in later commits).
Add lac member to gsm_subscriber_connection, to allow decoupling from
bts->location_area_code. The conn->lac will actually be set in iu.c in an
upcoming commit ("add iucs.[hc]").
move to libcommon-cs: gsm48_extract_mi(), gsm48_paging_extract_mi().
libmsc: duplicate gsm0808 / gsm48 functions (towards BSC).
In osmo-nitb, libmsc would directly call the functions on the BSC level, not
always via the bsc_api. When separating libmsc from libbsc, some functions are
missing from the linkage.
Hence duplicate these functions to libmsc, add an msc_ prefix for clarity, also
add a _tx to gsm0808_cipher_mode():
* add msc_gsm0808_tx_cipher_mode() (dummy/stub)
* add msc_gsm48_tx_mm_serv_ack()
* add msc_gsm48_tx_mm_serv_rej()
Call these from libmsc instead of
* gsm0808_cipher_mode()
* gsm48_tx_mm_serv_ack()
* gsm48_tx_mm_serv_rej()
Also add a comment related to msc_gsm0808_tx_cipher_mode() in two places.
Remove internal RTP streaming code; OsmoNITB supported that, but for OsmoMSC,
this will be done with an external MGCP gateway.
Remove LCHAN_MODIFY from internal MNCC state machine.
Temporarily disable all paging to be able to link libmsc without libbsc.
Skip the paging part of channel_test because the paging is now disabled.
Employ fake paging shims in order for msc_vlr_tests to still work.
msc_compl_l3(): publish in .h, tweak return value. Use new libmsc enum values
for return val, to avoid dependency on libbsc headers. Make callable from
other scopes: publish in osmo_msc.h and remove 'static' in osmo_msc.c
add gsm_encr to subscr_conn
move subscr_request to gsm_subscriber.h
subscr_request_channel() -> subscr_request_conn()
move to libmsc: osmo_stats_vty_add_cmds()
gsm_04_08: remove apply_codec_restrictions()
gsm0408_test: use NULL for root ctx
move to libbsc: gsm_bts_neighbor()
move to libbsc: lchan_next_meas_rep()
move vty config for t3212 to network level (periodic lu)
remove unneccessary linking from some tests
remove handle_abisip_signal()
abis_rsl.c: don't use libvlr from libbsc
gsm_subscriber_connection: put the LAC here, so that it is available without
accessing conn->bts. In bsc_api.c, place this lac in conn for the sake of
transition: Iu and A will use this new field to pass the LAC around, but in a
completely separate OsmoBSC this is not actually needed. It can be removed
again from osmo-bsc.git when the time has come.
Siemens MRPCI: completely drop sending the MRPCI messages for now, they shall
be added in osmo-bsc once the A-Interface code has settled. See OS#2389.
Related: OS#1845 OS#2257 OS#2389
Change-Id: Id3705236350d5f69e447046b0a764bbabc3d493c
2017-05-08 13:12:20 +00:00
|
|
|
/* TODO MSCSPLIT the gsm_network struct is basically a kitchen sink for
|
|
|
|
* global settings and variables, "madly" mixing BSC and MSC stuff. Split
|
|
|
|
* this in e.g. struct osmo_bsc and struct osmo_msc, with the things
|
|
|
|
* these have in common, like country and network code, put in yet
|
|
|
|
* separate structs and placed as members in osmo_bsc and osmo_msc. */
|
|
|
|
|
2018-02-22 03:04:54 +00:00
|
|
|
struct osmo_plmn_id plmn;
|
|
|
|
|
2008-12-30 18:01:02 +00:00
|
|
|
char *name_long;
|
|
|
|
char *name_short;
|
2018-02-22 03:04:54 +00:00
|
|
|
|
2017-12-23 18:30:32 +00:00
|
|
|
/* bit-mask of permitted encryption algorithms. LSB=A5/0, MSB=A5/7 */
|
|
|
|
uint8_t a5_encryption_mask;
|
2016-06-19 16:06:02 +00:00
|
|
|
bool authentication_required;
|
2009-12-14 08:00:24 +00:00
|
|
|
int send_mm_info;
|
2008-12-23 20:25:15 +00:00
|
|
|
|
2016-08-02 09:34:11 +00:00
|
|
|
struct rate_ctr_group *msc_ctrs;
|
2016-08-23 05:32:27 +00:00
|
|
|
struct osmo_counter *active_calls;
|
2018-06-26 11:27:25 +00:00
|
|
|
struct osmo_counter *active_nc_ss;
|
2009-12-21 23:41:05 +00:00
|
|
|
|
2009-06-10 15:11:52 +00:00
|
|
|
/* layer 4 */
|
2018-12-05 00:11:28 +00:00
|
|
|
char *mncc_sock_path;
|
2011-10-26 16:37:09 +00:00
|
|
|
struct mncc_sock_state *mncc_state;
|
2016-05-11 12:28:25 +00:00
|
|
|
mncc_recv_cb_t mncc_recv;
|
2009-06-10 15:11:52 +00:00
|
|
|
struct llist_head upqueue;
|
2016-05-20 19:59:55 +00:00
|
|
|
/*
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
* TODO: Move the trans_list into the RAN connection and
|
2016-05-20 19:59:55 +00:00
|
|
|
* create a pending list for MT transactions. These exist before
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
* we have a RAN connection.
|
2016-05-20 19:59:55 +00:00
|
|
|
*/
|
2009-06-10 15:11:52 +00:00
|
|
|
struct llist_head trans_list;
|
|
|
|
|
fix paging: add timeout to discard unsuccessful paging
Currently, if there is no reply from the BSS / RNC, a subscriber will remain as
"already paged" forever, and is never going to be paged again. Even on IMSI
Detach, the pending request will keep a ref count on the vlr_subscr.
Add a paging timeout, as gsm_network->paging_timeout and in the VTY on the
'msc' node as 'paging timeout (default|<1-65535>'. (There is a 'network' /
'T3113' in OsmoBSC, but to not confuse the two, give this a different name.)
Add test_ms_timeout_paging() test to verify the timeout works.
I hit this while testing Paging across multiple hNodeB, when a UE lost
connection to the hNodeB. I noticed that no matter how long I wait, no Paging
is sent out anymore, and found this embarrassing issue. Good grief...
The choice of 10 seconds is taken from https://osmocom.org/issues/2756
Change-Id: I2db6f1e2ad341cf9c2cc7a21ec2fca0bae5b2db5
2017-12-15 02:02:27 +00:00
|
|
|
unsigned int paging_response_timer;
|
2009-12-13 09:53:12 +00:00
|
|
|
|
|
|
|
/* Radio Resource Location Protocol (TS 04.31) */
|
|
|
|
struct {
|
|
|
|
enum rrlp_mode mode;
|
|
|
|
} rrlp;
|
2010-09-06 01:25:48 +00:00
|
|
|
|
2010-12-24 12:48:27 +00:00
|
|
|
struct gsm_sms_queue *sms_queue;
|
2011-07-22 15:55:42 +00:00
|
|
|
|
libmsc/VTY: introduce kill-switch for routing SMS over GSUP
As a rudiment of OsmoNiTB, OsmoMSC is still involved in SMS
processing, storage (in SQLite DB), and routing (via SMPP).
In real networks this is done by the external entity called
SMSC (SMS Centre), while the MSC is doing re-encapsulation
of GSM 04.11 SM-TL (Transport Layer) payload (i.e. TPDU)
between SM-RL (Relay Layer) and MAP.
Since OsmoMSC itself is not a 'Network in The Box' anymore, it
makes sense to replicate the 'traditional' behaviour of MSC.
The problem is that this behaviour cannot co-exist with the
current implementation, so the key idea is to rip out the
local SMS storage and routing from OsmoMSC, and (re)implement
it in a separate process (OsmoSMSC?).
As a temporary solution, this change introduces a 'kill-switch'
VTY option that enables routing of SMS messages over GSUP
towards ESME (through VLR and HLR), but breaks the local
storage and routing. This is why it's disabled by default.
As soon as we move the SMS processing and storage away from
OsmoMSC, this behaviour would be enabled by default, and
the VTY option would be hidden and deprecated. At the moment,
this option basically does nothing, and will take an effect
in the follow-up changes.
Change-Id: Ie57685ed2ce1e4c978e775b68fdffe58de44882b
Related: OS#3587
2018-11-19 23:20:53 +00:00
|
|
|
/* The "SMS over GSUP" kill-switch that basically breaks internal
|
|
|
|
* SMS routing (i.e. SQLite DB and SMPP), and enables forwarding
|
|
|
|
* of short messages over GSUP towards ESME (through VLR and HLR).
|
|
|
|
* Please see OS#3587 for details. This is a temporary solution,
|
|
|
|
* so it should be removed as soon as we move the SMS processing
|
|
|
|
* logic to an external process (OsmoSMSC?). REMOVE ME! */
|
|
|
|
bool sms_over_gsup;
|
|
|
|
|
2011-07-22 15:55:42 +00:00
|
|
|
/* control interface */
|
|
|
|
struct ctrl_handle *ctrl;
|
dyn TS: OS#1778 workaround: disable TCH/F on dyn TS for nitb
To avoid two phones picking mismatching TCH pchans, never pick TCH/F on dynamic
TS in osmo-nitb.
Add gsm_network flag dyn_ts_allow_tch_f, set to true by default in
gsm_network_init().
Set this flag to false in osmo-nitb's main().
See http://osmocom.org/issues/1778
Reasoning about ways to solve this:
* a compile time switch doesn't work because libbsc is first compiled and then
linked to both osmo-nitb and osmo-bsc.
* we could test net->bsc_api == msc_bsc_api(), but I have the so-called MSC
split waiting on branch sysmocom/cscn, which will result in msc_bsc_api() not
being linked in the osmo-bsc binary.
* have a function am_i_nitb() with different implementations in osmo-nitb and
osmo-bsc, but then we'd need to add implementations to all tests and other
binaries linking lchan_alloc().
* have a flag in struct bsc_api, but so far there are only function pointers
there.
Having a "global" flag in gsm_network allows to add a VTY command in case we
decide to keep this feature (#1781), has no linking implications and is nicely
explicit.
Tested that osmo-bsc still picks TCH/F on dyn TS indirectly, since I have no
standalone MSC available: when compiling osmo-nitb with the line that sets
dyn_ts_allow_tch_f = false commented out, TCH/F is picked as described in
OS#1778; and by printf-verifying that dyn_ts_allow_tch_f == true in osmo-bsc
main(), only osmo-nitb should have TCH/F disabled.
Related: OS#1778, OS#1781
Change-Id: If7e4797a72815fc6e2bbef27756ea5df69f4bde7
2016-07-23 18:15:28 +00:00
|
|
|
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
/* all active RAN connections. */
|
|
|
|
struct llist_head ran_conns;
|
2016-05-10 11:29:33 +00:00
|
|
|
|
|
|
|
/* if override is nonzero, this timezone data is used for all MM
|
|
|
|
* contexts. */
|
|
|
|
/* TODO: in OsmoNITB, tz-override used to be BTS-specific. To enable
|
|
|
|
* BTS|RNC specific timezone overrides for multi-tz networks in
|
2017-02-23 20:06:12 +00:00
|
|
|
* OsmoMSC, this should be tied to the location area code (LAC). */
|
2016-05-10 11:29:33 +00:00
|
|
|
struct gsm_tz tz;
|
add struct bsc_subscr, separating libbsc from gsm_subscriber
In a future commit, gsm_subscriber will be replaced by vlr_subscr, and it will
not make sense to use vlr_subscr in libbsc. Thus we need a dedicated BSC
subscriber: struct bsc_subscr.
Add rf_policy arg to bsc_grace_paging_request() because the bsc_subscr will no
longer have a backpointer to gsm_network (used to be via subscr->group).
Create a separate logging filter for the new BSC subscriber. The implementation
of adjusting the filter context is added in libbsc to not introduce
bsc_subscr_get/_put() dependencies to libcommon.
During Paging Response, fetch a bsc_subscr from the mobile identity, like we do
for the gsm_subscriber. It looks like a duplication now, but will make sense
for the VLR as well as for future MSC split patches.
Naming: it was requested to not name the new struct bsc_sub, because 'sub' is
too ambiguous. At the same time it would be fine to have 'bsc_sub_' as function
prefix. Instead of struct bsc_subscriber and bsc_sub_ prefix, I decided to
match both up as struct bsc_subscr and bsc_subscr_ function prefix. It's fast
to type, relatively short, unambiguous, and the naming is consistent.
Add bsc_subscr unit test.
Related: OS#1592, OS#1594
Change-Id: Ia61cc00e8bb186b976939a4fc8f7cf9ce6aa3d8e
2017-02-18 21:20:46 +00:00
|
|
|
|
2016-06-19 16:06:02 +00:00
|
|
|
/* MSC: GSUP server address of the HLR */
|
|
|
|
const char *gsup_server_addr_str;
|
|
|
|
uint16_t gsup_server_port;
|
|
|
|
|
|
|
|
struct vlr_instance *vlr;
|
mscsplit: various preparations to separate MSC from BSC
Disable large parts of the code that depend on BSC presence. The code sections
disabled by #if BEFORE_MSCSPLIT shall be modified or dropped in the course of
adding the A-interface.
Don't set msg->lchan nor msg->dst.
Don't use lchan in libmsc.
Decouple lac from bts.
Prepare entry/exit point for MSC -> BSC and MSC -> RNC communication:
Add msc_ifaces.[hc], a_iface.c, with a general msc_tx_dtap() to redirect to
different interfaces depending on the actual subscriber connection.
While iu_tx() is going to be functional fairly soon, the a_tx() is going to be
just a dummy for some time (see comment).
Add Iu specific fields in gsm_subscriber_connection: the UE connection pointer
and an indicator for the Integrity Protection status on Iu (to be fully
implemented in later commits).
Add lac member to gsm_subscriber_connection, to allow decoupling from
bts->location_area_code. The conn->lac will actually be set in iu.c in an
upcoming commit ("add iucs.[hc]").
move to libcommon-cs: gsm48_extract_mi(), gsm48_paging_extract_mi().
libmsc: duplicate gsm0808 / gsm48 functions (towards BSC).
In osmo-nitb, libmsc would directly call the functions on the BSC level, not
always via the bsc_api. When separating libmsc from libbsc, some functions are
missing from the linkage.
Hence duplicate these functions to libmsc, add an msc_ prefix for clarity, also
add a _tx to gsm0808_cipher_mode():
* add msc_gsm0808_tx_cipher_mode() (dummy/stub)
* add msc_gsm48_tx_mm_serv_ack()
* add msc_gsm48_tx_mm_serv_rej()
Call these from libmsc instead of
* gsm0808_cipher_mode()
* gsm48_tx_mm_serv_ack()
* gsm48_tx_mm_serv_rej()
Also add a comment related to msc_gsm0808_tx_cipher_mode() in two places.
Remove internal RTP streaming code; OsmoNITB supported that, but for OsmoMSC,
this will be done with an external MGCP gateway.
Remove LCHAN_MODIFY from internal MNCC state machine.
Temporarily disable all paging to be able to link libmsc without libbsc.
Skip the paging part of channel_test because the paging is now disabled.
Employ fake paging shims in order for msc_vlr_tests to still work.
msc_compl_l3(): publish in .h, tweak return value. Use new libmsc enum values
for return val, to avoid dependency on libbsc headers. Make callable from
other scopes: publish in osmo_msc.h and remove 'static' in osmo_msc.c
add gsm_encr to subscr_conn
move subscr_request to gsm_subscriber.h
subscr_request_channel() -> subscr_request_conn()
move to libmsc: osmo_stats_vty_add_cmds()
gsm_04_08: remove apply_codec_restrictions()
gsm0408_test: use NULL for root ctx
move to libbsc: gsm_bts_neighbor()
move to libbsc: lchan_next_meas_rep()
move vty config for t3212 to network level (periodic lu)
remove unneccessary linking from some tests
remove handle_abisip_signal()
abis_rsl.c: don't use libvlr from libbsc
gsm_subscriber_connection: put the LAC here, so that it is available without
accessing conn->bts. In bsc_api.c, place this lac in conn for the sake of
transition: Iu and A will use this new field to pass the LAC around, but in a
completely separate OsmoBSC this is not actually needed. It can be removed
again from osmo-bsc.git when the time has come.
Siemens MRPCI: completely drop sending the MRPCI messages for now, they shall
be added in osmo-bsc once the A-Interface code has settled. See OS#2389.
Related: OS#1845 OS#2257 OS#2389
Change-Id: Id3705236350d5f69e447046b0a764bbabc3d493c
2017-05-08 13:12:20 +00:00
|
|
|
|
|
|
|
/* Periodic location update default value */
|
|
|
|
uint8_t t3212;
|
2016-05-20 19:59:55 +00:00
|
|
|
|
2018-10-10 15:00:49 +00:00
|
|
|
/* Global MNCC guard timer value */
|
|
|
|
int mncc_guard_timeout;
|
|
|
|
|
2016-05-20 19:59:55 +00:00
|
|
|
struct {
|
2017-09-03 23:03:58 +00:00
|
|
|
struct mgcp_client_conf conf;
|
|
|
|
struct mgcp_client *client;
|
|
|
|
} mgw;
|
2016-05-20 19:59:55 +00:00
|
|
|
|
2018-03-15 11:55:46 +00:00
|
|
|
#if BUILD_IU
|
2016-05-20 19:59:55 +00:00
|
|
|
struct {
|
2017-04-09 10:32:51 +00:00
|
|
|
/* CS7 instance id number (set via VTY) */
|
|
|
|
uint32_t cs7_instance;
|
2018-03-15 11:55:46 +00:00
|
|
|
enum ranap_nsap_addr_enc rab_assign_addr_enc;
|
2017-04-09 10:32:51 +00:00
|
|
|
struct osmo_sccp_instance *sccp;
|
2016-05-20 19:59:55 +00:00
|
|
|
} iu;
|
2018-03-15 11:55:46 +00:00
|
|
|
#endif
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
struct {
|
|
|
|
/* CS7 instance id number (set via VTY) */
|
|
|
|
uint32_t cs7_instance;
|
|
|
|
/* A list with the context information about
|
|
|
|
* all BSCs we have connections with */
|
|
|
|
struct llist_head bscs;
|
|
|
|
struct osmo_sccp_instance *sccp;
|
|
|
|
} a;
|
2018-02-09 19:41:14 +00:00
|
|
|
|
|
|
|
struct {
|
|
|
|
/* MSISDN to which to route MO emergency calls */
|
|
|
|
char *route_to_msisdn;
|
|
|
|
} emergency;
|
2018-12-06 11:06:59 +00:00
|
|
|
|
|
|
|
/* This is transmitted as IPA Serial Number tag, which is used for GSUP routing (e.g. in OsmoHLR).
|
|
|
|
* For inter-MSC handover, the remote MSC's neighbor configuration requires to match this name.
|
|
|
|
* If no name is set, the IPA Serial Number will be the same as the Unit Name,
|
|
|
|
* and will be of the form 'MSC-00-00-00-00-00-00' */
|
|
|
|
char *msc_ipa_name;
|
2008-12-23 20:25:15 +00:00
|
|
|
};
|
|
|
|
|
2012-11-08 18:44:08 +00:00
|
|
|
struct osmo_esme;
|
|
|
|
|
|
|
|
enum gsm_sms_source_id {
|
|
|
|
SMS_SOURCE_UNKNOWN = 0,
|
|
|
|
SMS_SOURCE_MS, /* received from MS */
|
|
|
|
SMS_SOURCE_VTY, /* received from VTY */
|
|
|
|
SMS_SOURCE_SMPP, /* received via SMPP */
|
|
|
|
};
|
|
|
|
|
2009-03-30 20:56:32 +00:00
|
|
|
#define SMS_HDR_SIZE 128
|
|
|
|
#define SMS_TEXT_SIZE 256
|
2012-11-23 18:02:37 +00:00
|
|
|
|
|
|
|
struct gsm_sms_addr {
|
|
|
|
uint8_t ton;
|
|
|
|
uint8_t npi;
|
|
|
|
char addr[21+1];
|
|
|
|
};
|
|
|
|
|
2009-03-30 20:56:32 +00:00
|
|
|
struct gsm_sms {
|
2009-11-06 15:06:19 +00:00
|
|
|
unsigned long long id;
|
2016-06-19 16:06:02 +00:00
|
|
|
struct vlr_subscr *receiver;
|
2012-11-23 22:35:01 +00:00
|
|
|
struct gsm_sms_addr src, dst;
|
2012-11-08 18:44:08 +00:00
|
|
|
enum gsm_sms_source_id source;
|
|
|
|
|
libmsc: send RP-ACK to MS after ESME sends SMPP DELIVER-SM-RESP
Hold on with the GSM 04.11 RP-ACK/RP-ERROR that we send to the MS until
we get a confirmation from the ESME, via SMPP DELIVER-SM-RESP, that we
can route this sms somewhere we can reach indeed.
After this change, the conversation looks like this:
MS GSM 03.40 SMSC SMPP 3.4 ESME
| | |
| SMS-SUBMIT | |
|------------------->| |
| | DELIVER-SM |
| |---------------->|
| | |
| | DELIVER-SM-RESP |
| |<----------------|
| GSM 04.11 RP-ACK | |
|<-------------------| |
| | |
Before this patch, the RP-ACK was sent back straight forward to the MS,
no matter if the sms can be route by the ESME or not. Thus, the user
ends up getting a misleading "message delivered" in their phone screen,
when the message may just be unroutable by the ESME hence silently
dropped.
If we get no reply from the ESME, there is a hardcoded timer that will
expire to send back an RP-ERROR to the MS indicating that network is
out-of-order. Currently this timer is arbitrarily set to 5 seconds. I
found no specific good default value on the SMPP 3.4 specs, section 7.2,
where the response_timer is described. There must be a place that
describes a better default value for this. We could also expose this
timer through VTY for configurability reasons, to be done later.
Given all this needs to happen asyncronously, ie. block the SMSC, this
patch extends the gsm_sms structure with two new fields to annotate
useful information to send the RP-ACK/RP-ERROR back to the MS of origin.
These new fields are:
* the GSM 04.07 transaction id, to look up for the gsm_trans object.
* the GSM 04.11 message reference so the MS of origin can correlate this
response to its original request.
Tested here using python-libsmpp script that replies with
DELIVER_SM_RESP and status code 0x0b (Invalid Destination). I can see
here on my motorola C155 that message cannot be delivered. I have tested
with the success status code in the SMPP DELIVER_SM_RESP too.
Change-Id: I0d5bd5693fed6d4f4bd2951711c7888712507bfd
2017-05-04 16:44:22 +00:00
|
|
|
struct {
|
|
|
|
uint8_t transaction_id;
|
|
|
|
uint32_t msg_ref;
|
|
|
|
} gsm411;
|
|
|
|
|
2012-11-08 18:44:08 +00:00
|
|
|
struct {
|
|
|
|
struct osmo_esme *esme;
|
|
|
|
uint32_t sequence_nr;
|
|
|
|
int transaction_mode;
|
|
|
|
char msg_id[16];
|
|
|
|
} smpp;
|
2009-03-30 20:56:32 +00:00
|
|
|
|
2009-07-05 12:02:46 +00:00
|
|
|
unsigned long validity_minutes;
|
2017-08-16 20:45:07 +00:00
|
|
|
time_t created;
|
2017-08-07 13:01:30 +00:00
|
|
|
bool is_report;
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t reply_path_req;
|
|
|
|
uint8_t status_rep_req;
|
|
|
|
uint8_t ud_hdr_ind;
|
|
|
|
uint8_t protocol_id;
|
|
|
|
uint8_t data_coding_scheme;
|
|
|
|
uint8_t msg_ref;
|
|
|
|
uint8_t user_data_len;
|
|
|
|
uint8_t user_data[SMS_TEXT_SIZE];
|
2009-07-27 18:11:35 +00:00
|
|
|
|
2009-03-30 20:56:32 +00:00
|
|
|
char text[SMS_TEXT_SIZE];
|
|
|
|
};
|
|
|
|
|
2013-01-09 16:03:27 +00:00
|
|
|
/* control interface handling */
|
|
|
|
int bsc_base_ctrl_cmds_install(void);
|
2016-06-19 16:06:02 +00:00
|
|
|
int msc_ctrl_cmds_install(struct gsm_network *net);
|
2013-01-09 16:03:27 +00:00
|
|
|
|
2011-05-25 11:10:08 +00:00
|
|
|
#endif /* _GSM_DATA_H */
|