Commit Graph

6607 Commits

Author SHA1 Message Date
Neels Hofmeyr 29ab4a799a drop unused openbscdefines.h
Change-Id: If35cd49baa4d0a3b38f31736e1696f481babba9c
2018-11-30 22:44:23 +01:00
Vadim Yanitskiy 14e32a41d8 libmsc/gsm_04_11.c: fix: always use SAPI 3 for MT SMS
In I4a07ece80d8dd40b23da6bb1ffc9d3d745b54092 I've introduced a
regression. According to GSM TS 04.11, section 2.3, SAPI 3 shall
be used for both MO/MT SMS transmissions. Due to a mistake,
caused by misunderstanding of the meaning of trans->dlci, SAPI 3
was not assigned to SM transactions if there is already an active
RAN connection with subscriber. Let's fix this.

Let's also drop this misleading comment:

  /* FIXME: specify SACCH in case we already have active TCH */

because it's a task of the BSC/BTS to decide which lchan to use.

Change-Id: I08d0801a89d377441e95fb8e3dd27c8d587f89e9
Related: OS#3716
2018-11-30 19:43:28 +00:00
Neels Hofmeyr f9773b0b97 drop unused gsm_network->handover.active
gsm_network contains an int handover.active which is always zero. Drop it.

There is real handover code coming up soon, one part of this is to avoid
confusion.

The internal MNCC code queried it to decide whether to MNCC_BRIDGE or proxy RTP
(MNCC_FRAME_RECV). Since RTP is being handled by osmo-mgw since forever, drop
that entire condition from mncc_builtin.

Change-Id: Ie16e718266882588b38297121364ca0b7fdfe948
2018-11-30 04:56:59 +01:00
Neels Hofmeyr 344ee30bd4 drop unused gsm_subscr_conn->mncc_rtp_bridge
Change-Id: I322dc18cfe2cc573744261df837e719b5cf224ba
2018-11-30 04:49:12 +01:00
Vadim Yanitskiy 24e025e3e2 libmsc/gsm_04_11.c: refactor MT SMS message handling
According to GSM TS 04.11, the SMC (Short Message Control) state
machine is a part of CM-sublayer of L3, that is responsible for
connection management (establisment and releasing), and SM-RP
(Relay Protocol) message delivery.

For some reason, the connection establisment request from SMC
(GSM411_MMSMS_EST_REQ) was not handled properly - it was
always assumed that connection is already established.

This is why the code initiating a MT (Mobile Terminated) SMS
transfer had to establish a radio connection with subscriber
manually.

Let's benefit from having the SMC state machine, and offload
connection establishment to it. This change makes the local
implementation closer to GSM TS 04.11, and facilitates the
further integration of GSUP transport.

NOTE: the expected unit test output is changed, because now we
always allocate a transaction first, and then establish a
connection, not vice versa.

Change-Id: I4a07ece80d8dd40b23da6bb1ffc9d3d745b54092
2018-11-29 02:54:54 +07:00
Ivan Kluchnikov 9bd4fd601a libmsc/transaction: introduce trans_find_by_sm_rp_mr()
According to GSM TS 04.11, section 8.2.3, the RP Message Reference
is a mandatory field for all messages on the SM-RL (SM Relay Layer),
that is used to link an RP-ACK or RP-ERROR message to the associated
(preceding) RP-DATA or RP-SMMA message transfer attempt.

This change extends the transaction state structure with SM-RP-MR,
and introduces a new function for matching transactions within a
given connection by this reference.

Change-Id: Ice47c37ecef4416e65ecee8931d946c915316791
2018-11-29 02:54:54 +07:00
Vadim Yanitskiy 87c7ea3c5a libmsc/gsm_09_11.c: drop redundant assertion of stored msgb
It's already asserted at the beginning of handle_paging_event().

Change-Id: Ia558e11c6bde7bff130e4b76a4402ecc8068f1ed
2018-11-28 17:01:29 +00:00
Oliver Smith 39093768ca build manuals moved here from osmo-gsm-manuals.git
Moved to doc/manuals/, with full commit history, in preceding merge commit.
Now incorporate in the build system.

Build with:

$ autoreconf -fi
$ ./configure --enable-manuals
$ make

Shared files from osmo-gsm-manuals.git are found automatically if
- the repository is checked out in ../osmo-gsm-manuals; or
- if it osmo-gsm-manuals was installed with "make install"; or
- OSMO_GSM_MANUALS_DIR is set.

Related: OS#3385
Change-Id: Ic3c5add3c87f0aadb1ffab668ce16be6d0805d33
2018-11-27 17:50:54 +01:00
Neels Hofmeyr d9fb15603e Merge history from osmo-gsm-manuals.git
Change-Id: I30ec6b3bc18fa36e7bad74ca445bc9949dcefe80
2018-11-27 17:44:56 +01:00
Neels Hofmeyr ab3ade70c4 msc: update vty reference
Change-Id: I31f1d388b5323af8ece8a71a82c1b91f80d404e1
2018-11-27 17:43:39 +01:00
Daniel Willmann 020a485287 OsmoBSC/HLR/MSC: Fix default config file name
Mention that the default is not openbsc.cfg, but osmo-*.cfg

Change-Id: I139e6004e28d6f918f31792e634214a6153edd0e
2018-11-27 17:43:39 +01:00
Harald Welte 732443c3b8 add SGs / CSFB related dot + msc files
Those graphs + message sequence charts are not yet used by any
of our manuals, but they should become used by the OsmoMSC user
manual once SGs interface support is added.

Related: OS#2583
Change-Id: Idfd3a66c18131b5458d183b8e66f62eaaab65991
2018-11-27 17:43:39 +01:00
Harald Welte d89f1d18cb vty-ref: Update URI of docbook 5.0 schema
... to match the /etc/xml/catalog file on debian (no "www" in hostname)

Change-Id: Id9f3579c7f2bc3af13fe30b5268f249b6f59ed0d
2018-11-27 17:43:39 +01:00
Neels Hofmeyr df7d7ffc52 OsmoMSC: update VTY reference
This is the first update since the libosmocore changes to the 'show
online-help' generated output. Hence the produced document now benefits from
the structural improvements:
- not repeating common commands for every node;
- using section names that match the VTY prompt.

Update msc_vty_additions.xml to match the new node ID scheme.

Change-Id: I6f1698dbc205334cf69234f88b124abfce54cc9a
2018-11-27 17:43:39 +01:00
Harald Welte 593bbb5e5e share chapters/gsup.adoc from OsmoSGSN to OsmoMSC + OsmoHLR
Since the NITB split, GSUP is used in all three network elements, so
make the protocol a shared chapter

Change-Id: Id2d7c27ef16eb0ebe5f60d625a1fcf42f1603f4f
2018-11-27 17:43:39 +01:00
Alexander Couzens 7fd0e0fd64 OsmoMSC: add rate counter documentation
Change-Id: Idc105fd16511c6ea4f5069a57b217ea3319bdbec
2018-11-27 17:43:39 +01:00
Neels Hofmeyr adfbd3b8d6 refactor Makefile build rules, don't use the FORCE
The initial goal was to make sure we don't have overall FORCE rules causing
unnecessary rebuilds -- annoying while writing documentation. As I looked
through possible dependencies, I finally understood what's going on here.

Remove code dup and nicely sort which belongs where in build/Makefile.*.inc. In
each, describe in a top comment how to use it, and also unify how they are
used:

- Rename Makefile.inc to Makefile.docbook.inc and refactor
- Add Makefile.vty-reference.inc
- Add Makefile.common.inc

Make sure that we accurately pick up all dependencies.

Drop use of the macro called 'command', that silenced the actual command lines
invoked and replaced them with short strings: it obscures what is actually
going on and makes the Makefiles hard to read and understand.

Each manual's makefile is greatly reduced to few definitions and a Makefile
include, e.g. one for asciidoc, one for VTY reference.

Move common/bsc_vty_additions.xml to OsmoBSC/vty/libbsc_vty_additions.xml, link
from OsmoNITB. It applies only to OsmoBSC and OsmoNITB.

Add a script that combines a VTY reference file with *all* additions files
found in a manual's vty/ dir. Call this from Makefile.vty-reference.inc.

Change-Id: I9758e04162a480e28c7dc83475b514cf7fd25ec0
2018-11-27 17:43:39 +01:00
Neels Hofmeyr fee9dd7902 add OsmoHLR manual, OsmoHLR VTY reference
Change-Id: Ieb6a362a26a7e65199f68f5cd32d9b6b0e5d0fbf
2018-11-27 17:43:39 +01:00
Neels Hofmeyr 8c8ebb13b6 add OsmoMSC manual
Add OsmoMSC and OsmoHLR to bibliography (even though the OsmoHLR manual does
not yet exist, a reference to it has been added in OsmoMSC's manual).

Change-Id: I9ecff2837fbf5fdc19675a726f6d70c21eb178ee
2018-11-27 17:43:39 +01:00
Neels Hofmeyr 845031955e Importing history from osmo-gsm-manuals
Change-Id: I1b7d606d489f3881ca5b21111a3615c469403d02
2018-11-27 17:43:22 +01:00
Vadim Yanitskiy 380b2195cf libmsc/transaction.c: cosmetic: fix typo
Change-Id: I6d72b856e40ba81ee2f1e60693055705b5993b09
2018-11-27 15:14:31 +07:00
Vadim Yanitskiy 535f110d09 libmsc/gsm_04_11.c: refactor RP-DATA header validation
It's much better to have both RP-DATA header parsing and validation
code in a single function. There is no need to pass all the header
fields (DA, OA, UI) to gsm411_rx_rp_ud() because they are not
used there.

Change-Id: Iaf295949148e2a613c5403d1f7a926fcd6849c15
2018-11-25 21:48:29 +07:00
Vadim Yanitskiy 0c8998f066 libmsc/gsm_04_11.c: don't pass msgb to gsm411_rx_rp_{ack|error}
Passing a message buffer containing the whole encoded message, and
a pointer to the RP header (struct gsm411_rp_hdr) is redundant.

Change-Id: I0eb5c7c485ab7d109966431bd875fa74e00936d7
2018-11-25 21:48:29 +07:00
Philipp Maier 54729d6e5e osmo_msc: remove unused parameter from msc_dtap()
The parameter link_id in the function msc_dtap() is unused. Lets remove
it.

Change-Id: I7ba67b0cb514c91bc87a7b396ed3962b7a68e7da
2018-11-23 10:04:29 +00:00
Vadim Yanitskiy b7e5201b62 msc_vlr_tests.c: drop duplicating DMM category definition
Change-Id: I2bf8150580c318ccaa9c30657582c15020f6b711
2018-11-22 20:24:27 +07:00
Vadim Yanitskiy c350c093c4 msc/gsm_04_11.h: use forward-declaration for _gsm411_sms_trans_free()
Change-Id: I87f96abd2b2d446751d8f95c9164c5eb6a58e66c
2018-11-21 20:52:36 +07:00
Vadim Yanitskiy fb05bb4a60 msc/gsm_04_11.h: drop unused sms_next_rp_msg_ref()
Change-Id: I53b27629177b3342c4f5b34c80d52cbb6dc8476b
2018-11-21 20:52:36 +07:00
Vadim Yanitskiy 0cd761c604 libmsc/db.c: cosmetic: mark missing breaks in switch as intended
Change-Id: I3f4f34ecd0c5bb2d1a675ad5c4669fcffb87f292
Closes: Coverity CID#148209
2018-11-21 19:48:16 +07:00
Max 58099f699f Use libosmocore to function to parse cipher mode reject cause
This allow us to handle both regular and extended cause transparently.

Change-Id: I7742ac41dd0642a5a40ce79d23250f8d9e6ae556
Related: OS#3187
2018-11-20 17:27:40 +00:00
Max f1329c533d Use BSSAP-specific TLV parser from libosmocore
Change-Id: Iae1a3ffcebf1b0b95e61cd5dffe7ef734796fcfc
2018-11-20 15:24:54 +00:00
Pau Espin 3710623e36 msc: vty: Fix integer printf formatting
| ../../../git/src/libmsc/msc_vty.c:1202:44: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'uint64_t {aka long long unsigned int}' [-Wformat=]
|   vty_out(vty, "Location Update         : %lu attach, %lu normal, %lu periodic%s",
|                                             ^

Change-Id: Iae1c0b20a519ce71a21f72cea3c63694ef10adb4
2018-11-19 11:11:17 +01:00
Max 48a595e8ba Fix build with latest libosmocore
Remove locally defined function which conflicts with the one in
libosmocore.

Change-Id: I464c16034b76e4599ac42857f60442c3fd000c75
2018-11-19 09:48:22 +00:00
Keith Whyte bea25f1302 libmsc: Don't send SMS STATUS REPORT locally if the ESME accepted it.
When using smpp-first, after the ESME accepts our STATUS REPORT,
we were sending it locally into gsm340_rx_sms_submit() anyway.
In the case of the ESME mirroring the report back to us, this
would result in two copies of the status report in the SMS
database, which were also both then delivered to the MS.
This causes no visible error to the user but is a waste of radio
resources.

With this patch, we check if it is the sms_report that has had 
receiver set in sms_route_mt_sms() and not the original SMS we
are reporting on, which of course already has receiver set.

Change-Id: I3529b89535800eaa1127721d613fa7bbcb8b23be
2018-11-19 09:32:20 +00:00
Max ba8a007a2d msc_vlr_tests: tweak conn_exists()
* constify function parameter
* internalize parameter check

Change-Id: Icf507d094319123c6667ba963db1d385df4d4f92
2018-11-18 20:12:41 +00:00
Philipp Maier 6038ad4cf9 vlr: drop unused is_ps parameter in vlr_subscr_req_lu()
the function vlr_subscr_req_lu() has a parameter is_ps, which is set
to vsub->vlr->cfg.is_ps by the only caller in vlr_lu_fsm.c. Inside the
function one can see that vsub->vlr->cfg.is_ps is used directly to
decide between PS or CS LU, we could also use is_ps there. Presumably
the parameter is_ps had been abandonned in an early development stage
and was not removed, so lets drop the parameter.

Change-Id: Id239721773b90099d122b232dae1ba457be9d255
2018-11-16 18:11:50 +00:00
Max c51609aa5c vty: add command to show all known BSC
Change-Id: I247fdce00f43072b0a2a0122b80bd40cdd9e0128
2018-11-13 15:59:39 +00:00
Philipp Maier 5b6ccce1c6 cosmetic: remove forgotten debug printf
the control interface command subscriber-list-active-v1 contains a stray
debug printf, lets remove it.

Change-Id: I085cf7b4a45708ccb883f70f71f4fbcfda58d332
2018-11-08 11:10:15 +01:00
Max 366390d81a Add counters for BSSMAP cipher mode messages
Count COMPLETE and REJECT messages. Besides general troubleshooting
that's also useful for TTCN-3 tests to check that OsmoMSC processed
those messages as expected.

Change-Id: I5822b2b38b64f1a691b26c926a8e2bece21dc624
Related: OS#3187
2018-11-02 22:06:09 +00:00
Max 662e2ba73e Properly parse cause in cipher mode reject
Use appropriate TLV routines to get and log the value of rejection
cause.

Change-Id: I26b3eb0deff6dbd217b23d284bbc6e6a9eebc8e6
Fixes: OS#3187
2018-11-02 22:06:09 +00:00
Neels Hofmeyr dd2aeba02c lu_fsm: result cb: use proper cause type (warning/coverity)
enum gsm48_gmm_cause is the wrong enum to pass to lu_fsm_failure(). Use enum
gsm48_reject_value instead.

Change-Id: If661f72056decb28c0ee82ad2449630a24d4f31c
2018-10-30 19:51:15 +01:00
Philipp Maier 9ca7b31cbf gsm_04_08_cc: Add global guard timer for MNCC
The external MNCC handler may hang indefinitely in cases where the remote
end of the MNCC ceases to work properly. Add a global guard timer to
make sure the call reaches ACTIVE state.

Change-Id: I7375d1e17cd746aac4eadfe1e587e82cf1630d3d
Related: OS#3599
2018-10-24 10:27:39 +02:00
Harald Welte f6400737f9 gsm0407_is_duplicate(): Handle error ret of gsm0407_pdisc_ctr_bin()
Change-Id: If9525694bcbc5c6c0e622e899dd634dc11ed61c4
Fixes: Coverity CID#182702
2018-10-21 12:56:20 +02:00
Philipp Maier 782ccec526 msc_mgcp: move mncc struct initalization to where its actually needed
The function _handle_error() initalizes a struct gsm_mncc variable
on startup. The initalization accesses mgcp_ctx->trans->callref. All
this is done before the assertion on mgcp_ctx. Later in the code one
finds an if which tests on mgcp_ctx->free_ctx. This is the only part of
the code that accesses the mncc struct variable. We should move the
initalization there as well.

- Move initalization of struct gsm_mncc mncc into the if body
  that uses it.

Change-Id: I86983eabd999c4275dcc0e4a169ef2aa1e33c747
Related: OS#3635
2018-10-08 17:18:37 +02:00
Neels Hofmeyr d0756b152b GSUP client: send CN domain IE on LU request
Give the HLR a chance to send us updated subscriber data by indicating the CN
domain to be Circuit Switched, only during a LU Request GSUP message.

Adjust msc_vlr_tests to expect the added GSUP CN domain IE to indicate CS, i.e.
append '280102'.

Related: OS#3601
Change-Id: I0c2d33fbfdb4728e480679120d06b7f3a2ccfd76
2018-09-30 23:55:25 +02:00
Stefan Sperling 722f2b4161 fix a use-after-free in msc_mgcp.c:_handle_error()
Move code which needs to test the mgcp_ctx->free_ctx flag upwards
such that it runs before we're calling functions which will
potentially free mgcp_ctx. The code being moved up takes effect
only in case mgcp_ctx won't be freed, so there should be no
functional difference.

Change-Id: I5df17c19e2a68c019f7eaf582b14585caa54b32a
Related: OS#2885
2018-09-28 14:26:35 +02:00
Philipp Maier e2497f70bb mncc: fix byte ordering of IP-Address in mncc
At the moment osmo-msc populates the member ip in struct gsm_mncc_rtp
with the wrong byte ordering. This causes LCR or
osmo-sip-connector to receive the IP address in the wrong order, which
eventually leads into a reversed IP address in the SDP part of the SIP
messages.

Change-Id: I86148179b549b511528e4c65213eb6c204cc609e
Related: OS#3431
2018-09-28 10:40:40 +02:00
Neels Hofmeyr 86ed06c048 vty: add SCCP related vty commands
Depends: I214ea51fc6bfa2a9a4dd7c34b43add0c77ffe22e (libosmo-sccp)
Change-Id: I245b153785f615b998bb5279cb8d93787d57b4b7
2018-09-27 03:35:02 +02:00
Neels Hofmeyr 68cf957bfd fix Classmark Update without VLR subscriber
This recent patch moves Classmark storage to the VLR subscriber, and introduced
a segfault when a Classmark Update is received during IMSI detach:

commit 986fe7ed18
change-id I27081bf6e9e017923b2d02607f7ea06beddad82a
Mon Sep 17 01:12:13 2018 +0200
"store classmark in vlr_subscr, not conn"

It assumed that we would never accept any Classmark Update messages unless we
also have a valid subscriber for it. Well, that is proven wrong by the
ttcn3-msc-test TC_imsi_detach_by_imsi(), which brings osmo-msc to its knees.

Fix: in case of no valid vlr_subscr being present, store Classmark in the conn
temporarily, and copy any received Classmark to VLR subscriber as soon as it
gets associated with the conn (if at all).

Change-Id: Ib2a2ae6bf86e8f29fc6751a8b5cdb7187cd70290
2018-09-18 16:13:58 +02:00
Neels Hofmeyr 3117b701c8 A5/n Ciph: request Classmark Update if missing
When the VLR requests a Ciphering Mode with vlr_ops.set_ciph_mode(), and if we
need a ciph algo flag from a Classmark information that is not yet known
(usually CM 2 during LU), send a BSSMAP Classmark Request to get it.

To manage the intermission of the Classmark Request, add
- msc_classmark_request_then_cipher_mode_cmd(),
- state SUBSCR_CONN_S_WAIT_CLASSMARK_UPDATE,
- event SUBSCR_CONN_E_CLASSMARK_UPDATE.

From state AUTH_CIPH, switch to state WAIT_CLASSMARK_UPDATE. Once the BSSMAP
Classmark Response, is received, switch back to SUBSCR_CONN_S_AUTH_CIPH and
re-initiate Ciphering Mode.

To be able to re-enter the Ciphering Mode algo decision, factor it out into
msc_geran_set_cipher_mode().

Rationale:

In the following commit, essentially we stopped supporting A5/3 ciphering:

commit 71330720b6
"MSC: Intersect configured A5 algorithms with MS-supported ones"
Change-Id: Id124923ee52a357cb7d3e04d33f585214774f3a3

A5/3 was no longer supported because from that commit on, we strictly checked
the MS-supported ciphers, but we did not have Classmark 2 available during
Location Updating.

This patch changes that: when Classmark 2 is missing, actively request it by a
BSSMAP Classmark Request; continue Ciphering only after the Response. Always
request missing Classmark, even if a lesser cipher were configured available.

If the Classmark Update response fails to come in, cause an attach failure.
Instead, we could attempt to use a lesser cipher that is also enabled. That is
left as a future feature, should that become relevant. I think it's unlikely.

Technically, we could now end up requesting a Classmark Updating both during LU
(vlr_lu_fsm) and CM Service/Paging Response (proc_arq_fsm), but in practice the
only time we lack a Classmark is: during Location Updating with A5/3 enabled.
A5/1 support is indicated in CM1 which is always available, and A5/3 support is
indicated in CM2, which is always available during CM Service Request as well
as Paging Response. So this patch has practical relevance only for Location
Updating. For networks that permit only A5/3, this patch fixes Location
Updating. For networks that support A5/3 and A5/1, so far we always used A5/1
during LU, and after this patch we request CM2 and likely use A5/3 instead.

In msc_vlr_test_gsm_ciph, verify that requesting Classmark 2 for A5/3 works
during LU. Also verify that the lack of a Classmark Response results in attach
failure.

In msc_vlr_test_gsm_ciph, a hacky unit test fakes a situation where a CM2 is
missing during proc_arq_fsm and proves that that code path works, even though
the practical relevance is currently zero. It would only become interesting if
ciphering algorithms A5/4 and higher became relevant, because support of those
would be indicated in Classmark 3, which would always require a Classmark
Request.

Related: OS#3043
Depends: I4a2e1d3923e33912579c4180aa1ff8e8f5abb7e7 (libosmocore)
Change-Id: I73c7cb6a86624695bd9c0f59abb72e2fdc655131
2018-09-17 02:08:07 +02:00
Neels Hofmeyr d28ea6c8c3 msc_vlr_tests: cosmetically tweak perm algo printing
In the msc_vlr_tests, instead of printing the algo IDs, rather print the
corresponding A5/n name, for clarity.

Change-Id: Ic00f1e54490650bcb40170647b8ffd52ede23fd3
2018-09-17 01:19:12 +02:00