Commit Graph

5594 Commits

Author SHA1 Message Date
Max 3ed214c7b0 Improve code re-use
Introduce explicit __main__ function to facilitate re-use of defined
python functions for ctrl interface.

Change-Id: I9bad8f0dd1d69bd28816bf047d85840e3411bb9c
Related: OS#1646
2016-07-29 18:23:21 +02:00
Neels Hofmeyr 5f0c71b7d5 dyn TS: OS#1778 workaround: disable TCH/F on dyn TS for nitb
To avoid two phones picking mismatching TCH pchans, never pick TCH/F on dynamic
TS in osmo-nitb.

Add gsm_network flag dyn_ts_allow_tch_f, set to true by default in
gsm_network_init().

Set this flag to false in osmo-nitb's main().

See http://osmocom.org/issues/1778

Reasoning about ways to solve this:

* a compile time switch doesn't work because libbsc is first compiled and then
  linked to both osmo-nitb and osmo-bsc.

* we could test net->bsc_api == msc_bsc_api(), but I have the so-called MSC
  split waiting on branch sysmocom/cscn, which will result in msc_bsc_api() not
  being linked in the osmo-bsc binary.

* have a function am_i_nitb() with different implementations in osmo-nitb and
  osmo-bsc, but then we'd need to add implementations to all tests and other
  binaries linking lchan_alloc().

* have a flag in struct bsc_api, but so far there are only function pointers
  there.

Having a "global" flag in gsm_network allows to add a VTY command in case we
decide to keep this feature (#1781), has no linking implications and is nicely
explicit.

Tested that osmo-bsc still picks TCH/F on dyn TS indirectly, since I have no
standalone MSC available: when compiling osmo-nitb with the line that sets
dyn_ts_allow_tch_f = false commented out, TCH/F is picked as described in
OS#1778; and by printf-verifying that dyn_ts_allow_tch_f == true in osmo-bsc
main(), only osmo-nitb should have TCH/F disabled.

Related: OS#1778, OS#1781
Change-Id: If7e4797a72815fc6e2bbef27756ea5df69f4bde7
2016-07-28 17:40:59 +02:00
Neels Hofmeyr c5e75f3e6a dyn TS: Rename bsc_dyn_pdch.c to bsc_dyn_ts.c
It's no longer just for IPAC style TCH/F_PDCH, but also contains code for
TCH/F_TCH/H_PDCH, so pick a more general name.

Change-Id: Ic19db81eca03fd72738839ee3686b6b4c8b6b437
2016-07-28 11:56:51 +02:00
Neels Hofmeyr d3b7fa837d dyn TS: split dyn_pdch_init() for new dyn type and rename
Init both TCH/F_PDCH and TCH/F_TCH/H_PDCH via dyn_ts_init(), which
refactors dyn_pdch_init().

Make dyn_ts_switchover_start from abis_rsl.c public in abis_rsl.h, so we can
start the initial switchover to PDCH from dyn_ts_init(); in abis_rsl.h include
gsm_utils.h for enum gsm_phys_chan_config.

Change-Id: I5c0b257ba8ff0e9c9a2268681a84b0681a778368
2016-07-28 11:56:51 +02:00
Neels Hofmeyr b91e6002a6 dyn TS: implement pchan switchover logic
In struct gsm_lchan, add dyn.rqd_ref and dyn.rqd_ta. These save the Channel
Requested details across the PDCH deactivation dance.

abis_rsl.c: add static functions:

* dyn_ts_switchover*() for the various stages of switchover between pchans.

* pchan_for_lchant() to derive the desired pchan from the lchan type that was
  set during lchan_alloc().

* rsl_chan_activate_lchan_as_pdch() to compose the simpler RSL CHAN ACT message
  without introducing numerous special cases to the normal RSL CHAN ACT code.

In rsl_chan_activate_lchan(), detect and initiate required pchan switchovers if
requested pchan on a dyn TS differs.

In rsl_rx_rf_chan_rel_ack(), initiate or continue pchan switchovers after a
channel was released.

In rsl_rx_chan_act_ack(), notice that a switchover is complete.

In chan_alloc.c, add ts_subslots(): abis_rsl.c will need to know the number of
subslots per pchan, to verify that all lchans are free before dyn TS
switchover. The subslots_per_pchan[] array is static to lchan_alloc.c, and
since we need a non-trivial check for dyn TS anyway, add public ts_subslots()
to lchan_alloc.c, which also checks the current dyn pchan type.

Change-Id: I5c6bce13092a10204113d84678c587c65e35e4fd
2016-07-28 11:56:51 +02:00
Neels Hofmeyr 7af652c0b2 dyn TS: chan act: set chan_nr according to dyn pchan type
Change-Id: Ica5ef2197b3e97d5e895f3e3221295d5d0ef8908
2016-07-28 11:56:51 +02:00
Neels Hofmeyr fdd9ad7c40 dyn TS: enhance channel allocator for dynamic TS
Change _lc_find_bts() to _lc_dyn_find_bts() with added dyn_as_pchan arg to
pass exactly as which pchan we'd like to allocate on a dynamic TS. Add
_lc_find_bts() as wrapper so non-dynamic-TS callers remain unchanged.

Also add dyn_as_pchan arg to _lc_find_trx() (not renaming to dyn and wrapping
because there is only one caller).

Implement dynamic allocator logic in _lc_find_trx() and lchan_alloc().

A returned dynamic channel still needs to be switched to the proper mode, which
will follow in another commit.

Replace a fixme comment with a normal comment in subslots_per_pchan[], because
handling of dynamic TS is now defined.

Change-Id: I18da7679300c43220d9baa6a304e8df74d366249
2016-07-28 11:56:51 +02:00
Neels Hofmeyr f58852d117 dyn TS: rsl_lchan_lookup(): add dyn PCHAN
Accept GSM_PCHAN_TCH_F_TCH_H_PDCH for TCH/F and TCH/H if in matching pchan mode
or switching to matching pchan.

Accept RSL_CHAN_OSMO_PDCH chan_nr cbits for GSM_PCHAN_TCH_F_TCH_H_PDCH pchan.

Change-Id: If8f7c118f69e5a9f370bfe25f82f3d5a8de75b51
2016-07-28 11:56:51 +02:00
Neels Hofmeyr 9518ffc299 dyn TS: verify_chan_comb(): handle new dyn TS NM_CHANC_*
Change-Id: I7ce754a48c7f492e921a4450745383bb8dd7225c
2016-07-28 11:56:51 +02:00
Neels Hofmeyr 4673b86f3d dyn TS: rsl *2chan_nr(): handle TCH/F_TCH/H_PDCH
In gsm_lchan2chan_nr() use the current pchan type.

In gsm_lchan_as_pchan2chan_nr(), add the special case of non-standard cbits for
activating PDCH on a TCH/F_TCH/H_PDCH dyn TS. This way, gsm_pchan2chan_nr()
conforms to the standard and does not need access to a ts struct.

Change-Id: If248b9073b9f397110a2003d8e1a04afdc1c0e20
2016-07-28 11:56:51 +02:00
Neels Hofmeyr d384110d3d dyn TS: gsm_lchan2chan_nr(): decouple from ts->pchan
For upcoming dynamic TS, the pchan choice for RSL De-/Activation is not
trivial. So in order to pass the desired pchan to generate the RSL chan_nr,
introduce gsm_lchan_as_pchan2chan_nr().

To avoid code dup, this requires decoupling the gsm_ts2chan_nr() pchan from the
actual ts struct, so refactor gsm_ts2chan_nr() to gsm_pchan2chan_nr() with
explicit pchan, ts_nr and lchan_nr arguments.

Change-Id: I1a40e8452fe8120d350a27973e56be0b8c8c517f
2016-07-28 11:56:49 +02:00
Neels Hofmeyr 6e999b75fa dyn TS: rename lchan->dyn_pdch to lchan->dyn
This will also be used by the new dynamic TS type, so make the name more
general.

Change-Id: I2451b10519dff3e5cdf503b430574c0984d19000
2016-07-28 11:55:03 +02:00
Neels Hofmeyr cf7933892a prepare dyn TS: act lchan: fetch the channel mode a bit later
Dyn TS will add a new type of chan activation, which does not need a Channel
Mode IE. Incidentally, the dyn PDCH also doesn't need this IE if it opts for
sending a PDCH ACT instead. So it makes sense to compose the Channel Mode IE
only after the dynamic decisions are done.

Change-Id: I66d88ad6a4ae7bee1e552960fd4e92aff953125c
2016-07-28 11:55:03 +02:00
Neels Hofmeyr e2eb5cb6a1 error log: rsl_chan_activate_lchan: log channel mode error
Change-Id: I0f403b13ff9897770c0b855bf57a9440717b46e8
2016-07-28 11:55:03 +02:00
Neels Hofmeyr 2e84b60652 cosmetic: dyn_pdch_init(): debug log: use new gsm_ts_and_pchan_name()
Change-Id: I396c2696bdbedb41a1f1fe2183f8eada57dc3413
2016-07-28 11:55:03 +02:00
Neels Hofmeyr ec1b5a0e9e gsm_ts2chan_nr(): add assertions for lchan_nr
Change-Id: Ibfdef347c85d4a145645a7325cd193ea1b475a54
2016-07-28 11:55:00 +02:00
bhargava 350533cc32 Modify SI 13 field to support 11 bit RACH
System Information 13 field EGPRS PACKET CHANNEL REQUEST is
modified to support 11 bit RACH. Further VTY configuration is added
to enable/disable 11 bit RACH support in EGPRS. By default 11 bit
RACH support is disabled.

Change-Id: I51357bec936c28a26ab9ff5d59e0e30ca3363297
2016-07-28 06:49:03 +00:00
Neels Hofmeyr e3dc498e01 debug log: fix line endings for abis_rsl_rx_rll logging
This function outputs a debug log without line ending, which should be
completed by a subsequent DEBUGPC(), so complete the started log line where
missing in three of the switch cases.

The three cases do print another log message, but since these don't start on a
new line when RLL is in debug level, the log output for these is hard(er) to
read without this patch.

Change-Id: I355647e77e1b2d8e75ae1a167fe87a507a38d82d
2016-07-28 06:31:35 +00:00
Max e443145d3e Fix default subscriber regexp
Incorrect regular expression used by default to authorize all
subscribers to implement authorization policy 'accept-all' prevented MS
from camping on the open network.

Change-Id: I20284b3d40ecf4ca1e67d8cd25afb8d5e4ae3025
2016-07-27 14:52:14 +02:00
Neels Hofmeyr d1c0e3755f log lchan_alloc() result
It is particularly interesting to see whether a given lchan type is allocated
on a dynamic timeslot.

Change-Id: I8a0bca6d9cd583a0988e5ee8f4e6f74f218f4185
2016-07-25 17:35:47 +02:00
Neels Hofmeyr bbbcfe5b73 error log: abis_rsl.c: log errors in channel_mode_from_lchan()
Change-Id: Ifa416eab76e6c26dc83e979d815ae778d0d7133b
2016-07-25 17:35:47 +02:00
Neels Hofmeyr 745857277c code dup: join [rsl_]lchan_lookup() from libbsc and osmo-bts
lchan_lookup in abis_rsl.c and rsl_lchan_lookup() from osmo-bts rsl.c are the
same code, except for the log context, which is only set in abis_rsl.c.
Factor out the common code to rsl_lchan_lookup() in gsm_data_shared.c.

Openbsc and osmo-bts each define their own DRSL log constant, so add an int *rc
return code argument and keep the logging part in abis_rsl.c's thin lchan_lookup()
wrapper. Incidentally, this also removes code dup for logging.

To avoid duplicate symbols, the rsl_lchan_lookup() implementation needs to be
removed from osmo-bts, so older osmo-bts git revisions will not build with
this.

Change-Id: Ie89bc5bb9110a0e539d37991dedac6f913211b48
2016-07-25 17:35:47 +02:00
Neels Hofmeyr 34b8b5b29b gsm_data_shared: add gsm_ts_and_pchan_name() for dyn ts logging
Change-Id: I9b6be77c9e5fb9dffa2021a2da72293af15a03a0
2016-07-25 17:35:47 +02:00
Neels Hofmeyr c165876223 dyn TS: add ts->dyn state
Add state fields osmo_bts_trx_ts->dyn.* to record dynamic timeslot state.
Initialize in gsm_bts_trx_alloc().

Change-Id: I0a4049df8500b4f7c864f1355c4e9238932d1b8f
2016-07-25 17:35:47 +02:00
Neels Hofmeyr f29dd5f15b cosmetic: rsl_rx_chan_act_ack(): use local lchan var in 14 instances
In preparation for an upcoming change.

Change-Id: I9ce71fd7dde42ad7d20f806ac70c150d11450efa
2016-07-25 15:21:24 +00:00
Neels Hofmeyr 8151648ceb cosmetic: act lchan type: use constant instead of 0x00
Change-Id: Idc8afc4e52e189f474077899eef896381ce238f7
2016-07-25 15:21:24 +00:00
Neels Hofmeyr 4007468014 cosmetic: rsl_rx_rf_chan_rel_ack(): use local ts var for brevity
In preparation for an upcoming change.

Change-Id: I11bd59492fa8d5b9392d9f2b511c8fa9585afe6c
2016-07-25 15:21:24 +00:00
Neels Hofmeyr c6926d064d comments: clarify some dynamic TS comments
A new type of dynamic channel will be introduced soon, so prepare some comments
to name the dynamic TS kind more specifically.

Change-Id: I51fa8c2ebba507299e55a5cb7e67e48a6c8471f7
2016-07-25 15:21:24 +00:00
Neels Hofmeyr 67933a19d6 fix: create_pdp_conf(): unset reject_cause after unknown ran_type
f9f4387686 introduced a check for ran_type,
which potentially leaves reject_cause unset. Fix that.

Change-Id: I0220841ff796f949d00a1415d46b54a3eacc9493
2016-07-25 15:19:50 +00:00
Harald Welte 7c989e7ced remove old copy of documentation that now is in osmo-gsm-manuals.git
We keep some random snippets of documentation here, but manuals are now
generally kept in osmo-gsm-manuals.git.  Particularly the GSUP, OAP and
control interface are documented more extensively there.

To avoid having two sets of (diverging) documentation, let's remove it
from the openbsc.git repository.

Change-Id: I4a4c918587e236a7aa00cf2bb6aa05b090f7229b
2016-07-25 09:58:34 +00:00
Alexander Couzens 14314bd808 sgsn: add statistics counter for GPRS and PDP packets
Changing the test to allow still allocated block from the rate
counters.

Change-Id: Ie30e4c3084ee3a138d6b39bb5000234ac814e65f
2016-07-25 00:15:53 +00:00
Alexander Couzens b1c227e5ab bs11_config: add brackets to fix warning in argument parsing
Change-Id: I2f02e09a21ca622b03fd966445f533263a499c8d
2016-07-25 00:14:44 +00:00
Neels Hofmeyr 17a6bab150 fix ctrl test: dyn TS: use new GSM_PCHAN_TCH_F_TCH_H_PDCH
Add GSM_PCHAN_TCH_F_TCH_H_PDCH in gsm_pchant_names and gsm_pchant_descs: the
VTY and CTRL can now handle the new pchan type.

Adjust the CTRL iface test to expect the new PCHAN type in the output.

Fixes make check with --enable-external-tests after libosmocore commit
fd80f5a04239c2ab7b561401476dd89f2861748b that adds GSM_PCHAN_TCH_F_TCH_H_PDCH.

Change-Id: I4ad9c972d7f76f7e20cf74d6fc3d1928b644a4f8
2016-07-24 13:35:04 +02:00
Vadim Yanitskiy d091b8de21 mncc_sock: use osmo_sock_unix_init() from libosmocore
Since the osmo_unixsock_listen() was moved to libosmocore
it would be better to use the library's implementation
instead of reinventing the wheel again.

Change-Id: Iacfc39b6214c24084438f8fe04d03952cdc9ebc2
2016-07-23 19:21:17 +00:00
Alexander Couzens 15fcd10fde gprs_gmm: remove duplicated start of T3395
The timer is already scheduled by gsm48_tx_gsm_deact_pdp_req().

Change-Id: I8203b939d2196f87b11c0f3b2b0ff481e572835c
2016-07-23 15:26:13 +00:00
Dieter Spaar b572d7c45e SGSN: fix FCS calculation for encrypted frames
Change-Id: I352bc9db0c17fff773788831c4389ec0a5a30af8
Related: OS#1582
2016-07-17 08:44:38 +00:00
Neels Hofmeyr 9ddd8e6267 dyn pdch: don't PDCH ACT if gprs mode is none
Skip PDCH activation if the GPRS mode is 'none' at:

* TCH/F_PDCH init after OML Enable (dyn_pdch_init())
* after TCH/F_PDCH is released, in TCH/F mode
* in the T3111 error timer callback after a TCH/F_PDCH was released in error
  state

Assert the GPRS mode in rsl_ipacc_pdch_activate() to make sure all callers
check the GPRS mode.

Closes: OS#1765

Change-Id: I970e5f9dbcb1c625209e914a4c7696294ed34e62
2016-07-17 07:46:38 +00:00
Neels Hofmeyr 9331df16cf cosmetic: dyn_pdch_init(): flatten if-logic, add comments
Prepare for upcoming addition of heeding gprs mode == none.

Change-Id: Id0fe6f762ac863c4d4053841c7732d011aa8c561
2016-07-17 07:46:38 +00:00
Max 1de159168c SGSN: move cipher application to separate function
Split out generation and application of GEA gamma into separate function
which can be used for both encryption and decryption.

Change-Id: I442f2ead57e40d9bcd24e7f1b261041371595360
Related: OS#1582
2016-07-17 07:15:20 +00:00
Max 82040101eb SGSN: encrypt/decrypt only necessary frames
According to 3GPP TS 24.008 § 4.7.1.2 some GMM frames are not supposed
to be ciphered. Propagate information about the necessity for
encryption between MM <-> LLC to ensure only proper frames are
encrypted/decrypted/dropped.

Change-Id: I0358905e60d1b182f75caec81bfcc72bbbbb2aa1
Related: OS#1582
2016-07-16 23:17:58 +00:00
Max b997f84443 SGSN: add preliminary support for GPRS encryption
It is already functional enough to allow testing with real
phones. However, note - there are several limitations in the current
implementation:

* only default value for IOV-UI is supported at the moment
* AUTN-based key material is not supported

Related: OS#1582
Change-Id: I8900b906693496e4e6b35be5a86937c58039ed9e
2016-07-16 21:11:10 +00:00
Max 5aa5196fbf SGSN: split GEA key management from TLLI
Move GEA key from TLLI assignment into separate function.

Change-Id: I8a0bc907072dc19cd9535a28b5252dc0f05357cc
Related: OS#1582
2016-07-16 21:04:01 +00:00
Max 4011e728d2 SGSN: use unique AUTH REQ reference
The A&C reference number specified in 3GPP TS 24.008 § 10.5.5.19
identifies particular request sent by network with the related response
sent by MS. The value transparently copied from request to response by
MS: the spec do not specify what exactly should be in there so we use
rand() to decrease chance for collisions.

Note: variable named 'rand' clashes with standard function rand() so it
was renamed.

Change-Id: I3638821a9b4a0532b28dbbb50faa30c4082579f6
Related: OS#1582
2016-07-16 21:03:30 +00:00
Neels Hofmeyr 9759374adb jenkins.sh: add --enable-iu matrix build
Change-Id: Ida76f24d0b801fa609f3a128b3b912572cad4297
2016-07-13 17:50:12 +02:00
Neels Hofmeyr a3d93ed2f9 jenkins.sh: remove code dup
Have a bash function to build each dependency with the same commands.  There is
a tradeoff: having each dependency build with the same function means you can't
easily tweak one of the dependencies. OTOH having a unified function means a)
more readable script, b) that we're sure not to forget some steps and c) no
need to do the same edit n times.

Set the PKG_CONFIG_PATH globally. Also a tradeoff: if a future addition
wouldn't need the same PKG_CONFIG_PATH, this would make things ugly. But that
is actually quite unlikely, and the readability improvement is substantial.

Use env variables to remember local paths. That means we always are sure to cd
to the same absolute base path, which a 'cd ..' can't guarantee; also, we avoid
possible typos for e.g. "$deps/install".

Change-Id: Ib23f86c6cc1441d882de59bcdde5de87fa4e9fdf
2016-07-13 17:50:10 +02:00
Daniel Willmann 5754206379 osmux: Add negotiation state so race conditions can't disable osmux
Without this commit it is possible that osmux is disabled again on links with
high jitter. This happens when an MGCP response without X-Osmux header is
received before the NAT receives an Osmux dummy frame from the other side.

Ticket: SYS#2628, SYS#2627
Sponsored-by: On-Waves ehf
Change-Id: Id624b0279aee5e2412059a10296ce7896e2d4628
2016-07-11 19:19:05 +00:00
Max 176b62a80c SGSN: prevent starting with inconsistent config
Previously it was possible to start osmo-sgsn with "auth-policy remote"
but without "gsup remote-*" which resulted in broken setup: no MS could
perform GPRS ATTACH. Add consistency check to vty code to fix this.

Related: OS#1582
Change-Id: Ie4296e7d99d7833f7d828b0196435ea81097cf6e
2016-07-11 19:18:17 +00:00
Max e6052c4cc7 Make random MSISDN assignment optional
Previously if subscriber was automatically created it got assigned
random MSISDN number. Make it optional (defaulting to previous behavior)
by adding following:

* new optional no-extension argument for subscriber-create-on-demand vty
  command
* db unit tests
* vty test

Note: using the db made with new code might result in subscribers with
empty extension. Such subscribers cannot be deleted using old
code. Make sure not to mix db versions or manually fix it by editing
sqlite with external program.

Fixes: OS#1658
Change-Id: Ibbc2e88e4722b08854ebc631485f19ed56443cbb
2016-07-09 19:52:54 +00:00
Alexander Couzens 9f8f9b8021 libbsc: skip channel state LCHAN_S_INACTIVE while handover
The state is directly overwritten by the next function. Because
there isn't any state transition, remove this state.

Change-Id: I7f287692dbd559268fb5e61d81ac19e5dd4827eb
2016-07-09 08:53:16 +00:00
Max 3955025c2a SGSN: move TLLI unassignment into separate function
Change-Id: Ia4df145ab03ebcaad70a13601cff60c488a5de54
Related: OS#1582
2016-07-04 08:42:37 +00:00