Commit Graph

254 Commits

Author SHA1 Message Date
Philipp Maier d3fa9002a9 a_iface: remove unused variable
Change-Id: If964ac5344fa0275c07755b5a43d37ce186d3ca2
2017-07-12 23:42:47 +02:00
Philipp Maier 49603972aa osmo-msc/a_iface/reset: add missing const
Change-Id: Id75918dfd891d9407a62a0b7cd9590932c858093
2017-07-12 23:42:47 +02:00
Philipp Maier 6408ea8c5f osmo-bsc/sigtran: add missing const
Change-Id: I36404b34b8a85fc98670a3eeb8aaf29a4a6f10ea
2017-07-12 23:42:47 +02:00
Philipp Maier c808db4afc osmo-msc: rename called/calling address in struct a_conn_info
Change-Id: I1b28652662d83f52db21cb78b512c501c7adf4bb
2017-07-12 23:42:47 +02:00
Philipp Maier f9bac02f78 osmo-bsc: change calling/called_addr variable names
"calling_address" and "called_address" is not very expressive.

change the respective struct memeber names of bsc_msc_data to
bsc_addr and msc_addr to increase readability of the code.

Change-Id: I63b2e810b97131c690edd5a9cc5c7b3b54ec5e12
2017-07-12 23:42:47 +02:00
Philipp Maier dba0700d1e osmo-bsc: Make SCCP-Addresses configurable via VTY
Add VTY commands to configure the sccp-address of the BSC
and the one of the MSC.

Change-Id: I49cedc0ce339defa6fb354f6fb9b1af7820da7cc
2017-07-12 23:42:47 +02:00
Philipp Maier 67c7356ba5 osmo-msc: finish msc-sided reset
finish the implementation for msc sided reset, automatically
register connecting BSCs.

Ensure that all sccp connections are cleared when the reset
procedure executes.

Change-Id: Iba3f5523795c6972600bbfda2a02b06ba84ea12d
2017-07-12 23:42:47 +02:00
Philipp Maier 6d410dff91 mgcp: Fix missing call id in DLCX
The call id field in the DLCX message is missing. Use the endpoint
id as call id in all CRCX and DLCX messages.

Change-Id: I8b78b76126c63c4882e982c64c3953dbe1dab179
2017-07-12 23:42:47 +02:00
Philipp Maier bc7fabb8b9 reset: fix allocation and add deallocator for reset procedure
When the reset is started, state machines are allocated. The user
must provide a correctly filled structure where the reset start
function adds the state machine into.

This is prone to errors, besides of that, a proper deallocator
function which tears down the osmo fsm is missing.

make a more cofmortable allocator function and add deallocator
function.

Change-Id: I0054fb31589fb9f4c63c45df436e83448c59bd97
2017-07-12 23:42:47 +02:00
Neels Hofmeyr 0d55fcd795 aoip: don't use iu struct: move rtp ports from .iu to new subscr_conn.rtp
Change-Id: Ib1a84b0733655b2e87c1598ae9df0640cdca833b
2017-07-12 23:42:47 +02:00
Neels Hofmeyr 90ac6b0684 AoIP+3G: use one common SCCP client for A and IuCS
Move osmo_sccp_simple_client() setup out of iu_init() and a_init().
In msc_main.c and sgsn_main.c, initialize the STP connection first and then
pass to iu_init() and a_init().

This allows serving 3G (IuCS) and 2G (A) from one and the same MSC instance.

Since both OsmoHNBGW and OsmoBSC are using PC 23 by default now, move BSC to PC
42 (because OsmoBSC typically has vty port 4242, bla).

Also:
a_iface.c: remove now unused defines
a_init(): remove osmo_ss7_init() call that duplicated msc_main.c

Change-Id: I963a94e1a0bfc455992d22940dcc9c67c44570b9
2017-07-12 23:42:47 +02:00
Philipp Maier 15cc54e85c osmo-bsc: react on reset requests from MSC
The bsc side currently can not receive reset commands from an
MSC. This patch adds required functionality to receive a reset
command and acknowlege it properly. The effects are the same
as with when sending resets (all drop all ongoing calls and
sccp connections)

Change-Id: I44c7e54c845948c54614b36d97d2ba1e760ac46b
2017-07-12 23:42:46 +02:00
Philipp Maier ac1f2a0817 libcommon-cs: genralize a interface reset fsm
The AoIP standard also describes an MSC->BSC reset procedure. We
currently do not implement it. However, the fsm that is used to
issue the reset request from the bsc side is not generalized. This
patch generalizes the code in order to be able to use the same
code on the MSC side to perform a reset procedure from there.

Change-Id: I65e20bebb126ba35122ca3a545393d18fcadf5ad
2017-07-12 23:42:46 +02:00
Philipp Maier 203e93d4f6 fixup: remove unused counter
Forgot to remove the counter struct osmo_timer_list msc_reset_timer;
Needs to be fixuped into the reset handling patches

Change-Id: I6d397188732f4593edc12459de6f3b5f47b7f06a
2017-07-12 23:42:46 +02:00
Philipp Maier dbb53d4bc7 cosmetic: make function names in a_iface_bssap more expressive.
The function names in a_iface_bssap.c are not very expressive.
The problem not only exists on the API side, but also for static
functions. This patch replaces the function names with more
expressive names.

Change-Id: I1cdf37e4034ed8a9536c253c13910fc436c66f04
2017-07-12 23:42:46 +02:00
Philipp Maier 09907d5745 cosmetic: more expressive function names in a_iface
The function names if the API function in a_iface.c are not
very expressive. Besides of that, the prototypes are in the
wrong header file. This commit gives the function more
expressive names and moves the prototypes in the right header
file.

Change-Id: I6af4b7deed9d11ac5fe188eb5625fba50caad7c1
2017-07-12 23:42:46 +02:00
Philipp Maier 2b3b4d407f mgcp: make bts base port configurable
Currently the rtp base port of the BTS is hardcoded (4000) and not
configurable. This patch adds VTY configuration options to make
it adjustable.

Change-Id: I76e008eb0bd95b2941b67ea2fbdc1a82eef3cc5f
2017-07-12 23:42:46 +02:00
Philipp Maier 62afc1467a Revert "mgcp: make sure all endpoints are closed on startup"
Clearing all endpoints by sending a DLCX on startup has ben found
to be a bit too offensive. It also will not help against
inconsitancies that may occour during runtime (e.g. an overheard
DLCX during regular call teardown).

This reverts commit b669ea94cb78fd9b56ee8dd9392538151349f8ba.

Change-Id: Ia3bd8bfe9a09e300cf11629f7d7e3012ca8f394d
2017-07-12 23:42:46 +02:00
Philipp Maier b427707355 a_iface_bssap: clear lingering subscriber connections on reset
When the BSC is vanishing, the subscriber connections will stay
active until the MSC is instructed via tha A interface to clear
the connections. Unfortunately, this will most likely not be
the case because the BSC will most likeley have lost all its
state and does not know about the old connections anymore.

This patch fixes the problem by looping through the list with
the active gsm subscriber connections and clearing them manually
when the reset from the BSC is received. Only connections by the
bsc who actually executes the reset are affected. Connections
from other BSCs will not be touched.

Change-Id: Ic2b43b937d08a6dea4fe70dbc3eb722323338dc1
2017-07-12 23:42:46 +02:00
Philipp Maier 87a3020e52 cosmetic: fix typo
Change-Id: I2cfea36a5626605ecb72d0f0927ac1a731aa1609
2017-07-12 23:42:46 +02:00
Philipp Maier 6db2ffdcd6 mgcp: make sure all endpoints are closed on startup
If the MSC is crashing and restarting, it may leave some endpoints
open. The endpoints can not be re-used until they are deleted
(DLCX). This patch sends a DLCX to all possible endpoints (usually
this is in a countable range) in order to clear possible open
endpoints from a previous run

Change-Id: I9de2f67ffe08b2d76574ef4470c7a9767ca74702
2017-07-12 23:42:46 +02:00
Philipp Maier b7bec70f60 mgcp: make structs accessible from outside
struct mgcpgw_client and struct mgcp_inuse_endpoint are not
accessible from outside, making it difficult to look in the
mgcp client properties and status. The commit moves the
structs into the header file.

Change-Id: I20dcdaac013e3bcbd870eaf34a17598eac373f95
2017-07-12 23:42:46 +02:00
Philipp Maier 9d4765129b mgcp: improve endpoint management
Currently the assignment of endpoint identifiers works by just
incrementing a counter. The mgcpgw only has a limited amount
of endpoint identifiers avaliable, this means we will run out
of endpoints after only a few calls.

This commit adds a mechanism to keep track of used endpoint
identifiers so unused endpoint identifiers can be re-used

Change-Id: I081f9178975b6593a7ab8de5261a29a1d43d36a3
2017-07-12 23:42:46 +02:00
Philipp Maier 30c749e089 mgcp: use mgcp DLCX command to terminate endpoint after call is done
Currently no DLCX command is sent to the mgcpgw when a call is over,
this leaves the endpoint open. This means that the endpoint can not
never be reused by other calls. This patch adds a DLCX that
terminates the the endpoint when the call is done.

Change-Id: Ifc5a7a62fc07b4b7fee612d52e949fcd6a8e04ed
2017-07-12 23:42:46 +02:00
Philipp Maier 253fc0b82e mgcp: add DLCX command to mgcpgw client
The mgcpgw client currently lacks support for DLCX. This patch
adds a generator function to generate a DLCX command as well.

Change-Id: I1ac4635fc1371f2d3a46815f26a1f9ede3eedafa
2017-07-12 23:42:46 +02:00
Philipp Maier f6209b2fba fixup: in osmo-bsc-sigtran.h header (bsc_msc_data.h) was missing
Change-Id: I4220bc9a3a6f13fd6b09c3a7edadea5b8823d1c5
2017-07-12 23:42:46 +02:00
Philipp Maier 615db796d3 osmo-bsc: Handle RESET/RESET-ACK properly
Improve the way the BSC executes its RESET/RESET-ACK sequence.
Currently only a simple bool variable serves as a state holder.
We set this variable to true when we receive the RESET-ACK
message. Unfortunately no further checking is done. This
patch replaces the old mechanism with a more elaborated
implementation which also detects a loss of the connection
and makes sure to reconnect properly afterwards. Also the
all open connections are closed on connection loss

Change-Id: I876319b15103cc395e74597a52ce4d1a934915f4
2017-07-12 23:42:46 +02:00
Philipp Maier 1a56e22245 aoip: signal channel type to BSC
obtain the permitted speech and the prefered channel parameters
and signal it to the MSC with the channel type field.

Change-Id: I642480fa408dee7a4f40f7aab95f40383b3e91af
2017-07-12 23:42:46 +02:00
Philipp Maier 4599007a41 osmo-bsc: Negotiate rtp ip address/port with BTS
This patch adds the support for the RTP IP-Address/Port assignment.
The post communicated via the assignment request is now transmitted
via RSL/IPACC to the BTS. The Response containing the RX-Port at
the BTS side is communicated back to the MSC.

Since we plan to add a private MGCPGW to each BSC, this has to
be extended. Currently it only creates a direct connection to
the BTS. This will be introduced with a future patch.

Change-Id: I693e428b6bfdd8534eb5b88fa4d47dac20db88ea
2017-07-12 23:42:46 +02:00
Philipp Maier cd2a22659d WIP: Integrate AoIP into MSC
Change-Id: Iaf7deff397ec95b744fe287e713bbdd6a1ee73cf
2017-07-12 23:42:46 +02:00
Philipp Maier bc3c004c49 WIP: Integrate AoIP into OsmoBSC
Change-Id: I5ae4e05ee7c57cad341ea5e86af37c1f6b0ffa77
2017-07-12 23:42:45 +02:00
Harald Welte a929299cc4 WIP: Port to new libosmo-sigtran API (with proper M3UA for Iuh)
This changes 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.

Only the ASP (client) is used, assuming that both the HNB-GWs and RNCs
as well as the MSCs and SGSNs are all connecting as ASP to some STP/SGW
which offers M3UA server functionality as well as point-code and/or
global title based routing.

Change-Id: I450e22d46e47eec350a152f7832428f226bf17fc
Tweaked-by: nhofmeyr (test expectation)
2017-07-12 23:42:45 +02:00
Neels Hofmeyr 388948d77f mgcp: hack RAB success from nano3G: patch first RTP payload
The ip.access nano3G needs the first RTP payload's first two bytes to read hex
'e400', or it will reject the RAB assignment. Add flag
patched_first_rtp_payload to mgcp_rtp_state to detect the first RTP payload on
a stream, and overwrite its first bytes with e400. This should probably be
configurable, but seems to not harm other femto cells (as long as we patch only
the first RTP payload in each stream). Only do this when sending to the BTS
side.

Change-Id: I5eff04dcb0936e21690e427ae5e49228cd459bd4
2017-07-12 23:42:45 +02:00
Neels Hofmeyr ef2d29f2a1 Implement IuCS (large refactoring and addition)
osmo-nitb becomes osmo-msc
add DIUCS debug log constant
add iucs.[hc]
add msc vty, remove nitb vty
add libiudummy, to avoid linking Iu deps in tests
Use new msc_tx_dtap() instead of gsm0808_submit_dtap()
libmgcp: add mgcpgw client API
bridge calls via mgcpgw

mgcp: hack RAB success from nano3G: patch first RTP payload
The ip.access nano3G needs the first RTP payload's first two bytes to read hex
'e400', or it will reject the RAB assignment. Add flag
patched_first_rtp_payload to mgcp_rtp_state to detect the first RTP payload on
a stream, and overwrite its first bytes with e400. This should probably be
configurable, but seems to not harm other femto cells (as long as we patch only
the first RTP payload in each stream). Only do this when sending to the BTS
side.

Change-Id: I5b5b6a9678b458affa86800afb1ec726e66eed88
2017-07-12 23:42:45 +02:00
Neels Hofmeyr 235207c9fb mscsplit: various preparations to separate MSC from BSC
Disable large parts of the code that depend on BSC presence.

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.

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.
In osmo-nitb, paging is done on BSC level and MSC level "at the same time".
When the new MSC is fully operational, paging will be controlled separately on
the MSC level, and the BSC (RNC) level will be instructed over an IuCS or
A-interface to negotiate paging with the MS (UE). This MSC level paging does
not yet exist and will be added in subsequent commits.

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

Change-Id: Id3705236350d5f69e447046b0a764bbabc3d493c
2017-07-12 23:42:45 +02:00
Harald Welte 4c4cd7944b IuPS adjustments
SGSN: Don't indicate GERAN in Iu mode PDP CTX ACT REQ to GGSN

sgsn_ranap_iu_event: handle some events without valid MM context

sgsn init: pass sgsn_config pointer to sgsn_vty_init(), not sgsn_parse_config

Change-Id: Ie6b6e5422987586531a898e0c5b867623dbecb0f
IuPS: cosmetic: explicitly check RAN type; move comment
2017-07-12 23:42:45 +02:00
Harald Welte 80e6ece792 Use libvlr in libmsc (large refactoring)
Original libvlr code is by Harald Welte <laforge@gnumonks.org>,
polished and tweaked by Neels Hofmeyr <nhofmeyr@sysmocom.de>.

This is a long series of trial-and-error development collapsed in one patch.
This may be split in smaller commits if reviewers prefer that. If we can keep
it as one, we have saved ourselves the additional separation work.

SMS:

The SQL based lookup of SMS for attached subscribers no longer works since the
SQL database no longer has the subscriber data. Replace with a round-robin on
the SMS recipient MSISDNs paired with a VLR subscriber RAM lookup whether the
subscriber is currently attached.

If there are many SMS for not-attached subscribers in the SMS database, this
will become inefficient: a DB hit returns a pending SMS, the RAM lookup will
reveal that the subscriber is not attached, after which the DB is hit for the
next SMS. It would become more efficient e.g. by having an MSISDN based hash
list for the VLR subscribers and by marking non-attached SMS recipients in the
SMS database so that they can be excluded with the SQL query already.

There is a sanity limit to do at most 100 db hits per attempt to find a pending
SMS. So if there are more than 100 stored SMS waiting for their recipients to
actually attach to the MSC, it may take more than one SMS queue trigger to
deliver SMS for subscribers that are actually attached.

This is not very beautiful, but is merely intended to carry us over to a time
when we have a proper separate SMSC entity.

Introduce gsm_subscriber_connection ref-counting in libmsc.

Related: OS#1592
Change-Id: I639544a6cdda77a3aafc4e3446a55393f60e4050
2017-07-12 23:42:45 +02:00
Harald Welte 7788cbf96c Add libvlr implementation
Original libvlr code is by Harald Welte <laforge@gnumonks.org>,
polished and tweaked by Neels Hofmeyr <nhofmeyr@sysmocom.de>.

This is a long series of trial-and-error development collapsed in one patch.
This may be split in smaller commits if reviewers prefer that. If we can keep
it as one, we have saved ourselves the additional separation work.

Related: OS#1592
Change-Id: Ie303c98f8c18e40c87c1b68474b35de332033622
2017-07-12 23:42:45 +02:00
Neels Hofmeyr da6f951691 gsup_client: allow passing a unit id to identify with HLR
Before, each GSUP client would contact the HLR with an identical unit id, i.e.
"SGSN-00-00-00-00-00-00", with the result that some messages were sucked off by
the wrong client.

Pass explicit unit name from each gsup client user, so that OsmoMSC is "MSC"
and OsmoSGSN is "SGSN". Hence the HLR can properly route the messages.

Todo: also set some values instead of the zeros.

Unrelated cosmetic change while editing the arguments: gsup_client_create()'s
definition's oap client config arg name mismatched the one used in the
declaration. Use oapc_config in both.

Change-Id: I0a60681ab4a4d73e26fe8f0637447db4b6fe6eb2
2017-07-12 23:42:44 +02:00
Neels Hofmeyr 0b5cf1d1d4 move openbsc/* to repos root
This is the first step in creating this repository from the legacy openbsc.git.
Like all other Osmocom repositories, keep the autoconf and automake files in
the repository root. openbsc.git has been the sole exception, which ends now.

Change-Id: I9c6f2a448d9cb1cc088cf1cf6918b69d7e69b4e7
2017-07-12 23:42:44 +02:00
Harald Welte 13e10daa33 move openbsc into its own subdirectory 2009-06-10 05:40:52 +08:00
Harald Welte f7c43524cf * add support for storing classmark1/2/3 per subscriber
* add support for parsing measurement results (both BTS and MS side)
2009-06-09 20:24:21 +00:00
Harald Welte d3ff51dfe3 don't prefix every line with timestamp, this saves some screen real estate 2009-06-09 20:21:57 +00:00
Holger Freyther 6d9f77acd0 openbscdefines.h: Add header file to control visibility of symbols
Add the hooks/configure detection to compile everything with
-fvisibility=hidden and then make certain symbols visible. This
will be used to make parts of the API public.
There are no users yet but we should have some soon.
2009-06-08 10:32:54 +00:00
Holger Freyther 7c19f74084 lchan: Handle the abnormal case of channel getting closed
The abnormal case is that lchan_free ist getting called due
a RSL_MT_CHAN_REL_ACK in the RSL but the refcount of this
channel is not zero. This means that some "logical operation"
is still going on that needs to be cancelled.
Instead of always queuing up all operations in the
struct gsm_lchan use the signal framework to inform higher
layers about this abnormal case.

In gsm_04_08.c a signal handler is installed and in the
abnormal case the location updating request operation is
freed.
2009-06-06 13:54:35 +00:00
Holger Freyther c7b86f9011 Revert "[db] Keep track of the current gsm_network"
This was a stupid decision. We will have to assign the
network at some other place. The problem will be a problem
when we have two gsm_networks in one process and the same
subscriber is traveling in both networks.
2009-06-06 13:54:20 +00:00
Harald Welte 8b697c74c7 BS11: add nm_state for EnveBTES, PA and BBSIG physical objects 2009-06-05 19:18:45 +00:00
Holger Freyther c3d4b2d441 [subscr] Remove the struct gsm_bts pointer from subscriber
The pointer was initially added to support to open a lchan
by using the gsm_subscriber structure. We would have restored
the struct gsm_bts from the db when loading the subscriber.

Instead we will dynamically resolve the gsm_bts and might end
up paging multiple bts in the same (stored/old) location area
until it answers.
2009-06-04 14:27:39 +00:00
Holger Freyther 862cfff609 gsm_subscriber.h: Remove trailing whitespace...
Cosmetic changed
2009-06-04 14:15:33 +00:00
Holger Freyther 213b20bec0 [subscriber] Change id to long long unsigned int (Andreas Eversberg)
Changes the subscriber id type defintion from "long unsigned int" to "long
long unsigned int". Without, printf with '%llu' caused a crash.
2009-06-02 03:24:54 +00:00