Commit Graph

2050 Commits

Author SHA1 Message Date
Max b904091173 doc: fix incorrect return value description
Change-Id: Ieba009273f911bc4217122a6346220aeb29e8bc4
Related: OS#1614
2017-05-10 13:32:49 +02:00
Pablo Neira Ayuso 44f423f117 timer: add osmo_timer_setup()
Add a new function timer function to set up the timer, similar to what
we have in the Linux kernel. This patch also converts existing opencoded
timer setup in the libosmocore tree as initial client of this new
function.

This patch implicitly removes function callback passed by reference that
defeat compile time type validation.

Compile-tested only, but I ran make check that reports success when
testing timer infrastructure.

Change-Id: I2fa49972ecaab3748b25168b26d92034e9145666
2017-05-09 12:10:51 +02:00
Max c65c5b4ea0 vty: cleanup logging functions
* remove unused parameter from logging_vty_add_cmds()
* mark log level descriptors static
* change internal static function int check_log_to_target() to more
  appropriate bool should_log_to_target()
* deprecate log_vty_command_*() from public API as it should only be
  used by logging_vty_add_cmds()

Change-Id: I0e9ddd7ba3ce211302d99a3494eb408907a2916e
Related: OS#71
2017-05-09 09:11:05 +00:00
Max 584f4b69d6 gprs: add value strings for NS PDU type
Add value strings for Service Control PDUs according to 3GPP TS 48.016 §9
and use them for logging.

Change-Id: I0ea3a45f35d68619d4cfa9735ef77abd9f9f0d58
Related: SYS#3610
2017-05-09 09:10:20 +00:00
Max 33c7ba6934 Simplify ctrl cmd lookup
Replace if-else ladder & gotos with single switch statement & explicit
return to make reading code easier.

Change-Id: Ida1b389b571c60c26813cd29e61b3e4423c5df0f
2017-05-08 08:36:50 +00:00
Philipp Maier 85a6af213e gsm0808: fix control flow issue
Coverity Scan reported a control flow issue in line 206:

CID 166898: Control flow issues (DEADCODE)

The second branch of the if statement can not be reached. The
purpose of the second if branch was to filter out zero length
elements if the header states that it is a non extended speech
codec type. This makes no sense, since the header needs at
least one byte.

This patch removes the second if branch, zero length elements
are catched by the already existing zero length check at the
beginning of the function

Change-Id: I89751fc0d598734c64ef1fdced75b7c4fa77c616
2017-05-08 07:35:37 +00:00
Vadim Yanitskiy a8a5819155 configure.ac: check for __builtin_cpu_supports call support
The '__builtin_cpu_supports' is a GCC's built-in function which
returns a positive integer if the run-time CPU supports specified
SIMD feature and returns 0 otherwise. It is required for further
SSE optimization of Viterbi decoder.

This change adds a new check, whether compiler supports this call.
See /gcc/X86-Built-in-Functions.html at gcc.gnu.org for reference.

Change-Id: I5d52cfb3e8fab3eedc0293a2842708cbee0f476a
2017-05-08 02:02:49 +07:00
Vadim Yanitskiy 2c3066e5da configure.ac: add SIMD detection capabilities
This change adds a check whether compiler supports some SIMD
(Single Instruction, Multiple Data) instructions. It is enabled
by default, and can be disabled by configure option --disable-simd.
The check macro is based on the AX_EXT from autoconf-archive:

www.gnu.org/software/autoconf-archive/ax_ext.html

And depends on the ax_check_compile_flag macro:

www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html

Currently only the following SIMD extensions are being checked:
AVX2, SSE3, SSE4.1, but adding others is also possible. All found
extensions are being defined in the 'config.h' header.

Change-Id: Idf8fff984bd936a75c7c307338df88ba4b005817
2017-05-07 23:11:06 +07:00
Vadim Yanitskiy e604ee39cf core/conv: strip unused memalign() call
The alligned memory allocation is only required for SSE, which
is currently unsupported. Moreover, it's better to use dedicated
_mm_malloc() and _mm_free() from xmmintrin.h instead, which are
introduced by Intel specifically for SIMD computations.

Change-Id: Ide764d1c643527323334ef14335be7f8915f7622
2017-05-07 23:10:51 +07:00
Max 409e897df5 Fix broken ctrl commands
Recent changes to libosmoctrl resulted in ctrl comands being broken
because local lookup helper returned incorrect value for ROOT_NODE.

Note: although this commit seems to fix it for me, I'm still not sure
how the logic behind lookup function return values work. Would be nice
to get it documented.

Change-Id: Iddd20602047ebd9be1b668593f5dfa6f1d3e8369
2017-05-03 14:23:45 +00:00
Vadim Yanitskiy 33e03065a5 tests/conv: add GSM 05.03 specific test
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
2017-04-30 02:59:42 +07:00
Max f74cfd35ac Add SW Description (de)marshalling
* 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
2017-04-28 08:45:09 +00:00
Harald Welte 8a4895c0e5 Uninitialized variable in ipa_ccm_make_id_resp_from_req()
We are allocating a buffer on the stack without initializing it, and
then passing it into ipa_ccm_make_id_resp().  There is no real danger
from this, as the buffer is only uninitialized if num_ies is 0, but
let's memset() it for good style

Change-Id: If5761a47b8cba73ddcc02a88cfa5c87c1970c04e
Fixes: coverity CID#167040
2017-04-27 10:25:10 +02:00
Harald Welte 0b2f7153f2 control_if: Don't use magic number '5' when allocating vector
We have a proper constant for this (_LAST_CTRL_NODE), so let's use it.

Change-Id: I46275e644166156cb665da70d2964008f1c6cd88
2017-04-27 09:50:51 +02:00
Harald Welte 31c0fef2fd control_if: Add control interface commands for FSMs
This allows programmatic access to introspection of FSM instances, which
is quite handy from e.g. external test cases: Send a message to the
code, then use the CTRL interface to check if that message has triggered
the right kind of state transition.

Change-Id: I0f80340ee9c61c88962fdd6764a6098a844d0d1e
2017-04-27 09:50:47 +02:00
Harald Welte f85861d6eb control_if: Add helper function for 'local execution' of control command
Sometimes (particularly when testing), we may want to parse+execute an
arbitrary control command simply form a string buffer, rather than from
a msgb.  Let's add a helper for that.

Change-Id: Iaca748e0d942bb2a1ee7c2776b37485e1439eb0c
2017-04-27 09:50:33 +02:00
Harald Welte 79c137c654 control_if: Add API to initialize control interface without TCP port bind
When executing test cases, we don't want to bind to a local TCP port, as
we cannot make assumptions as to which ports are actually free.

Change-Id: I5717f9dd92d1f143f069cecd4b4c8ba3d03b25f8
2017-04-26 13:47:06 +02:00
Harald Welte d6b1f85fd8 ctrl: Allow installation of additional node lookup helpers
The existing code assumes that the main application knows about all
control command nodes and can thus present one lookup function.

As libraries are getting their own control interface handling, this
is too restrictive, and we need a way how library code can dynamically
register more node lookup helpers.   We can now do this by means of a
ctrl_lookup_register() function.

Change-Id: Ib69908d1c57f5bb721d5496e3b4a5258fca450e3
2017-04-26 09:22:19 +00:00
Thorsten Alteholz a81055db1d fix spelling in API docu, command reply, logging, descriptions
sections: ctrl, gb, gsm, vty

Change-Id: Iac211b5cd8504da36b699777b95a2448dd7c3e70
2017-04-23 14:34:18 +00:00
Harald Welte 9e83c3d5ca fsm: Re-set fsm_inst->T to 0 after timer expiration
If the user starts the FSM timer with a given timer number during
fsm_inst_state_chg() with a timeout, we should remove that "T" number
after timer expiration.  Otherwise it might be confusing if e.g. the VTY
interface shows FSM instances with a certain timer number assigned, but
that timer is not actually running anymore.

Change-Id: I71167ec1000dc4c6954d851d3b92f6bf12984925
2017-04-16 17:28:23 +02:00
Harald Welte 4585e6755d osmo_fsm: Lookup functions to find FSM Instance by name or ID
Introduce two lookup helper functions to resolve a fsm_instance based on
the FSM and name or ID.  Also, add related test cases.

Change-Id: I707f3ed2795c28a924e64adc612d378c21baa815
2017-04-16 17:28:23 +02:00
Harald Welte 7bc88bbd7e ipa: Introduce helpers to encode IPA CCM ID RESPONSE
The ipa.c file already contained code to parse an ID RESPONSE into the
'struct ipaccess_unit', but it didn't so far contain code to put
together an ID RESPONSE packet based on that structure.  Let's change
that with ipa_ccm_make_id_resp() and a helper wrapper
ipa_ccm_make_id_resp_from_req().

Change-Id: Icbcd8827a75fd5f3393351c1ca372de85275ad35
2017-04-15 19:05:33 +02:00
Harald Welte 59a9ebf8b8 msgb: Add msgb_pull_to_l2() analogous to msgb_pull_to_l3()
Introduce msgb_pull_to_l2() which pulls (removes) any msgb contents in
front of the L2 header (msg->l2h).

Change-Id: I7786a1b30f9e7eaa3dcdb3cbb2a85a126588f6cd
2017-04-15 19:04:34 +02:00
Harald Welte b522740be5 vty/command.h: Introduce VTY nodes for libosmo-sigtran
This adds several VTY nodes required by the libosmo-sigtran VTY
interface.

Change-Id: I184a7e3187b48c15c71bf773f86e188fe1daad15
2017-04-14 14:01:56 +02:00
Tom Tsou 35536807ab core/conv: implement optimized Viterbi decoder
Add a separate, faster convolution decoding implementation for rates
up to N=4 and constraint lengths of K=5 and K=7, which covers the
most GSM code uses. The decoding algorithm exploits the symmetric
structure of the Viterbi add-compare-select (ACS) operation - commonly
known as the ACS butterfly. This shift-register optimization can be
found in the well-known text by Dave Forney.

Forney, G.D., "The Viterbi Algorithm," Proc. of the IEEE, March 1973.

Implementation is non-architecture specific and improves performance on
x86 as well as ARM processors. Existing API is unchanged with optimized
code being called internally for supported codes.

The original code was relicensed under GPLv2-or-later with permission
of copyright holder - Tom Tsou.

Change-Id: I74d355274b4176a7d924f91ef3c96912ce338fb2
2017-04-11 00:36:08 +00:00
Harald Welte dda70fca79 Add osmo_sock_init2() function, allowing both BIND *and* CONNECT
The old osmo_sock_init() function allows only either a bind (for a
server socket), or a connect (for a client socket), but not both
together.  So there's no way to have a client socket that is bound to a
specific local IP and/or port, which is needed for some use cases.

Change-Id: Idab124bcca47872f55311a82d6818aed590965e6
2017-04-09 21:46:21 +02:00
Harald Welte acd08feb8f Add struct osmo_prim_event_map and osmo_event_for_prim()
This can be used to map from an osmo_prim to an osmo_fsm event.

Change-Id: I52350f4ebe97811b2a692e5a69a2cd39a853583c
2017-04-09 17:54:28 +00:00
Thorsten Alteholz 18a62b0488 compiler warnings: take care of compiler warning "unused-result"
Though it makes no sense to handle the return code of freopen() here,
the compiler complains about it. The #pragma statements take care of
that.

Change-Id: Ia2caadbed2a24f84d1d55a47236b398b74224e82
2017-04-08 07:45:13 +00:00
Philipp Maier 15596e2a7f gsm0808: make gsm0808_create_reset_ack() accessible
The create function to generate the RESET ACKNOWLEDGE
message is not accessible from outside, as it does not
appear in limosmogsm.map. It also has not testcase.

This commit adds gsm0808_create_reset_ack() to the
map file and also adds a testcase.

Change-Id: I82d3411484f82b4a9205d407fa0442244678f183
2017-04-08 07:44:47 +00:00
Philipp Maier c6144a2448 gsm0808: Add create functions for BSS_MAP_MSG_ASSIGMENT_RQST
gsm0808.h/c lacks functionality to generate BSS_MAP_MSG_ASSIGMENT_RQST messages.
These messages are required if the code is used in an MSC implementation.

This commit adds a gsm0808_create_assignment() function, that generates an
A/AoiP BSS_MAP_MSG_PAGING message.

Change-Id: I4d1d455a1e1cf95407e23ded7b7defbcf2dd6ff0
2017-04-08 07:44:47 +00:00
Philipp Maier 3d48ec06a9 gsm0808: Add create functions for BSS_MAP_MSG_PAGING
gsm0808.h/c lacks functionality to generate BSS_MAP_MSG_PAGING messages. These
messages are required if the code is used in an MSC implementation.

This commit adds a gsm0808_create_paging() function, that generates an A/AoiP
BSS_MAP_MSG_PAGING message.

Change-Id: I9afecf0109305ca5153bf081bb29cd94071dd2b7
2017-04-08 07:44:46 +00:00
Philipp Maier b478dd38d2 gsm0808: Add create functions for CIPHER MODE COMMAND
gsm0808.h/c lacks functionality to generate CIPHER MODE COMMAND messages. These
messages are required if the code is used in an MSC implementation.

This commit adds a gsm0808_create_cipher() function, that generates an A/AoiP
CIPHER MODE COMMAND message.

Change-Id: I8eb1c357860c3e740b0f5d17e1c256bc87920958
2017-04-08 07:44:46 +00:00
Philipp Maier 783047e86e gsm0808: Add utils for Cell Identifier List
The planned support for true A over IP requires the encoding of
the a Cell Identifier List element (see also BSS_MAP_MSG_PAGING).

This commt adds encoding/decoding functionality and tests for
the element mentioned above, however, it is not yet actively used.

Change-Id: I625245dd1dd396fc2bc189e8cd2c444a33042528
2017-04-08 07:44:46 +00:00
Philipp Maier 14e76b9958 gsm0808: Add utils for Encryption Information
The planned support for true A over IP requires the encoding of
the an Encryption Information element (see also BSS_MAP_MSG_CIPHER_MODE_CMD).

This commt adds encoding/decoding functionality and tests for
the element mentioned above, however, it is not yet actively used.

Change-Id: I8262050a9d9fd3f17462cfbb046c6e034dccc6fb
2017-04-08 07:44:46 +00:00
Philipp Maier e0c65301d5 gsm0808: Add utils for Channel Type
The planned support for true A over IP requires the encoding of
the a Channel Type element (see also ASSIGNMENT REQUEST).

This commt adds encoding/decoding functionality and tests for
the element mentioned above, however, it is not yet actively used.

Change-Id: Id0e2164d84b8cbcc6fe6a090fc7f40a1251421d7
2017-04-08 07:44:46 +00:00
Philipp Maier fa896abbb3 gsm0808: Add AoIP specific elements to gsm0808_create_... functions
the classic A implementation in libosmocore lacks support for AoIP
message elements. This patch adds support for AoIP by adding a set
of new gsm0808_create_..., which support the missing AoIP message
elements

Change-Id: I77f866abec1822d19871052f3c647ad782785b34
2017-04-08 07:44:45 +00:00
Philipp Maier 6f725d6da3 gsm0808: Add utils for Speech Codec List and Speech Codec
The planned support for true A over IP requires the encoding and
decoding of a so called "Speech Codec Element" element.

This commt adds parsing functionality and tests for the element
mentioned above, however, it is not yet actively used.

Change-Id: I0e1e2edf47adaa45b22d4b0bcae3640dba7ca200
2017-04-08 07:44:45 +00:00
Philipp Maier 22401433aa gsm0808: Add utils for AoIP Transport Layer Address
The planned support for true A over IP requires the encoding and
decoding of a so called "AoIP Transport Layer Address" element.

This commt adds parsing functionality and tests for the element
mentioned above, however, it is not yet actively used.

Change-Id: I57933b0a06a3f54ec2a41e6ecb6ced9fbbc89332
2017-04-08 07:44:45 +00:00
Harald Welte f7add0889c add VTY port number for osmo-stp
Change-Id: I978e1b73aa8097a7db6318d78f9f93457e6ce2af
2017-04-08 09:34:04 +02:00
Holger Hans Peter Freyther ff20641d9e select: Find the highest fd when filling the fd_sets
Instead of returning maxfd, which is the highest fd ever seen, take
the highest we have seen on this iteration.

This makes a tiny difference for the osmo-sip-connector and its
event loop integration. select.c ignores the return value of this
function right now.

This was seen while debugging the eventloop integration of the
osmo-sip-connector before and after a VTY connection. The fds
being polled didn't go down.

Change-Id: I1a6d7271273ec08bb511c21b936891bc508843e4
2017-04-04 20:14:32 +00:00
Harald Welte 059c40476c logging: Add log_info_cat for DLSS7/DLSCCP/DLSUA/DLM3UA
In Change-Id I61f452208088dc7097165deecef7c058ebb4bd4e we introduced
the #defines but didn't introduce the new log_info_cat information.

Change-Id: I218aa4cb1fc7640a75663be29bac672dfa8770f5
2017-04-03 22:20:49 +02:00
Harald Welte 62d3296c14 logging.h: #define DLSS7, DLSCCP, DLSUA, DLM3UA for libosmo-sigtran
Change-Id: I61f452208088dc7097165deecef7c058ebb4bd4e
2017-04-03 19:38:37 +02:00
Neels Hofmeyr d4089f4b07 jenkins: also test build in separate dir
To make sure that new patches don't break a build done in another dir than
srcdir, make jenkins verify that it still works.

Even though 'make distcheck' also tests a build from a separate dir, this does
not verify that BUILT_SOURCES are generated properly. If these already exist in
the source tree from a previous 'make' issued in the source tree, the
BUILT_SOURCES are not regenerated during 'make distcheck'. Hence a separate
test run is necessary to ensure stability of new patches.

Change-Id: I4b31538c155941fd241bcd33b0d39f2f8491ac1e
2017-03-31 12:06:13 +00:00
Jean-Francois Dionne d78c973cd8 Fix LAPD UA message buffer memory leak.
The state check in lapd_dl_reset causes some buffers
never to be released. Using talloc report LAPD UA
message buffers are never released after each call
and cause a memory leak.

Change-Id: I2799b70623f2ec4dbc725eb213e332e98da02a3e
2017-03-29 13:40:34 +00:00
Max 7f9c7e7b8b Add support for PCU version report
Expand 3GPP TS 52.021 §9.4.43 Probable Cause with Osmocom-specific value
for PCU version reporting to enable sending it via OML alarms.

Change-Id: If57459c0610f2c7b36d599b13087c8deef8bdd9e
Related: OS#1614
2017-03-23 09:56:56 +00:00
Max 5d994e4f75 abis: add message type names
Add human-readable names for Message Types from 3GPP TS 52.021 §9.1

Related: OS#1614

Change-Id: Ide8202b4387351f57ceee34a9eb8c30aef09a663
2017-03-22 15:26:35 +01:00
Max 62d6f25703 abis: add attribute names
Add human-readable names for Attributes from 3GPP TS 52.021 §9.4

Change-Id: I861247c01557dac7e484ef6fb9b170f69c8a7f55
Related: OS#1614
2017-03-21 17:38:49 +01:00
Neels Hofmeyr e64d5bd29b build: fix distcheck: include gen scripts in EXTRA_DIST
Change-Id: Id94d2fe83f080a18a2a686206bd21cf5fafe2fa7
2017-03-20 14:30:43 +01:00
Neels Hofmeyr f444600afe build: fix build dependencies for generated sources
Ensure that a changed conv_gen.py and/or conv_codes_gsm.py result in
regeneration of the gsm0503* generated sources. Before this patch, manual
cleaning of the generated files was necessary to benefit from a code update.

Change-Id: Ib4328662c21280c0ea6aa9391a64ada2c6598704
2017-03-20 14:30:43 +01:00
Neels Hofmeyr d1537e033f build: conv_gen.py: ensure parent dirs of written files exist
Previously, this would fail when generating to $builddir if that subtree did
not exist yet in $builddir.

Change-Id: Ia4fba96dcf74a25cf3e515eb3e4f970e0c3cdd54
2017-03-20 12:33:36 +00:00