| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
The calculation of the beginning of a block for TCH/F, TCH/H and FACCH
can be challenging since those channels are affected by the diagonal
interleaving of the TCH channels. However, GSM 05.02 Section 7 Table 1
of 5 specifies how the blocks are distributed over the TDMA frame
interval. Lets add a mapping function that is based on that table
Related: OS#3803
Change-Id: I3d71c66f8c401f5afbad9b1c86c24580dab9e0ce
|
|
|
|
|
|
|
|
|
|
| |
Rather than having applications maintain their own talloc cotexts,
let's offer some root talloc contexts in libosmocore. Let's also
make them per thread right from the beginning. This will help
some multi-threaded applications to use talloc in a thread-safe
way.
Change-Id: Iae39cd57274bf6753ecaf186f229e582b42662e3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add global flag osmo_fsm_term_safely() -- if set to true, enable the following
behavior:
Detect osmo_fsm_inst_term() occuring within osmo_fsm_inst_term():
- collect deallocations until the outermost osmo_fsm_inst_term() is done.
- call osmo_fsm_inst_free() *after* dispatching the parent event.
If a struct osmo_fsm_inst enters osmo_fsm_inst_term() while another is already
within osmo_fsm_inst_term(), do not directly deallocate it, but talloc-reparent
it to a separate talloc context, to be deallocated with the outermost FSM inst.
The effect is that all osmo_fsm_inst freed within an osmo_fsm_inst_term()
cascade will stay allocated until all osmo_fsm_inst_term() are complete and all
of them will be deallocated at the same time.
Mark the deferred deallocation state as __thread in an attempt to make cascaded
deallocation handling threadsafe. Keep the enable/disable flag separate, so
that it is global and not per-thread.
The feature is showcased by fsm_dealloc_test.c: with this feature, all of those
wild deallocation scenarios succeed.
Make fsm_dealloc_test a normal regression test in testsuite.at.
Rationale:
It is difficult to gracefully handle deallocations of groups of FSM instances
that reference each other. As soon as one child dispatching a cleanup event
causes its parent to deallocate before fsm.c was ready for it, deallocation
will hit a use-after-free. Before this patch, by using parent_term events and
distinct "terminating" FSM states, parent/child FSMs can be taught to wait for
all children to deallocate before deallocating the parent. But as soon as a
non-child / non-parent FSM instance is involved, or actually any other
cleanup() action that triggers parent FSMs or parent talloc contexts to become
unused, it is near impossible to think of all possible deallocation events
ricocheting, and to avoid running into freeing FSM instances that were still in
the middle of osmo_fsm_inst_term(), or FSM instances to enter
osmo_fsm_inst_term() more than once. This patch makes deallocation of "all
possible" setups of complex cross referencing FSM instances easy to handle
correctly, without running into use-after-free or double free situations, and,
notably, without changing calling code.
Change-Id: I8eda67540a1cd444491beb7856b9fcd0a3143b18
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Provide a common implementation of use counting that supports naming each user
as well as counting more than just one use per user, depending on the rules the
caller implies.
In osmo-msc, we were originally using a simple int counter to see whether a
connection is still in use or should be discarded. For clarity, we later added
names to each user in the form of a bitmask of flags, to figure out exactly
which users are still active: for logging and to debug double get / double put
bugs. This however is still not adequate, since there may be more than one CM
Service Request pending. Also, it is a specialized implementation that is not
re-usable.
With this generalized implementation, we can:
- fix the problem of inadequate counting of multiple concurrent CM Service
Requests (more than one use count per user category),
- directly use arbitrary names for uses like __func__ or "foo" (no need to
define enums and value_string[]s),
- re-use the same code for e.g. vlr_subscr and get fairly detailed VLR
susbscriber usage logging for free.
Change-Id: Ife31e6798b4e728a23913179e346552a7dd338c0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For handling RTP IP addresses and ports, osmo-mgw, osmo-bsc and osmo-msc
so far have their own separate shims and code duplication around
inet_ntoa(), htons(), sockaddr conversions etc. Unify and standardize
with this common API.
In the MGW endpoint FSM that was introduced in osmo-bsc and which I
would like to re-use for osmo-msc (upcoming patch moving that to
osmo-mgw), it has turned out that using char* IP address and uint16_t
port number types are a convenient common denominator for logging,
MGCP message composition and GSM48. Ongoing osmo-msc work also uses this
for MNCC.
This is of course potentially useful for any other IP+port combinations
besides RTP stream handling.
Needless to say that most current implementations will probably stay
with their current own conversion code for a long time; for current
osmo-{bsc,msc,mgw} work (MGW endpoint FSM) though, I would like to move
to this API here.
Change-Id: Id617265337f09dfb6ddfe111ef5e578cd3dc9f63
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move T_def from osmo-bsc to libosmocore as osmo_tdef. Adjust naming to be more
consistent. Upgrade to first class API:
- add timer grouping
- add generic vty support
- add mising API doc
- add C test
- add VTY transcript tests, also as examples for using the API
From osmo_fsm_inst_state_chg() API doc, cross reference to osmo_tdef API.
The root reason for moving to libosmocore is that I want to use the
mgw_endpoint_fsm in osmo-msc for inter-MSC handover, and hence want to move the
FSM to libosmo-mgcp-client. This FSM uses the T_def from osmo-bsc. Though the
mgw_endpoint_fsm's use of T_def is minimal, I intend to use the osmo_tdef API
in osmo-msc (and probably elsewhere) as well. libosmocore is the most sensible
place for this.
osmo_tdef provides:
- a list of Tnnnn (GSM) timers with description, unit and default value.
- vty UI to allow users to configure non-default timeouts.
- API to tie T timers to osmo_fsm states and set them on state transitions.
- a few standard units (minute, second, millisecond) as well as a custom unit
(which relies on the timer's human readable description to indicate the
meaning of the value).
- conversion for standard units: for example, some GSM timers are defined in
minutes, while our FSM definitions need timeouts in seconds. Conversion is
for convenience only and can be easily avoided via the custom unit.
By keeping separate osmo_tdef arrays, several groups of timers can be kept
separately. The VTY tests in tests/tdef/ showcase different schemes:
- tests/vty/tdef_vty_test_config_root.c:
Keep several timer definitions in separately named groups: showcase the
osmo_tdef_vty_groups*() API. Each timer group exists exactly once.
- tests/vty/tdef_vty_test_config_subnode.c:
Keep a single list of timers without separate grouping.
Put this list on a specific subnode below the CONFIG_NODE.
There could be several separate subnodes with timers like this, i.e.
continuing from this example, sets timers could be separated by placing
timers in specific config subnodes instead of using the global group name.
- tests/vty/tdef_vty_test_dynamic.c:
Dynamically allocate timer definitions per each new created object.
Thus there can be an arbitrary number of independent timer definitions, one
per allocated object.
T_def was introduced during the recent osmo-bsc refactoring for inter-BSC
handover, and has proven useful:
- without osmo_tdef, each invocation of osmo_fsm_inst_state_chg() needs to be
programmed with the right timeout value, for all code paths that invoke this
state change. It is a likely source of errors to get one of them wrong. By
defining a T timer exactly for an FSM state, the caller can merely invoke the
state change and trust on the original state definition to apply the correct
timeout.
- it is helpful to have a standardized config file UI to provide user
configurable timeouts, instead of inventing new VTY commands for each
separate application of T timer numbers.
Change-Id: Ibd6b1ed7f1bd6e1f2e0fde53352055a4468f23e5
|
|
|
|
|
|
|
|
| |
Add functions to encode and decode Global Call Reference as per
3GPP TS 29.205 Table B 2.1.9.1 add corresponding tests.
Change-Id: Iee95aa4e5c056645b6cb5667e4a067097d52dfbf
Related: OS#2487
|
|
|
|
|
|
|
| |
As oap_client has moved from osmo-sgsn to libosmogsm, it is only fair
that the related unit test shall also be moved here.
Change-Id: I9d64e10b4bacac9b530cf077841bad762fc6d558
|
|
|
|
|
|
|
| |
Recent OS#3407 shows that we should verify stderr to catch sanitizer failures.
(They might not always be ignorable like that one.)
Change-Id: Ic9e437a1cc96ae081e0fd6a9b6e3156987e14c0c
|
|
|
|
| |
Change-Id: I5bebc6e01fc9d238065bc2517058f0ba85620349
|
|
|
|
|
|
|
|
|
|
|
| |
When a bad GSM voice frame is received, it's being replaced
by a silence frame. This may cause unpleasant audio effects.
This change implements a functionality to craft a replacement
frame from the last known good frame. Currently, only FR is
supported, support for other codecs may be added latter.
Change-Id: I06a21f60db01bfe1c2b838f93866fad1d53fdcd1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Validate that incoming CTRL commands...
- have decimal IDs,
- return error on trailing characters,
- have invalid characters in variable identifiers,
- send detailed error messages as reply to the requestor.
Adjust ctrl_test.{c,ok}, which best show the change in behavior.
Message handling causes log messages on stderr; previously, stderr was empty.
Add '[ignore]' in testsuite.at so that the nonempty stderr doesn't cause test
failures.
Change-Id: I96a9b6b6a3a5e0b80513aa9eaa727ae8c9c7d7a1
|
|
|
|
|
|
|
|
|
|
|
|
| |
This function is actively used by OsmoPCU but have not been covered by
tests so far. The test code is based on
Minh-Quang Nguyen <minh-quang.nguyen@nutaq.com> submission with some
modifications.
The test's FIXME will be addressed in follow-up patches.
Change-Id: I2ee544256b8675bc62a42493aab66a8eeee54f90
Related: OS#1526
|
|
|
|
|
|
|
|
|
| |
Add GSM23003_IMSI_MIN_DIGITS definition.
Add regression test gsm23003_test.c to test the two new functions.
Will be used by OsmoHLR to validate VTY and CTRL input.
Change-Id: I1e94f5b0717b947d2a7a7d36bacdf04a75cb3522
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Note: This will break users' config files if they do not use consistent
indenting. (see below for a definition of "consistent".)
When reading VTY commands from a file, use indenting as means to implicitly
exit child nodes. Do not look for commands in the parent node implicitly.
The VTY so far implies 'exit' commands if a VTY line cannot be parsed on the
current node, but succeeds on the parent node. That is the mechanism by which
our VTY config files do not need 'exit' at the end of each child node.
We've hit problems with this in the following scenarios, which will show
improved user experience after this patch:
*) When both a parent and its child node have commands with identical names:
cs7 instace 0
point-code 1.2.3
sccp-address osmo-msc
point-code 0.0.1
If I put the parent's command below the child, it is still interpreted in the
context of the child node:
cs7 instace 0
sccp-address osmo-msc
point-code 0.0.1
point-code 1.2.3
Though the indenting lets me assume I am setting the cs7 instance's global PC
to 1.2.3, I'm actually overwriting osmo-msc's PC with 1.2.3 and discarding the
0.0.1.
*) When a software change moves a VTY command from a child to a parent. Say
'timezone' moved from 'bts' to 'network' level:
network
timezone 1 2
Say a user still has an old config file with 'timezone' on the child level:
network
bts 0
timezone 1 2
trx 0
The user would expect an error message that 'timezone' is invalid on the 'bts'
level. Instead, the VTY finds the parent node's 'timezone', steps out of 'bts'
to the 'network' level, and instead says that the 'trx' command does not exist.
Format:
Consistent means that two adjacent indenting lines have the exact
same indenting characters for the common length:
Weird mix if you ask me, but correct and consistent:
ROOT
<space>PARENT
<space><tab><space>CHILD
<space><tab><space><tab><tab>GRANDCHILD
<space><tab><space><tab><tab>GRANDCHILD2
<space>SIBLING
Inconsistent:
ROOT
<space>PARENT
<tab><space>CHILD
<space><space><tab>GRANDCHILD
<space><tab><tab>GRANDCHILD2
<tab>SIBLING
Also, when going back to a parent level, the exact same indenting must be used
as before in that node:
Incorrect:
ROOT
<tab>PARENT
<tab><tab><tab>CHILD
<tab><tab>SIBLING
As not really intended side effect, it is also permitted to indent the entire
file starting from the root level. We could guard against it but there's no
harm:
Correct and consistent:
<tab>ROOT
<tab><tab>PARENT
<tab><tab><tab><tab>CHILD
<tab><tab>SIBLING
Implementation:
Track parent nodes state: whenever a command enters a child node, push a parent
node onto an llist to remember the exact indentation characters used for that
level.
As soon as the first line on a child node is parsed, remember this new
indentation (which must have a longer strlen() than its parent level) to apply
to all remaining child siblings and grandchildren.
If the amount of spaces that indent a following VTY command are less than this
expected indentation, call vty_go_parent() until it matches up.
At any level, if the common length of indentation characters mismatch, abort
parsing in error.
Transitions to child node are spread across VTY implementations and are hard to
change. But transitions to the parent node are all handled by vty_go_parent().
By popping a parent from the list of parents in vty_go_parent(), we can also
detect that a command has changed the node without changing the parent, hence
it must have stepped into a child node, and we can push a parent frame.
The behavior on the interactive telnet VTY remains unchanged.
Change-Id: I24cbb3f6de111f2d31110c3c484c066f1153aac9
|
|
|
|
|
|
|
| |
These PRBS sequences are specified in ITU-T O.150. They are typically
used as test data to be transmitted for BER (bit error rate) testing.
Change-Id: I227b6a6e86a251460ecb816afa9a7439d5fb94d1
|
|
|
|
|
|
|
|
| |
Based on ETSI TS 101 318 section 5.1.2 the 95 bits SID code word
is not detected correctly due to a wrongful offset in the bits
location indexes.
Change-Id: I45d98c6edf267f313883503a65385190ffbc65ca
|
|
|
|
|
|
|
| |
our code is actually wrong, so let's skip the test until the fix is
applied in a follow-up patch.
Change-Id: I710c7871f959671deb3d18ab9062588f3056fd7c
|
|
|
|
| |
Change-Id: I9e2e7fcda28e7c6844d5faa09e02acf537cea44d
|
|
|
|
|
|
|
|
| |
We need to have an architecture-independend way of endian conversion /
byte swapping functions which will also work on embedded (bare iron)
builds. Let's introduce osmocom/core/bytesawp.h for this purpose.
Change-Id: Ibc0cc1e36d4ed63a35cf8ceff3af0f26e5ac7a3d
|
|
|
|
|
|
|
|
|
|
| |
This change extends the convolutional code test coverage, adding
the GSM 05.03 specific test vectors, generated by the conv_gen.py.
Inspired by Tom's patch:
http://lists.osmocom.org/pipermail/openbsc/2014-April/007364.html
Change-Id: I76d1cd4032d2f74c5bb93bde4fab99aa655b7f1a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* data structure representing 3GPP TS 52.021 ยง9.4.62 SW Description
* function to serialize it into msgb
* function to deserialize it from buffer
* functions to extract/estimate buffer size for SW Description
* test harness (partially taken from OpenBSC)
There are several similar functions to deal with SW Description in
OpenBSC, there's also need to use similar functionality in
OsmoBTS. Hence it's better to put the code into common library with
proper tests and documentation.
Change-Id: Ib63b6b5e83b8914864fc7edd789f8958cdc993cd
Related: OS#1614
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add test for osmo-auc-gen invocations to ensure stability across upcoming SQN
increment scheme changes.
The test comprises of a shell script that invokes the osmo-auc-gen binary with
various milenage parameters, of which the stdout/stderr are verified.
More osmo-auc-gen invocations could be added, but my main focus is on the SEQ
changes. Instead of manually testing that it still works for each SQN patch, I
want this test to do it for me.
To make sure that osmo-auc-gen is build before the tests are launched, place
'utils' before 'tests' in the root Makefile.am.
Related: OS#1968
Change-Id: Ib4af34201cd2e7d76037bcd31dd89ef18c1a9aec
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are some projects, such as GR-GSM and OsmocomBB, which would
benefit from using one shared implementation of GSM 05.03 code. So,
this commit introduces a new sub-library called libosmocoding, which
(for now) provides GSM, GPRS and EDGE transcoding routines, migrated
from OsmoBTS.
The original GSM 05.03 code from OsmoBTS was relicensed under
GPLv2-or-later with permission of copyright holders (Andreas Eversberg,
Alexander Chemeris and Tom Tsou).
The following data types are currently supported:
- xCCH
- PDTCH (CS 1-4 and MCS 1-9)
- TCH/FR
- TCH/HR
- TCH/AFS
- RCH/AHS
- RACH
- SCH
Change-Id: I0c3256b87686d878e4e716d12393cad5924fdfa1
|
|
|
|
|
|
|
|
| |
Use value_string for enum ctrl_type instead of custom code. Add
corresponding unit tests.
Related: OS#1615
Change-Id: Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28
|
|
|
|
|
|
|
|
|
| |
Configure logging to be deterministic and add stderr checking to testuite.at.
However, exclude the thousands of message modification log lines from the log
to not have a huge test expectation file.
Change-Id: I0dd7112967a64a168556b62e5ec15107b7608ffb
|
|
|
|
| |
Change-Id: I2773b3859a206f96fb8fa095d50a653d9eeb8d79
|
|
|
|
| |
Change-Id: I0e14099e2fc18e333a73d38bda059d53a8ca9944
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The write queue was always meant to not queue more than the
max_length messages but the implementation never rejected a
message.
Begin to log and enforce the queue size limit, add a testcase
to verify the code and initialize except_cb as part of a fix
for that new test case.
Real applications might now run into the queue limit and drop
messages where they just queued them before. It is unfortunate
but I still think it is good to implement the routine as it was
intended. We need to review osmo_wqueue_enqueue once more to
see that no msgb is leaked.
Change-Id: I1e6aef30f3e73d4bcf2967bc49f0783aa65395ae
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Numerous issues caused sim_test to be attempted even though libosmosim was not
built:
In configure.ac, the ENABLE_PCSC variable lacked an AC_SUBST() to be exported.
Furthermore in configure.ac, no value 'yes'/'no' was assigned to the
ENABLE_PCSC variable, only to the enable_pcsc value.
In testsuite.at, encapsulating the sim_test in 'if ENABLE_PCSC' seems to have
no effect, regardless (not even when using a variable that should be defined
accurately).
So fix with these steps, similarly to how we do it in openbsc:
In AC_ARG_ENABLE, directly use 'ENABLE_PCSC' to assign 'yes'/'no'.
Export the same using AC_SUBST().
Add tests/atlocal.in to translate ENABLE_PCSC to enable_sim_test (also add
atlocal to AC_OUTPUT and distclean).
Use enable_sim_test in testuite.at, as seen in openbsc: use AT_CHECK() to
indicate skipping the test if enable_sim_test isn't 'yes'.
Change-Id: I9e8740c7d2dfbd272e22fee85972ef3fda7184a8
|
|
|
|
| |
Change-Id: I5070578e9fe2bdacaad000eaafb8dc5f549d6f3e
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
|
|
|
|
|
|
| |
Move those routines from OpenBSC to libosmogsm, so they can be
re-used from other programs. I think it was a mistake to add them only
inside the openbsc repository in the first place. We need to pay more
attention to this in the future.
|
|
|
|
|
| |
These routines have nothing to do with specifically the BSC, so import
them to the TLV parser we keep in libosmogsm.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add bit map encoder and decoder functions: decoder is fully functional
while encoder is good enough for testing - no backtracking to find
the best possible compression is implemented. If somebody is willing to
implement MS side of EDGE than this has to be expanded.
Add corresponding tests.
N. B: the encoding is implemented according to ETSI TS 44.060 which is
slightly different from T4 used for fax according to CCITT G31D (RFC 804).
Ticket: OW#2407
Sponsored-by: On-Waves ehf
Signed-off-by: Max <msuraev@sysmocom.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently the msgb error handling cannot be fully tested, since in
many cases osmo_panic will be called. This will in turn call abort().
Usi |