Commit Graph

581 Commits

Author SHA1 Message Date
Philipp Maier 39c609b7c9 mgcp: use osmo-mgw to switch RTP streams
osmo-bsc currently negotiates the RTP stream directly with the
BTS and reports back the RTP IP/Port on the BTS. This works fine
for a single BTS, but for Handover the port/ip pointing to the
MSC side must not change, so an entity in between the BTSs and
the MSC is required.

Integrate the mgcp-client and use osmo-mgw to switch the RTP
streams.

Depends: osmo-mgw Ib5fcc72775bf72b489ff79ade36fb345d8d20736
Depends: osmo-mgw I44b338b09de45e1675cedf9737fa72dde72e979a
Depends: osmo-mgw I29c5e2fb972896faeb771ba040f015592487fcbe

Change-Id: Ia2882b7ca31a3219c676986e85045fa08a425d7a
2017-11-07 20:57:51 +00:00
Neels Hofmeyr 9eb208fcfb bssap: paging: page entire BSS for unimplemented cell id list
3GPP TS § 08.08 defines various types of Cell Identifier List IEs, but we only
implement "entire BSS" and "one LAC". If the MSC sends a Cell Identifier List
that we don't implement, it is best for interoperability to page the entire BSS
and post a log message instead of rejecting the paging altogether. Apart from
resource management, it is not harmful to page more than the MSC requested; if
use of resources becomes an issue, the log message will guide towards the
solution of providing an actually implemented Cell Identifier List IE.

Upon IE length that is other than we expect, log the error, but also fall back
to paging the entire BSS. Overall message length correctness has been checked
earlier.

The particular case observed is that a Huwaei MSC sends a LAI for Cell
Identifier List (MCC+MNC in bcd, followed by a LAC), parsing of which we may
want to add later.

Improve logging: identify the subscriber that is being paged.

Coding style: use a switch() statement to clarify flow and provide a place to
add more implementations later.

Add regression test bssap_test.c: fabricates BSSAP Paging messages with the two
implemented Cell Identifier List IEs as well as the unimplemented LAI
identifier, verify the resulting paging LAC in wrapped function and stderr.

Change-Id: Ie934c5d229140a89763bf2efff86d6a3766cd351
2017-11-07 04:08:44 +01:00
Max 36bf7974ab Check OML state per-BTS
To properly decide if a given OML link is degraded we have to use
BTS-specific information about MO state.

* move check function into BTS-specific part
* add generic wrapper

Related: OS#2486
Change-Id: Iddc7a4d20fbb95a6566eed1487a12733e5adb9e2
2017-11-02 15:58:08 +01:00
Neels Hofmeyr 848e1a566f vty: skip installing cmds now always installed by default
vty_install_default() and install_default() will soon be deprecated.

Depends: I5021c64a787b63314e0f2f1cba0b8fc7bff4f09b
Change-Id: If2edf59a687a78d6db6bc73117a27509374b0fc6
2017-11-01 00:48:52 +01:00
Harald Welte 322254f762 Don't link osmo-bsc_nat against libosmoabis
This fixes the following dpkg-shlibdeps warning:

Change-Id: Iea00c209652e8070a59942504bef660db0999e86
dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/osmo-bsc-nat/usr/bin/osmo-bsc_nat was not linked against libosmoabis.so.6 (it uses none of the library's symbols)
2017-10-28 13:29:29 +02:00
Harald Welte 2d4e976dcc osmo-bsc_nat: Don't link against libosmonetif
This fixes the following dpkg-shlibdeps warning:

Change-Id: I31af5fb8b52ef1fd5effb139d9cdea1ebe9a41b4
dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/osmo-bsc/usr/bin/osmo-bsc_nat was not linked against libosmonetif.so.4 (it uses none of the library's symbols)
2017-10-28 13:14:24 +02:00
Philipp Maier 718b0c72a0 log: output hexdump of transmitted sccp messages
We output a hexdump for each sccp message we receive, but not when
sending.

Also log the hexdump of sccp messages when sending.

Change-Id: Ibfe52a0b7dbca4c569c603a008d73d0d99d1c345
2017-10-26 16:08:00 +02:00
Philipp Maier df78e48eb0 log: log the sccp message type of messages sent
We already log the message type of sccp messages we receive, but
for transmitting the log output is missing.

Also log the message type for tramsitted sccp messages.

Change-Id: I6736f15ddc03e5f70c3504abffbae6cbf766c9d7
2017-10-26 16:08:00 +02:00
Harald Welte 5de728564c Rename osmo_fsm to avoid illegal space in name + more meaningful name
A FSM doesn't need "FSM" in its name, as it is obvious that it is a
FSM.  Also, having two that are called RESET is confusing, so let's
try to come up with better names.

Also, after Change-Id I9ef59432f43a3cdb94e4cbb0c44ac3f9b2aac0f2 in
libosmocore, we now enforce that no FSM identifiers contain spaces
or other illegal characters.

Change-Id: I1b44d26cebc4a47094d7b8b3983e5737b88bf003
2017-10-24 18:23:36 +02:00
Harald Welte 7b1d59c3c4 osmo-bsc: Initialize logging before initializing rate_ctr
The library code for rate counter initialization, which is called
from the descendants of bsc_network_alloc() might already want to
log something (particularly after Change-Id
Ifc6ac824f5dae9a848bb4a5d067c64a69eb40b56 in libosmocore), so the
logging framework must be initialized before.

Change-Id: I1e893c97e023e63489fe8c46539b5e507d3cec8f
2017-10-24 18:23:36 +02:00
Pau Espin d1bec34ea3 bsc_vty: Improve description of mid-call-text cmd
Change-Id: I367b7734390daf39160de6462e9b2210368666f4
2017-10-23 16:24:12 +00:00
Pau Espin f6e8e6692c libbsc: Use correct printf formatting for uint64_t
unsigned long can be 32 bits on some arch/OS, while "current" field is
always 64 bit because it's a uint64_t.

Change-Id: Ibad1e4f09cf912cb654dbe3687a3f2182e2060f5
2017-10-23 14:52:15 +02:00
Pau Espin 73ab3f070a bsc_api: Fix NULL secondary_lchan access in handle_ass_fail
Related: OW#3893

Program terminated with signal SIGSEGV, Segmentation fault.
0  gsm_lchan_name (lchan=lchan@entry=0x0) at gsm_data_shared.c:342
(gdb) bt
0  gsm_lchan_name (lchan=lchan@entry=0x0) at gsm_data_shared.c:342
1  0x0805ab80 in lchan_release (lchan=0x0, sacch_deact=sacch_deact@entry=0, mode=mode@entry=RSL_REL_LOCAL_END)
    at chan_alloc.c:410
2  0x0805c1dd in handle_ass_fail (msg=0x94142b8, conn=0x9251048) at bsc_api.c:459
3  dispatch_dtap (msg=0x94142b8, link_id=0 '\000', conn=0x9251048) at bsc_api.c:598
4  gsm0408_rcvmsg (msg=msg@entry=0x94142b8, link_id=0 '\000') at bsc_api.c:658
5  0x08058ca2 in abis_rsl_rx_rll (msg=0x94142b8) at abis_rsl.c:1686
6  abis_rsl_rcvmsg (msg=0x94142b8) at abis_rsl.c:2097
7  0xb7e8cf9a in handle_ts1_read (bfd=0x94e8e08) at input/ipaccess.c:271
8  ipaccess_fd_cb (bfd=0x94e8e08, what=1) at input/ipaccess.c:386
9  0xb7ee8434 in osmo_select_main (polling=polling@entry=0) at select.c:158
10 0x0804bd7c in main (argc=6, argv=0xbfc27144) at osmo_bsc_main.c:272
(gdb) print lchan
$2 = (const struct gsm_lchan *) 0x0

Possible scenario in which this crash can appear:
1- gsm0808_assign_req() calls handle_new_assignment() which sends an CHAN
ACTIVATE msg and arms T10 timer.
2- ACTIVATE ACK is received (handle_chan_ack), which calls
gsm48_send_rr_ass_cmd() which sends an ASSIGNMENT CMD, and doesn't
disable/modify T10 timer.
3- T10 timeout is triggered (assignment_t10_timeout()), which sets
conn->secondary_lchan = NULL
4- Immediately after, the ASSIGNMENT FAILURE message (which might have been
already queued) is processed in handle_ass_fail, and then the crash occurs.

This race condition is not an issue for handle_ass_compl() path because there's
this check there which would trigger most probably if secondary_lchan is NULL:
"if (conn->secondary_lchan != msg->lchan)"

Change-Id: I3798b36c628f75d4e8bc7b0996c27d695d53fbb1
2017-10-17 10:10:44 +02:00
Max 39999a7dcf SI1q: fix EARFCN appender
Previously if we ran out of space while adding EARFCN, we simply return
which might result in malformed SI2q. Fix it by proper rollback of
entire EARFCN. While at it, let's be paranoid and introduce extra checks
against integer overflow in budget calculations.

Change-Id: I4b2aa3825e9affb6dfeadecdf24dd1a43a92b7b7
Related: OS#2357
2017-10-11 01:28:50 +00:00
Max 25cc407c5b ctrl: add oml-uptime command
Expose OML link uptime available via vts's "sh bts 0" command with the
new "bts.0.oml-uptime" ctrl command. To avoid code duplication, move
uptime computation into separate function and use it for both.

Change-Id: Iec405aa949d6a38a9c8e64cd7ee4b49fd416835d
Related: OS#2486
2017-10-11 01:28:10 +00:00
Max 7d73cc797a SI2q: fix generation for multiple UARFCNs
* fix insert routine to keep the list sorted by UARFCN
* fix rest octets generator to properly account for offset
* adjust test results accordingly

Change-Id: I443c5c5f937b490578354f3c8a0c5b92629f2794
Related: OS#2357
2017-10-10 11:39:31 +00:00
Max 3d049d27f5 OML: consider RSL link state
OML link state is available via vty ("sh bts 0" command) and
ctrl ("oml-connection-state" RO variable).

When showing OML link state, take into consideration RSL link state as
well: if OML is up but RSL is missing show it as degraded.

That's implemented via BTS model-specific functions (currently Sysmo- and
Nano- BTS only)

Change-Id: I5952fc59e4d82e0aa627ad91d20f964d9559a4c4
Related: OS#2486
2017-10-09 18:42:15 +02:00
Max 081cebaa6d SI2q: cleanup UARFCN addition
* expand comments, fix typos
* constify parameter
* move try-add-adjust routine into separate function to facilitate
  further modifications
* remove excessive checks and unnecessary return values
* move (UARFCN, Scrambling Code) tuple uniqueness check into separate
  function and use it early

Change-Id: Ia72f848dec40723510ca56868e08081804227d47
Related: OS#2357
2017-10-09 10:08:16 +00:00
Neels Hofmeyr ff20215db2 add ';' after OSMO_ASSERT()
Currently, OSMO_ASSERT() is defined such that it ends in a semicolon, hence an
added ';' is redundant. However, the usual way this kind of macro should be
defined is

  #define OSMO_ASSERT(x) do { ... } while(0)

so that the compiler requires a trailing semicolon.

To prepare for such a change possibly coming up in libosmocore, add ';' to all
OSMO_ASSERT() users.

Change-Id: If6dce81faee9177737a6e1b572a871aaf7e37138
2017-10-05 15:30:05 +02:00
Harald Welte aa70d9d828 Make sure BA-IND in all SI2xxx is '0' and in all SI5xxx is '1'
In masurement reports sent by the MS, this can then be used to correlate
if a given measurement report was in response to a BCCH/neighbor list
received on BCCH (SI2xxx) or on dowlink SACCH (SI5xxx).

Closes: OS#2525
Change-Id: I1cd0dc51026dcd0e508e63eea4e333e6b184787a
2017-10-01 11:26:28 +08:00
Harald Welte d6a52e993d libbsc: document arguments of generate_bcch_chan_list()
Change-Id: I5afc6e6a5a1d6b6a8ee73fdb60cc28074cf8585b
2017-10-01 11:26:28 +08:00
Max d1f70ed234 Show OML link uptime in vty
Save the time when OML link to BTS was established and show it in
vty. That's useful when troubleshooting issues like periodic/sporadic
BTS restart.

Related: SYS#3889
Change-Id: I9e4e8504afe8ca467b68d41826f61654e24d9600
2017-09-27 10:53:28 +00:00
Max a9594b5058 CTRL: cleanup write-only command functions
Remove trivial functions by using more specific defines for CTRL
commands.

Change-Id: I10d6d18663aed87324d60472a0fc3bd1d0961dea
2017-09-25 08:27:23 +00:00
Max 9cc704424a Further cleanup leftovers from BSC/MSC split
* drop unused header
* fix name of jenkins test
* remove dead code

Change-Id: I986904864741995910b6ba92173b9f7b1b03e2f1
2017-09-25 08:25:15 +00:00
Max dc10ce90b2 Wrap channel state assignment in macro
Previously we've used function so debug print always pointed to the same
place which is not very useful. Wrap it with macro so proper
file:line is printed. Also, make sure that we always change state only
through this wrapper and log only when the state has changed.

Change-Id: I21789f8021290965b61a54a2b23177ccbbfe8321
2017-09-23 10:13:55 +00:00
Max 72fbc95c55 SI13: drop PBCCH-related bits
According to 3GPP TS 44.018 §1.8 the "network shall never enable PBCCH
and PCCCH".

Change-Id: I319e71a4b0c682361529e9c21377398a826b934b
Related: OS#2400
2017-09-14 19:17:39 +02:00
Max be356ed32f Make TRX rf locking more visible
* log administrative state transitions
* log what's caused it
* while at it, mark boolean variable as such

Change-Id: I3e25a19fac4d0b4886d825c9876771b1f66efe58
Related: SYS#3864
2017-09-08 08:31:02 +00:00
Neels Hofmeyr c01647914b move include/openbsc to include/osmocom/bsc
Change-Id: I39e7b882caa98334636d19ccd104fd83d07d5055
2017-09-06 16:26:13 +02:00
Neels Hofmeyr 5282a81323 drop files unrelated to osmo-bsc
These either remain from openbsc.git or slipped in while applying recent
patches from openbsc.git and do not belong in osmo-bsc.

Empty out contrib: remove things that are either obviously unrelated to
osmo-bsc, or seem old and/or esoteric.

osmoappdesc.py: drop nitb_e1_configs (and some ws)

Change-Id: Ib20064f35e623d99c7d59496a3156e84b8a0d07a
2017-09-06 16:25:08 +02:00
Harald Welte 8d59bf26a8 configure.ac: remove smpp_mirror, which has no relation to a BSC
smpp_mirror is maintained in osmo-msc.git, so let's remove it
(and the associated libsmpp34 build requirement).

Change-Id: Ia7b242cc52cf261b1a5dd3c287da2868e1a2b9a8
2017-09-03 22:57:31 +02:00
Harald Welte 1861b55516 configure.ac: remove --enable-osmo-bsc, --enable-nat
This is the OsmoBSC project.  Disabling the build of the BSC would be
somewhat odd, so let's remove the option.

Also, OsmoBSC depends on libosmo-sccp now, so we must unconditionally
depend on it.  As a result, we can remove the --enable-nat option,
as this was only to avoid a mandatory libosmo-sccp requirement in
historical times.

Change-Id: Icfee8a904d33b7c13ab8d185d64fb5c2337d8640
2017-09-03 22:57:31 +02:00
Neels Hofmeyr 7b656884cf split off osmo-bsc: remove files, apply build
Change-Id: I64d84c52f6e38e98144eb9be8f0ab82e0e1f6cca
2017-08-30 14:11:25 +02:00
Neels Hofmeyr 31a11aa75b add msg type to SMS rx logging
Change-Id: I73ea4eebe57b2d1008045a27f174072178b9f077
2017-08-30 14:09:31 +02:00
Neels Hofmeyr 5a66940b19 gsup client: move not-connected to error loglevel
Change-Id: I8290963aedb7237da89c9ff98adf4cd33beb5031
2017-08-30 14:09:31 +02:00
Neels Hofmeyr becfc4cb1b move to osmo-mgw.git: osmo-bsc_mgcp and libmgcp as libosmo-legacy-mgcp
Rewire build and includes to libosmo-legacy-mgcp.

Drop osmo-bsc_mgcp and related python tests, now found in osmo-mgw.git.

libosmo-legacy-mgcp is installed from osmo-mgw, hence add the dependency to
jenkins.sh (so far using the pre_release branch).

Change-Id: Ic99d681759edce11564da62500c2aac5cf5fffe2
2017-08-30 14:09:31 +02:00
Neels Hofmeyr eb228bd430 move libiu to osmo-iuh/libosmo-ranap
Remove libiu here, use the functions from libosmo-ranap instead, by applying
the ranap_ / RANAP_ prefix.

Corresponding change-id in osmo-iuh.git is I6a3f7ad15be03fb94689b4af6ccfa828c25f45c0

To be able to run the msc_vlr tests for RAN_UTRAN_IU without Iu client headers
available, add iu_dummy.h, containing mere function signatures that match
iu_dummy.c and a mostly empty struct ranap_ue_conn_ctx.

Make sure we can build with and without --enable-iu: include osmo-iuh headers
only with --enable-iu.

Change-Id: Ib8c4fcdb4766c5e575618b95ce16dce51063206b
2017-08-30 14:09:31 +02:00
Philipp Maier 26a2433a1b mgcp: add VTY Option to force-realloc endpoints
Currently the force_realloc feature is turnd on and of in a
hardcoded way. This patch makes the option available via VTY.

Change-Id: Ic8740512c5ea0766ff6ceb1c28b9c2b3fe46e75f
2017-08-30 14:09:31 +02:00
Philipp Maier 39f62bbcbf Implement AoIP, port to M3UA SIGTRAN (large addition and refactoring)
This was originally a long series of commits converging to the final result
seen in this patch. It does not make much sense to review the smaller steps'
trial and error, we need to review this entire change as a whole.

Implement AoIP in osmo-msc and osmo-bsc.

Change over to the new libosmo-sigtran API with support for proper
SCCP/M3UA/SCTP stacking, as mandated by 3GPP specifications for the IuCS and
IuPS interfaces.

From here on, a separate osmo-stp process is required for SCCP routing between
OsmoBSC / OsmoHNBGW <-> OsmoMSC / OsmoSGSN

jenkins.sh: build from libosmo-sccp and osmo-iuh master branches now for new
M3UA SIGTRAN.

Patch-by: pmaier, nhofmeyr, laforge
Change-Id: I5ae4e05ee7c57cad341ea5e86af37c1f6b0ffa77
2017-08-30 14:09:31 +02:00
Harald Welte 8f4a7c14af Treat SIGTERM just like SIGINT in our programs
When somebody kills the process, it's best to handle the signal
and to use the opportunity for some cleanup.  We always did this
in the NITB on SIGINT, but never on SIGTERM. Let's change it.

Change-Id: Iea6804325a6575ceab5edfd28dd20249462f143b
2017-08-27 03:52:47 +02:00
Harald Welte 5d35245adc NITB: remove 'help' output about '-a' option that is removed for ages
This option was present in very early versions of the NITB, but
at least since 2011 it is no longer supported.  It's still listed
in --help output, which is wrong.

Change-Id: I1d2cceb588ec5fb34ec5e2c05a7d8c93310bee88
2017-08-27 03:52:47 +02:00
Keith Whyte 5f9d0bdd64 libmsc: Use actual delivery time in delivery reports.
Set the time on the status report to the time the message was delivered, as
this may not be the same as the time when we are delivering the report to the
originating MS.

Change-Id: I9056429d40bf02731f004b7833f1de45a0d1add8
2017-08-27 03:52:47 +02:00
Max e8159690ac gbproxy: log signal value as text
Change-Id: I6ed923f5c60a8d64305f4b8e90d1362d6510e1c5
2017-08-27 03:52:47 +02:00
Max 8089353861 gbproxy: log unhandled BSSGP PDU as text
Change-Id: Ibe3c8bd353b3a178e26b0936f25b2e1959f9990c
2017-08-27 03:52:47 +02:00
Pau Espin 56d96da8ef libmsc: Fix wrong handling of user_message_reference parameter
libsmpp34 already converts received TLV integer values to native
endianess in libsmpp34_(un)pack.

Converting them again at receive time swaps the 2 bytes of
user_message_reference, then using a wrong value. As GSM03.40 spec
uses only 1 byte for the id, then only the high byte of the initial
value is used and eventually sent back to the ESME. Again, at that time,
htons() is not needed because libsmpp34 already handles that part.

See OS-#2429 for more details.

Change-Id: If748548a4a223e529a1110c89e483b599b406e8b
2017-08-27 03:52:47 +02:00
Pau Espin fc03b1ec6c smpp: Fix compilation warning
I already stumbled into 2 compilation environments which had Werror
enabled for -Wmaybe-uninitialized and the build failed, so let's
workaround this warning.

| smpp_openbsc.c: In function 'handle_smpp_submit':
| smpp_openbsc.c:216:9: error: 'sms_msg_len' may be used uninitialized in this function [-Werror=maybe-uninitialized]
|    memcpy(sms->user_data, sms_msg, sms_msg_len);
|          ^
| smpp_openbsc.c💯15: note: 'sms_msg_len' was declared here
|   unsigned int sms_msg_len;
|                ^
| cc1: some warnings being treated as errors

Change-Id: I0901ddadb5f72e1585cb1797ac22c8ab95e83146
2017-08-27 03:52:47 +02:00
Keith Whyte 1ec20dad3e LIBMSC: Use sms->text, not sms->user_data to construct report body
gsm_04_11.c sms_report_alloc()

Use the sms->text, not the sms->user_data to construct the report body.
This also prevents the potential output of non printable characters to
the log and or vty.

Change-Id: Id51bc9483ad6f52d6da74135605cfd12434c7c96
2017-08-27 03:52:47 +02:00
Keith Whyte c04ce792cb LIBMSC: Place correct dst address in status report
gsm_04_11.c: gsm340_gen_sms_status_report_tpdu()

When we construct the status report PDU, use sms->src
instead of sms->dst as the destination address
This way we tell the MS that the message was delivered
to the destination and not to itself.
This is relevant for phones that display a textual
representation of the delivery report.

Change-Id: I2d4f87ac777465de9bfb5a775a789a2691755ee9
2017-08-27 03:52:47 +02:00
Pablo Neira Ayuso 0a4a805434 libmsc: use SMPP34_DELIVERY_RECEIPT_* in libsmpp34
Use new definitions in libsmpp34 to set the registered_delivery field
accordingly, as provided by I5b3afff1b3b77cccd949e0606914c7ac3ba6114c.

Moreover, do not set this header field to zero if status reports are
off, the deliver_t structure has been already zeroed so this not
required.

Change-Id: Ie78e17323796120f576b9c0e1bc5ccc32da8ee12
2017-08-27 03:52:47 +02:00
Harald Welte 33d18fe10f Migrate from gprs_apn_to_str() to libosmocore osmo_apn_to_str()
In 2015, Jacob moved/copied related functions to libosmocore, but
for some reason didn't remove the copies here.  Let's follow-up on
that and remove duplicated code.

The libosmocore commit introducing osmo_apn_to_str() was
8114294bf29ac6e44822c0ae43d4b0819f11b022

Change-Id: I7315ffcbed8a54cca2056f313bb7783ad82d0ee9
2017-08-27 03:52:47 +02:00
Harald Welte 7f1324f6de sgsn_vty: Don't assume pdp->lib is always valid
We can only print libgtp pdp information if a library context is
attached to this pdp context.  This is not always the case,
particuarly during some teardown scenarios.

Change-Id: Ia3184877f9709db65f5f93a98403f2ef5b04a8ca
2017-08-27 03:52:47 +02:00