Commit Graph

6415 Commits

Author SHA1 Message Date
Max 61b0c30cca Generate SI2bis Rest Octets
According to the spec it's an empty 1-byte element reserved for future
extension but we still have to generate padding properly. Add stub
function similar to the used for SI2ter and adjust test output
accordingly.

Related: OS#2711
Change-Id: I3c278c57880a173df3c4648c9724339d23ce94fd
2017-12-12 18:00:56 +00:00
Harald Welte d382bf63e2 paging: Stop all paging if MSC sends us BSSMAP RESET
When the MSC has lost its state and issues a RESET, we should not only
clear all ongoing radio connections, but we should also stop any paging.
There's no point in paging a subscriber if the MSC doesn't know about
this paging anymore.

Change-Id: If3f53d3bb66ad2dc02db823cb813590c6b59c700
Closes: OS#2736
2017-12-11 16:21:38 +01:00
Harald Welte f4b66fb2f1 paging: Remove obsolete paging call-back support
The call-back was needed inside the NITB to determine which part (CC,
SMS, ...) had triggered a given paging.   A pure BSC doesn't need that
feature, so let's get rid of it.

The 'void *cbfn_data' is replaced with a 'struct bsc_msc_data *', as
all callers use it with that type.

Change-Id: I8839e8338d3ad1a91b41e687e8412fcdca3fd9ab
2017-12-11 16:21:38 +01:00
Harald Welte 958cccf89a paging.c: add more documentation on what the functions actually do
This was created during code review towards some upcoming fix for
OS#2736. However, it's not really related to that.

Change-Id: I68d4fc8baaedd1d64cd628b2441c57ebc64ecebc
2017-12-11 16:21:38 +01:00
Harald Welte dea252d29c Change T3101 default from 10s to 3s.
This timer is started when a channel is allocated with an IMMEDIATE
ASSIGNMENT message. It is stopped when the MS has correctly seized the
channel.  Ever since the early days of development we were using a very
long timeout to be on the safe side.  However, in production networks
this is a terrible waste of resources, as we will occupy 10s worth
of air-time on one of our channels for each RACH request we receive.

The only scenarios where you might need something absurdly high as 10s
would be if you have 8s of RTT between your BTS and the BSC.

See also https://osmocom.org/projects/osmobsc/wiki/Timers

Change-Id: If3c52a7cf0c06d074c44a2fc414679279189aab9
Closes: OS#2733
2017-12-11 14:03:50 +01:00
Max 4bd710d107 Generate SI2ter Rest Octets
Previously we simply omitted SI2ter Rest Octets which is spec violation
which lead to 'Malformed Packet' error in Wireshark RSL dissector. Fix
this by generating empty 'no rest octets' with proper padding. Adjust
test output accordingly.

Change-Id: Ie4419aaaf93a462f501f8d8f7bf2677d37c58f94
Fixes: OS#2711
2017-12-11 12:27:49 +01:00
Philipp Maier eb79614f4e mgcp: cosmetic fixups
- use unique enum/struct fsm struct names
- use macro to shift bits in FSM description
- use OSMO_STRINGIFY to generate the state names
- remove duplicate logging of states and events
- remove unnecessary space in log strings
- prefix hexadecimal enpoint ids with
- remove unnecessary log messages
- rename bsc_mgcp_cause_codes_str to bsc_mgcp_cause_codes_names

Change-Id: I663e03046cde3c786af72d15681bf7497330d7f9
2017-12-10 14:22:41 +00:00
Max 115e2672fe OML: expand status reporting checks
* check GPRS state: if GPRS is enabled for the BTS but NSE, CELL or both
  NSVC are locked than report it as degraded
* check TRX usability: use already available function to check that TRX
  is actually usable when reporting OML status via CTRL
* fix tests linking: libbsc is using gsm48_create_mm_serv_rej() which is
  defined in libcommon-cs but neither libbsc itself nor tests using it
  are actually linked against libcommon-cs

Related: OS#2486
Change-Id: I9dce1d3b0cabe149a90cfca58a3fe55f8d6a72bc
2017-12-10 14:18:41 +00:00
Harald Welte 9311005aff Remove 'msc' counter group from BSC
This is left over from the OsmoNITB days.  We're defining and allocating
these MSC counters, but never actually using them.  This also means that
the automatic counter export will list them, raising the expectation at
users that such counters could be used in OsmoBSC.

Let's remove them.  They are in OsmoMSC, but not OsmoBSC.

Change-Id: I5bd9e6e333b1c396beae46630986b17e7f8b82ef
2017-12-09 23:14:50 +01:00
Harald Welte 1ef46d922a rate_ctr: Use ':' as separator, not '.'
In more recent versions of libosmocore, we are converting any '.'
in [rate] counter names to ':' to avoid clashes with the special
meaning of '.' in the CTRL interface.  Let's avoid any conversion
and use the proper name already here.

This also changes the codec_foo counters to codec:foo to follow the
notation of other counters.

Change-Id: I18916abbfc706b86bd211e7cca1a0ca3099826e9
2017-12-09 23:10:46 +01:00
Harald Welte d82101e663 Move many counters from BSC-global to per-BTS granularity
We used to have a lot of counters only globlly per BSC, but they're
much more useful on a per-BTS level.

Change-Id: I954b9dda72b83b91d46a934c221a8b3375743599
2017-12-09 23:07:38 +01:00
Alexander Couzens 547c207579 use _NUM_CHREQ_T to define the size of ctype_by_chreq
Make it future compatible for changes. Otherwise it will break
when additional enums are adding to chreq in libosmocore.
Depends on libosmocore Id67ba8de89dd6288e449197438e9e1c5d7f5a134

Change-Id: I2acab2af8d67bccb2bc495512c1f259ae649a832
2017-12-06 13:25:35 +00:00
Philipp Maier f4d0889abb cosmetic: use fsm pointer from parameter list
the parameter list of osmo-fsm callbacks contains a pointer
to the fsm instance. Use this pointer instead of reaching
out for mgcp_ctx->fsm.

Change-Id: I05ff62e7e2de64c2dbf5ea2736f5e58faf16df0b
2017-12-01 13:36:30 +01:00
Philipp Maier a89e163e4c cosmetic: correct sourcecode formatting
add missing line break

Change-Id: Ia117e4099046fefcf35ccb94400554062e667869
2017-12-01 13:36:30 +01:00
Philipp Maier e941f88ea1 cosmetic: add missing log prefix
the log messages have prefixes that mark important phases (CRCX/BTS,
etc...). Some lines lack the prefix.

Add missing prefixes.

Change-Id: Iea5ea9e54f4b5c998b1d5fe18a98a94abd7b728b
2017-12-01 13:36:30 +01:00
Philipp Maier 7eeb84271d cosmetic: do not cast void pointer
remove the casting of void *data, just assign directly

Change-Id: I2e37630e315b3602da2f14e2364bb76be9dd2894
2017-12-01 13:36:30 +01:00
Philipp Maier e4cfa74d38 cosmetic: remove duplicate logging
The log output of the reset FSM duplicates lots of the built in
FSM log output.

Remove duplicate logging, use more expressive log messages where
needed.

Change-Id: Ia5af309207476291f88af47878dc1d32b2dada06
2017-12-01 13:36:30 +01:00
Philipp Maier 06c3f8d3cb mgcp: do not fail silently on snprintf()
The snprintf() that is used to compose the fsm name on an assignment
request may cause a silent failure. The buffer is large enough to
take the string under all circumstances. If snprintf() fails, this
would mean we have some other serious problem.

use OSMO_ASSERT in case the snprintf() fails, so the failure
gets noticed.

Change-Id: I3c36df8cfd0880c524244048a993cd136be41f56
2017-12-01 13:36:30 +01:00
Philipp Maier 3ada5397d7 mgcp: add missing switch case
In the beginning of the CRCX phase for the network does not distinguish
between EV_MDCX_BTS_RES and EV_TEARDOWN, so a Teardown due to an error
could be misinterpreted as a successful MGW response.

Add missing case statement to distinguish CV_MDCX_BTS_RES from
EV_TEARDOWN.

Change-Id: I9bf49df167d94b33ad65d8b9382a01f160b5aec0
2017-12-01 13:36:30 +01:00
Philipp Maier fa85d18807 mgcp: use mgw assigned connection identifiers
osmo-mgw assigns connection identifiers which are returned with
the response to the CRCX.

store the assigned connection identifiers and use them to identify
the connections.

Depends: osmo-mgw Iab6a6038e7610c62f34e642cd49c93d11151252c

Closes: OS#2648
Change-Id: Ib379a6f40875bb8f2cf29038a5b5b7a40a21adab
2017-12-01 13:36:30 +01:00
Philipp Maier 2c3bf45449 mgcp: use hexadecimal digits in endpoint names
The current implementation of osmo-mgw parses the numerical
digit inside the endpoint name as hexadecimal number.

also use hexadecimal numbers in endpoint names.

Change-Id: I64a970d300b7290d50ec84b0640d5a321d903f5e
2017-12-01 13:36:30 +01:00
Philipp Maier 20114aa809 auth: remove obsolete VTY commands
authentication (optional|required) is no longer needed, the
related decisions are now made in the HLR.

Change-Id: Ib6c6331cc86004c4862067031e4fcb12a6975b63
2017-11-30 09:21:51 +01:00
Philipp Maier ad381102ea auth: remove unused structs
The following structs are no longer used/needed:

- gsm_auth_algo
- gsm_auth_info
- gsm_auth_tuple
- gsm_security_operation

Change-Id: I93873a6cb980a54e03e719170e27a7e397236b77
2017-11-30 09:21:51 +01:00
Philipp Maier 3b18044859 sccp-lite: remove obsolete VTY commands
remove obsolete vty commands:

- token
- auth-key
- no auth-key

Change-Id: I9101d750a424b8af46d603bc7c877229bbae8727
2017-11-30 08:18:45 +00:00
Philipp Maier bad11ae812 bssap: remove libosmo-legacy-mgcp dependancy
the functions mgcp_timeslot_to_endpoint() and rtp_calculate_port()
which are used to calculate the port in the sccp-lite / non AoIP
case are part of libosmo-legacy-mgcp. Unfortunately libosmo-mgcp
and libosmo-legacy-mgcp cause problems when used at the same
time.

Replace the functions mgcp_timeslot_to_endpoint() and rtp_calculate_port()
with a local helper function.

Change-Id: Id10311332aeabd8fd3ba1922198e34708e04cef9
2017-11-30 08:17:41 +00:00
Neels Hofmeyr 9c6d01173b HO prep: pass gsm_network to gsm_bts_alloc() already
Prepare for a future change that accesses bts->network during gsm_bts_alloc().

Currently, gsm_bts_alloc() takes a ctx parameter, and gsm_bts_alloc_register()
then gets the gsm_network pointer and sets bts->network to it. All callers
anyway pass gsm_network as ctx to gsm_bts_alloc(), and anything else would not
make sense anyway. So enforce passing exactly gsm_network to gsm_bts_alloc()
and already set the bts->network pointer from there.

Prepares-for: I00870a5828703cf397776668d3301c0c3a4e033a
Change-Id: Ie590c14aa08df4c4f345596b23e5226c5577057a
2017-11-29 17:37:18 +00:00
Neels Hofmeyr 17f2adb0a4 examples: add osmo-bsc-minimal.cfg
An upcoming VTY test requires a cfg that doesn't have handover values set.
Prepare for that by adding a minimal BSC config. It is a version further
stripped down from the Osmocom Network In The Box wiki page.

Prepares-for: I00870a5828703cf397776668d3301c0c3a4e033a
Change-Id: Ib68b550a0e9fbb7041e554f358054c0a7931404e
2017-11-29 17:37:18 +00:00
Neels Hofmeyr a2733ae9dc cosmetic: handover.h: use "#pragma once", declare structs, comments
Use new #pragma style instead of #ifndef dance.
Forward-declare all structs we're using pointers of.
Move function comments to their definitions in the .c file.

Change-Id: I3d43ec01897c0ef9eaf506e68d5a1ec1977f70ea
2017-11-29 17:37:18 +00:00
Neels Hofmeyr f0ea05e52f compiler warnings: add includes in abis_rsl.h, gsm_data_shared.h
Change-Id: Ic0b1410a352c7be399d16d5db7cfe7a62192df6f
2017-11-29 17:37:18 +00:00
Neels Hofmeyr 3d0b76d76e cleanup: drop unused gsm_bts.role
While this header was still shared among several code trees, we had this ROLE
construct in place to exclude some parts in some trees. Since we're having one
copy per code base now, the ROLE #ifdefs were dropped, also drop void *role.

Change-Id: I4f0c337779d8e7266b6e02815d886728c4826bb9
2017-11-29 17:37:18 +00:00
Neels Hofmeyr 27cd0fe430 compiler warnings: constify in abis_nm.c
Constify in- and output arguments for Parse Attribute Response Info chain to
avoid compiler warnings, and more clearly indicate const data in the first
place.

Change-Id: Ib7d069fe1fda69e89dfd171cd76b1ed6d6db0ceb
2017-11-29 17:37:18 +00:00
Neels Hofmeyr 39d50a7f4e compiler warnings: drop some unused variables
Change-Id: I840b0cd8ee3e7c521e7c9053a992deeb9ec22ff4
2017-11-29 17:37:18 +00:00
Max c8d55f2c0b cosmetic: mark gsm_objclass2mo as static
It's only used once in the same file so there's no need to put it into
global header.

Change-Id: Id9674cad54bab6cc04475719678efc2c25d058a9
2017-11-29 14:26:15 +00:00
Max c87dc3ee1e cosmetic: drop unused include
Change-Id: I46a2af19358c0eb5d2f1644b10afd58c424a51e8
2017-11-29 14:25:16 +00:00
Max d0ff694cb9 cosmetic: tighten function type signatures
* change return type to bool
* constify parameters

The nm_is_running(), trx_is_usable() and ts_is_usable() always return
boolean value and are always used as such anyway. The also do not change
their parameters.

Change-Id: I6a572fc78371c69f5308edbad0ebe15e143d0505
2017-11-29 14:23:13 +00:00
Pau Espin 8c209c9e2b cosmetic: bsc_vty: Document bvci reserved values
Change-Id: I7a4374c3619cb83ef8beef594281f887d9fbf70a
2017-11-29 11:55:18 +00:00
Pau Espin c5a84166cb cosmetic: bsc_vty: Fix trailing whitespace
Change-Id: I7089062285c40ec11af479c98b43d1d407397c82
2017-11-29 11:55:18 +00:00
Philipp Maier ad47f7108a auth: remove obsolete VTY commands
Authentication is no longer done in the BSC, the variables that
set the authentication policy and the IMSI regex have no longer
any effect.

Remove auth policy and authorized-regexp

Change-Id: Ie31b921b5fd0af5501ec0c77c0f08089c10075e2
2017-11-29 11:48:49 +00:00
Max d0f479e744 cosmetic: remove obsolete ROLE_BSC
It's leftover from the time when gsm_data_shared.* was actually shared
with OsmoBTS. Nowadays ROLE_BSC is always defined so we can just drop it
entirely and make working with gsm_data_shared.h slightly easier.

Change-Id: I34fc9ee5955c14bbbde68d5499cf2acfd329afbc
2017-11-29 12:24:52 +01:00
Max aa954cd10f OML: consider administrative state when reporting
Report state as degraded if BTS or any of its TRX are administratively
locked.

Change-Id: Ic9ee998d972ca870ce5d039c3ed95edb6ba8b36f
Related: OS#2486
2017-11-29 12:18:02 +01:00
Pau Espin e8dda5f296 vty: Add cmd to configure 3g Early Classmark Sending
In state prior to this patch, "3G Early Classmark Sending Restriction"
bit in SI3 rest octets was always set to H, which is a sane default as
the policy to send the information is then controlled by "Early
Classmark Sending Control" bit in the same octet.

However, it seems Quortus SoftCore can have some issues decoding the
option, so let's add a vty cmd to be able to disable it for those
having any issues.

Related: SYS#4021

Change-Id: Ic1afe071038a3bb5871d7ff40f665c8644f801ec
2017-11-24 15:01:20 +01:00
Pau Espin 91c76fd656 Use type bool for boolean fields in gsm48_si_ro_info
Change-Id: Ic0981fca96f4927717ca335be1dab00a5d17fd6c
2017-11-24 12:55:15 +01:00
Pau Espin 7e78681f0f tests: Fix selection of python version
According to documentation (and personal experience), AM_PATH_PYTHON
selects the highest version of python, no matter if major version is
different, which means if both python2 and 3 are available, 3 will be
chosen an PYTHON will point to "/.../python" which is python3. Apparently,
the macro cannot be easily used to pick highest python2 version.

As {vty,ctrl}_test_runner.py require python2 and are incompatible with
python3, let's instead rely on the system having a "python2" binary
available, which is the case in most distros.

Change-Id: Id22e157d1bee453babdfa7ed04c506390b0f17bb
2017-11-24 12:55:15 +01:00
Neels Hofmeyr 434187533b bsc filter: don't ignore imsi-allow on "global" filter level
First off, there are "global" and "local" IMSI black/whitelist levels:

     "global"  "local"
 VTY 'bsc'     'msc'   for osmo-bsc
 VTY 'nat'     'bsc'   for osmo-bsc_nat

Both in osmo-bsc and osmo-bsc-nat, the "global" IMSI filter so far completely
ignores all 'imsi-allow' rules it may contain. A comment in imsi_allow()
proclaims actions that are missing in the code. Notably, in our example config
osmo-bsc_nat.cfg, there is an imsi-allow on the 'nat' level, which with the
code before this patch cannot have been effective in any way.

Furthermore, on the "local" level the order is to check imsi-allow first, and
imsi-deny after that. The comment says to do that in reverse order on the
"global" level. There is no apparent reason for reversing.

Add evaluation of imsi-allow directives on the "global" level, i.e. 'bsc' in
osmo-bsc and 'nat' in osmo-bsc-nat, in the same order as on "local" level, to
avoid confusion. Swap the comment to be consistent.

Before this patch, to have effective imsi-allow, this config would be necessary
for osmo-bsc:

    bsc
     access-list acl imsi-allow 999999999999999
     access-list acl imsi-allow 9017.*
     access-list acl imsi-deny .*
    msc 0
     access-list-name acl
     ...
    msc 1
     access-list-name acl
     ...

With this patch, imsi-allow also works on the "global" level:

    bsc
     access-list acl imsi-allow 999999999999999
     access-list acl imsi-allow 9017.*
     access-list acl imsi-deny .*
     access-list-name acl
    msc 0
     ...
    msc 1
     ...

Change-Id: Idb6c8dd62aa90666ba6fcd213f59d79f5498da3f
2017-11-23 13:21:12 +00:00
Neels Hofmeyr d663097b8a bsc_init: fix Werror: define rc for 2quater with si2q_count == 0
src/libbsc/bsc_init.c: In function ‘rsl_si’:
  src/libbsc/bsc_init.c:153:2: error: ‘rc’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
    return rc;
    ^

Change-Id: Iedad1efcb477c77db8c741777ea076761658c7d1
2017-11-21 14:38:21 +01:00
Philipp Maier ebd6fd1873 doc: add example configuration for osmo-mgw
osmo-bsc now uses osmo-mgw to switch the RTP streams, but there
is no example configuration yet.

Add the missing example configuration.

Change-Id: I4d4ed401bee6c3dfdec2b584bf7248ffb02bddbf
2017-11-20 09:31:53 +00:00
Philipp Maier 7e0c269e5c reset: remove name variable from reset context
The reset context contains a string buffer to allow for setting
a human readable name, that is then displayed in the logs. Since
OSMO-FSMs already have such a feature there is no need for an
extra name variable.

Use LOGPFSML and the name parameter of osmo_fsm_inst_alloc()
to display the name of the FSM

Fixes: Coverity CID#178664

Change-Id: I34511698923abec7545a6f3defd595f97b4bbeb1
2017-11-20 09:21:16 +00:00
Neels Hofmeyr 17b773acd1 add --enable-sanitize config option
Change-Id: Ie6888cc29b9815d3dc7aa6673599a0d6cb010e6b
2017-11-18 10:17:25 +00:00
Alexander Couzens 2ddf399c5f debian: remove doublicated project name in example files
For example:
/usr/share/doc/osmo-bsc/examples/osmo-bsc/osmo-bsc.cfg -> usr/share/doc/osmo-bsc/examples/osmo-bsc.cfg

Change-Id: I8a9f45e72dd966ca3913b5483ff78039a3e472ea
2017-11-15 23:44:16 +01:00
Harald Welte 4a3b044ad7 osmo-bsc: Print NOTICE message on unimplemented BSSMAP UDT
When we receive unimplemented/unhandled message types, we shouldn't
simply silently discard them, but print a log message for the
benefit of the user.

Change-Id: I65489578b1c214f193b1ce0e9ba59432dcd42a3e
2017-11-12 14:36:11 +00:00