Commit Graph

1872 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther 6030ce844e sim: Link to libtalloc as symbols of it are used here
A DSO should link to the libraries that it is using. Linking to
libtalloc will resolve these warnings:

Change-Id: I4c8d5e80e194b9d9b4fa2424c4a22377ecee9c7a
dpkg-shlibdeps: warning: symbol _talloc_zero used by debian/libosmosim0/usr/lib/i386-linux-gnu/libosmosim.so.0.0.0 found in none of the libraries
dpkg-shlibdeps: warning: symbol _talloc_free used by debian/libosmosim0/usr/lib/i386-linux-gnu/libosmosim.so.0.0.0 found in none of the libraries
dpkg-shlibdeps: warning: symbol talloc_strndup used by debian/libosmosim0/usr/lib/i386-linux-gnu/libosmosim.so.0.0.0 found in none of the libraries
dpkg-shlibdeps: warning: symbol talloc_strdup used by debian/libosmosim0/usr/lib/i386-linux-gnu/libosmosim.so.0.0.0 found in none of the libraries
dpkg-shlibdeps: warning: symbol _talloc_memdup used by debian/libosmosim0/usr/lib/i386-linux-gnu/libosmosim.so.0.0.0 found in none of the libraries
2017-01-24 14:26:11 +01:00
Harald Welte abba1537a7 ipa: Remove unneeded #include statement
Change-Id: I69f2891a2bea6f87f079b6778aa01ee27a25001b
2017-01-23 12:20:34 +00:00
Harald Welte 75c0e2f371 utils.h: #include <stdio.h> as we use fprintf()
Change-Id: I911c7f4bcadde414ce0b384e13a3a9a4a953e2fb
2017-01-23 12:20:33 +00:00
Harald Welte 44c0f63de6 disable various code if building for bare-iron embedded
We don't have file-based I/O nor ethernet devices with mac addresses
when building for OsmocomBB.

Change-Id: I01a9e6d8dbe885dbeac2769b84931a4d44f7a3a5
2017-01-23 12:20:33 +00:00
Neels Hofmeyr 505a22fc51 linuxlist.h: add llist_count()
After subchan_demux.c in libosmo-abis, osmo-bts/common/vty.c and openbsc's
gtphub_test.c, more places would like to count the llist items (mostly unit
tests). Instead of proliferating numerous local implementations, add here.

NOTE: other than the previous llist_len() implementations, this one returns an
*unsigned* length, which might need some adjusting of current callers.

Call this llist_count() rather than llist_len() to highlight the fact that this
is actively iterating. This also avoids a potential naming conflict when
library versions mismatch.

Change-Id: Ic49adc7a346f5722bf624d7d3b4a735e4220ae15
2017-01-21 01:12:32 +01:00
Max b0a4234c49 Add abis_nm_fail_evt_vrep to libosmogsm.map
Change-Id: If56b521429af497ddd5a47170eb2c085b1fb78ba
2017-01-19 09:07:33 +00:00
Neels Hofmeyr 0aeda1b17f doc: fix doxygen 'utils' group closing brace
osmo_strlcpy() was excluded from the group because the closing brace was above
it.

Change-Id: I6701261f5854342ac4cd4f2da62e49eb40362938
2017-01-18 01:50:39 +00:00
Max 6e8c172476 libosmogsm.map: fix typo
Change-Id: I71413fbe703e459782a235e5b1d8487265de3780
Related: OS#1615
2017-01-17 15:37:06 +00:00
Max aa1bc012c8 logging: remove code duplication
* make DEBUGP* macro into simple wrappers around LOGP*
* deprecate unused logp() function

Related: OS#71
Change-Id: Ia6c92bd4824c44fc22cc733ce7a88da86e58ed93
2017-01-16 14:12:13 +00:00
Vadim Yanitskiy d8494bc9b7 tests/conv: whitespece fix
Change-Id: I73ab4614c5c23390862d3ecaa2561a6749604a15
2017-01-16 12:54:32 +00:00
Vadim Yanitskiy 1214295062 tests/conv: add LTE PBCH test vector
Change-Id: I1a3a48bba9ee32a0bacc0b05d25358496dbcbc1b
2017-01-16 12:52:01 +00:00
Max 8928747a3e CTRL: add write-only helpers
Similar to CTRL_CMD_DEFINE_RO() add helper for control commands which
are not meant to be read, only to set. Similarly, add
CTRL_CMD_DEFINE_WO_NOVRF() for commands which do not perform inbound
data verification.

Change-Id: I66b7990db590c1f8e56326e392e6c1d2eafebd9a
2017-01-16 08:54:17 +00:00
Max ace80bb569 Mark deprecated function as such
Mark abis_nm_debugp_foh() function superseded by macro with the same
name as deprecated.

Change-Id: I2d3ea2b56aff6b687f72f832360b8cb8a24164e9
2017-01-16 08:53:20 +00:00
Neels Hofmeyr b41b48e76a stats_test: fix mismatching osmo_stats_reporter->send_item signature
The function pointer expects the last arg as int64_t, stats_test.c uses
an int instead. Fix the argument type as well as the printf format for it.

Fixes this compiler warning seen on our FreeBSD build slave:

    CC       stats/stats_test.o
  ../../tests/stats/stats_test.c:288:18: warning: incompatible pointer types assigning to 'int (*)(struct osmo_stats_reporter *, const struct osmo_stat_item_group *, const struct osmo_stat_item_desc *, int64_t)' from 'int (struct osmo_stats_reporter *, const struct osmo_stat_item_group *, const struct osmo_stat_item_desc *, int)' [-Wincompatible-pointer-types]
          srep->send_item = stats_reporter_test_send_item;
                          ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1 warning generated.

Change-Id: I91cbfd4dd25a881b803943430101dabf07dafc7c
2017-01-15 18:10:15 +00:00
Neels Hofmeyr df83eced68 doc: clarify osmo_strlcpy() doc
Stating that it 'truncates src' is misleading. Also clarify whether siz
includes the space needed for the terminating NUL.

Change-Id: I01c1a94408b471f7f54576178a60938bf9ee3261
2017-01-15 17:58:29 +00:00
Harald Welte 449324b264 bitvec: Ensure bitvec.h and bitvec.c agree on function argument type
uint32_t may or may not be unsigned int.

Change-Id: I21c96985fcbb72372b6df949301c21f1ebca41f2
2017-01-15 18:04:02 +01:00
Harald Welte f2899c674e Always include <osmocom/core/talloc.h> and not <talloc.h>
In EMBEDDED builds we don't have a system-wide talloc

Change-Id: Icc526016bda45b36e584afee8669996752d6d89c
2017-01-15 18:04:02 +01:00
Harald Welte 1a7d64ccd1 configure.ac: Disable PCSC related code on EMBEDDED
The EMBEDDED conditional is used for building inside 'bare iron'
embedded devices like OsmocomBB phones.  There's no PC/SC in them.

Change-Id: I2ef7561d7fdb1ef1c060f8ac73d8588fc0f8eb3f
2017-01-15 18:04:02 +01:00
Harald Welte 1c67e754b8 configure.ac: Introduce --disable-ctrl
Using --disable-ctrl, one can disable the building of libosmoctrl.

The 'embedded' target will also automaticall disable ctrl.

Change-Id: I6912396338c5b23ae860fef2a55854d6df9a579d
2017-01-15 18:04:02 +01:00
Max 2f0b0c955b Fix compilation warnings: missing includes: gsm0411_utils.c, lapd_core.c, oap_test.c
Change-Id: Id524327b3f44e22e3aa44c5e8e4965b084cb326a
2017-01-13 09:36:25 +00:00
Neels Hofmeyr c32bfd5824 gprs_ns_vty: guard against duplicate VTY elements
The TbfTest in osmo-pcu calls gprs_ns_vty_init() repeatedly, which aborts
because of duplicate VTY elements. Fix this by skipping the VTY init if
it already happened.

Change-Id: I05c7f25a4e873ae76b206819180b8b043b60103e
2017-01-12 22:32:36 +01:00
Max 1251afe254 Add abis_nm_fail_evt_vrep() function
It accept fixed number of arguments including va_list instead of variable
number of arguments in abis_nm_fail_evt_rep() - similar to vprintff() vs
printf().

Related: OS#1615
Change-Id: Ib293dec1c2de9b664584a8456c782ea7b6dd8555
2017-01-11 18:12:32 +01:00
Max b632e03f65 Remove obsolete .deb patch
Change-Id: Icbf911540fcc840833c5012363c2ba48fd71db52
Related: OS#1694
2017-01-10 23:29:47 +00:00
Max 87218edb9a LAPD: improve logging
Log error cause and state names in case of SABM errors.

Change-Id: I2c7fa276e03f8b14ba41cc1fb6e19d0aae77d127
2017-01-10 23:28:40 +00:00
Jean-Francois Dionne d02c8af6cc DTX: fix AMR SID-FIRST detection
Max's note: adjusted test output.

Change-Id: I46477c631bf86345cb757f31d7f2e2935b12adcc
Related: OS#1801
2017-01-10 23:28:12 +00:00
Max 85908a9c2f Add value strings for Probable Cause Type
Add string representation of Probable Cause Type from 3GPP TS 12.21 §
9.4.43.

Change-Id: I9fe14ed3b5398f59dd06a509e4d419e074cc20a7
Related: OS#1615
2017-01-10 17:49:23 +01:00
Harald Welte ebcf02de6c gsmtap: Add GSMTAP_TYPE_QC_DIAG
This adds a definition for wrapping Qualcomm DIAG frames into GSMTAP for
transporting them over an IP network.

Change-Id: I1b357b7d11a370685671c7b01e55f4f36dec2f25
2017-01-09 13:19:16 +01:00
Vadim Yanitskiy c0c8432345 gitignore: ignore *.pyc files
Change-Id: I148584e1664b20741c0ade02cbda635c24268d2e
2017-01-08 14:02:51 +00:00
Harald Welte 3419391422 fsm: Add VTY introspection of osmo_fsm and their instances
Change-Id: I89212e4f149f019099115a85bab353c04170df90
2017-01-07 12:21:11 +00:00
Harald Welte 8808bb49a2 Add osmo_fsm_find_by_name() and avoid registering FSM with same name
This addresses a FIXME in the fsm.c code: osmo_fsm_register() should
fail in case a FSM with the given name already exists.

Change-Id: I5fd882939859c79581eba70c14cbafd64560b583
2017-01-07 12:20:59 +00:00
Harald Welte addeaa39b1 vty: OSMO_ASSERT() if two identical commands are installed
When the caller installs two identical commands at a given VTY node, the
result is that neither of the two commands can ever be executed: The VTY
would always complain about "Ambiguous command.".  Let's fail fast at
program start when two identical commands are intalled.

Change-Id: I85ff4640ebb3d8b75a6a9ab5d2f668edb5b7189e
2017-01-07 12:14:48 +00:00
Max ecbcdf52ec Add OML Failure Event Report support
Add 3GPP TS 12.21 § 8.8.2 Failure Event Report function which pack given
vararg string and parameters into msgb.

Change-Id: I58c198d8ea588432c62520928b08f0b2a7035e93
Related: OS#1615
2017-01-06 18:05:49 +01:00
Max 07352fee09 Add event cause string descriptions
Add human-readable descriptions to event causes from 3GPP TS 12.21 §
9.4.43.

Change-Id: Id173c978616c98b7831fbafb5401064257f1cf73
Related: OS#1615
2017-01-06 11:37:09 +00:00
Pravin Kumarvel 848de8f1df Add function to get uninterrupted bit run
Function bitvec_rl_curbit added to get number of  uninterrupted
bits run in vector starting from the current bit till max number
of bits.
Test case is added to check bitvec_rl_curbit.

Change-Id: Iae153d3639ea6b891c1fc10d7801a435c9492e26
2017-01-06 10:37:42 +00:00
Minh-Quang Nguyen 592fcc97c0 Add cause enum for OML fail reports
Add 3GPP TS 12.21 §9.4.43 Probable Cause values of type 03 (Manufacturer
specific values).

Max's note: renamed to make it clear that values are vendor-specific.

Related: OS#1615
Change-Id: Ie9ba4b53fb19a151447aec9ea309284e20613585
2017-01-06 10:21:11 +00:00
Max dbd3a92f70 Add parsed TLV helpers from OsmoBTS
Add functions to copy and merge parsed TLV structures from OsmoBTS.

Change-Id: Ieaaaed19da9c069fe451faa53d24c5b84d7d5615
2017-01-06 10:21:11 +00:00
Max 0bee65c0d8 Add OML definitions from OsmoBTS
Change-Id: I9c3bc15662949654e7bba6aad5488c69ee7d0c45
Related: OS#1615
2017-01-06 10:21:11 +00:00
Max edc8db21fa Remove direct logging
Drop perror() calls from GSMTAP code: it's application job to do the
proper logging - library code should not write to stdout/stderr
directly.

Change-Id: Ifa149e65d76c6e64fda2946725c16672233aff2e
2017-01-06 10:12:24 +00:00
Vadim Yanitskiy b1edd16e75 gitignore: ignore tests/oap/oap_test
Change-Id: Iccb8c46a721d5389058c5cf36621820bcd861b7b
2017-01-06 10:08:57 +00:00
Harald Welte 53e2672e11 lapd_test: avoid calling memcpy with NULL source
fixes
lapd/lapd_test.c:54:2: runtime error: null pointer passed as argument 2, which is declared to never be null

Change-Id: I7030729f4f4c867adecc7afc15bb5ca9beff0030
2017-01-06 10:03:30 +00:00
Harald Welte 6cfa56ba0c gprs_cipher_core: Use typecase to avoid sanitizer error
This resolves
gprs_cipher_core.c:118:37: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

Change-Id: Ib1866595030ad9d11c886621ce69632462befa3a
2017-01-06 10:03:30 +00:00
Neels Hofmeyr 3faa014805 fsm: term: get parent pointer as late as possible
During FSM instance termination, fetch the parent pointer every time just
before using it, in case the child termination or cleanup callback wish to
change anything about the parent, e.g. to prevent event dispatch.

This patch was created to try and fix a problem that was in the end solved
differently. There is no actual need or use case for this at the moment, but it
generally makes sense to get the parent pointer as late as possible.

Change-Id: I999d7f29ba10281d4005c5163130bb2d80148362
2016-12-24 18:44:41 +01:00
Vadim Yanitskiy 15492bcb26 utils/conv_gen.py: separate code definitions
This change separates the convolutional code definitions from the code
generator logic, allowing us to make further changes in more specific
way. For example, adding some new codes, you change the conv_codes.py
only because such change isn't related to the generator.

Change-Id: I3428561251b7d7a180d1e9b6fcaad50bdbbc37fa
2016-12-24 17:12:49 +00:00
Vadim Yanitskiy 6431adde78 utils/conv_gen.py: use shared tables if possible
This change introduces the memory usage optimization, mentioned
in d2d9760c08. The aim is to make
code generator able to detect, whether the same tables are used
by several convolutional code definitions, and prevent one from
writing these tables multiple times.

For now, the detection process isn't fully automatic, so all
shared polynomials should be placed inside the 'shared_polys'
dictionary, for example:

shared_polys = {
	"xcch" : [
		( G0, 1 ),
		( G1, 1 ),
	],
	"mcs" : [
		( G4, 1 ),
		( G7, 1 ),
		( G5, 1 ),
	],
}

Change-Id: I84760f5cdfdaece376b801d2e6cb2954ee875a3b
2016-12-24 17:12:49 +00:00
Neels Hofmeyr c014f606d0 fsm: factor out osmo_fsm_inst_term_children() from osmo_fsm_inst_term()
osmo_fsm_inst_term() has code for safe child removal, publish that part as
osmo_fsm_inst_term_children(); also use from osmo_fsm_inst_term().

As with osmo_fsm_inst_term(), add osmo_fsm_inst_term_children() macro to pass
the caller's source file and line to new _osmo_fsm_inst_term_children().

Rationale: in openbsc's VLR, I want to discard child FSMs when certain events
are handled. I could keep a pointer to each one, or simply iterate all
children, making the code a lot simpler in some places.

(Unfortunately, the patch may be displayed subobtimally. This really only moves
the children-loop to a new function, replaces it with a call to
_osmo_fsm_inst_term_children(fi, OSMO_FSM_TERM_PARENT, NULL, file, line) and
drops two local iterator variables. No other code changes are made, even though
the diff may show large removal + addition chunks)

Change-Id: I8dac1206259cbd251660f793ad023aaa1dc705a2
2016-12-24 17:11:52 +00:00
Neels Hofmeyr eeacf906dd fsm: move LOGPFSMSRC and LOGPFSMLSRC to .h
LOGPFSM and LOGPFSML are in the header file, put the *SRC variants also there
so users of the osmo_fsm_inst API may conveniently create own functions that
log the caller's source file and line.

Very useful if many action functions call the same event dispatching function,
like foo_fsm_done(), and one needs to know which of the callers to debug.

Change-Id: I39447b1d15237b28f88d8c5f08d82c764679dc80
2016-12-24 17:11:52 +00:00
Neels Hofmeyr c7155df3ec fsm: log calling file+line for error "event for NULL fi"
Change-Id: I1970773440865f1415004bcf0164603468acf90b
2016-12-24 17:11:52 +00:00
Neels Hofmeyr b805cc1992 fsm: doc: add missing file, line args; fix ws + tweak on one line
Change-Id: I6af0d43ab0082e45df676c1d69b26310b59a8031
2016-12-24 17:11:52 +00:00
Neels Hofmeyr cba8eb9b21 fsm_test.c: fix compiler warning: timer cb return type
Change-Id: Ifd7e85cd69b5e7e473000abc1ef7a56748aafc0e
2016-12-24 17:11:52 +00:00
Harald Welte 1514f34dcf serial.c: file descriptor '0' is a valid value
if stdin/stdout/stderr are all closed by our environment, it may very
well be that opening a serial port returns fd == 0.

Change-Id: Ifd9670260883a35da0629369e0d49e467d5b4d72
2016-12-24 17:59:36 +01:00