Commit Graph

1743 Commits

Author SHA1 Message Date
Harald Welte 460f9ef7da fsm: Make sure we call 'onenter' of new state, not old state
Change-Id: I1a0181c25d9debe935e86d97ddffc24675e56a5f
2016-08-01 00:38:36 +02:00
Harald Welte f92e44c539 lapd_core: Fix crash in lapd_dl_flush_hist()
When lapd_dl_flush_hist() was called before we actually had started a
transmit history from lapd_dl_init(), we woul segfault before this
patch.

Change-Id: Ifa677c9b335dd2884b4f3e44699d901957a0500b
2016-08-01 00:27:37 +02:00
Harald Welte 881dcaf7aa Mark input string to osmo_talloc_replace_string() as const
This allows us to pass in strings that are 'const', which for the
source of a copy should be the normal/regular case anyway.

Change-Id: Icee6a5f88babd3a4e30bf0886f0f8d3b865d80ce
2016-07-28 08:02:48 +02:00
Tom Tsou 9a5bbf36b5 egprs: Add CPS tables from TS 04.60
Includes EGPRS coding and puncturing scheme (CPS) tables from 3GPP
TS 04.60. Currently osmo-bts-trx is the only user of CPS table
values, but this may change with gprsdecode and other utilities.

Change-Id: I09fe6514a0e2e51bb3206f8387633f7e0255345f
2016-07-25 18:33:26 +00:00
bhargava 1a96946875 Update structure in libosmocore for 11 bit RACH
Parameters are added to the structure ph_rach_ind_param to
differentiate the type of RACH received from Layer 1. This is to
further support the 11 bit RACH.

Change-Id: Ic4f0f2424a3af7599d986044be25ea4fcc0ca477
2016-07-24 14:15:03 +00:00
Max da34bf01a3 Add define for invalid TA
Add GSM48_TA_INVALID which is invalid Timing Advance value according to
3GPP TS 44.018 § 10.5.2.40.

Change-Id: I061760ccac656f39164562a7883f8ab522cd0911
Related: OS#1526
2016-07-23 19:31:30 +00:00
Neels Hofmeyr 47390764dd rsl: add rsl_act_type_name()
Change-Id: Ie90c76d8aef42d5e2c9be94f4b206d4994e305f8
2016-07-23 15:32:55 +02:00
Neels Hofmeyr fd80f5a042 dyn TS: add definitions for dynamic TCH/F_TCH/H_PDCH
Add:
* GSM_PCHAN_TCH_F_TCH_H_PDCH
* NM_CHANC_OSMO_TCHFull_TCHHalf_PDCH
* RSL_CHAN_OSMO_PDCH
* RSL_ACT_OSMO_PDCH

Related: OS#1776
Change-Id: Ib1a8b11f37af4686d00ac88beba38557aa29edc2
2016-07-23 15:32:55 +02:00
Neels Hofmeyr 15b96ff70c gsm_08_58.h: introduce RSL_CHAN_NR_1 constant
Using the RSL_CHAN_* constants, we sometimes need to add 1 to the chan bits
to indicate e.g. the second TCH/H channel.

RSL_CHAN_NR_1 marks this lowest channel bit that needs to be added.

The name is analogous to RSL_CHAN_NR_MASK.

Change-Id: Iea06432039d1cd23cc6b5acec308bb829b596d47
2016-07-23 15:25:18 +02:00
Neels Hofmeyr 505adee93b fix compiler warning: gsup.c: missing braces
osmo_auth_vector's first member is an array, so for a zero initializer, we
should add a second set of array braces.

Change-Id: Iace448caca8152e46244f26c3af250f2035c99eb
2016-07-17 07:44:11 +00:00
Holger Hans Peter Freyther 511b448fe3 bitvec: Force inlining of bitvec_set_bit_pos/bitvec_set_bit
The PCU is using bitvec_write_field a lot but on the
arm-poky-linux-gnueabi-gcc v4.8.1 the calls to set_bit and
set_bit_pos are not inlined. The inlined variant has been
a more quick for the PCU compressed bitmap decompression
testcase.

Used objdump -d to look at the bitvec_write_field before and
after the change. The branch to bitvec_set_bit is gone and a
inlined version has been used.

Change-Id: I0b6b90610f4c17f02e4efa064c3bf1ac2dccb22a
2016-07-16 21:02:41 +00:00
Max edb57e7709 Add function to check TA validity
Check if given Timing Advance is valid according to 3GPP TS 44.018 §
10.5.2.40.

Change-Id: I5cb6149d6e36fda8cb3f557e4d6d3a724da805a5
Related: OS#1545
2016-07-16 21:00:00 +00:00
Holger Hans Peter Freyther 4a62dbbfa9 ussd: Decode interrogateSS that doesn't have test
Keith of Rhizomatica has an issue of a unrejected interrogateSS.
Start with just decoding the message and printing the empty test
and the code.

What is kind of missing is the classification between invoke,
returnResult and returnResultLast that we need to add in the
long run.

Change-Id: Iadfa156707a96f2a34f3948c7cc9a74435f17114
2016-07-12 17:45:34 +02:00
Tom Tsou 9394dbd8e0 Add EGPRS RLC/MAC headers from 3GPP TS 04.60
For shared use by osmo-pcu and osmo-bts-trx.

Change-Id: I500cdc87cd30faf36c8cd92d234642f809c8f2aa
2016-07-12 06:06:33 +00:00
Max 4f169500df Add GEA3 & GEA4 ciphers
Corresponding test code include both official test vectors from the
specs and data from over-the-air tests.

This obsoletes libosmo-crypt-a53 as it was last missing piece
unimplemented in libosmogsm.

Change-Id: I939e4f6b91b4a7c591ef3761fe2d46ed1c2fb2d3
Related: OS#1582
2016-07-11 19:15:24 +00:00
Harald Welte 02a6672885 fsm: delete the timer when changing state
In osmo_fsm_inst_state_chg(), we need to stop any not-yet-expired timer
of the old state before transitioning into the new state.

Change-Id: I2558f9a7027a877ea8263785ed3c8d70d2513996
2016-07-10 15:13:51 +02:00
Harald Welte f3239113db fsm: talloc + copy the 'id' passed into a FSM
The 'id' is used to generate the human-readable name of the FSM.
However, when the FSM creates slave FSMs later, the caller-passed "ID"
mgiht long be gone again (e.g. it was on stack memory).  So let's copy
the 'id' string to a chunk of dynamically-allocated memory at time of
FSM start to ensure we have it later when creating child FSMs.

Change-Id: Ib88a2c02c5c91f17b4ec1e9db57a06d6d66465fb
2016-07-10 15:11:45 +02:00
Harald Welte 673018fed9 fsm: call 'onenter' as last step of a state change
This is useful to allow the user to terinate the fsm from the onenter()
callback.

Change-Id: Ia45a1f3279e702028250e10dc54b2d46a4039905
2016-07-10 15:09:43 +02:00
Max f5f773f013 Add strings with GPRS GMM messages
Change-Id: I48477b733e2da72f59349c00554dd3e080c9f445
Related: OS#1582
2016-07-08 15:08:17 +00:00
Max fdca25dfb8 Add function to check GMM encryptability
Check if particular GMM message can be encrypted according to 3GPP TS
24.008 § 4.7.1.2

Related: OS#1582
Change-Id: I7ad0e03c2c738d174dd6bc3453f332eeb8da1e7d
2016-07-07 12:55:46 +00:00
Neels Hofmeyr ae3b78076e gitignore tests/fsm/fsm_test
was added in 136e73764e

Change-Id: I0f344cc459626f71316f99341f79b5f0479ad82c
2016-07-07 12:52:57 +00:00
Max 92ce39f3d1 Add missing osmo_c4 export
Change-Id: Iaf53b31b4fa3860301054e970907ada061360b28
Related: OS#1741
2016-07-07 13:00:43 +02:00
Harald Welte 0ee90f8614 lapd_dl_flush_hist(): Don't flush a non-existant history
If lapd_dl_flush_hist() is called after lapd_dl_exit(), dl->tx_hist has
already been free'd and set to NULL.  Check for this before attempting
to de-reference a NULL pointer.

This bug breaks OpenBSC with any E1 based BTSs using DAHDI.

Change-Id: I117ba3445fa5e8097e21c11c5a6337de6ba46c7d
Related: OS#1760
2016-07-03 20:47:06 +02:00
Max dda9dffca9 Clarify GPRS algorithm
Add spec reference and set explicit values for enum representing
ciphering algorithm for GPRS encryption.

Change-Id: Ia9ee429b73a37d52599fce70778cfe87b767411c
Related: OS#1582
2016-06-29 16:34:14 +00:00
Max c57e5daf22 Clarify GPRS ciphering direction
Add spec reference and set explicit values for enum representing
direction parameter for GPRS encryption.

Change-Id: Iaf1b13da2e889d55cc9dd7516710104dba48c992
Related: OS#1582
2016-06-29 16:33:57 +00:00
Max eb59f241ec tests: test actual support status for auth. algo
Check if library actually support Milenage, COMP128 v2 and v3 algorithms
instead of just printing enum values or nothing.

Change-Id: I2b98481f56a8381058d4b29db5e8a36eb193eee9
2016-06-29 16:33:40 +00:00
Max a337b9c37a Add function to check MS GEA capabilities
Add function which parses MS network capability IE value for bits
indicating support for particular version of GEA.

Change-Id: I785cef37dd272a2fab9b172f6e1392f865174e9a
Relates: OS#1582
2016-06-29 16:33:25 +00:00
Max ceae123752 Make C4 function globally available
This function perform 64 -> 128 bit key expansion which useful for
converting between UMTS CK and GSM Kc, A5/3 and A5/4, GEA3 and GEA4
keys.

Change-Id: I5a6c6deef6027cd6af144c9062d4c9166be26904
Related: OS#1582
2016-06-29 16:32:55 +00:00
Max b897c42993 Add strings for GPRS ciphers
Change-Id: I050bda5fb50aad42fe2d72de39f8256b4fb12fb2
Related: OS#1582
2016-06-29 16:32:27 +00:00
Neels Hofmeyr 6797b3a808 gitignore: *-libtool for differing platforms
Change-Id: Ia8c011b53d4256305e70f78372a4aa0019b1131b
2016-06-28 16:17:12 +02:00
Harald Welte 14bf28a43d Mark input parameter to bitvec_set_bits() as 'const'
The input data is accessed in a read-only manner, so it should be marked
with the const qualifier.

Change-Id: I0d6b86289fa647594f3da1f1c0e0168685307a37
2016-06-27 15:19:10 +02:00
Harald Welte f627c0f0af fsm: Introduce default time-out handling
If a FSM doesn't specify any timer_cb, simply terminate the FSM by
default on time-out.  This is a reasonable default for most cases, and
avoids copy+pasting a one-line timer_cb function in every FSM.

Also, even if there is a timer_cb, let it have a return value to decide
if the core should terminate after return from timer_cb or not.

Change-Id: I0461a9593bfb729c82b7d1d1cf9f30b1079d0212
2016-06-27 15:17:53 +02:00
Max d826f1771c Fix potential segfault in msg_dequeue
Change-Id: I06e9c5ba3e00c73a4e52d2583ce3492f236275ce
2016-06-23 20:00:33 +00:00
Max e0a7d9e2c2 Add octet-aligned/unaligned shift functions
The actual code is from OsmoBTS' tch.c by Harald Welte. Add unit tests,
doxygen annotation and extra memory safety check. Those functions are
used in several BTS implementations but seems generic enough to be
generally useful.

Change-Id: I2b1901c4161e8035f059585901dca593b661556d
2016-06-20 19:02:56 +02:00
Harald Welte 136e73764e Add Finite State Machine abstraction code
This code is supposed to formalize some of the state machine handling in
Osmocom code.

Change-Id: I0b0965a912598c1f6b84042a99fea9d522642466
Reviewed-on: https://gerrit.osmocom.org/163
Tested-by: Jenkins Builder
Reviewed-by: Harald Welte <laforge@gnumonks.org>
2016-06-16 21:43:45 +00:00
Harald Welte 82f94ef50f Add UMTS AKA related MM/GMM message type and IE definitions
Change-Id: Id45ea2c631ee589a4df1f8213da6f7e7d1bf6616
Reviewed-on: https://gerrit.osmocom.org/305
Reviewed-by: Harald Welte <laforge@gnumonks.org>
Tested-by: Jenkins Builder
2016-06-16 21:43:21 +00:00
Harald Welte bda26c0901 Add structures defining decoded TS 23.003 identities
Change-Id: I6423f8d75bb3e7aeca285854ab3232a087d62b57
Reviewed-on: https://gerrit.osmocom.org/304
Reviewed-by: Harald Welte <laforge@gnumonks.org>
Tested-by: Jenkins Builder
2016-06-16 21:25:26 +00:00
Harald Welte de960cbc0c gsup: Add OSMO_GSUP_MSGT_AUTH_FAIL_REPORT
The VLR must be able to notify the HLR of authentication failures.

Change-Id: I156cff76e092b3548b05534141b61887ee6be3f3
Reviewed-on: https://gerrit.osmocom.org/303
Reviewed-by: Harald Welte <laforge@gnumonks.org>
Tested-by: Jenkins Builder
2016-06-16 21:25:22 +00:00
Harald Welte db78d2172b gsup.c: Fix encoding of UMTS auth vectors
Encoding auth vectors worked fine for GSM authentication, but didn't
yet include the new IEs for UMTS authentication yet.

Change-Id: I7fa5ba1c950292bd0a9874b3102a27f221ce390d
Reviewed-on: https://gerrit.osmocom.org/302
Reviewed-by: Harald Welte <laforge@gnumonks.org>
Tested-by: Jenkins Builder
2016-06-16 21:25:18 +00:00
Harald Welte f624c33ef2 vty: Fix documentation of 'show asciidoc counters' VTY command
VTY documentations strings follow a certain structure, and we need to
follow that to make the interactive help work.

Change-Id: I0bb0bda68dbbf9995338ec555ff99d73a223162c
Reviewed-on: https://gerrit.osmocom.org/276
Reviewed-by: Harald Welte <laforge@gnumonks.org>
Tested-by: Harald Welte <laforge@gnumonks.org>
2016-06-15 09:39:20 +00:00
Max 22886d9e32 Fix retrieving rate_ctr over control interface
Allow getting either particular
counter (e. g. rate_ctr.per_hour.e1inp.0.hdlc.abort) or entire rate
counter group for a given index (e. g. rate_ctr.per_hour.e1inp.0).

Change-Id: I2b0109536170f7b5388d3236df30b98f457aa98d
Fixes: OS#1730
Reviewed-on: https://gerrit.osmocom.org/274
Tested-by: Jenkins Builder
Reviewed-by: Harald Welte <laforge@gnumonks.org>
2016-06-14 22:21:24 +00:00
Alexander Couzens ad580ba7c4 add vty call show asciidoc: generate a documentation for counters
For each counter group a ascii doc table is generated
containing all single counter with a reference to a section to
add additional information to the counter

Change-Id: Ia8af883167e5ee631059299b107ea83c8bbffdfb
Reviewed-on: https://gerrit.osmocom.org/70
Reviewed-by: Harald Welte <laforge@gnumonks.org>
Tested-by: Harald Welte <laforge@gnumonks.org>
2016-06-14 10:38:17 +00:00
Neels Hofmeyr 0167e3f355 add rsl_or_ipac_msg_name() for both standard and ip.access msg types
Context: in osmo-bts, I want to look up an RSL message name in rsl_msgt_names
and fall back to rsl_ipac_msgt_names if not found, because the IPAC PDCH ACT
and DEACT messages are sent in a standard ABIS_RSL_MDISC_DED_CHAN.

Change-Id: Ic9ba721a1469cf51aed97ab0f44a7fe055c94b1f
Reviewed-on: https://gerrit.osmocom.org/231
Reviewed-by: Harald Welte <laforge@gnumonks.org>
Tested-by: Jenkins Builder
2016-06-13 17:46:48 +00:00
Neels Hofmeyr 8d6dcd9bca add get_value_string_or_null() to handle unknown items
Add get_value_string_or_null() to return NULL in case the given value is not
found in the list of strings, to be able to cleanly fall back to another list
of strings. Absorb the lookup loop from get_value_string().

Context: in osmo-bts, I want to look up an RSL message name in rsl_msgt_names
and fall back to rsl_ipac_msgt_names if not found, because the IPAC PDCH ACT
and DEACT messages are sent in a standard ABIS_RSL_MDISC_DED_CHAN.
In a subsequent commit, get_value_string_or_null() will be used by new
rsl_or_ipac_msg_name().

Change-Id: I1fa3907e28d528d2758bc3eae9d19e6c1168f5e5
Reviewed-on: https://gerrit.osmocom.org/230
Reviewed-by: Harald Welte <laforge@gnumonks.org>
Tested-by: Jenkins Builder
2016-06-13 17:46:20 +00:00
Neels Hofmeyr 8a3c83ed00 api doc: get_value_string(): mention composition in static buffer
Change-Id: I93dad98711ef69f8a1e196efa029a842a1ff5bd6
Reviewed-on: https://gerrit.osmocom.org/229
Reviewed-by: Harald Welte <laforge@gnumonks.org>
Tested-by: Jenkins Builder
2016-06-13 17:45:52 +00:00
Neels Hofmeyr 6cf8eba4ec gitignore: add gsup_test, tlv_test
Change-Id: Ied1cbc7a48bdbc3696e9d8657285071c377d6de5
Reviewed-on: https://gerrit.osmocom.org/207
Tested-by: Jenkins Builder
Reviewed-by: Holger Freyther <holger@freyther.de>
2016-06-07 11:04:38 +00:00
Harald Welte 4f511b67fd osmo-auc-gen: Print hex values without intermittent spaces
When generating some authentication vectors using the osmo-auc-gen
utility, it used to print values like this:

AUTN:   f7 55 bc 47 de d0 00 00 f9 ed 4b 3f 6c 2a 97 6f

which is quite difficult to copy+paste on the terminal.  Now it
generates the following format:

Change-Id: I2805615e0c2087ca632e0658b37a9e06929620b6
AUTN:   f755bc47ded00000f9ed4b3f6c2a976f
Reviewed-on: https://gerrit.osmocom.org/164
Reviewed-by: Harald Welte <laforge@gnumonks.org>
Tested-by: Jenkins Builder
2016-06-01 12:10:41 +00:00
Max ec8f192fec Add functions to detect HR/FR SID frames
Add functions which check if given FR or HR frame (packed in RTP)
contains SID (SIlence Descriptor) and corresponding tests.

Related: OS#22
Change-Id: I4051e3c0d4fb9ee93d7e9e0ef4abaf9f18e227ca
Reviewed-on: https://gerrit.osmocom.org/160
Tested-by: Jenkins Builder
Reviewed-by: Harald Welte <laforge@gnumonks.org>
2016-06-01 10:44:06 +00:00
Ruben Undheim 720ac4a4e1 Patched structs for big-endian architectures
Change-Id: I29eafe481e112d18c624b1c83add0d53c354dbe4
Reviewed-on: https://gerrit.osmocom.org/124
Tested-by: Jenkins Builder
Reviewed-by: Neels Hofmeyr <nhofmeyr@sysmocom.de>
Reviewed-by: Harald Welte <laforge@gnumonks.org>
2016-05-31 11:52:12 +00:00
Max 92db150488 Add helper functions for AMR codec
* add functions to encode/decode various codec paramters from RTP payload with
  AMR frame according to RFC 4867
* those functions are extended version based on code from osmo-bts'
  amr.c by Andreas Eversberg
* add corresponding enum types and strings for logging
* add regression tests

It's useful both to replace manual parsing in osmo-bts with fuctions
covered by test suite and as a debugging helpers for issues related to
AMR.

Change-Id: Ia217679a07d3fbc970f435e20f6eac33d34bd597
Related: OS#1562
Reviewed-on: https://gerrit.osmocom.org/118
Tested-by: Jenkins Builder
Reviewed-by: Holger Freyther <holger@freyther.de>
2016-05-31 10:11:51 +00:00