Commit Graph

3265 Commits

Author SHA1 Message Date
Kirill Zakharenko 9d74866575 release 1.3.0-fw.5 2020-05-09 03:11:18 +03:00
Kirill Zakharenko 8151635596 Merge fairwaves/wip-stats into fairwaves/production 2020-05-09 03:08:36 +03:00
Alexander Chemeris 4b3e4dc866 stats: Change timer to timerfd to make it a true interval timer.
Previously the interval between stats flushes would slowly increase
which would lead to reporting time jitter and confuse a timescale
database.

Change-Id: I23d8b5157ef8a9833ba16a81d9b28a126f303c30
2020-05-09 02:54:45 +03:00
Alexander Chemeris e3f785fbf1 select: Fix typo in a comment Osmcoom->Osmocom
Change-Id: I6fb4d20d149abc724d477420b5eba482a0b63259
2020-05-09 02:54:45 +03:00
Alexander Chemeris 73160d3d0a stats: Support regular stats flush
Reliable monitoring requires regular flush of all stat values, even
if they have not changed. Otherwise (1) the monitoring app has to
maintain state and (2) can go out of sync if it's restarted while
the app is still running.

Change-Id: I04f1e7bdf0d6f20e4f15571e94191de61c47ddad
2020-05-09 02:54:45 +03:00
Kirill Zakharenko a89b22aa22 release 1.3.0-fw.4 2020-05-08 22:58:35 +03:00
Kirill Zakharenko 7037e6d7d1 Merge fairwaves/wip-stats into fairwaves/production 2020-05-08 22:57:05 +03:00
Alexander Chemeris 228535d9d5 stats: Support regular stats flush
Reliable monitoring requires regular flush of all stat values, even
if they have not changed. Otherwise (1) the monitoring app has to
maintain state and (2) can go out of sync if it's restarted while
the app is still running.

Change-Id: I04f1e7bdf0d6f20e4f15571e94191de61c47ddad
2020-05-08 22:07:34 +03:00
Kirill Zakharenko fd6df4d2ac Merge master into fairwaves/production 2020-05-08 20:40:52 +03:00
Alexander Chemeris 7739d11fc6 stats: Fix documentation for osmo_stats_set_interval()
Change-Id: Ie07a03251d6fe9d40b62815feb51ec8af9ed7c95
2020-05-08 19:09:22 +03:00
Alexander Chemeris 33c703caee stats: Move cfg_stats_interval_cmd() function.
cfg_stats_interval_cmd() function was (probably mistakenly)
inserted between cfg_stats_reporter_statsd_cmd() and
cfg_no_stats_reporter_statsd_cmd() function which makes no sense.
Move it below the cfg_no_stats_reporter_log_cmd() to follow the order
of the osmo_stats_vty_add_cmds() function calls.

Change-Id: I1ecec7025e95cf5ffc21ae3b1c75cf6da8c58de2
2020-05-08 18:21:40 +03:00
Harald Welte 3a6bedf1e5 sim: When decoding SW, take application specific SW into account
So far we only looked at SW definitions of the card profile. However,
if we have a currently selected application, we also must check
that application for SW definitions.

This breaks ABI and API all over the place, but as there are no
known users beyond osmo-sim-test, this is acceptable.

Change-Id: I3a1d60898529c173f73587e34c155660ba5f5fb1
2020-05-05 19:41:12 +00:00
Vadim Yanitskiy c9eab828ea rest_octets: fix encoding of 3G Early Classmark Sending Restriction
Change-Id: I6df515a00518fabb3eb8f65054addd3aead14bfe
Relates: OS#3075
2020-05-05 02:03:51 +07:00
Harald Welte 9892945ec2 gsm_29_118.h: Fix compilation with gcc-10
this causes problems when compiling user applications
/usr/bin/ld: ../../src/libvlr/libvlr.a(vlr_lu_fsm.o):/usr/local/include/osmocom/gsm/protocol/gsm_29_118.h:184: multiple definition of `sgsap_ie_tlvdef'; msc_main.o:/usr/local/include/osmocom/gsm/protocol/gsm_29_118.h:184: first defined here

Change-Id: Iaa1d36c7a9bb64aa84ee85fa3e40f6b3560fe693
2020-05-02 19:43:49 +00:00
Kirill Zakharenko 6e1b55de01 release 1.3.0-fw.3 2020-05-01 18:24:32 +03:00
Kirill Zakharenko 357ab3abba Merge master into fairwaves/production 2020-05-01 18:21:58 +03:00
Pau Espin 47eb4e18d0 configure.ac: Fix HAVE_CLOCK_GETTIME undef when func in -lrt
AC_SEARCH_LIBS was finding the function correctly, but later on
AC_CHECK_FUNCS was not including the found LIBRARY_RT so the function
was not found, and hence HAVE_CLOCK_GETTIME ended up undefined (which in
turns disables support for osmo_clock_gettime() API).
This happened in systems like the soekris where the clock_gettime sybmol
is available in external lib -lrt.

Let's avoid double-checking for the function twice, and simply define
HAVE_CLOCK_GETTIME when AC_SEARCH_LIBS succeeds (the success action is
guaranteed to be called even if there's no extra lib required).

Change-Id: Iced1e0542cee6beb9f08f5299aad49fab142cfb4
2020-05-01 16:51:26 +02:00
Pau Espin d87d6f1778 gsm_04_06.h: Remove repeated egprs header struct definitions
Each struct already contains different definition based on endianess, so
there's no reason to re-define all of them again based on endianess.
Probably at some point somebody run the script
./contrib/struct_endianess.py on those structures but forgot to remove
the old way of supporting differnet endianess.

Change-Id: Ibd002e52979950e09013767fa643b2a3c52dfea9
2020-04-28 12:13:08 +02:00
Kirill Zakharenko 459224a993 release 1.3.0-fw.2 2020-04-23 19:02:08 +03:00
Kirill Zakharenko 1405163e3d statsd: do not omit index==0 when sending stat item groups 2020-04-23 19:02:08 +03:00
Kirill Zakharenko fd26776526 release 1.3.0-fw.1 2020-04-23 19:02:08 +03:00
Kirill Zakharenko 8a23546fe4 WIP: gb: disable failing gprs-ns tests temporarily 2020-04-23 17:45:32 +03:00
Harald Welte 1f48b93999 gsm0503_parity: Fix compilation with gcc-10
/usr/bin/ld: .libs/gsm0503_coding.o:/home/laforge/projects/git/libosmocore/src/coding/../../include/osmocom/coding/gsm0503_parity.h:16: multiple definition of `gsm0503_mcs_crc12'; .libs/gsm0503_parity.o:/home/laforge/projects/git/libosmocore/src/coding/../../include/osmocom/coding/gsm0503_parity.h:16: first defined here

Change-Id: I15945bbf59c873e50154c40fed0ba3d6b4d7c399
2020-04-20 18:18:50 +02:00
Harald Welte 100e44ed49 timerfd: call osmo_fd_unregister() when closing on read error
Change-Id: I8513126286083ebf02d14043cf072c8297878dd7
2020-04-19 08:27:27 +00:00
Eric Wild 06747d5720 timer.c: make timers thread safe
This is implicitly used by the libosmocore select abstraction, which
might be used in multiple threads at the same time.

Change-Id: I5a3802c94af6ff0315f1553f20870342d51ce726
2020-04-19 02:21:05 +02:00
Harald Welte a70ac85f5b select.c: Introduce support for signalfd
The signalfd(2) mechanism of Linux allows signals to be delivered
and processed via normal file descriptor I/O.  This avoids any of the
usual problems about re-entrancy of signal processing, as signals can
be processed from the osmocom select() loop abstraction just like any
other event.

Change-Id: If8d89dd1f6989e1cd9b9367fad954d65f91ada30
2020-04-18 21:16:12 +02:00
Harald Welte f3cc731d40 exec: Introduce osmo_system_nowait2() to allow specify a user
For a process running as root, it may be desirable to drop privileges
down to a normal user  before executing an external command.  Let's
add a new API function for that.

Change-Id: If1431f930f72a8d6c1d102426874a11b7a2debd9
2020-04-18 15:06:59 +02:00
Pau Espin e7d0d70ce7 tests/coding_test: Fix test_pdtch() results
When switching the l2 structures passes to test_pdtch() to be constant,
it was noted that output of the test changes. This happens because same
array is tested several times with different length, incrementing each
time. Since the test was modifying the input array directly, it means
each new run of test_pdtch() the array was further modified.
Upon constifying the structures, we copy the array and hence only modify
the required bits each time.

Change-Id: Iffd0ca3669eb8d0d2e80d754fc8acbf72f1bebe8
2020-04-17 10:15:05 +00:00
Pau Espin ce28d2ebba tests/coding: Test decoding of DL EGPRS data packet
Change-Id: Ide23a484b980995f24092d1cfbf062aed58fdf61
2020-04-17 10:15:05 +00:00
Harald Welte e616cbad62 ports.h: Add 4268 for UECUPS VTY
Change-Id: I6c53654f06fac6b6b196be88178a918d38e91e46
2020-04-17 10:37:53 +02:00
Philipp Maier 898c9c6af8 dtx: add decoding for AMR-DTX frames
gsm0503_coding contains AMR decoder functions for HR and FR. Those can
only decode AMR payload frames but not amr DTX frames. Lets add
functionality to detect DTX frames. Also lets add decoding for SID_UPDATE
frames as well as error checking for the SID frame recognition patterns.

Related: OS#2978
Change-Id: I2bbdb39ea20461ca08b2e6f1a33532cb55cd5195
2020-04-14 13:22:44 +00:00
Eric Wild 099c8340ed configure.ac: fix libtool issue with clang and sanitizer
As pointed out at https://github.com/libexpat/libexpat/issues/312
libtool does not play nice with clang sanitizer builds at all.
For those builds LD shoud be set to clang too (and LDFLAGS needs the
sanitizer flags as well), because the clang compiler driver knows how
linking to the sanitizer libs works, but then at a later stage libtool
fails to actually produce the shared libraries and the build fails. This
is fixed by this patch.

Addtionally LD_LIBRARY_PATH has no effect on conftest runs during
configure time, so the rpath needs to be set to the asan library path to
ensure the configure run does not fail due to a missing asan library,
i.e.:

SANS='-fsanitize=memory -fsanitize-recover=all -shared-libsan'
export CC=clang-10
ASANPATH=$(dirname `$CC -print-file-name=libclang_rt.asan-x86_64.so`)
export LDFLAGS="-Wl,-rpath,$ASANPATH $SANS $LDFLAGS"

Change-Id: I8ebd9c6d4efda41c7c8196f963d1f04d65160754
2020-04-11 18:31:59 +00:00
Pau Espin d1cd527541 gsm0503_tables: Document USF encoding tables
Change-Id: I596c10960bd1ff1b1ec14ad953ce5e1ed040d35a
2020-04-07 13:26:59 +02:00
Pau Espin 63ebc368af gsm0503_coding: Fix USF encoding in MCS1-4
osmo-gsm-tester raised an ASan warning in osmo-bts-trx  during execution
of a test with EGPRS enabled and a modem connecting to it (see OS#4483
for full trace):
==12388==ERROR: AddressSanitizer: global-buffer-overflow on address 0x7fa20b9ab8d0 at pc 0x7fa20b982894 bp 0x7ffdfea8b9c0 sp 0x7ffdfea8b9b8
READ of size 1 at 0x7fa20b9ab8d0 thread T0
 #0 0x7fa20b982893 in gsm0503_mcs1_dl_interleave /home/osmocom-build/jenkins/workspace/osmo-gsm-tester_build-osmo-bts/libosmocore/src/coding/gsm0503_interleaving.c:165

Function gsm0503_mcs1_dl_interleave() was being passed the 6-bit USF
encoding while clrearly expecting a 12 element array. TS 05.03 5.1.5.1.2
"USF precoding" also clearly states that 12bit encoding is to be used
for MCS1-4.

Fixes: OS#4483
Change-Id: I94db14de770070b17894a9071aa14391d26e776c
2020-04-07 13:15:38 +02:00
Pau Espin f62f073c79 gsm0503_coding: Fix misleading comment UL vs DL
Change-Id: I563c60271e218f9953e26f9bf0304d442c6acd43
2020-04-07 13:12:21 +02:00
Vadim Yanitskiy 9e713f3828 coding: fix bit ordering in 11-bit RACH coding functions
According to 3GPP TS 44.004, figure 7.4a.b, the format of 11-bit
RACH uplink / Uplink access burst block is as defined follows:

  <---------------------------------------------------

      8     7     6     5     4     3     2     1
  +--------------------------------------------------+
  |  11 bit RACH uplink / Uplink access burst block  | OCT1
  +--------------------------------------------------+
                                 |                   | OCT2
                                 +-------------------+

As was (correctly) assumed in [1], the bit ordering in 11-bit RACH
coding functions is wrong. The problem is that neither of generic
functions from bit16gen.h can be used to load / store the RA11
value (regardless of the endianness), because they assume that
the payload is 16 bit long.

With this patch applied, RA11 values from [1] look correct:

  < EGPRS Packet channel request message content > ::=
    < Signalling : 110011  < RandomBits : 00111 > > |
    < Signalling : 110011  < RandomBits : 00110 > > |
    < Signalling : 110011  < RandomBits : 01111 > > |
    < Signalling : 110011  < RandomBits : 01100 > > |
    < Signalling : 110011  < RandomBits : 00111 > > |
    < Signalling : 110011  < RandomBits : 10110 > > ;

[1] Id80e471d252b9416217b56f4c8c0a8f5f1289fee

Change-Id: I43d30611dd69f77f2b3b46f4b56056a8891d3c24
Related: OS#1548
2020-04-01 01:09:31 +07:00
Vadim Yanitskiy 41ce6753bc tests/coding: add 11-bit Access Burst samples from a real phone
This change adds several soft-bit (-127 .. 127) sequences containing
EGPRS Packet Channel Request message (11-bit, payload only) sent by
an EGPRS capable phone, and captured on the BTS/PCU side using a
tool from the TRX Toolkit - trx_sniff.py.

As can be seen from the test output, none of decoded RA11 values
looks like a valid EGPRS Packet Channel Request message (see
table 11.2.5a.2 of 3GPP TS 44.060). All test sequences contain
the same message with several random bits:

  < EGPRS Packet channel request message content > ::=
      < Signalling : 110011  < RandomBits : bit (5) > >;

since the phone was trying to perform Attach Request. It seems
the bit order of decoded messages is somehow wrong.

Change-Id: Id80e471d252b9416217b56f4c8c0a8f5f1289fee
Related: OS#1548
2020-03-31 19:26:44 +07:00
Vadim Yanitskiy 8055cddbe2 coding: fix documentation of PDTCH encoding functions
Change-Id: Ia38723fb9424551eaf5747d736ae73ab20873def
2020-03-31 15:37:27 +07:00
Vadim Yanitskiy 88c61c3822 tests/coding: cosmetic: use ARRAY_SIZE() macro from utils.h
Change-Id: Ie6278d84d405f073669e607f978ca5b187bcf78e
2020-03-31 15:37:27 +07:00
Vadim Yanitskiy 0f4919e915 tests/coding: reduce verbosity of 8-bit / 11-bit RACH coding tests
We don't really need additional 1.4M of debug output, given that
we test every possible 8-bit and 11-bit RA value. It's enough
to print error message if the resulting value does not match.

Otherwise it's hard to read the expected output without commenting
the related log statements out. Note that it's still possible to
re-enable verbose debug output by defining DEBUG.

Change-Id: I0d5ed90cb0a2b3007d665520a73b0fa0b86a4099
2020-03-31 15:37:23 +07:00
Vadim Yanitskiy ca466cf5f6 tests/coding: check return value of encoding / decoding functions
Change-Id: I78850a4ab2fb7cd63bb4a3789f934634b6fb2cb7
2020-03-31 15:34:07 +07:00
Harald Welte 17051403bf osmo-sim-test: Avoid double-close
Change-Id: Ibd67a5461085a77dd9e804a4f1266d67ee91a04a
Closes: CID#208960
2020-03-22 11:26:24 +01:00
Harald Welte 2954aa9b8a sim: Add HPSIM application support
Change-Id: I883faae5e170803b8301d10c8b9fad7892da009c
2020-03-21 16:31:17 +01:00
Harald Welte e92f3628a8 card_fs_{usim,isim}: Update to 15.7.0 / Release 15
Various new files and some new status words have been defined
by now. Let's add them.

Change-Id: Ia007281bcb61dcd8260d0a77203abeff21d5255f
2020-03-21 16:31:17 +01:00
Harald Welte 58d173ade1 osmo-sim-test: Also [attempt to] dump DF.GSM on USIM cards
an USIM application can very well exist on a UICC without supporting
classic DF.GSM access.  However, most commonly, both are found on
cards.

Change-Id: I6180a3f81a7d3006e8ece4302c2433db2588bfaa
2020-03-21 16:31:17 +01:00
Harald Welte 429adecfd8 sim: re-structure how we support cards + applications
Before this change, a card application (USIM, ISIM, ...) didn't
exist as a separate concept from a card profile.  This meant,
we had a manual combination of UICC card profile with USIM application,
and another one of UICC card profile and ISIM application.  But what
if there's a combined USIM+ISIM?

In reality, applications exist as separate objects, on top of an
ETSI UICC.  Lets therefore register all known applications to the
osim library core, and add code to osmo-sim-test which dynamically
detects all applications present on a given card (by reading EF.DIR).

Change-Id: Ic4b4ac433a9976842b30a017fb0fc347d87201cd
2020-03-21 16:31:17 +01:00
Harald Welte bf90d747ad sim: add osim_file_desc_find_aid()
Change-Id: I80468c8c4f4590c262019f42285e8d8fd3444f7f
2020-03-21 16:31:17 +01:00
Harald Welte 870f94d0cc osmo-sim-test: Optionally dump card files to host filesystem
Using the new '--output-dir' command line argument, the user can
instruct osmo-sim-test to dump the file content to a local directory.

osmo-sim-test will create one sub-directory per DF, and create a
text file for each EF.  The contents of the text files are a hexdump
of the contents.  Transparent EF are dumped as one line of hex,
while linear fixed EF are dumped as one record per line, i.e. the
number of lines corresponds to the number of records.

Change-Id: I35176f4a13c3537eaa8de550e231818a22b4c07c
2020-03-21 16:31:10 +01:00
Harald Welte 8d934efbb9 osmo-sim-test: don't print SW in successful case of dump_file()
Change-Id: Ie5a58a89052400d76a8607a2e0063917385beb25
2020-03-21 16:24:53 +01:00
Harald Welte 835ed9644d osmo-sim-test: Use stderr for error messages
Change-Id: I8f36b07b8601af2b0d54d95c3c6374d6c54bafd1
2020-03-21 16:24:53 +01:00