Commit Graph

6129 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther 3730de4d87 sgsn: Convert cch_pdp to host order for libgtp
libgtp is calling gtpie_tv2 which will convert this uint16_t from host
to network order. So far libosmogsm and the sgsn treated the charging
characteristics as opaque data. So when moving from byte array to the
uint16_t do the swapping.

Change-Id: I977aec2e2f8d57802e45f591754e5733562d5c2a
2017-08-27 02:33:48 +02:00
Harald Welte 3b61a3812a remove code disabling T3109 if configured to 0
We no longer permit timers with a 0 value, so this case can never
happen.  Also, if it should happen, I'd rather have a timter expiring
immediately (and breaking something) than not being started in the
first place.

Change-Id: Ibfcdd3ddc0155caee89c501498329bde247621a0
2017-08-27 02:33:48 +02:00
Harald Welte 50546a9adb bsc_vty: Don't allow timers of zero (0)
It typically doesn't make sense to configure any of the GSM RR timer
to 0 (Seconds).  In fact, accidentially configuring any of the timers
to zero might have severe side effects, such as "stuck channels"
described in https://osmocom.org/issues/2380

Change-Id: I517828f2f0c80ec01cb63648db2626f17a67fe57
2017-08-27 02:33:48 +02:00
Harald Welte 5d1fa89819 GSM timers: User reasonable defaults; don't save if equal default
A number of the GSM timers (including T3109) had no reasonable
default values if not specified in the VTY / config file.  Together
with unconditional writing to the config file, this created
config files with a persistent setting for important timers as '0'.

To make things worse, many of our example cofig files suffered from the
same problem.

Let's avoid this from happening by
* having reasonable defaults if nothing specified in the config file
* conditionally savingg timers only if they differ from default
* reject any timer values that state zero during start-up (see previous
  commit)

Change-Id: Iaac0bfca423852b61d8b9eb1438157ef00d0d8c8
Closes: OS#2380
2017-08-27 02:33:48 +02:00
Harald Welte 1f7fe3c813 bsc_vty: Add VTY command to test CTRL TRAP feature
Using this new command (introduced in OsmoBSC + OsmoNITB), you can
simulate the generation of TRAP events for testin purposes.

start the control interface monitor as an example client program:
	./openbsc/contrib/bsc_control.py -m -d localhost -p 4249

then start OsmoBSC or OsmoNITB, telnet to the VTY and enter 'enable'
mode and issue the following (example) command:
	ctrl-interface generate-trap my.foo.var 2342

As a result, on the bsc_control.py you will see:
	Got message: TRAP 0 my.foo.var 2342

Change-Id: Ib1d2ec38290dc94797c1b365d9b733e5215ab7d1
2017-08-27 02:33:48 +02:00
Harald Welte 63dde0a44a gtphob: check for missing result of rate_ctr_group_alloc()
In case the counter group allocation fails, we must handle this
gracefully and fail the allocation of the parent object, too.

The recent change (Id I7dad4a4d52fe05f6b990359841b4408df5990e21) seems
to have missed one instance, so let's follow-up.

Change-Id: I1ee9e3d26dcc18e7f979fd9a786162cbcc50942c
Related: OS#2361
2017-08-27 02:33:48 +02:00
Harald Welte 852456db5f gsm_bts_trx_set_system_infos(): Disable non-existing SI
If we previously had a given SI present/active, we must send a
zero-length BCCH FILLING for that SI type to the BTS to stop it from
further transmitting this SI.

Change-Id: I33e356e2fa3a69efac9080813e3e9ef4e6438ed1
Closes: OS#2368
2017-08-27 02:33:48 +02:00
Harald Welte 942175ccd0 RSL: Allow disabling of BCCH/SACCH filling for given SI type
If we want to instruct the BTS to stop sending a given SI, we must be
able to send the respective BCCH INFO / SACCH FILLING with a header but
without any L3 data IE.  This patch enables the related functions to do
this whenever their data argument points to NULL.

Change-Id: I88b85614951a108574f05db3b706884afe7e87a9
2017-08-27 02:33:48 +02:00
Harald Welte 9b5ace86a1 Fix regression causing loss of static system-information messages
In commit 8b1a2f8cd7 we started to
initialize bts->si_valid to 0.  This means we are skipping the manually
configured static system information.

Instead, we have to initialize bts->si_valid to bts->si_mode_static,
i.e. start with those that are static and not to be auto-generated.

Found while developing
http://git.osmocom.org/osmo-ttcn3-hacks/tree/sysinfo

Change-Id: Iab9cc93cf6d54560a72cc393cc3721a8d10e04bf
Closes: #2367
2017-08-27 02:33:48 +02:00
Harald Welte 3ee3b85bb1 check for missing result of rate_ctr_group_alloc()
In case the counter group allocation fails, we must handle this
gracefully and fail the allocation of the parent object, too.

RelateD: OS#2361
Change-Id: I7dad4a4d52fe05f6b990359841b4408df5990e21
2017-08-27 02:33:48 +02:00
Harald Welte e168c122d3 libbsc: Add VTY command to re-send the SYSTEM INFORMATION to BTS
This is useful if you are updating some configuration parameters which
affect the content of the SYSTEM INFORMATION messages.  Currently, we
only send them at the time the RSL connection is established (i.e. when
the BTS is initialized), so if you change something, you need to bring
down and re-start the BTS.

Using the newly-introduced "bts <0-255> resend-system-information"
command, you can re-generate + re-send SYSTEM INFORMATION without
bringing the BTS down, i.e. without any radio carrier downtime.

Change-Id: I326df47de98f6d36c9a4d2d5475225d1e62bafb5
2017-08-27 02:33:48 +02:00
Harald Welte 5a218c02d9 bsc_api: Fix copy+paste error in printing name of RR STATUS PDU
Change-Id: I0ef78ef046e4850346569f750693e12938b50ab5
2017-08-27 02:33:48 +02:00
Benoit Bolsee e7cf5e7513 transaction: reject calls from unidentified subscribers
A valid subscriber is indespensible when allocating a new
transaction. Return NULL if no subscriber is supplied. This
will cause unidentified subscribers to be rejected.

Note: Under normal conditions, the problem does not occour,
but it is still possible that a misbehaving MS might trigger
the problem by sending a SETUP command before authenticating
the subscriber. (unencrypted networks)

Change-Id: Ia8739b6e329ab02c0064270d02ad1d6ee245520d
2017-08-27 02:33:48 +02:00
Max b9d13bf227 Fix BTS attribute requests
* fix BTS numbers: use 0 to indicate given BTS and 0xFF to indicate all
  BTS' as it's explained in 3GPP TS 52.021 §9.3.
* only request attributes from supported (OsmoBTS) types

Change-Id: I8f43055c38000248033a8ff9ddaf0910d68d794b
Related: OS#2317
2017-08-27 02:33:48 +02:00
Harald Welte 943077755d Add VTY commands for experimentation with TS 04.14 commands
TS 04.14 (TS 44.014) specifies a series of commands specific to
conformance testing.  Let's add some VTY commands to play (at least
initially) with closing and opening voice loops in the MS.

Change-Id: I38b1ee9dbf26f5689c38cb83b1b3c5e9eaad7678
2017-08-27 02:33:48 +02:00
Harald Welte eac38c3fa8 Support for TS 04.14 conformance test commands
Change-Id: Ib27edbfc8ccdedf00589ec715ced7bed435fa94c
2017-08-27 02:33:48 +02:00
Alexander Chemeris a7388d7d0f libmsc: Fix VTY output for handover counters.
Handover countrs belong to BSC, but we mistakenly take values from MSC counters.

Change-Id: I9512330f2e91d2f526751c5228e6e8e0fe17d579
2017-08-27 02:33:48 +02:00
Holger Hans Peter Freyther 9d6f0625f7 sgsn: Fill the cch_pdp with a value coming from the tlv structure
For some GGSNs we need to insert the PDP Charging Characteristics
that were returned. We receive these values from GSUP and will
fill them into the tlv structure when finding the ggsn context.

Change-Id: I1725bfd2403d29ce3550bfcd6fcc1498426ef906
2017-08-27 02:33:48 +02:00
Benoit Bolsee 38bb344a47 04.08: find a portable way to obtain the timezone offset
Portable GMT offset calculation to display correct
time on GSM.

Change-Id: I673f17af2550c9708c4771e4ea4eafbbfafbb824
2017-08-27 02:33:48 +02:00
Harald Welte e2e41c1e61 jenkins.sh: Proper error message if local environment isn't set up
Change-Id: I79c2302365824d9c8783dadfa378c8eaa07e2ee7
2017-08-27 02:33:48 +02:00
Benoit Bolsee d34ed5768c smpp: fix return cause
Return cause 38 when default SMPP route is unavailable. This
is better than cause 1.

Change-Id: If3241d50a78fa611981e55fef6ae4c72b0a2a167
2017-08-27 02:33:47 +02:00
Pau Espin 95606647ef smpp_smsc.c: Log on sending deliver_sm message
Change-Id: Ie16294df6d5bc0065f8d2b49320ead61f535f271
2017-08-27 02:33:47 +02:00
Neels Hofmeyr 6ecdbc90f1 Use value string check from osmo-ci
Necessary since libosmocore I513835be2d931d0a931cdfc996f361a451bc1a15
removes the script from libosmocore/contrib.

Change-Id: I02d7e1c0151c687fd9341d21a09ca15cbf5a1938
2017-08-26 19:22:24 +00:00
Daniel Willmann 8dc8ea435f examples/sgsn: Use osmo-hlr with auth-policy remote by default
For the vty tests, add osmo-sgsn-accept-all.cfg (that does not need an HLR) and
use in vty_test_runner.py, otherwise the 'show sgsn' command will reply that it
could not connect to the HLR, failing the vty test which expects empty.

Change-Id: Ie3b2013198d3e2b780a4e31c36b89b58129dcacd
2017-08-24 16:47:42 +02:00
Daniel Willmann b81d3bdad5 contrib: Change systemd requirements so the services connect properly
Change-Id: Ib1b3c640ddd81927a60ee307c4b0cb90fd83eebe
2017-08-23 14:38:08 +02:00
Daniel Willmann 2be19428f7 examples: Change IP address of config files
This helps in providing 3G software packages for the sysmoNITB hardware, which
uses 10.23.24.1 for SGSN and 10.23.24.2 for GGSN.

However, in order to not break the python tests, the osmo-sgsn.cfg example
still uses 127.0.0.1 as local address.

Change the GGSN address to 127.0.0.2, because SGSN and GGSN cannot co-exist on
the same address (the GTP port number is fixed by spec: no IE to communicate a
differing port, so it has to be the standard GTP port for both).

Change-Id: Ie3a25f6771ed6e620cb2b315638c622a9a24e530
2017-08-23 14:37:22 +02:00
Daniel Willmann e4ac64c39e contrib: Add osmo-msc service file
Change-Id: Ifdaf4107167c84af8a616f4ee792d5a34495564b
2017-08-23 14:35:31 +02:00
Neels Hofmeyr 78ada64be7 04.08: log protocol discriminators and message types by name
On incoming 04.08 messages, we log only the protocol discriminator in
decimal. Enhance: log pdisc and message type in hex, and also log the
protocol and message type as human readable string.

Also adjust the msc_vlr tests' log statements for wrapped rx/tx functions
of dtap from/to the MS.

Adjust the expected output of msc_vlr_tests.

Change-Id: Ida205d217e304337d816b14fd15e2ee435e7397d
Depends: libosmocore change-id I0fca8e95ed5c2148b1a7440eff3fc9c7583898df
2017-08-23 14:35:31 +02:00
Neels Hofmeyr 4df72051f9 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.

Related: OS#2459
Change-Id: I5eff04dcb0936e21690e427ae5e49228cd459bd4
2017-08-23 14:34:38 +02:00
Neels Hofmeyr 05230eac4a fix msc_vlr tests after libosmocore uses localtime for SMS
libosmocore change-id I4efdb1eaae43aced33961b64d4f14b0040321c10 changes the
gsm340_gen_scts() from gmtime to localtime, meaning that by feeding a mere zero
as timestamp, we get different results depending on the local machine's
timezone setting. Instead of calling gsm340_gen_scts() with zero, simply write
a bunch of bytes as time so that the tests get identical SMS bytes every time.

Change-Id: I8a50e8963dce80609749571b61fc6ffe1c54660c
2017-08-22 18:13:54 +02:00
Neels Hofmeyr 84da6b1edb 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

Enable MSC specific CTRL commands, bsc_base_ctrl_cmds_install() still needs to
be split up.

Change-Id: I5b5b6a9678b458affa86800afb1ec726e66eed88
2017-08-08 19:17:53 +02:00
Neels Hofmeyr 4283675311 sgsn init: pass sgsn_config pointer to sgsn_vty_init(), not sgsn_parse_config
In an upcoming commit, sgsn_vty_init() will require access to the global sgsn
config struct to initialize a generic VTY command with the proper config
destination address, see Change-Id I5b5b6a9678b458affa86800afb1ec726e66eed88.

Change-Id: Ie6b6e5422987586531a898e0c5b867623dbecb0f
2017-08-08 19:17:53 +02:00
Neels Hofmeyr e2f24d53e4 mscsplit: various preparations to separate MSC from BSC
Disable large parts of the code that depend on BSC presence. The code sections
disabled by #if BEFORE_MSCSPLIT shall be modified or dropped in the course of
adding the A-interface.

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.

Remove internal RTP streaming code; OsmoNITB supported that, but for OsmoMSC,
this will be done with an external MGCP gateway.

Remove LCHAN_MODIFY from internal MNCC state machine.

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.
Employ fake paging shims in order for msc_vlr_tests to still work.

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

gsm_subscriber_connection: put the LAC here, so that it is available without
accessing conn->bts. In bsc_api.c, place this lac in conn for the sake of
transition: Iu and A will use this new field to pass the LAC around, but in a
completely separate OsmoBSC this is not actually needed. It can be removed
again from osmo-bsc.git when the time has come.

Siemens MRPCI: completely drop sending the MRPCI messages for now, they shall
be added in osmo-bsc once the A-Interface code has settled. See OS#2389.

Related: OS#1845 OS#2257 OS#2389
Change-Id: Id3705236350d5f69e447046b0a764bbabc3d493c
2017-08-08 19:17:53 +02:00
Alexander Couzens 3b8dc57514 update .gitreview to new repo url
Leftover from split out of openbsc

Change-Id: I684eedfdeb52a9b018d3798961b29b9e31526cd1
2017-08-08 17:26:28 +02:00
Neels Hofmeyr 54a706cf92 vlr: LU FSM: enable Retrieve_IMEISV_If_Required
Change-Id: I121b95ad6d5ecb7603815eece2b43008de487a8a
2017-08-07 16:52:25 +02:00
Neels Hofmeyr ef9126c4dc vlr: place comments on if (0) cases
Change-Id: I56c1e61dedeac01a4e24452feee6616782783d8f
2017-08-07 16:52:23 +02:00
Harald Welte 46f4f14024 SGSN: Don't indicate GERAN in Iu mode PDP CTX ACT REQ to GGSN
Change-Id: Ifd9ff4342de342475609bad0257a23c50290e23b
2017-07-23 04:30:44 +02:00
Neels Hofmeyr ecd8c048fc IuPS: explicitly check RAN type; move comment
Change-Id: I054d72590dfb2012f6f8506d3a5f8fd2953194e1
2017-07-23 04:30:44 +02:00
Neels Hofmeyr ed739b9dac IuPS: don't require an MM context for Iu Release
Change-Id: I8b4d08b3ee8add1f1d54efb13985eabe0c9d31f3
2017-07-23 04:30:44 +02:00
Neels Hofmeyr 5322912630 SI3: indicate R99+ MSC to GSM MS to enable UMTS AKA
Change-Id: I796e1f4281628061f4522c43c549de9e751bc045
2017-07-23 04:30:44 +02:00
Neels Hofmeyr 772205aae1 cosmetic: make osmo-python-tests dependency more accurate
Change-Id: I4f84a13b7fa6ec4173bdc155e6114d4d7328b619
2017-07-23 04:30:44 +02:00
Neels Hofmeyr 853883d1f6 osmo-nitb: change default db name to sms.db
libvlr now delegates subscriber management to osmo-hlr, so the database no
longer represents a HLR. It basically only stores SMS, so reflect that fact in
the default database name.

Change-Id: I3289d68d3eb63aff940b48a25b584d5e83cd0197
2017-07-23 04:30:44 +02:00
Neels Hofmeyr 6a29d326e0 Add msc_vlr test suite for MSC+VLR end-to-end tests
Change-Id: If0e7cf20b9d1eac12126955b2f5f02bd8f1192cd
2017-07-23 04:30:05 +02:00
Harald Welte 2483f1b050 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.

Remove/Disable VTY and CTRL commands to create subscribers, which is now a task
of the OsmoHLR. Adjust the python tests accordingly.

Remove VTY cmd subscriber-keep-in-ram.

Use OSMO_GSUP_PORT = 4222 instead of 2222. See
I4222e21686c823985be8ff1f16b1182be8ad6175.

So far use the LAC from conn->bts, will be replaced by conn->lac in
Id3705236350d5f69e447046b0a764bbabc3d493c.

Related: OS#1592 OS#1974
Change-Id: I639544a6cdda77a3aafc4e3446a55393f60e4050
2017-07-23 04:08:43 +02:00
Harald Welte b8b85a1b2e 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-21 18:32:03 +02:00
Neels Hofmeyr 53edff3c70 jenkins: pass proper configure flags to make distcheck
Enable various components according to the build matrix during make distcheck.
Add python tests, osmo-bsc, nat, ...

Change-Id: Ic724cf61d44409337414dc58c8795896b4b97a8a
2017-07-21 03:48:01 +02:00
Neels Hofmeyr 625e05a6b2 fix make distcheck with python tests
- bscs.config needed by the vty tests was not picked up as a dist file, because
  its suffix is not 'cfg'. Rename to *.cfg. Apply this rename in
  vty_test_runner.py and osmo-bsc_nat.cfg.
- Remove restart counters after external tests, otherwise distcheck complains
  about uncleaned files.
- Add contrib/ipa.py to EXTRA_DIST, hence add a Makefile.am to contrib/.
  Otherwise the python tests cannot find that dependency.

Change-Id: I42b55cb1125099afc3a8e3f87c0e398426b2e2a9
2017-07-21 03:39:38 +02:00
Neels Hofmeyr 3355fd674f logging: auth request: use hexdump without spaces for RAND, AUTN
Change-Id: Ie16bb2c01e770914f411bfb34b523c56ea9fab81
2017-07-13 02:17:39 +00:00
Neels Hofmeyr f2ba81303e 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-13 02:17:31 +00:00
Neels Hofmeyr cbafa255cc GPRS/IuPS: remove all 3G authentication dev hacks
UMTS auth works now with the external OsmoHLR.

Change-Id: Ie42945bb687b077fd0ee430c2711d19782151610
2017-07-13 02:17:23 +00:00