Commit Graph

6499 Commits

Author SHA1 Message Date
Pau Espin 02a79d8545 libmsc: bssap: Remove fixme and properly update msgb tail
Change-Id: I28073efd5cff58cd212341bceee784caf08d5ad8
2018-02-16 13:29:57 +01:00
Daniel Willmann 4e825b6a68 libmsc: Add a function to return a unique ID of the subscriber conn
The ID will include the type of connection (GERAN_A, UTRAN_IU) followed
by the SCCP conn_id.
This can be used for the fsm instance ID before we know the IMSI.

Change-Id: I4b875772e3994ad3458ee60dbf880604486d9afd
2018-02-16 08:09:33 +00:00
Daniel Willmann 6fbd3bf732 iucs: Add a function to return the connection ID for the IU SCCP conn
Change-Id: Ica4a7f463fcf1bd67fe082296cecea8d10f2fc5b
2018-02-16 08:09:32 +00:00
Pau Espin 75559284d0 libmsc: bssap: Catch TLV parse failures
Change-Id: I1d1951f4a5daf200e85c76fea14a35e952491d27
2018-02-14 14:31:45 +01:00
Pau Espin 31776ff58f libmsc: bssap: Refactor rx paths to to avoid parse_tlv code duplication
Change-Id: I6aef9a94fa5b2e0b62a9c1744b8e18e5985f788f
2018-02-14 14:31:45 +01:00
Pau Espin 9f055f5983 libmsc: bssap: Fix typo in log message
Change-Id: I941cd7f4e9eec3e4f2786100a0e64770d5aee4a7
2018-02-14 14:13:43 +01:00
Harald Welte c0e425dbd0 remove dead code (gsm_parse_reg)
Change-Id: I47b0260561a9c2bad65c50c8164873e4c23d61b7
2018-02-14 09:04:56 +01:00
Harald Welte 098aa71e83 remove unused "auth policy" VTY command
This is yet another unsused bit from the OsmoNITB legacy.

Related: OS#2528
Change-Id: I825e659da529257e5edec94d9d59f0e10c1b4c63
2018-02-14 09:04:56 +01:00
Harald Welte 2346619c1a remove unused "authorized-regexp" VTY command
This is another left-over VTY command from the OsmoNITB days.

If such functionality is desired, it must be implemented in OsmoHLR,
but not here.

Related: OS#2528
Change-Id: Icf0897c47388e49ba7886b55acc728a6f7d213fe
2018-02-14 09:04:52 +01:00
Harald Welte 27b40c601c remove unused VTY command "location updating reject cause"
OsmoMSC is using whatever reject cause is apropriate in the given
situation.  This user-configurable reject cause only had relevance
in OsmoNITB, and hence it is an unused parameter that can be removed
in OsmoMSC.

Related: OS#2528
Change-Id: Ie1f39e706477aaf42051877b52d4b3ae1c5f138e
2018-02-14 08:29:24 +01:00
Harald Welte 3db47c4e51 osmo-msc: Add talloc context introspection via VTY
This requires libosmocore with Change-Id
I43fc42880b22294d83c565ae600ac65e4f38b30d or later.

Change-Id: I575500bd911f9792ab5ca76eebb1d2682ee34fa3
2018-02-14 00:56:26 +00:00
Harald Welte 7421a6e4b7 remove unused dyn_ts_allow_tch_f VTY option
This belongs into the BSC and has no relevance in the MSC, as the MSC
has no clue about dynamic timeslots.

Related: OS#2528
Change-Id: Iaa41d22db81120572d4cd2c0c4c75d258947a42f
2018-02-14 00:28:10 +01:00
Harald Welte 9199f8b60d dead code removal
Related: OS#2528
Change-Id: I89157c446d66e11adbe3cad587eb34ec40271c12
2018-02-14 00:28:07 +01:00
Harald Welte d5db170261 remove bsc_api.h and all users - they're all dead code
Related: OS#2528
Change-Id: I332aa8697c98a0d7b3db65f98711275da3d381d7
2018-02-14 00:28:02 +01:00
Harald Welte c93ce02042 gsm_data: remove unused gsm_subscriber_connection members
The mncc_rtp_create_pending and mncc_rtp_connect_pending members
were unused, let's remove them.

Related: OS#2528
Change-Id: I417e23ec53323ddd8e1e5d18952566fe8fd6ac24
2018-02-14 00:27:52 +01:00
Harald Welte 4804c558ea MNCC: Copy bearer_cap from MNCC to gsm_trans
When we receive bearer capabilities from MNCC and encode thme into
a CC message, we have to also update our "cache" inside 'struct
gsm_trans'.  Only that way, the BSSMAP ASSIGNMENT code is aware of
the actual current/present bearer capabilities such as permitted speech
codecs.

This will in practise only work if the related CC/MNCC message with
berer_cap IE will happen before the MSC performs the BSSMAP ASSIGNMENT
procedure.  Our logic still needs to change in a way that the CC/MNCC
code in gsm_04_08.c detects if trans->bearer_cap != new bearer_cap, and
in that case triggers a new follow-up BSSMAP ASSIGNMENT.

Change-Id: I6838dc0c8c4c2c6bba385da548c92f3fc91060c1
Closes: OS#2854
2018-02-12 12:32:48 +01:00
Harald Welte 329588721f MT Calls: Copy bearer capabilities from NNCC primitive to trans
When we receive a MNCC_SETUP_REQ primitive from the external MNCC
handler, we must not only encode it into the TS 04.08 CC SETUP, but
also keep it around in the "trans" structure representing this voice
call, as it is needed e.g. at BSSMAP ASSIGNMENT time.

Change-Id: Ib6919d148ff6687112e8166dbde947be19e70a76
Related: OS#2322
Closes: OS#2929
2018-02-12 11:56:51 +01:00
Harald Welte 474e5a768a a_iface: Consistent and understandable function names
Change-Id: I36894e68e4b1f25f266e941c39a44e0171d24689
2018-02-12 10:12:35 +01:00
Harald Welte f417b8c07d a_iface: s/Abis/L3/ for speech version/preference fields
There is no encoding of speech version / preference on Abis, only
on L3.  L3 is carried on Um, Abis and A.  Hence, referrin to Abis
in function names and comments is irritating.

Change-Id: Id226cd1414ca2a92356801bc71f43102d03ba37e
2018-02-12 10:10:05 +01:00
Harald Welte 33d61e71b3 MGCP: Response code 250 is *not* an error for DLCX
Change-Id: I9f64996bfff09561f253115681ed63ee87b90ef3
Closes: OS#2923
2018-02-10 10:43:38 +01:00
Harald Welte 80620d2d7c a_iface: Fix heap-use-after-free in a_clear_all()
We cannot use conn->a.conn_id after conn has been free'd inside
msc_clear_request().  Let's store conn_id before that call to
ensure we avoid an use-after-free situation.

A more elegant (but more intrusive) solution would be to
move the SCCP connection clearing into the FSM itself.

Change-Id: Ibe41aa503e9f7cbeb05dce4b1a20b3eac85e619f
Closes: OS#2922
2018-02-10 10:24:15 +01:00
Harald Welte 69c54a8b3c Add VTY command to configure destination MSISDN for emergency calls
As in GSM/3GPP networks emergency calls carry no explicit destination
number/address, add a VTY commadn to patch in some destination handler
in the EMERGENCY SETUP before delivering to [internal or external] MNCC.

Change-Id: I7c9f43ba312fadda2b9a9483b3cf50e4abca9599
2018-02-09 22:30:39 +01:00
Harald Welte a172e9e231 a_iface: Fix heap-use-after-free by cleaning up msgb ownership
When we receive a msgb-wrapped primitive from the SCCP provider (stack),
it transfers msgb ownership to us (the SCCP user).  The existing code
passed the msgb ownership down into all the various downstream
functions, which each then had to take care of msgb free'ing.

Not all of the paths did eventually free the msgb.  And at least one
path used data from the primitive *after* the free

Let's restructure this in a way that no msgb ownership is transferred
down the call chain.  Instead, there's one common msgb_free() in
sccp_sap_up().  We can do this as nobody is queueing or otherwise
keeping the msgb.

Change-Id: Ie65616ccb55ec58a0224bbe3c8e004e6029ef3e6
SUMMARY: AddressSanitizer: heap-use-after-free /home/laforge/projects/git/osmo-msc/src/libmsc/a_iface.c:538 in sccp_sap_up
2018-02-09 22:21:20 +01:00
Harald Welte 1f477442dd Introduce new BSSAP logging category/subsystem
Having all BSSAP related logs in the "DMSC" category is overly
generic, and dosn't provide useful granularity.

Change-Id: Id1e52dad03840dfd026fb23f3845a8771c8cc308
2018-02-09 02:22:22 +01:00
Harald Welte c9e7859311 a_iface: Add copyright statement (after recent contributions)
Change-Id: I3f5dedb045a9ae9b93b00a8388a73ed77e67f19f
2018-02-09 02:22:22 +01:00
Harald Welte 35284469b6 cosmetic: a_iface: More logging harmonization
Change-Id: I66139862c4d821fcce0334207ce84fffbd08b4e3
2018-02-09 02:22:22 +01:00
Harald Welte c27ef65796 a_iface: centralize lookup of subscriber_conn
There's little point in resolving the gsm_subscriber_connection in each
and every function handling connection-oriented messages.  We can
resolve it once and dispatch the already-resolved conn into the
function, instead of passing the raw sccp_user and a_conn_info.

Change-Id: Iea85527ea4d4cde7b36cc28a8027362c1570518f
2018-02-09 02:22:22 +01:00
Harald Welte c65d324ea6 cosmetic: No need for 'break' after 'return'
This just makes the code longer with no added benefit.

Change-Id: If689b8284a669021219eff0397c6e90570e2aaa4
2018-02-09 02:22:22 +01:00
Harald Welte fb7ba91907 cosmetic: a_iface: Harmonize log statements
Clean up the log statements in a_iface*.c, which was very inconsistent.
For example "BSC sending" is very confusing.  We are receiving from the BSC,
and it did already send the message, it is no longer in the process of
sending it if we have already received it in the MSC.

Change-Id: Id50e964d86713ae506d4e7657159797e09501d99
2018-02-09 02:22:22 +01:00
Harald Welte 6c3e4e7934 a_sccp_rx_dt(): Don't print hexdump of message multiple times
We don't need to hexdump it in a_sccp_rx_dt() and then again in
rx_bssmap() or rx_dtap().

Change-Id: I2caa8e0af236983430155f9c808de913377d5780
2018-02-09 02:22:22 +01:00
Harald Welte 6de46595f2 a_iface_bssap.c: Use LOGPCONN() whenever possible
Change-Id: Ic1c9d14b892154d51165598338d23a924a772265
2018-02-09 02:22:22 +01:00
Harald Welte f0dc1be95b a_iface: Reduce log levels
During normal operation, regular messages occurring during processing
of a call / transaction should not be higher than LOGL_INFO.

Change-Id: Ibd04ade47b249406696c7d0b660474afc4f4adee
2018-02-09 02:22:22 +01:00
Harald Welte a41b630ae7 cosmetic: Use msgb_hexdump*() rather than manual osmo_hexdump() on msg
This requires libosmocore Change-Id I98e85397fb541ee0fd711f2e1852f63f3bb87359

Change-Id: Ieeb97a9f1eba2fdef84294b8c8c7ac0984ae5c70
2018-02-09 02:22:09 +01:00
Harald Welte 54a10efea0 Don't answer to BSC-originated RESET with another RESET
If the BSC is contacting us for the first time and sending a BSSMAP
RESET, then we should simply ACK that and transition into the
"connected" state, where connection-oriented and connectionless
procedures are permitted.

This patch is a bit large for such a seemingly simple behavioural
change, but the existing data model didn't permit a more
straight-forward implementation.

Change-Id: Ie67e7ed20a6c42afe99bafef96d85a4e083dd057
Closes: OS#2914
2018-02-09 02:20:51 +01:00
Harald Welte b6777fb055 a_reset: Add additional "a_reset_alloc" argument
Using this argument we can create the state machine in the
"already connected" state, i.e. without starting an outbound
RESET procedure.

Change-Id: Ibf569d57300965cd47084fa0bff54aa67679e2a1
2018-02-09 02:20:51 +01:00
Harald Welte 66a301e65d VTY: Add 'show connections' and 'show transactions' commands
It is quite important to have some way of runtime state introspection
about the major objects inside osmo-msc.  This patch adds some basic
capabilities to dump the most important information about
subscriber_connections and transactions (like calls/sms).

OsmoMSC> show connection
--ConnId ------------Subscriber RAN --LAC Use --Tokens CSA A5 State
00000001    IMSI:26242000000006   A    23   1 00000004 --- /0 SUBSCR_CONN_S_COMMUNICATING

Change-Id: I1c457c1eac20188f67b8379a36cfda3a085fcef4
2018-02-09 02:20:47 +01:00
Philipp Maier 4c57377766 increase RAN timeout in MGCP FSM
The MGCP FSM implements a timeout when waiting for the RAN to complete
the call (assignment complete, alerting, connect...). This timeout
is currently set to 10sec. This means if the other end did not pick
up after 10sec, the MGCP connection will be lost while the phone keeps
ringing. When the other end finally picks up, the call gets
disconnected.

This behavior is odd and requires a proper fix. For now increasing the
timeout to 120sec. will decrese the probability that he problem occurs.

- Increas RAN timeout to 120sec (2 min).

Change-Id: I5a11d53f9701d9b11b18d7026ff2241c7c0b57f5
2018-02-08 14:12:05 +01:00
Max 770fbd2024 GSUP: check osmo_gsup_encode() result
Check and handle gracefully any error which might appear in
osmo_gsup_encode() - mark corresponding functions with
warn_unused_result attribute to make sure this failure is always checked
against.

Change-Id: I4551212011fb0bd898c020a183756ed7a9afb9e5
Related: OS#2864
2018-02-08 09:29:50 +00:00
Max 5e60de63ef VLR tests: move network init into function
That's a preparation step for properly splitting main function of
different tests in follow-up function.

Change-Id: I68a2e94cf79fcb83286eef981a8d88bdbe10ef69
Related: OS#2864
2018-02-07 13:01:49 +01:00
Max b0a4314911 VLR tests: always print test parameters
For each test print:
* the test number
* IMSI

Unfortunately tests are organized in such a way that we don't know the
number of particular test in advance. Nevertheless, it make sense to
always print it regardless of -v option presense.

Related: OS#2864
Change-Id: I2e1d7701f5322d2311f32b796148a8b414f53b8e
2018-02-07 12:08:19 +01:00
Max 29ce08a77a VLR tests: remove weird code
Having while(0) as a body for for() cycle generate too much WTF while
looking at the code while not serving any obvious purpose. Let's just
drop it to avoid confusing developers.

Change-Id: I1f571ec319ff3231fd9acd4066e470476c3b1f78
Related: OS#2864
2018-02-07 12:08:12 +01:00
Max 6817190efd VLR tests: don't fail via assert
Don't fail tests using thwart_rx_non_initial_requests() via
OSMO_ASSERT. Instead log extended error which will fail the test
eventually but allows to gather additional info helpful for debugging.

Change-Id: I2607cb1ac60941dbc22fca532ed2b3738bfbcc63
Related: OS#2864
2018-02-07 12:07:59 +01:00
Max d5feadeee8 Expand VLR tests
Print the IMSI used for each test. This enables expansion to tests with
several IMSIs in follow-up patches.

Change-Id: I7958608e5136351f7b7c0c57fe79791d989ce9c3
Related: OS#2864
2018-02-07 12:07:50 +01:00
Max d8d1a9e3cc VLR tests: mark static test functions as such
Related: OS#2864
Change-Id: I5eac4c24257fd38068ba629d3c21848181703220
2018-02-07 12:07:39 +01:00
Max 093300d141 Move IMSI into test parameters
This makes test routines more flexible and allows to easier re-use them
for tests with different IMSIs.

Change-Id: I74d46fdb7e87dc04c6b82a0b6f3ce6bef60bde58
Related: OS#2864
2018-02-07 12:07:24 +01:00
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