aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2018-02-27core/logging.h: Add logging category for jitter bufferPau Espin Pedrol2-1/+7
Forthcoming jitter buffer code in libosmo-netif will make use of it. Change-Id: I2434f9dfa401f736bc62a2ddce920e587cd8c517
2018-02-27l1sap: Add fields for higher-precision timing offset valuesHarald Welte1-2/+8
So far, we used quarter-bits across the L1SAP between the hardware/PHY specific part of OsmoBTS and the common part. In order to increase the resolution, let's add fields/members for 1/256th bit. In order to keep ABI and API compatibility, we use a union around the old and new values, so old code will still compile + work withe new libosmocore. Change-Id: Ibb58113c2819fe2d6d23ecbcfb8b3fce4055025d
2018-02-27l1sap: Add RSSI, BER and quarter-bit accurate timing to PH-RACH.indHarald Welte1-0/+4
Let's extend PH-RACH.ind with some useful data across the L1SAP boundary. Change-Id: I9439810c3a3ad89ea0302753617b850749af887c Related: OS#3003
2018-02-27core: Add timespec helper macros and make timer_compat.h publicPau Espin Pedrol2-1/+45
If a monotonic clock must be used, then the clock_gettime API is used which uses timespec structures. Linux systems by default don't provide helpers to calculate time using timespecs, so let's add them here. Let's also make this header public so these helpers can be used in other projects using libosmocore (expected user: libosmo-netif). Change-Id: I45fc993b9bb0a343763238bf463c8640f47b00f1
2018-02-26ensure VTY commands don't segfault if an FSM has no event namesStefan Sperling1-4/+8
If no event names are defined for an FSM, show a placeholder message which points out the problem instead of segfaulting. Change-Id: I87457945a7b76aa052305c9c531722be1ea0c1d1 Related: OS#3007
2018-02-26print BIG FAT ERROR message if osmo_fsm lacks event namesStefan Sperling3-4/+13
Event names are displayed in VTY commands so all FSM should have them. Print an error message if an FSM is registered without event names. We could also return an error code, however at present no caller checks the return value of osmo_fsm_register() so this would be pointless. Add event names to the test FSM and update expected output accordingly. Change-Id: I08b100d62b5c50bf025ef87d31ea39072539cf37 Related: OS#3008
2018-02-26coding: Add BER-reporting RACH decode functionsHarald Welte4-8/+54
For all other decode operations we report the BER, but not for the RACH. This results in osmo-bts-trx not being able to report BER to the higher layers, which is possible on other BTS backends. Let's close this gap by introducing gsm0503_rach_ext_decode_ber() and gsm0503_rach_decode_ber() with the usual n_errors / n_bits_total arguments. Change-Id: I2b1926a37bde860dcfeb0d613eb55a71271928c5
2018-02-24rate_ctr: Add rate_ctr_inc2() as convenience wrapperHarald Welte1-0/+9
rate_ctr_inc2() is slightly easier to use than the old rate_ctr_inc() variant. Change-Id: Ie00706be201c32ec2981ea38b70354ed85e1aefd
2018-02-23ensure that osmo_fsm vty commands are only installed onceStefan Sperling1-0/+12
There is a desire to install osmo_fsm vty commands automatically in a library context, rather than requiring every application which directly or indirectly uses osmo_fsm to run osmo_fsm_vty_add_cmd(). However, the function install_element_ve() asserts that elements about to be installed have not already been installed. This means we cannot shift responsibility into a library context without first making sure that osmo_fsm commands are only installed once per combined application+library context, because applications won't know which commands any of its libraries has already installed. A simple solution is to use a global flag which is checked by osmo_fsm_vty_add_cmd() before installing osmo_fsm commands, and is set once the commands have been installed. This way, no harm is done if osmo_fsm_vty_add_cmd() is called multiple times. Change-Id: I10b0b1c1c1bf44c3b8eafc465c1ee06ea2590682 Related: OS#2967
2018-02-22Revert "Add function to encode classmark"Harald Welte3-18/+0
This breaks all existing / older osmocom-bb builds, and hence cannot be accpeted. See also https://gerrit.osmocom.org/#/c/6679 Related: OS#2985 This reverts commit 3c38e60cd55814a7b4c34f22e0b2e6e671f883c4. Change-Id: Icfc52ca4e5cbe3a444d98037d27fa101e3614e06
2018-02-22ports.h: Add VTY and CTRL ports for osmo-trxPau Espin Pedrol2-0/+5
Change-Id: Ib79cdb62d45d8c78445c7b064e58eb7e9faeccf9
2018-02-22gsm0408_test: also test gsm48_generate_lai() and gsm48_decode_lai()Neels Hofmeyr2-0/+53
Change-Id: Idd6cee090464bc92b654332904a9a08edf16e5c9
2018-02-22gsm0408_test: RA test: include min/max value casesNeels Hofmeyr2-0/+22
(Preparation for adding 3-digit MNC) Change-Id: Ifbc167de0cc039858112677b8d0cd14a2c8af086
2018-02-22gsm0408_test: include BCD and leading zeros in test outputNeels Hofmeyr2-5/+8
(Preparation for adding 3-digit MNC) Change-Id: I7f8ae05fa3e4a6fc004212757b05ca8a14c9ef45
2018-02-20gsm0408_test: cosmetically re-order MCC to come before MNCNeels Hofmeyr2-7/+7
For consistency in human readability, MCC simply should come first, always. Change-Id: Idb86a7088fac4d8a8c41190ab46f9801635f4eee
2018-02-20cosmetic: gsm0408_test: RA test cases as array-of-structNeels Hofmeyr1-8/+12
(Preparation for adding 3-digit MNC) Change-Id: Ic6c645ebf82d5f8d9d51c4c4cc804a0172008156
2018-02-19contrib/jenkins_arch.sh: Fix script comparison and arm supportDaniel Willmann1-3/+3
Change-Id: Ic53a675963cae328b296b4abaed9524451153271
2018-02-19fsm: allow graceful exit on FSM terminationPhilipp Maier3-2/+16
The function _osmo_fsm_inst_term() terminates all child FSMs befor it calls fi->fsm_cleanup(). This prevents the cleanup callback to perform last actions on the child FSMs (e.g. osmo_fsm_inst_unlink_parent()). - Since moving the cleanup callack to the beginning of the function would alter the termination behavior and possibly cause malfunction in already existing implementation that use OSMO fsm, a new optional callback that is called immediately at the beginning of the terminatopn process is added. Change-Id: I0fdda9fe994753f975a658c0f3fb3615949cc8bb Closes: OS#2915
2018-02-16memleak: _gsmtap_raw_output(): free msg in case of vsnprintf failureNeels Hofmeyr1-1/+3
Don't just return, free the allocated msg first. Change-Id: I51431ae7baca33ce5bab085cc3efe25f1a10b6d1
2018-02-16memleak: fix all libosmocore callers of gsmtap_sendmsg() to free on failureNeels Hofmeyr2-2/+8
gsmtap_sendmsg() does not free the msgb if it returns a failure rc, so the callers must check the rc and free the msg. Change-Id: I7cf64ed9b14247298ed8b4ab8735627f8235a499
2018-02-16memleak: gsmtap_sendmsg(): don't return 0 when no data was writtenNeels Hofmeyr1-1/+1
If less than the msgb size was written by write(), we want to return -EIO. Hence do not return zero when write() wrote zero bytes, return -EIO in that case as well. Previously, if write() returned zero, gsmtap_sendmsg() would return zero *without* freeing the msg, hence neither would the (ideal) caller. So this fixes a corner-case memleak. Change-Id: I099ae1c663c018da5db884f7e9d52c45af3ed817
2018-02-16gsmtap_sendmsg(): clarify API doc concerning msgb ownershipNeels Hofmeyr1-0/+3
Not freeing on error does enable callers to try to re-send as well, so it is a kind of useful feature, even though I find it likely for callers to either forget about freeing the msg on error or double-free by accident... I considered changing gsmtap_sendmsg() to always free, but since it is public API, I chose to keep and document its current behavior properly instead. We don't know what callers may exist out there. Change-Id: Id3266ce36442024f16eaf6afa3f516d201930c41
2018-02-15fsm: Add a function to change the FSM instance ID laterDaniel Willmann2-6/+27
Sometimes we want to create an FSM instance before we know its name. In that case we should be able to update the id later. Change-Id: Ic216e5b11d4440f8e106a297714f4f06c1152945
2018-02-15Add function to encode classmarkMax3-0/+18
The code is based on Osmocom-BB implementation. Change-Id: I78f6968edaa3ed535673411fb2a80060a472290f
2018-02-15Add generic Mobile Identity encoderMax3-14/+19
Add generic function which allows caller to set Mobile Identity explicitly. This allows to use IMEI or IMEISV for example. Make gsm48_generate_mid_from_imsi() into wrapper around new function. Change-Id: Id79be7abfff75ecd0d248bbeed93e605abeec9b3
2018-02-15Add test for gsm48_generate_mid_from_imsi()Max2-0/+14
Change-Id: Ibe5c0831268c788ceecd10fd7b22ece6480da817
2018-02-14talloc_ctx_vty: Fix help strings (missing \n at end of line)Harald Welte1-3/+3
This was causing build failures in applications using this library feature: Documentation error (missing docs): <command id='show talloc-context (application|all) (full|brief|DEPTH) tree ADDRESS'> <param name='ADDRESS' doc='(null)' /> Documentation error (missing docs): <command id='show talloc-context (application|all) (full|brief|DEPTH) filter REGEXP'> <param name='REGEXP' doc='(null)' /> Documentation error (missing docs): <command id='show talloc-context (application|all) (full|brief|DEPTH) tree ADDRESS'> <param name='ADDRESS' doc='(null)' /> Documentation error (missing docs): <command id='show talloc-context (application|all) (full|brief|DEPTH) filter REGEXP'> <param name='REGEXP' doc='(null)' /> Change-Id: I785c852e3313d20eade79746a7cd485d2d5908ea
2018-02-14build: Ensure all .pc files are installedMartin Hauke1-1/+1
Change-Id: I824e63087021adfda81bd0f867a3fdb5e9efcf7a
2018-02-14gsmtap.h: define TETRA DMO mode channelsallesklar21-0/+5
Change-Id: I98976c0ff16a69b2508a79259ed1aeaec51e7549
2018-02-13Add helper functions for ACC bit flags in rach control IE.Stefan Sperling1-2/+43
Add inline functions to manipulate and query ACC flag bits in the rach_control.t2 and rach_control.t3 octets. These function definitions also serve as documentation of the purpose of rach_control.t2/t3. Change-Id: I8f0a65c2980f86eb5c43f3bebe727f4d4d973163 Related: OS#2591
2018-02-09Add GSM 04.08 type-of-number / numbering-plan-id definitionsHarald Welte1-0/+22
Change-Id: Idd8d8a7a1c7f0b6cb9318e4f19ebadb415df2ed1
2018-02-09debian/control: Fix Vcs-Browser URLHarald Welte1-1/+1
Change-Id: I89bff8fcb8e0b7c0a0e415d4eee1636c21b8f8de
2018-02-09osmo_msgbdump_{l2,l3}(): Proper typecastHarald Welte1-2/+2
This avoids compiler warnings like /tmp/work/sysmobts_v2-poky-linux-gnueabi/osmo-pcu/0.4+gitAUTOINC+4c112dc5a6-r1.18/recipe-sysroot/usr/include/osmocom/core/msgb.h: In function 'const char* msgb_hexdump_l2(const msgb*)': error: invalid conversion from 'void*' to 'const unsigned char*' [-fpermissive] return osmo_hexdump(msgb_l2(msg), msgb_l2len(msg)); which we've been getting in osmo-pcu builds on some platforms. Change-Id: I0ec652a1a569ec1507d8411cf1ef87afabcca799
2018-02-09Revert "fsm: do not terminate child FSMs early"Harald Welte1-4/+3
This reverts commit 5ec91980ac2224aa1e9bf070a0e382d0d8c2b729. More or less like I expected, it creates fall-out. osmo-msc master builds are failing, as are the open build service builds. The patch has therefor *not* been sufficiently tested. Change-Id: I8d961d7bbd91b6a8d7691f24cb67720c3d001c7e
2018-02-09Revert "Use python 3 for utilities"Harald Welte3-3/+3
This reverts commit 76c6c50405c6cbb1d08bdd7b5d27c657fa5d38b6, which broke the obs builds. I'm really starting to get annoyed by ongoing python related breakage without ever fixing any bugs! Change-Id: I4d76e897d4f746ff9ea4e06f2efc708a12cc2944
2018-02-09fsm: do not terminate child FSMs earlyPhilipp Maier1-3/+4
The function _osmo_fsm_inst_term() terminates all child FSMs befor it calls fi->fsm_cleanup(). This prevnts the cleanup callback to perform last actions on the child FSMs (e.g. osmo_fsm_inst_unlink_parent()). move the function call to _osmo_fsm_inst_term_children() below the call to fi->fsm->cleanup(). Change-Id: Ie89d435417306c6bf897274eabc3ed0a46485c26
2018-02-09msgb: Add msgb_hexdump_{l2,l3}() to dump l2 or l3 part of message bufferHarald Welte1-0/+14
Change-Id: I98e85397fb541ee0fd711f2e1852f63f3bb87359
2018-02-09tlv_parser: Report *first* occurrence of repeated IEsHarald Welte1-2/+7
Most GSM related specifications require the receiver to use the *first* occurrence of repeated IEs. The Osmocom TLV parser so far did the opposite: It reported only the *last* occurrence in case of repeated IEs. Let's change our implementation to be more in-line with relevant specs, such as 3GPP TS 24.008 8.6.3. Change-Id: Icde09e075f68c842a7a96cf7160c8e44b77cf82d
2018-02-08tests: utils_test: Fix test failure when compiling with -O0Pau Espin Pedrol1-0/+1
It seems with default flags in_buf was being memzeroed by the compiler. When compiling with -O0, that's not the case anymore and printf prints after first 16 bytes, printing extra garbage which doesn't match the expected output. Change-Id: I736c1e4d625f647d3bb794fa717256e9dbf36e87
2018-02-08tests: coding_test: Fix compilation with -O0Pau Espin Pedrol1-2/+2
inline keyword is a hint for the compiler to inline the function, but it's not mandatory. If no static or extern is specified, the definition is only visible in the current unit but the identifier still has external linkage. When running with -O0 it seems the compiler (gcc 7.2.1) decides to use the external linkage but at the same time it seems it's not generating the function symbol. Fix it by explicitly stating that we want to use static linking for this function. coding/coding_test.o: In function `test_xcch': libosmocore/tests/coding/coding_test.c:86: undefined reference to `dump_ubits' libosmocore/tests/coding/coding_test.c:87: undefined reference to `dump_sbits' Change-Id: I18018adec05ce1c2ddbca38653311d74c7454ce8
2018-02-08Use python 3 for utilitiesMax3-3/+3
There're no python2-specific code in there so we can switch right away without waiting till 2020 for python 2 deprecation. Related: OS#2819 Change-Id: I8d34aed124b00c5dd2ab1bcc84bbfa8c620282cc
2018-02-06vty: fix 'logging print file' outputNeels Hofmeyr1-8/+11
In If1bd79026a3c680ccf7587d545d12f7759a998fc, an erratic logging output crept in for an earlier patch state and was merged by accident; fix 'logging print file (0|1|basename)' output. Add value string to map LOG_FILENAME_* enum to VTY args, use for both command evaluation as well as printing the vty config. The default is 'logging print file 1', hence we could omit an output when '1' is chosen. But for clarity, always output the current setting. Change-Id: I1c931bff1f1723aa82bead9dfe548e4cc5b685e0
2018-02-05GSUP: change osmo_gsup_encode() return typeMax3-6/+13
* match return type of osmo_gsup_encode() with osmo_gsup_decode() to allow propagating error to caller * check return value of osmo_gsup_encode() in GSUP test * return errors instead of braking app with aseert Change-Id: Idaa1deecb6d9e15329bd51867b4f6a03357461f0 Related: OS#2864
2018-02-05utils: add helper wrapper for osmo_strlcpy()Max2-4/+6
Add wrapper for osmo_strlcpy() which uses sizeof() to automatically determine buffer's size and use it for GSMTAP logging. This is pretty common use case for osmo_strlcpy() so it's a good idea to save some typing by using generic define. Related: OS#2864 Change-Id: I03d0d3d32a8d572ad573d03c603e14cdc27a3f7b
2018-02-03gsm48_hdr_msg_type(): SS is in the same group as MM/CCHarald Welte1-1/+1
Change-Id: I1ddadeacced9650885f454b81f3f0df531ea1e5d
2018-02-03gsm48_hdr_msg_type[_r99]: Fix bit-masksHarald Welte1-2/+2
TS 24.007 is quite clear: The upper two bits of the message type octet are *not* part of the message type in any of the L3 protocols which implement sequence numbers. it doesn't matter if it's R98 or R99, or whether the sequence number is 1bit or 2bits wide. Related: OS#2908 Change-Id: Iec875a77f5458322dfbef174f5abfc0e8c09d464
2018-01-27gsm_04_08.h: Reduce T310 default to 30s.Harald Welte1-1/+1
3GPP doesn't specify a network-side T310 default, but waiting for 180s (3 minutes!) for the next message after CALL CONFIRMED is clearly way too long and will just use radio resources for no good reason. Change-Id: Ia52f9358bc86b23c72af9c80e2fff5cb0004b57a Related: OS#2884
2018-01-27gsm_04_08.h: Clearly annotate timers that don't have a 3GPP Default valueHarald Welte1-7/+7
Change-Id: I44fffaec1f7c0d819aa2ebc85e97f19581fc689c
2018-01-24SMS: Add value_string for TS 04.11 CP and RP stateHarald Welte5-0/+27
Change-Id: I1b2f6fc6f455b0ba2a5732c567a4867bca97c3b0
2018-01-24gsm48_pdisc_names: Use conscise, short namesHarald Welte1-15/+15
Some times I *really* regret ever having merged OSMO_VALUE_STRING, as it generates completely unusable and way too long strings :( Change-Id: I8de7c01f9ea1d66c384e57449c4140186f5ce6c5