AgeCommit message (Collapse)AuthorFilesLines
2020-03-03wipneels/miscNeels Hofmeyr1-36/+87
Change-Id: I16e229992c00e161d7596e35cc6e6212e564e9fe
2020-03-03add contrib/new_fsm.pyNeels Hofmeyr1-0/+208
Change-Id: I7781008dffc49dc9a279fa066ad2e0bb7da25dfe
2020-03-03add contrib/ladder_to_msc.pyNeels Hofmeyr3-0/+464
Typing mscgen diagrams, I am hugely annoyed by having to type '[label="..."]' all the time. Also, IMHO the arrows have been chosen in an unintuitive way: in mscgen, '=>>' is the normal arrow, and '->' is a half-headed arrow, etc. I would like to use other arrow symbols. Hence, add script to convert my personal favorite ascii format for message sequence charts to mscgen format. See an example in ladder_to_msc_test.ladder. Change-Id: Iefac4cb91b82c93a64b4999afa62e299479913af
2020-03-03NOT FOR MERGE always set cyclic logging colors in osmo_init_logging2()Neels Hofmeyr1-0/+1
Change-Id: Ia629a1069f32b29bad5c43009cc3c99f39985a94
2020-03-03add log_set_cyclic_category_colors()Neels Hofmeyr3-5/+44
This is an easy way to ensure that categories generally have differing colors. For a long time I've wanted to make sure each osmo-* program logs categories in different colors, but I never really end up doing it: I don't really enjoy setting logging category colors manually. Maybe we will use this instead? The function sets library categories and user categories independently, because if we did both in the same sequence, a new libosmocore category would change the colors of all user defined logging, or the other way around. Change-Id: I66592f1dcb8babfec490a5970a736d42c8f42e4f
2020-03-03add utils/osmo-gsm-sharkNeels Hofmeyr3-0/+3158
Change-Id: Ifdfd261f776d9bf2bbfb0a584deac3e9a11bfe47
2020-03-03add gsm0808_create_common_id()Neels Hofmeyr2-0/+28
Change-Id: Id055df109cf67754854641ce6486523027f4d801
2020-02-28chantype_rsl2gsmtap(): Add entries for CBCHHarald Welte1-0/+6
This adds missing entries for CBCH in the conversion between RSL-style channel numbers and GSMTAP channel types. Without this change, you will see tons of messages like virtphy[19865]: Wed Feb 26 16:16:28 2020 DVIRPHY <0002> gsmtapl1_if.c:267 MS 0000: Ignoring unknown channel type UNKNOWN (0) if running virtphy of osmocom-bb with a BTS that broadcasts CBCH. Change-Id: I19bbd2942adf441f58955ac896ef968bfd8aec5f
2020-02-19bitvec: avoid redundant zero-initialization in bitvec_alloc()Vadim Yanitskiy1-1/+1
All the fields of the structure are set explicitly anyway. Change-Id: I40c0322d5f2febd98bae6fbe0ec2132eda6fb35b
2020-02-19bitvec: cosmetic: init i only once in bitvec_[un]pack()Vadim Yanitskiy1-2/+2
Change-Id: I5606ca34a72d42a9b6aafed662b995f9fa77be09
2020-02-19bitvec: fix misleading description of bitvec_spare_padding()Vadim Yanitskiy1-1/+1
Change-Id: Ie60bf7d993fe80d3c0fcd04e4c3dd81da4a2ea0b
2020-02-19bitvec: fix bitvec_unhex(): do not return 1 on successVadim Yanitskiy2-15/+12
This function is supposed to return 0 on success or 1 in case of error. However, it used to return 1 even in case of success. The reason is that length of the input string was not taken into account and sscanf() was failing on '\0'. Let's use osmo_hexparse() and rely on its return value. P.S. Funny that the unit test expectations were wrong too. Change-Id: I441a22c7964bb31688071d8bcf6a282d8c0187ff
2020-02-19tests/bitvec: add a unit test for bitvec_read_field()Vadim Yanitskiy2-0/+60
The aim of this unit test is to demonstrate the problem described in OS#4388: bitvec_read_field() can never return negative value on error (e.g. out of bounds access). Change-Id: I340ab5799fa53d5345edb02f3e2a3655527705c0 Related: OS#4388
2020-02-15osmo-sim-test: Fall-back to classic SIMHarald Welte2-20/+104
If selection of ADF_USIM fails, let's fall-back to reading/dumping a classic TS 11.11 (51.011) SIM card. Change-Id: I5a986fc65de76c24c5af52ce7e8c699cf302fda9
2020-02-15osmo-sim-test: Recurse through subdirectoriesHarald Welte1-13/+39
Don't just iterate over all files in the current working directory (cwd), but also recurse through all sub-directories. Change-Id: I737b01d9a845e37d8be9d4709ef0de04e749daec
2020-02-10bitvec: make bitvec_free() safe against NULLVadim Yanitskiy1-0/+2
Change-Id: Ifafb65e9d0adc286e16104274db440f38a86d800 Related: CID#208181, CID#208179
2020-02-09exec: propogate errors from osmo_environment_[filter|append]Vadim Yanitskiy1-4/+10
Change-Id: If7d6e0441f73092a4fb455340c076ba4dc60af3f
2020-02-09exec: prevent uninitialized memory access in osmo_system_nowait()Vadim Yanitskiy1-0/+3
If (!env_whitelist && addl_env), osmo_environment_append() would access uninitialized memory. If both are false, execle() would also deal with garbage values. Let's ensure that at least the first element of new_env[] is initialized. Change-Id: Id3901de4692ef44e9e9c67b1804e027fc4ce7c18 Fixes: CID#206571
2020-02-09osmo_libusb: check return value of osmo_fd_register()Vadim Yanitskiy1-1/+4
Most likely, we should not assert() here, but let's at least log an error message in case if osmo_fd_register() fails. Change-Id: Ia20755ec12ee9fb0eba8322551642a96e68e1570 Related: CID#206572
2020-02-09conv: prevent theoretical NULL pointer dereference in osmo_conv_encode()Vadim Yanitskiy1-0/+2
A caller shall never pass NULL to osmo_conv_encode(). Change-Id: Ice0050cd7c7e3fcbf57c2c73682ca28843a92d8b Fixes: CID#208174
2020-02-06tdef_vty: do not enforce enum 'node_type' in osmo_tdef_vty_groups_init()Vadim Yanitskiy2-4/+4
Some osmo-* applications may need to use their own VTY node as a parent for the timer configuration commands. Therefore it makes more sense to use 'unsigned int' instead of 'enum node_type'. Let's also clarify that osmo_tdef_vty_groups_init() accepts parent node for configuration commands only: 'parent_node' -> 'parent_cfg_node'. Change-Id: Ifb4c406c85d76a25fc53fc235484599aa87dc77c
2020-02-04value_string: Switch val from unsigned to intPau Espin Pedrol1-1/+1
There's nothing really preventing a user from user negative values. Otherwise if we keep it like this then g++ is not happy when passing eg. { -2, "foobar" } when initializing a value_string array. Change-Id: I754fa7e054cb89801ef82edc82199dcfbe59c6ab
2020-01-29pcsc: don't leak memoryEric Wild1-1/+4
Change-Id: I183882ff2eae82754d55189b154863fad9cce4aa
2020-01-21gsm/gsm48049.c: fix use of GNU 'missing =' extension in designatorVadim Yanitskiy1-1/+1
Found by clang with enabled LTO (Link Time Optimization). Change-Id: Ibda4600b4d23b93cf79ff13bb934dfc396aa7d93
2020-01-21usb/Makefile.am: fix copy-pasted library name: s/libosmosim/libosmousb/Vadim Yanitskiy1-2/+2
src/usb/Makefile.am:16: warning: variable 'libosmosim_la_LIBADD' is defined but no program or src/usb/Makefile.am:16: library has 'libosmosim_la' as canonical name (possible typo) src/usb/Makefile.am:15: warning: variable 'libosmosim_la_LDFLAGS' is defined but no program or src/usb/Makefile.am:15: library has 'libosmosim_la' as canonical name (possible typo) Change-Id: I062ea640a75f4521818ba71d5ffea2d08bf3052a
2020-01-18osmo_libusb: Check return of libusb_get_string_descriptor_ascii()Harald Welte1-0/+6
Change-Id: Ifc0133737627a8277635f8f3662b3f6e922be149 Closes: CID#207713
2020-01-12usb: Add osmo_libusb_find_matching_dev_{path,serial}Harald Welte2-0/+154
Thise two helper functions allow the user application to find a unique match among the existing USB devices, using either a user- provided iSerial string, or a user-provided physical USB path. Change-Id: I8ff3fb3e1a77e10cb313473480ce5e7673749a93
2020-01-07l1sap: add measurement related struct membersPhilipp Maier2-0/+4
In order to dissolve info_meas_ind_param in ph_data_param and ph_tch_param we need to add the measurement related struct members to ph_data_param and ph_tch_param as well so that those indications can also carry measurement data. Change-Id: I2c34b02d329f9df190c5035c396403ca0a4f9c42 Related: OS#2977
2020-01-07jenkins.sh: simpler invocation of verify_value_string_...Neels Hofmeyr1-1/+1
The script osmo-ci/scripts/verify_value_string_arrays_are_terminated.py is able to find .c/.h files in directory trees by itself. Shorten the cmdline invocation of this script for libosmocore. Change-Id: I888c20b9b19d777cd6581a541536842292f434b9
2020-01-07add crcXXgen.c.tpl to EXTRA_DISTNeels Hofmeyr2-1/+2
'make distcheck' distributes the generated .c files, but it is good GPL practice to also distribute the template. Change-Id: I988acd3bc629e98985a99780d3142112125d13f7
2020-01-06usb: Use OSMO_STRLCPY where appropriateHarald Welte1-1/+1
Change-Id: I6b2a90fd8f4b042a1e38dbf8e99414a94a290375
2020-01-03logging_vty.c: Avoid acquiring log tgt lock in logging level cmd when not neededPau Espin Pedrol1-4/+4
Change-Id: Ia6780221174070cee408625e24513f2c11cc9dfc
2020-01-03gb: Fix typo in bssgp_cause_strings descriptionPau Espin Pedrol1-1/+1
Change-Id: I2474bbe99bf0aa35aab046a1987047a8368beff6
2020-01-03bitvec: Fix return value in doc for bitvec_write_field()Pau Espin Pedrol1-1/+1
Change-Id: I629e71242cb6bafa3c1b1d65ae7ec6687ec203d1
2020-01-02Bump version: → Espin Pedrol8-14/+140
Change-Id: I5698bfe45467a8b0e44549105aaf27b8da500de8
2020-01-02Drop empty file debian/patches/seriesPau Espin Pedrol1-0/+0
Change-Id: I1a4aa5d6785aa7ff7dc454930a84d73fe1114726
2020-01-02osmo-release.sh: Improve of PKG_CHECK_MODULES from configure.acPau Espin Pedrol1-1/+1
Remove brackets and check for "(" after PKG_CHECK_MODULES to avoid getting comments containing the keyword. Change-Id: Ie2b9a65d42615aa3cce6906ddd53758bc3052942
2019-12-17Introduce helper functions for safe fork+exec of processesHarald Welte10-4/+487
In some situations, we want to execute an external shell command in a non-blocking way. Similar to 'system', but without waiting for the child to complete. We also want to close all file descriptors ahead of the exec() and filter + modify the environment. Change-Id: Ib24ac8a083db32e55402ce496a5eabd8749cc888 Related: OS#4332
2019-12-17debian/control: Add missing libusb-1.0-0-dev dependencyHarald Welte1-0/+1
In Change-Id I656a1a38cbb5b1f3a9145d2869d3b4d0adefcae3 we introduced USB support and also updated debian pacakaging informatio for this new package - however, I missed to add a realted Build-Depends line :( Change-Id: Ib0446510c8ba49623914b6103ea9cfa88c208d50 Related: #4299
2019-12-16usb: Import a variety of libusb utility functions from simtraceHarald Welte2-1/+452
Those functions were originally developed as part of simtrace; let's import them to libosmousb as they are truly generic. Change-Id: I2c18b938e4e1ea5b8a521a386f00db3a7389e47a Related: OS#4299
2019-12-16libosmocore libusb integrationHarald Welte10-2/+218
Osmocom applications typically use libosmocore select.[ch] event loop code as their main event dispatch mechanism. When they want to deal with libusb in a non-blocking/asynchronous way, they need to integrate libusb into that select(). The new libosmousb is doing exactly that: Providing a shared utility library for Osmocom programs that wish to use libusb. This is useful for example in simtrace2 host utilitie as well as osmo-e1d. Change-Id: I656a1a38cbb5b1f3a9145d2869d3b4d0adefcae3 Closes: OS#4299
2019-12-15gprs_bssgp: Work around gcc-9 claiming "error=stringop-overflow"Harald Welte2-0/+3
gcc-9.2.1 issues the following errror when compiling with -Werror: In function ‘tl16v_put’, inlined from ‘tvlv_put’ at ../../include/osmocom/gsm/tlv.h:156:9, inlined from ‘tvlv_put’ at ../../include/osmocom/gsm/tlv.h:147:24, inlined from ‘msgb_tvlv_put’ at ../../include/osmocom/gsm/tlv.h:223:9, inlined from ‘bssgp_tx_paging’ at gprs_bssgp.c:1250:2: ../../include/osmocom/gsm/tlv.h:131:2: error: ‘memcpy’ reading between 128 and 65535 bytes from a region of size 9 [-Werror=stringop-overflow=] 131 | memcpy(buf, val, len); | ^~~~~~~~~~~~~~~~~~~~~ Unfortunately I've not been able to work around it with some nice GCC #pragma GCC diagnostic ignored "-Wstringop-overflow" Change-Id: I22a0c399c6c00eaf87277002096a82844c9e198e
2019-12-12debian, utils: switch to python 3Oliver Smith6-6/+6
Make build and external tests work with python3, so we can drop the python2 dependency. This should be merged shortly after osmo-python-tests was migrated to python3, and the jenkins build slaves were (automatically) updated to have the new osmo-python-tests installed. Related: OS#2819 Depends: osmo-python-tests I3ffc3519bf6c22536a49dad7a966188ddad351a7 Change-Id: I84ef43f700e125c7a65f92347f12844e07e65655
2019-12-11core/defs.h: introduce and use OSMO_DEPRECATED_OUTSIDEVadim Yanitskiy3-3/+7
The new OSMO_DEPRECATED_OUTSIDE macro is similar to the existing OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE, but allows to override the deprecation message. Let's use it to suspend deprecation warnings related to: - gsm48_decode_bcd_number(), - osmo_ecu_fr_conceal(), - osmo_ecu_fr_reset(), as they're intentionally used in scope of the library. Change-Id: I1b0eff1396776900c1286e41da3aee3ff78b326e
2019-12-09sim: allow opening reader# > 0Eric Wild2-4/+53
Change-Id: I4b1abc8d8aae4bd9a32f927269d7ebfef902d7c5
2019-12-09gsup: Introduce OSMO_GSUP_NUM_VECTORS_REQ_IEHarald Welte5-4/+33
This is a bit of a hack, as we want to maintain binary compatibility without breaking existing users of libosmocore. To do so, we use the 'num_auth_vectors' field in two ways now: * In the existing use case as part of SEND_AUTH_INFO_RESPONSE, it indicates the number of vectors stored in the 'auth_vectors' field * In the new use case as part of SEND_AUTH_INFO_REQUEST, it indicates the number of vectors actually requested by the MSC/SGSN/MME. Change-Id: Iaecc47280f8ce54f3e3a888c1cfc160735483d0f
2019-12-03utils: exit(2) on unsupported positional arguments on command lineHarald Welte2-0/+10
Change-Id: Icc76cae2225ec4e664b950176dd861fa15712f59
2019-12-03osmo-arfcn: Fix '-h' optionHarald Welte1-1/+1
Change-Id: I13decca25dcdb75191c1e78058704ae8efa69b33
2019-12-03osmo-release.sh: Use set -e before applying changes to prepare releasePau Espin Pedrol1-0/+1
Change-Id: I783c3645537258a75ae6f5a684489d629b852188
2019-12-01gprs_ns_instantiate(): propagate errors from gprs_sns_init() to callerHarald Welte1-2/+7
Change-Id: I71f347a2f0376716e5f83d33a7931eb8a99aad77