aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2020-05-16release 1.3.0-fw.7fairwaves/1.3.0-fw.7fairwaves/productionKirill Zakharenko1-0/+6
Change-Id: I4c228c2c9858b984785ebecda52faa46bbfd7a5f
2020-05-16Merge fairwaves/ip-gb, fairwaves/gsm0808-confusion into masterKirill Zakharenko8-20/+158
Change-Id: I703b6feb546e60cbde19a86654a010e4b13e3706
2020-05-15libosmogsm: add Doxygen docs for gsm0502_hop_seq_gen()Harald Welte1-1/+10
This is basically I16d5190b3cdc997c5609b52d41203f10264b017c. Change-Id: Ife660f00d7a6d3b874ab2e59e34dca2109fa82d8 Related: OS#4546
2020-05-15libosmogsm: import hopping sequence generation codeSylvain Munaut3-0/+58
This implementation is taken from OsmocomBB, in particular from: target/firmware/layer1/rfch.c Change return type to uint16_t, because neither ARFCN, nor MAI can be negative. Add prefix 'gsm0502_' to the function's name. Change-Id: I8aba1578cc9d1bd89d4f5d33a6e8fedc8bea789a Related: OS#4546
2020-05-15cosmetic: apply changes to match struct_endianess.py outputNeels Hofmeyr3-14/+8
gsm48_pag_resp and gsm48_service_request: omit comments in big endian part. dtap_header: better segment the substruct. gsm23041_msg_param_gsm: match up whitespace / comments. Rationale: the script is a good way to avoid bugs from manually composing the big endian parts (for example, it detected the missing endian.h include, fixed in I593cc5e8272469b570559206bb02b6e79797340b). However, it becomes cumbersome if it creates numerous edits in the source tree, which cause more time spent for whoever wanted to rather save time with it. So let's keep the code tree matching that struct's output. Change-Id: I7432f5337d6589262c31f5186dfd0ac32221c467
2020-05-15struct_endianess.py: also recognise unnamed substructsNeels Hofmeyr1-1/+3
Before this, the new dtap_header substruct construct would end up being split up in a weird way: struct dtap_header { uint8_t type; union { uint8_t link_id; /* Backward compatibility */ struct { uint8_t dlci_cc:2, dlci_spare:3, dlci_sapi:3; /* enum gsm0406_dlc_sapi */ }; }; uint8_t length; } __attribute__((packed)); would previously become struct dtap_header { uint8_t type; union { uint8_t link_id; /* Backward compatibility */ struct { #if OSMO_IS_LITTLE_ENDIAN uint8_t dlci_cc:2, dlci_spare:3, dlci_sapi:3; /* enum gsm0406_dlc_sapi */ }; }; uint8_t length; #elif OSMO_IS_BIG_ENDIAN /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ uint8_t dlci_sapi:3, dlci_spare:3, dlci_cc:2; }; }; uint8_t length; #endif } __attribute__((packed)); now becomes struct dtap_header { uint8_t type; union { uint8_t link_id; /* Backward compatibility */ struct { #if OSMO_IS_LITTLE_ENDIAN uint8_t dlci_cc:2, dlci_spare:3, dlci_sapi:3; /* enum gsm0406_dlc_sapi */ #elif OSMO_IS_BIG_ENDIAN /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ uint8_t dlci_sapi:3, dlci_spare:3, dlci_cc:2; #endif }; }; uint8_t length; } __attribute__((packed)); Change-Id: I3c4986ebd1e41aad8b279d6132b7e3b2539d7dc5
2020-05-15add missing endian.h in gsm_23_041.hNeels Hofmeyr1-0/+2
Change-Id: I593cc5e8272469b570559206bb02b6e79797340b
2020-05-14gsm0808: Implement helper functions for CONFUSION BSSMAP message decoding.Alexander Chemeris6-0/+113
Also add a test for an actual CONFUSION message parsing. Change-Id: If8afd2d096fb66c6c2f255a08fc1129de3d09cec
2020-05-14codec: Add functions for AMR s->d bits and d->s bitsHarald Welte5-1/+165
These functions implement re-ordering of bits as per TS 06.90 / 26.101 based on the already existing tables we've had in libosmocoding. Change-Id: Ia4ac2aea2e96f9185f082a07ca64dfc5276efb46
2020-05-14libosmogsm: cosmetic: add spaces before and after PRIu32Vadim Yanitskiy1-1/+1
As was pointed out by pespin, some compilers may not like the lack of spaces around the format macro constants. Change-Id: I4b6517989030c8e3f6a1bf16c43044e4e9137f40
2020-05-14gsm0808_utils: Add gsm0808_get_cipher_reject_cause() back with a deprecation ↵Alexander Chemeris2-0/+8
notice. In Change-Id Idf2b99e9ef014eba26e3d4f0f38c2714d3a0520a we accidentially removed this symbol, let's re-introduce it. Change-Id: I9fbcbcc6619ef0c63d3682fc86adc80045baab02
2020-05-13WIP: gb: disable failing gprs-ns tests temporarilyfairwaves/ip-gbKirill Zakharenko1-5/+5
2020-05-13WIP: gb: Standard-compliant Static Gb over IPAlexander Chemeris1-15/+40
The current implementation of the Gb over IP in Osmocom is derived from the ip.access implementation of it, which is a "weird combination of Gb over FR and Gb over IP" in that it runs over UDP/IP but uses procedures like NS-RESET and NS-BLOCK which are only specified for Gb over FR. This makes it impossible to use OsmoPCU and OsmoGbProxy with standard SGSNs like from Huawei in "Static IP-GB" mode (i.e. without SNS procedure). This patch is a hack to remove NS-RESET procedure and use NS-ALIVE to setup an NS link and keep it open. One could argue that SNS is a much better way and should be used instead of the old "static" config but in pratical installations you do ant to use osmo-gb-proxy to aggregate multiple links and it doesn't support SNS yet. So using this hack is the easiest way to get multiple OsmoPCU's to connect to a standrd-compliant SGSN. NOTE: This patch is a quick hack and lacks any unit-testing or configuration. Change-Id: I1b1b28913488a40e4fceb65e646c3d89e8a431a4
2020-05-13gsm0808_utils: Fix gsm0808_cause_class() functionAlexander Chemeris1-1/+1
Cause class is in bits 5-7 of the cause value. For the cause value 0x52 old version returned 0xa instead of a correct 0x5. See section 3.2.2.5 Cause of TS 08.08 for the details. Change-Id: I46646740c5daaafe20123e709f26dd1d2c1b6f8d
2020-05-13gsm0808: Make a function to extract Cause IE publicly available.Alexander Chemeris6-19/+22
Function gsm0808_get_cipher_reject_cause() was previously available in private gsm0808_utils.h. In practice, the exact same code is useful to extract Cause IE value from any of the many other BSSMAP messages which use it. So let's rename it to gsm0808_get_cause() and make it avilable to everyone to use. Change-Id: Idf2b99e9ef014eba26e3d4f0f38c2714d3a0520a
2020-05-12gsm0505_amr_dtx: add missing value stringsPhilipp Maier2-5/+7
The value string array that explain the type of the AMR DTX / SID frames is incomplete, lets add the missing strings. Change-Id: If9e80b4bd8bdc31323c7c276155b2538e20a99be Related: OS#2978
2020-05-12logging: do not allow multiple calls of log_init()Philipp Maier1-0/+3
calling log_init() multiple times would lead into memory leaks. The function should only be called once on startup of the process. Lets make sure that it does not get called multiple times by accident. Change-Id: Ibb300e4c9b04767581116ab530b2e6a9a195db08
2020-05-12logging: use LOGL_NOTICE when no loglevel is setPhilipp Maier1-9/+17
when the API user of libosmocores logging infrastructure does not set a pre-defined logging level in struct log_info_cat, the result would be an invalid logging level. In order to avoid problems with that and to spare all the additional .loglevel = LOGL_NOTICE (API users are advised to use LOGL_NOTICE as default) lines in the user code lets check the logging level on startup and set LOGL_NOTICE if there is no logging level set. Change-Id: Ib9e180261505062505fc4605a98023910f76cde6 Related: OS#2577
2020-05-12gsm_04_08.h: fix big endian structsNeels Hofmeyr1-238/+0
Affected: - struct gsm48_range_1024 - struct gsm48_range_512 - struct gsm48_range_256 - struct gsm48_range_128 In commit [1], the automatic little-to-big-endian compatibility by struct_endianness.py introduced doubled little/big endian struct listings by accident, resulting in a wrong big endian structure (due to double reversal in the original big endian part). Remove the old conditionals around the new automatic ones to fix the structs for big endian. [1] Ia0b99d76932aeb03e93bd0c62d3bf025dec5f9d2 Change-Id: Iaccdd4a204841209f5eb50f336b30962ff00da0b
2020-05-12exec: osmo_system_nowait2: initalize *pw pointer with NULLPhilipp Maier1-1/+2
The pointer *pw is only populated when the the parameter *user is given, otherwise it remains uninitalized while it is used later when the previleges are being dropped. Change-Id: Idec7041e9ea17a252aefbf6fa90091ae17fd4fcd Fixes: CID#209895
2020-05-12usb: Add osmo_libusb_find_open_claim() all-in-one APIHarald Welte2-0/+126
This function offers the highest level of API among all libosmousb helper functions. It is intended as a one-stop shop for everything related to grabbing an interface. Change-Id: I748ded6cc7b73a73625588bd7a34a017a905b6bf
2020-05-12README.md: We don't build libosmotrau. The latter is in libosmo-abis.gitHarald Welte1-1/+0
Change-Id: Ida773c9611075cc02f017eb5606f94a65cac8533
2020-05-12README.md: fix typo (coore -> core)Harald Welte1-1/+1
Change-Id: Ib2bc61cfd9f24d2093b7e101e8987864a7279fb6
2020-05-12gsm0808: Fix encoding of the SAPI_N_REJECT BSSMAP message.Alexander Chemeris2-3/+3
See TS 08.08 section 3.2.1.34 SAPI "n" REJECT: 1) DLCI is a TV element, not V. 2) Cause is a TLV element and we have a special function to encode it. Change-Id: I033afe556c06427d06ac55c4f78854a45e41aae6
2020-05-11Drop old BSC references in fd check configure optionPau Espin Pedrol2-3/+3
Change-Id: I053c2bfe461aa82085e7dac1cdcc95dd77219949
2020-05-10statsd: fix rendering for groups with idx==0Kirill Zakharenko1-14/+6
while skipping `0` might be visually pleasant for non-repeating groups, e.g.: bsc.assignment.completed it makes metrics parsing very awkward for repeating groups, e.g.: bts.chreq.total bts.1.chreq.total bts.2.chreq.total and since nobody's going to look at raw statsd stream anyway, we can live with some extra zeroes Change-Id: Id294202fbcebe0b6b155c7f267b2da73af20adf4
2020-05-09stats: Change timer to timerfd to make it a true interval timer.Alexander Chemeris1-7/+37
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-09stats: Support regular stats flushAlexander Chemeris3-1/+59
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-09stats: Fix documentation for osmo_stats_set_interval()Alexander Chemeris1-2/+1
Change-Id: Ie07a03251d6fe9d40b62815feb51ec8af9ed7c95
2020-05-09stats: Move cfg_stats_interval_cmd() function.Alexander Chemeris1-18/+17
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-09select: Fix typo in a comment Osmcoom->OsmocomAlexander Chemeris1-1/+1
Change-Id: I6fb4d20d149abc724d477420b5eba482a0b63259
2020-05-05sim: When decoding SW, take application specific SW into accountHarald Welte4-21/+46
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-05rest_octets: fix encoding of 3G Early Classmark Sending RestrictionVadim Yanitskiy1-2/+2
Change-Id: I6df515a00518fabb3eb8f65054addd3aead14bfe Relates: OS#3075
2020-05-02gsm_29_118.h: Fix compilation with gcc-10Harald Welte1-1/+1
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-01configure.ac: Fix HAVE_CLOCK_GETTIME undef when func in -lrtPau Espin Pedrol1-2/+4
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-04-28gsm_04_06.h: Remove repeated egprs header struct definitionsPau Espin Pedrol1-153/+0
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-20gsm0503_parity: Fix compilation with gcc-10Harald Welte1-10/+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-19timerfd: call osmo_fd_unregister() when closing on read errorHarald Welte1-0/+1
Change-Id: I8513126286083ebf02d14043cf072c8297878dd7
2020-04-19timer.c: make timers thread safeEric1-3/+3
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-18select.c: Introduce support for signalfdHarald Welte3-1/+78
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-18exec: Introduce osmo_system_nowait2() to allow specify a userHarald Welte2-2/+49
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-17tests/coding_test: Fix test_pdtch() resultsPau Espin Pedrol2-29/+30
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-17tests/coding: Test decoding of DL EGPRS data packetPau Espin Pedrol2-28/+106
Change-Id: Ide23a484b980995f24092d1cfbf062aed58fdf61
2020-04-17ports.h: Add 4268 for UECUPS VTYHarald Welte1-0/+1
Change-Id: I6c53654f06fac6b6b196be88178a918d38e91e46
2020-04-14dtx: add decoding for AMR-DTX framesPhilipp Maier11-1/+702
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-11configure.ac: fix libtool issue with clang and sanitizerEric1-0/+5
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-07gsm0503_tables: Document USF encoding tablesPau Espin Pedrol1-0/+6
Change-Id: I596c10960bd1ff1b1ec14ad953ce5e1ed040d35a
2020-04-07gsm0503_coding: Fix USF encoding in MCS1-4Pau Espin Pedrol1-1/+1
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-07gsm0503_coding: Fix misleading comment UL vs DLPau Espin Pedrol1-1/+1
Change-Id: I563c60271e218f9953e26f9bf0304d442c6acd43
2020-04-01coding: fix bit ordering in 11-bit RACH coding functionsVadim Yanitskiy2-8/+9
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