summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* gsup: add OSMO_GSUP_SUPPORTED_RAT_TYPES_IE and OSMO_GSUP_CURRENT_RAT_TYPE_IENeels Hofmeyr2019-09-281-0/+35
| | | | | | | | | | | | | | OSMO_GSUP_SUPPORTED_RAT_TYPES_IE corresponds to the Supported RAT Types Indicator from 3GPP TS 29.002. See 8.1.2 MAP_UPDATE_LOCATION service, which indicates the capabilities of the MSC/VLR to the HLR. So far, have room for eight RAT types in the gsup_msg. That is an arbitrary random choice without any rationale. OSMO_GSUP_CURRENT_RAT_TYPE_IE is useful to communicate the currently used RAN / RAT type of the current subscriber during Location Updating Request. Change-Id: I93850710ab55a605bf61b95063a69682a2899bb1
* cosmetic: clarify c_iflag in osmo_serial_init()Harald Welte2019-09-281-1/+1
| | | | | | | We first set the ISTRIP bit only to remove it in the next line. Let's try to avoid confusing the reader. Change-Id: Icba43dd4b6dc4f9c7f8fcf91d24b3baac4e0c74a
* sim/class_tables: Fix typo in commentHarald Welte2019-09-281-1/+1
| | | | Change-Id: I837c8303a7bb47b690cc8841cf5cafba8ac338af
* tdef: fixup osmo_tdef_set()Neels Hofmeyr2019-09-111-8/+6
| | | | | | | | | | | | I missed code review, so here are my comments in form of a follow-up patch for Id56a1226d724a374f04231df85fe5b49ffd2c43c. - Fix 'as_unit' arg name to 'val_unit' as in the C file and API doc. - Explain rounding-up behavior of value conversion in API doc. - Use osmo_tdef_get_entry() instead of a loop. Related: OS#4190 Change-Id: Ia91c2f17e40fb9e79ffa5a7f28ce9c3605664402
* tdef: Introduce API osmo_tdef_set()Pau Espin Pedrol2019-09-071-0/+20
| | | | | | | | | This API is already useful for users willing to set a given timer to a given value. It will also contain code later that checks for value being inside valid range for that timer. Related: OS#4190 Change-Id: Id56a1226d724a374f04231df85fe5b49ffd2c43c
* Introduce BTS_FEAT_ETWS_PN for communicating ETWS PN capabilityHarald Welte2019-09-051-0/+1
| | | | | | | | | | As 3GPP doesn't specify how the BSC shall communicate ETWS Primary Notifications over Abis/RSL, we have to use a vendor-specific RSL message for this. And in order to know if the peer supports this feature, we introduces BTS_FEAT_ETWS_PN. Change-Id: I89c24a81ada6627694a9632e87485a61cbd3e680 Related: OS#4046, OS#4047
* gsm_08_58: Add vendor-specific Message Type for ETWS Primary WarningHarald Welte2019-09-051-0/+1
| | | | | Change-Id: I36fc2ffc22728887d1cb8768c7fcd9739a8ec0fc Related: OS#4046, OS#4047
* codec/ecu: Introduce new generic Error Concealment Unit abstractionHarald Welte2019-09-023-1/+170
| | | | | | | | | | | | | | | | | | | | We don't want to expose the details of a given ECU implementation to the user (e.g. osmo-bts), but have a generic abstraction layer where an ECU implementation can simply register a few call-back functions with the generic core. As the developer and copyright holder of the related code, I hereby state that any ECU implementation using 'struct osmo_ecu_ops' and registering with the 'osmo_ecu_register()' function shall not be considered as a derivative work under any applicable copyright law; the copyleft terms of GPLv2 shall hence not apply to any such ECU implementation. The intent of the above exception is to allow anyone to combine third party Error Concealment Unit implementations with libosmocore, including but not limited to such published by ETSI. Change-Id: I4d33c9c7c2d4c7462ff38a49c178b65accae1915
* MAXPATHLEN set if not definedRuben Undheim2019-09-022-0/+10
| | | | Change-Id: I1dce8ace228814b5a7246a00b31309ab9461d266
* cbsp: Fix decoding of WRITE-REPLACE payloadHarald Welte2019-09-011-2/+2
| | | | | | | The user length is the first IE *in* the fixed-length TV, make sure cbsp_dec_write_repl() respects that. Change-Id: I864cafac2466a89a4bd9644bc73363fff2babd03
* cbsp: Remove printf() statement from early development/debuggingHarald Welte2019-08-311-1/+0
| | | | Change-Id: I6916e2330e004f20a22f273147fa6288d18b5d0d
* cbsp: Fix endless loop iteration when decoding cell list IEsHarald Welte2019-08-312-4/+25
| | | | | | | | The CBSP code assumed that gsm0808_decode_cell_id_u() would return the number of bytes it has consumed/parsed. But it actually always returns '0', whcih makes us run in an endless loop :( Change-Id: I5758af4ec11a827d4b888a3a16c4ec22de90a7d6
* fix: vty crash by logging during VTY_CLOSED event handlingNeels Hofmeyr2019-08-301-3/+3
| | | | | | | | | | | | | | | | | | | | When a VTY closes, dispatch the VTY_CLOSED signal before tearing down the VTY buffer and fd. In particular this fixes: - a crash during telnet_close_client(), invoked by the VTY_CLOSED event, which logs to DLGLOBAL and uses vty->obuf that, so far, vty_close() had already unallocated earlier (OS#4164). - the logging about closing a telnet session so far logged: DLGLOBAL INFO Closing telnet connection r=NULL<->l=NULL By dispatching the VTY_CLOSED event while the fd is still valid, we instead get the actual connection IP address and port being closed: DLGLOBAL INFO Closing telnet connection r=127.0.0.1:36708<->l=127.0.0.1:4258 Related: OS#4164 Change-Id: I1d235cbfbfb9aaf411316642c7bcfac12106df44
* context: Add support for [per-thread] global talloc contextsHarald Welte2019-08-273-6/+88
| | | | | | | | | | Rather than having applications maintain their own talloc cotexts, let's offer some root talloc contexts in libosmocore. Let's also make them per thread right from the beginning. This will help some multi-threaded applications to use talloc in a thread-safe way. Change-Id: Iae39cd57274bf6753ecaf186f229e582b42662e3
* vty: Register logp cmd next to logging commandsPau Espin Pedrol2019-08-201-2/+3
| | | | | | | | This way it's easier by osmo_verify_transcript_vty.py to skip and avoid breaking existent test in osmo-hlr. Fixes: d0b3b9edac978c91bf84aa2537aa24426685b1fb Change-Id: Iab9423661e4f4eefca2e3d02b60a43f913ed92a3
* osmo_tdef_get(): allow passing -1 as default timeoutNeels Hofmeyr2019-08-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | The intention of osmo_tdef_get()'s val_if_not_present argument was to return a default timeout, or to optionally abort the program for missing timer definitions if the default timeout is < 0. This was the case in the original implementation of this API in osmo-bsc, but in the migration to libosmocore, the argument was by accident changed to an unsigned type. In consequence, the assertion in the implementation that was intended to abort the program seemed bogus to coverity, and was fixed by removal in I7a544d2d43b83135def296674f777e48fe5fd80a -- the wrong direction, as is obvious from the API doc for osmo_tdef_get(). Note that osmo-bsc master passes -1 in various places and expects the program-abort behavior that was missing from the libosmocore implementation. Change the val_if_not_present argument to a signed type, and revert removal of the assertion, so that passing -1 has the effect described in the API doc: program abort on missing timer definition. This bug was not detected because it is hard to write tests that expect a program abort to happen, hence no tests for this API feature exist. Related: OS#4152 Change-Id: Ie61c3c85069916336e6dbd91a2c16f7634816417
* add vty logp command to echo on all log targetsNeels Hofmeyr2019-08-131-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | When reading SUT logs resulting from TTCN3 runs, it can be hard to figure out which log section corresponds to which test code. Add a 'logp' command on VIEW and ENABLE nodes that simply echos an arbitrary message on log output, useful to set markers / explanations from the TTCN3 code, which then appear in all log outputs and can make it trivial to figure out which log section is interesting. logging_vty_test# logp lglobal notice This is the log message DLGLOBAL NOTICE This is the log message From TTCN3, could be used like this, e.g. in BSC_Tests.ttcn: private function f_logp(charstring log_msg) runs on MSC_ConnHdlr { // log on TTCN3 log output log(log_msg); // log in stderr log f_vty_transceive(BSCVTY, "logp lglobal notice " & log_msg); } ... f_logp("f_probe_for_handover(" & log_label & "): Ending the test: Handover Failure stops the procedure."); Change-Id: Ife5dc8999174c74e0d133729284fe526d6eaf8d9
* codec/ecu_fr: Mark input TCH frame as 'const' as we only read itHarald Welte2019-08-121-1/+1
| | | | Change-Id: I64c6d3dc08ff87b673ba6225f98546e86f91bcfd
* Bump version: 1.1.0.107-afce-dirty → 1.2.0Pau Espin Pedrol2019-08-066-7/+8
| | | | Change-Id: I05dd1f2725e05f856f1d27c9201a0005de101b8f
* osmo-release.sh: Drop whitespace after = when parsing LIBVERSIONPau Espin Pedrol2019-08-061-1/+1
| | | | | | | | | | As a result whitespace ended up in some variables and then command "expr" was not happy about it. It was spotted because src/coding/Makefile.am had some whitespacing. Since it's the only one, let's drop the whitespace there too to have similar line in all Makefile.am files. Change-Id: I33afef5e4ef9eb36de81274533f46598ba9a0edb
* Get rid of osmo_str_tolower() use inside libosmocore codePau Espin Pedrol2019-08-021-11/+13
| | | | | | | | | | | There's no real good reason for using that function (static buffer) instead of osmo_str_tolower_buf(local buffer), so let's use the later. In any case, we get rid of TLS variables in those places, which is a performance improvement. It will also allow later shrinking of those buffers if we decide to define maximum logging category and level name length. Change-Id: I2e99de1142020e4d80ef0a094e4e751f7903f5f9
* utils: share static buffer in osmo_str_to{lower,upper}()Pau Espin Pedrol2019-08-021-8/+8
| | | | | | | | | | | This way we get rid of extra 128 bytes in memory per thread created. It makes sense to share the buffer since it's same size and it doesn't make much sense to be using both osmo_str_tolower and osmo_strtoupper at the same time (usually you either want to move everything to uppercase or everything to lowerase). In required scenarios, one can still use the _buf versions. Change-Id: I032803faa0e27c2efdff1ff276acabab95a8319a
* pseudotalloc: Simplistic wrapper of talloc_named()Harald Welte2019-07-312-0/+6
| | | | | | | | The pseudotalloc layer doesn't yet support talloc_named() API which will be used by the upcoming "context" change. Let's add this function to pseudotalloc.c for our arm-non-eabi builds. Change-Id: I4d91ebd73a3357a17ef9143a1b41b90186d4c128
* avoid gcc format error on embedded buildsHarald Welte2019-07-311-1/+1
| | | | | | | | | | | | | when using gcc 8.3.0 on Debian unstable and doing an embedded build, I'm getting the following error: > fsm.c:621:40: error: format '%ld' expects argument of type > 'long int', but argument 6 has type 'time_t {aka long long int}' > [-Werror=format=] Let's avoid that... Change-Id: I92fb9b08def8475739f0dc6316de43b166f48ac3
* vty/vty.c: the command buffer can be accessed directlyVadim Yanitskiy2019-07-301-7/+7
| | | | Change-Id: Ic6d7d68e9a559a6fb5bd6eaf6eccceae51e7ed39
* vty/vty.c: fix vty_read(): prevent further heap-buffer overrunVadim Yanitskiy2019-07-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After reading data from the socket, assigned to a given VTY, we need to '\0'-terminate the received string. Otherwise, further access to that string, stored in a heap buffer vty->buf, would lead to a heap overrun. == How to reproduce? $ python -c "print 'A' * 512" | telnet $HOST $PORT ==21264==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6190000211e0 at pc 0x000000435d2f bp 0x7ffc06c7add0 sp 0x7ffc06c7a578 READ of size 1025 at 0x6190000211e0 thread T0 #0 0x435d2e in __interceptor_strlen (/usr/local/bin/osmo-msc+0x435d2e) #1 0x7fb95bfa5624 in talloc_strdup (/usr/lib/x86_64-linux-gnu/libtalloc.so.2+0x6624) #2 0x7fb95c1be2bc in vty_hist_add /opt/osmocom/libosmocore/src/vty/vty.c:578 #3 0x7fb95c1be2bc in vty_execute /opt/osmocom/libosmocore/src/vty/vty.c:703 #4 0x7fb95c1be2bc in vty_read /opt/osmocom/libosmocore/src/vty/vty.c:1425 #5 0x7fb95c1bfd78 in client_data /opt/osmocom/libosmocore/src/vty/telnet_interface.c:157 #6 0x7fb95b90bd33 in osmo_fd_disp_fds /opt/osmocom/libosmocore/src/select.c:223 #7 0x7fb95b90bd33 in osmo_select_main /opt/osmocom/libosmocore/src/select.c:263 #8 0x5006cc in main /opt/osmocom/osmo-msc/src/osmo-msc/msc_main.c:723:3 #9 0x7fb959935f44 in __libc_start_main /build/eglibc-xkFqqE/eglibc-2.19/csu/libc-start.c:287 #10 0x4226fb in _start (/usr/local/bin/osmo-msc+0x4226fb) == Why exactly 512? Because the initial size of the heap buffer is 512 (see VTY_BUFSIZ). Later on it can be realloc()ated, so X > 512 should also work. Found using AddressSanitizer and Radamsa [1] fuzzer. [1] https://gitlab.com/akihe/radamsa Change-Id: I82f774ad18d0e555eb8f3590a519946d9c583c78
* vty/telnet_interface.c: log connection accept() / close() eventsVadim Yanitskiy2019-07-301-0/+12
| | | | | | | | | | | | | | Unfortunately, osmo_sock_get_name_buf() fails in telnet_close_client(): DLGLOBAL INFO telnet_interface.c:130 Closing telnet connection <error-in-getsockname> because getsockname(), getpeername(), and even close() fail with: "Bad file descriptor". This looks like a bug of the existing code. Change-Id: I77b31abfa159d2f269deaa5a08d94b7bbba7d23c
* vty/logging_vty.c: fix writing of 'print category-hex'Vadim Yanitskiy2019-07-301-0/+2
| | | | Change-Id: I33837f0fac1afe83596fa600916abc05ecb8c356
* vty/telnet_interface.c: avoid unneeded initializationVadim Yanitskiy2019-07-271-1/+1
| | | | | | | | Unconditional initialization follows the structure definition, so there is no need to do it twice. This prevents compiler from warning about potential errors. Change-Id: If9fd2826f132dfa203dda62940d93dbdfcfd92ac
* vty/telnet_interface.c: use DLGLOBAL logging sub-systemVadim Yanitskiy2019-07-271-2/+2
| | | | Change-Id: I1564f4714a33d36792e4982deb8f19d1b740dc0c
* gsm/gsm48.h: drop meaningless 'const' from gsm48_mi_to_string()Vadim Yanitskiy2019-07-261-2/+1
| | | | Change-Id: I5eb17edadf89ac47b4ca86c9e822037f7c0e518e
* stats_vty: Add verb to sentence for show asciidoc countersDaniel Willmann2019-07-251-1/+1
| | | | Change-Id: Ib444383d2074ddb89b3fe5bbf198bcbfabd7057f
* tell ubsan to ignore SUN_LENEric Wild2019-07-211-0/+3
| | | | | | | | | | | | | ubsan will report undefined behavior due to the SUN_LEN macros interaction with a null pointer, so let's tell ubsan to ignore this function. After carefully reviewing the final publically availlable drafts of the C99,C11 and C18 standards I can confirm that dereferencing null pointers is still undefined behavior, as such ubsan will always warn with absolutely every existing compiler version. Since the sanitizers are periodically synced between llvm and gcc I'm also fairly confident that rebuilding everything with compiler_rt to use the integrated sanitizers would result in the same message. I sincerly hope that this explanation provides to be sufficient, If not I'd be willing to show up at the next llvm dev meeting to provide quotes from actual sanitizer developers to back up these claims. Change-Id: I0ff445072f1b46390c9f70b21d61c789e39358d5
* gsm/gsm0480.c: use DLGLOBAL and LOGL_ERROR for loggingVadim Yanitskiy2019-07-211-13/+13
| | | | Change-Id: Id38272ff93fae6d2fdf39df4ffc74856d6c9a898
* gsm/gsm0480.c: parse_ss(): drop needless debug printVadim Yanitskiy2019-07-211-2/+0
| | | | Change-Id: Ie18c291d0cfe3b246d09ac6cfd9591951a2984c8
* osmo_get_rand_id(): Avoid dead code by proper #if/#else/#endifHarald Welte2019-07-211-1/+2
| | | | | Change-Id: I34e465dead179487f7d4508e0e6ecf0e838c6eb7 Closes: CID#177910
* tdef: remove bogus OSMO_ASSERT(unsigned long >= 0)Harald Welte2019-07-211-1/+0
| | | | | Change-Id: I7a544d2d43b83135def296674f777e48fe5fd80a Closes: CID#190866
* cbsp.c: Remove dead codeHarald Welte2019-07-211-3/+1
| | | | | Change-Id: I0888fbad0f9094ec1b31e2cceecfc9cd372399bd Closes: CID#202057
* cbsp: Introduce osmo_cbsp_errstrHarald Welte2019-07-202-28/+100
| | | | | | | | | | | | | | Rather than having the encoder/decoder library print some log messages in case of encoding/decoding errors, let's provide something akin to 'errno', but with a string instead of a numeric error code. The 'osmo_cbsp_errstr' global variable (if set) contains a human-readable string describing the most recent encoding/decoding error. It exists separately for each thread and hence can be used safely in multi-threaded environments. Change-Id: Id9a5a595a76ba278647aee9470ded213d8464103
* CBSP (Cell Broadcast Service Protocol; 3GPP TS 48.049) supportHarald Welte2019-07-204-1/+1532
| | | | | | | | | | This introduces definitions as well as a parser+encoder for the Cell Broadcast Service Protocol (CBSP) as specified in 3GPP TS 48.049. CBSP is used on the interface between CBC and BSC. Related: OS#3537 Change-Id: I5b7ae08f67e415967b60ac4b824db9e22ca00935
* bitvec/bitval2mask(): cosmetic: get rid of temporary int variableVadim Yanitskiy2019-07-181-11/+4
| | | | Change-Id: I9d6f6b66c99c43107d1ad3e80af332e967bb19e8
* osmo_gsm48_rest_octets_si3_decode(): fix copy-paste error in commentVadim Yanitskiy2019-07-181-1/+1
| | | | Change-Id: I57a330e16cc2910597672e1b27cf971499cea5bc
* utils.h: require a semi colon after OSMO_ASSERTAlexander Couzens2019-07-081-3/+3
| | | | | | | | | When using `OSMO_ASSERT(exp);` clang will warn about an empty expression because the semi colon was superflous. Use do {} while (0) to enfore the need of a semi colon. This might break other test. Change-Id: I2272d29a81496164bebd1696a694383a28a86434
* vty: Simplify char escaping in asciidoc outputPau Espin Pedrol2019-06-251-9/+4
| | | | Change-Id: I7df6858bb98abffc1d5bf420f991ae5854b24638
* gsm: lapd_core: Log timeout used upon start of T200Pau Espin Pedrol2019-06-211-1/+2
| | | | | | | | The timeout is calculated dynamically in t200_by_lchan() based on FN advance value estimated by bts_get_avg_fn_advance(), so it's informative to have the final value printed out. Change-Id: Ib50a9c23de881c66c9218833703cc41101e06bfd
* vty: Remove trailing whitespace in output from show asciidocPau Espin Pedrol2019-06-191-2/+2
| | | | Change-Id: Ifb3115c7488fbcf082cc9b92abc25cf7c46064e0
* bitvec: correct comment in bitvec_allocAlexander Couzens2019-06-171-1/+1
| | | | | | The function allocates x bytes not bits for the vector. Change-Id: I60fbe9fe9acd11c5d3232207f1bb677e8a98625f
* Revert "fsm.c: Print error message for FSM with allstate_action but no events"Vadim Yanitskiy2019-06-161-11/+0
| | | | | | | | | This reverts commit b3f94eb39e19366c3458643ee329a73155d46ff8, that unfortunately breaks some projects which call osmo_fsm_register() on DSO load (i.e. using __attribute__((constructor))) before the logging is initialized. Change-Id: Idc6fcce7e946c23d48589b920e309d60aa7b6645
* fsm.c: Print error message for FSM with allstate_action but no eventsHarald Welte2019-06-151-0/+11
| | | | | | | | | | As suggested by Vadim while reviewing a related fix for ipa_keepalive.c in libosmo-abis (see https://gerrit.osmocom.org/#/c/libosmo-abis/+/13540/), it makes sense to print an error message if anyone registers a FSM that specifies an allstate_action callback but at the same time no events that would ever end up in that callback. Change-Id: I9e73f7363ab15a00843e3f0d1e5776f4be7ebc46
* vty: command.c: Fix: single-choice optional args are no longer passed ↵Pau Espin Pedrol2019-06-141-5/+14
| | | | | | | | | | | incomplete to vty func For instance, take command "single0 [one]": If user executes "single0 on", VTY func will receive argv[0]="one" instead of argv[0]="on". Related: OS#4045 Change-Id: I5f4e2d16c62a2d22717989c6acc77450957168cb