Commit Graph

6454 Commits

Author SHA1 Message Date
Max d83b17b3c7 Constify msc_subscr_conn_is_accepted() parameter
Related: OS#2864
Change-Id: I8af50a8847a5b438cf2ef660399d4c8bbac86a71
2018-02-07 12:04:56 +01:00
Max 5e2e9bd0be Fix whitespace issues
We don't usually put space before in-place increment or decrement. Let's
make code look similar to other Osmocom projects.

Change-Id: I5962431ad16c97e412939dc1b8949f6361a5c26e
2018-02-06 19:31:08 +01:00
Philipp Maier 621ba032bd mgcp: use osmo-mgw to switch rtp streams
in the current implementation we still use osmo-bsc_mgcp, which
has many problems and is also obsoleted by osmo-mgw.

integrate osmo-mgw and re-implement the current switching using
an osmo fsm.

Depends: osmo-mgw Iab6a6038e7610c62f34e642cd49c93d11151252c
Depends: osmo-iuh I3c1a0455c5f25cae41ee19229d6daf299e023062
Closes: OS#2605
Change-Id: Ieea9630358b3963261fa1993cf1f3b563ff23538
2018-02-05 22:28:43 +00:00
Philipp Maier 64dbc5464c a_iface: correct data type for a.conn_id in gsm_subscriber_connection
conn_id is modeled as int, but should be uint32_t.

- change conn_id from int to uint32_t

Change-Id: Ibf14d7c9a547c4eeb873975e7dcddef223e7df46
Related: OS#2769
2018-02-05 22:20:20 +00:00
Max 98f7467ac8 Wrap osmo_strlcpy() calls
Using following semantic patch:
@@ expression A, B, C; @@
- osmo_strlcpy(A, B, sizeof(A));
+ OSMO_STRLCPY_ARRAY(A, B);

Which was applied using following command:
spatch --dir src -I src --sp-file strlcpy.spatch --in-place --recursive-includes

All the calls to osmo_strlcpy() which use destination buffer obtained
via sizeof() were replaced with the corresponding wrapper macro.

Change-Id: I67b482dedfa11237ac21894fc5930039e12434ab
Related: OS#2864
2018-02-05 12:57:06 +01:00
Harald Welte c2007855ce Implement checks for duplicate uplink UL L3 message
According to TS 24.007 Section 11.2.3.2.3, it is possible that uplink L3
messages are duplicated in some scenarios, particularly during
assignment/handover procedure.

To avoid L3 entities from seeing duplicated messages, there's a modulo-2
or modulo-4 message sequence counter, based on which the MSC can detect
and suppress such duplicate messages.

It appears that even our unit tests were wrong in that regard so far.
Rather than manually adjusting each and every message, let's make sure
that the sequence number generation always increments as expected, and
that during matching of incoming messages, sequence numbers are masked
out.

Note: the tests will only pass from libosmocore Change-Id
Iec875a77f5458322dfbef174f5abfc0e8c09d464 onwards, due to
gsm48_hdr_msg_type() being broken in earlier versions.

Change-Id: Id15e399ab7e1b05dcd426b292886fa19d36082b1
Closes: #2908
2018-02-03 20:30:03 +00:00
Stefan Sperling 6d28981912 Make sending an SMS to an unknown subscriber B work over SMPP.
Make the submit_to_sms() funcion aware of the message mode. If the
message does not require real-time "transactional/forward mode" we
can store it in the SMS database even if subscriber B cannot be
found in the VLR at this point in time.

This should should make the esme_ms_sms_storeforward test in
osmo-gsm-tester pass (a tweak to this test's expectations will
be needed as well, because the test currently assumes that an
invalid phone number for subscriber B will fail immediately,
rather than cause the message to eventually expire).

Change-Id: Ic3d78919568ad9252b4d19c3ddab5068d1c52db2
Related: OS#2354
2018-01-31 19:49:48 +00:00
Max cd31f7a34f Remove unused code
The socket.* is unused leftover from pre-split time.

Fixes: CID57645
Change-Id: Ibf3b539fcbd7f311caa2291af23b8f18ebc6c2e0
2018-01-30 18:12:52 +01:00
Harald Welte 327c2f5beb Change GSUP re-connect interval to 1s
This leads to faster recovery in case of link loss.

It also makes the TTCN-3 test suite run much faster, as each test case
will inherently terminate the GSUP connection.

Change-Id: I16821a26f2c6ff4d0a76926c9212127ab6f6fedf
2018-01-28 00:14:25 +00:00
Harald Welte 71330720b6 MSC: Intersect configured A5 algorithms with MS-supported ones
There's no point of ever asking a MS to perform ciphering using an
algorithm it advertises no support for.  Let's hence use CLASSMARK
information to figure out the intersection between MSC policy (VTY
command) and MS-reported CLASSMARK.

Change-Id: Id124923ee52a357cb7d3e04d33f585214774f3a3
2018-01-28 00:09:43 +00:00
Harald Welte 7b222aa106 Permit a set of multiple different A5 ciphers
So far, the administrator had to pick one particular cipher which
would then be used throughout all subscribers/phones. This is a bit
impractical, as e.g. not all phones support A5/3.  Extend the VTY
command syntax in a backwards-compatible way to permit for multiple
ciphers.

NOTE: Like the previous code, OsmoMSC does *not yet check* whether
the configured cipher is compatible with the MS capabilities as
reported in CLASSMARK!  The network hence might choose an algorithm
not supported by the phone.  Fixing this is subject to another patch.

Closes: OS#2460
Change-Id: I79a4e2892eb5fbecc3d84e11dceffb7149db264b
2018-01-28 00:09:42 +00:00
Harald Welte 71c51df07d Shift ciphering algorithm selection from VLR to MSC
The VLR code seems to have the assumption that there is one particular
algorithm to be used, as opposed to one of a set of algorithms.

What's missing is basically to decide when/where to pick the best
algorithm within the capabilities of the phone (classmark) and the
network configuration (net->a5_encryption_mask).  So far, libvlr has no
notion of classmark.  Rather, libmsc has.

Why does the VLR care about the particular algorithm at all?  The VLR
should probably simply decide if it should use encryption or not, and if
so, the MSC will figure which algorithm to use.

Change-Id: I5ed80ca2086560a5975a758ec568a034a9a8ab89
2018-01-28 00:09:41 +00:00
Stefan Sperling 14e051776f Delete expired SMS automatically.
Delete expired SMS whenever we are done processing an SMS-related signal.
In order to minimize additional latency only one SMS is removed at a time.

Change-Id: I56cbe716e52b679c4b94f6cbb4a171306975be2e
Related: OS#2354
2018-01-25 20:30:40 +00:00
Stefan Sperling 1e67fea7ba Accept SMS for any receiver
Accept any SMS and store it in the database, even if the receiver of
the message cannot be determined when the message arrives at the MSC.

This fixes https://osmocom.org/issues/2354 ("SMSC: Store&Forward not
working for subscribed but unregistered MS").

Change-Id: I833c3abd290d2bc5fceec7457e3933c9600e6c24
Depends: Icd6093b7b5d8db84b19a0aa47c68182566113ee2
Depends: I56cbe716e52b679c4b94f6cbb4a171306975be2e
Depends: Icf786f9b1efabfe7407fb6414ec0d326d8f7244a
Related: OS#2354
2018-01-25 16:16:38 +00:00
Stefan Sperling 87cba1f105 Add a VTY command which deletes all expired SMS.
We already delete SMS which have been sent successfully. However, there
are plans to accept SMS for any subscriber in order to fix the problem
described in https://osmocom.org/issues/2354 ("SMSC: Store&Forward not
working for subscribed but unregistered MS").

This means we may end up storing SMS which never get sent, e.g. because
the B subscriber doesn't actually exist. This could lead to a higher
degree of SMS database growth over time, and therefore we need a way
to keep database size under control.

As a first step, introduce a DB function which removes an expired SMS,
and add a VTY command which removes all expired SMS from the DB.

Later commits will build upon this to remove expired SMS automatically.

The SMS expiry time period is currently hard-coded to 2 weeks.
We could make this configurable in the future if desired.

Change-Id: Icd6093b7b5d8db84b19a0aa47c68182566113ee2
Related: OS#2354
2018-01-25 16:16:15 +00:00
Harald Welte 703f2ec6f4 debug: Remove dead log categories
Change-Id: Ibdfc39ead4f0c5e3a74321e9d2c9720ae1603541
Related: OS#2528
2018-01-25 00:38:11 +01:00
Harald Welte 45f234c634 remove dead ctrl.h header file
Change-Id: I3ea0d98580085982ec0f20165c0ddcfd439e7419
Related: OS#2528
2018-01-25 00:38:09 +01:00
Harald Welte b752cc5ffc signal.h: Remove unused/dead signal definitions
Change-Id: Iba5be82e11fa1d5e5514bc86d8ec23cda24ae4c9
Related: OS#2528
2018-01-25 00:38:08 +01:00
Harald Welte 4bd35d4460 remove dead header files bsc_msc.h, bsc_msc_data.h and bsc_rll.h
Related: OS#2528
Change-Id: I13cc4513689af1d594952dd628738b1240560bb7
2018-01-25 00:38:06 +01:00
Harald Welte 51c65e8230 remove dead code in auth.h / auth.c
Change-Id: I57e3b79a95a35c4783dc3775a88d15f13cbec13e
Related: OS#2528
2018-01-25 00:38:05 +01:00
Harald Welte 6ffc95cb25 remove unused ipaccess.h
Change-Id: Ibee159a119a1cce2b3fcbdabf3491673aed4ea95
Related: OS#2528
2018-01-25 00:38:03 +01:00
Harald Welte d35038d229 Massive removal of unused code/structs/headers
osmo-msc still had large amounts of dead code that came along from
openbsc.git.  This commit removes a lot of it, mostly stuff relevant
only to the BSC side of things (or even GPRS).

Change-Id: I247def85da2dc3ec461389fb74414a0d964e7e3c
Related: OS#2528
2018-01-25 00:18:05 +01:00
Harald Welte 8b1cba8421 jenkins.sh: Don't depend on osmo-ggsn
There's nothing GPRS related left in osmo-msc, and hence no reason
why we should build osmo-ggsn as a build dependency.

Change-Id: I096f63e471dc8fdbd42a78f67d433f61b830615b
2018-01-25 00:18:05 +01:00
Harald Welte a3ab1de7dc remove traces of bsc_subscriber
Change-Id: I8672f0a76cb47595444a7ddbc4f34fc4ddaeb375
2018-01-24 23:29:51 +01:00
Harald Welte 4ab0a490ae debug: Remove code for filters that don't exist in OsmoMSC
We don't have BSC or GPRS related logging filters here.
This is a leftover from the NITB->MSC split

Change-Id: I05f991d1f5b7f89545521a73d79619bee4111094
2018-01-24 23:29:51 +01:00
Harald Welte a5e51ec7d7 remove unused paging.h and osmo_bsc_grace.h
Change-Id: I6af40f65f0634e49939906a3e50a41e0be246794
2018-01-24 23:29:51 +01:00
Harald Welte 284c39af2a msc_cipher_mode_compl: Handle CIPH MOD COMPL without L3 message
According to TS 44.008 Section 3.2.1.31, the "Layer 3 Message Contents"
IE of the BSSMAP Cipher Mode Complete is optional. The BSC may hence
inlcude that IE or not include it.

Without this patch, OsmoMSC is crashing if that IE was missing:

<000a> a_iface_bssap.c:699 Rx BSC DT: 00 03 55 2c 02
<000a> a_iface_bssap.c:629 Rx MSC DT1 BSSMAP CIPHER MODE COMPLETE
<001f> a_iface_bssap.c:91 Found A subscriber for conn_id 1
<000a> a_iface_bssap.c:415 BSC sends cipher mode complete (conn_id=1)
==5611== Invalid read of size 8
==5611==    at 0x128D0F: msc_cipher_mode_compl (osmo_msc.c:159)
==5611==    by 0x114F62: bssmap_rx_ciph_compl.isra.8 (a_iface_bssap.c:432)
==5611==    by 0x113267: sccp_sap_up (a_iface.c:520)

Change-Id: I722f9b468b157b3736918f090daaa9489a6028ee
Closes: OS#2871
2018-01-24 23:12:15 +01:00
Harald Welte 49f8fcbd94 Properly reject CM Re-Establishment Request
Even if we're not implementing CM re-establishment, we should give
the MS a clear indication that we don't do and follow the related
procedures of TS 24.008 by sending CM SERVICE REJECT.

Closes: OS#2869
Change-Id: I1c0473647295456fd635b8df6079ee48695dcf2e
2018-01-24 22:57:20 +01:00
Harald Welte 80315ef6b5 Fix msc_vlr test results (.err) for new libosmocore GSM48_PDISC names
In I8de7c01f9ea1d66c384e57449c4140186f5ce6c5, libosmocore introduced
shorter names in gsm48_pdisc_names, which has implications on the
expected test output

Change-Id: I4421872a0d609dd50a6b911b928aa5e111d1ad24
2018-01-24 22:55:05 +01:00
Harald Welte a1c5de45c1 Remove traces of meas_feed
Measurement reporting (and the relate feed) are functions of the BSC,
not the MSC.  This code should never have been inherited from OsmoNITB
to OsmoMSC in the first place, let's remove it.

Change-Id: I0d57ac214e574e267fa9752daf76566197b9aa64
2018-01-24 14:04:46 +00:00
Harald Welte 37382ec2cf Reject any CM SERVICE we don't support
When we receive a CM Service Request, OsmoMSC should eventually verify
what kind of service it is the phone requests, and whether we support
that service.

Change-Id: I499730d760dc9ac7f599e09959c6eac4452f2eab
Closes: OS#2668
2018-01-24 14:04:46 +00:00
Harald Welte 3995d2ea85 Refuse Emergency Calls by IMEI with proper CM SERVICE REJECT Cause
OsmoMSC rejects an Emergency Call with IMEI as mobile identity with
"semantically incorrect message" which is clearly wrong. According to TS
24.008 4.5.1.5 we should reject with cause 5 "IMEI not accepted"

Found with TTCN-3 test case MSC_Tests.TC_emerg_call_imei

Change-Id: I2f7ab0e32b914a112c0b17c523d149ccd0299099
Closes: #2866
2018-01-24 14:04:46 +00:00
Harald Welte 0dd013770e Emergency Call: Set MNCC_F_EMERGENCY flag
MNCC has a MNCC_F_EMERGENCY flag to indicate that the mncc.emergency
field is present. However, OsmoMSC never sets this flag.

Change-Id: I0ebd8f88e483172988f4a0cb0636b4160688d8ad
Closes: OS#2865
2018-01-24 14:04:45 +00:00
Harald Welte 79826e104a Log difference between SETUP and EMERGENCY_SETUP
An emergency call should be logged different from a normal call,
and we also increase the log level from INFO to NOTICE in such a
situation.

Change-Id: I83f3b8bd0aeda70f03aa7b8d264a9008d10d5687
2018-01-24 14:04:45 +00:00
Max c309fe37c5 cosmetic: log prim operation as text
When logging SCCP error, log failed primitive operation as text.

Change-Id: Icda9f8f18aacc7bcc281aad5fbb89208e6dab336
Related: OS#2851
2018-01-24 14:03:54 +00:00
Max 923a23900e VLR: constify GSUP-related function parameters
Change-Id: If3852e096210713cb5297f6b42ed66dbb98c4a50
2018-01-24 13:55:03 +01:00
Harald Welte 5718429ec9 MNCC: Add input validation
There appears to have been no input validation whatsoever on MNCC
messages.  Hence it was very easy for an external MNCC handler to
crash OsmoMSC, such as in OS#2853

Change-Id: Idaf3b8e409c84564b1eb26d01a19c605f89b14f4
Closes: OS#2853
2018-01-23 17:03:05 +00:00
Stefan Sperling 3b26f34950 Fix value of stored SMS validity time.
Quote the argument to sqlite's datetime(). Otherwise, the timestamp
stored in the database reads back as a negative value for some reason.

Before:

1032            validity_timestamp = dbi_result_get_datetime(result, "valid_until");
(gdb) p validity_timestamp
$2 = -1516814654

After:

1032            validity_timestamp = dbi_result_get_datetime(result, "valid_until");
(gdb) p validity_timestamp
$2 = 1516814654

Change-Id: Icf786f9b1efabfe7407fb6414ec0d326d8f7244a
2018-01-23 16:57:52 +00:00
Pau Espin b8c0cf8d09 libmsc: msc_vty: Fix compilation warning
As the include file gsm_data.h is generic (does not depend on osmo-iuh0s
iu_client.h), rab_assign_addr_enc is declared as "int" instead of "enum ranap_nsap_addr_enc".

osmo-msc/src/libmsc/msc_vty.c: In function ‘msc_vty_init’:
osmo-msc/src/libmsc/msc_vty.c:212:30: warning: passing argument 2 of ‘ranap_iu_vty_init’ from incompatible pointer type [-Wincompatible-pointer-types]
  ranap_iu_vty_init(MSC_NODE, &msc_network->iu.rab_assign_addr_enc);
                              ^

Change-Id: I1b63ee350911bdf772a2324fff55035275a455c4
2018-01-22 13:49:55 +01:00
Stefan Sperling d494162c9c Store/retrieve SMS validity time in the SMS datebase
Compute a validity timestamp based on SMS validity time.
Store the computed value in the database and recompute the validity
time when an SMS is read from the database.

Change-Id: Id27c250d3a64cd109416450e8ca155b18a8b9568
2018-01-20 15:02:40 +00:00
Stefan Sperling 6ba2d5a9f7 Delete SMS from the database once they were sent successfully
Currently the SMS database keeps accumulating entries for each SMS.
These entries are never deleted automatically. With this change, we
start deleting SMS which have successfully been sent to subscriber B.

Change-Id: I3749855fe25d9d4e37ec96b0c2bffbc692b66a78
2018-01-18 18:55:26 +01:00
Stefan Sperling 832046d383 Improve an error message in db_init().
If we cannot open a connection to the sqlite3 database, show the name of the
database we failed to access, and also hint at the fact that a likely reason
for the problem is a missing sqlite3 driver for libdbi.

Change-Id: If1c0026e882984b4358ce116ec4a7ad40340517c
2018-01-16 14:21:16 +01:00
Neels Hofmeyr ce4e984fe8 fix build: missing LIBOSMORANAP flags in libmsc
Change-Id: I2f498a2d008571d3eb8753bede0847fa7ab704ed
2018-01-16 14:06:36 +01:00
Vadim Yanitskiy b274d56dbb src/libmsc/ussd.c: drop useless forward declaration
There is no any significant reason to define static function
'send_own_number' after the code that calls it.

Change-Id: I7f76f278c09489dccd96921610e8d06efa679ff2
2018-01-10 22:17:37 +06:00
Vadim Yanitskiy 6e19d1b2d5 msc/gsm_04_80.h: use '#pragma once' instead of includes
This is a common include guard way for Osmocom projects.

Change-Id: I5a12a742719d4deba0b9dfa8bb330c1986a727f6
2018-01-10 22:17:37 +06:00
Vadim Yanitskiy 0774a539da msc/gsm_04_80.h: cosmetic: whitespace fix
Change-Id: Ia3632c75cf2d2ce79b42b3b55ef50a72ab1bb94c
2018-01-10 22:17:31 +06:00
Vadim Yanitskiy 7c93591b2c msc/gsm_04_80.h: clean up useless declarations
This change removes a few USSD specific declarations, which are
not actually used now, and probably accidentally migrated from
legacy OpenBSC.

Change-Id: Id57a24b92790d3ce0f9c7343d060f511e2b979c7
2018-01-10 18:09:16 +06:00
Neels Hofmeyr 563e1dbef2 a_iface_tx_assignment: fix log lvl for "Sending Assignment..."
Change-Id: I42bd3dc601465a4ac6a6e2bf8c4af736547d4838
2018-01-08 12:56:27 +00:00
the 34c3 gsm team cfab83e642 smpp_smsc.c: don't talloc_strdup NULL pointers
Change-Id: Ie6a83a20464a959cf51f999d6f900fa4516ced1b
2018-01-07 19:04:10 +01:00
Max dcc193d3a6 Add control command to expire subscriber
It's equivalent of existing vty command: common part is extracted into
shared helper function.

Change-Id: I267886b7c79ed6d9c2f34a2e60d2972b7f4f4036
2018-01-05 10:10:35 +00:00