aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2020-06-13WIP: gsm_412 Cell Broadcastlaforge/cbchHarald Welte1-0/+68
Related: OS#3537 Change-Id: I1a17c2ae8bf62150327956c10cb5bb896939e3fd
2020-06-12osmo_bcd2str: also validate start_nibble parameterNeels Hofmeyr1-1/+1
If start_nibble were passed negative, we'd end up accessing invalid memory. Safeguard against that. Change-Id: Ied3c1e02c3a01d868e08195cbd8dfa52d2c19ac3
2020-06-10tlv.h: add msgb_tvl_put() to add a TvLV without the value partNeels Hofmeyr1-0/+45
So far, we have msgb_tl_put(), which allows putting the TL header of a TLV, without the value part. Add the same for a variable-size length TvLV: put a TvL header of a TvLV without the value part. In a subsequent patch, osmo_mobile_identity will be introduced, which will allow writing the encoded MI directly to the end of a msgb. For BSSGP_IE_IMSI, which is a TvLV, it would hence be simplest to write only the TvL first. Change-Id: I02cca5182fe42e40b63680a2fd470f03bcc11076
2020-06-10add gsm23236: MSC pooling: TMSI and NRI utility functionsNeels Hofmeyr9-1/+1784
These utilities will be used by osmo-bsc to determine the Network Resource Indicator seen in the TMSI, and (potentially) by osmo-msc to compose a TMSI with a specific NRI, for osmo-bsc's load balancing between several MSCs. Add utility functions to: - extract an NRI value from a TMSI. - overwrite the NRI value in a TMSI. - limit an NRI in a (random) TMSI to a given list of ranges. - add NRI value ranges to a list. - remove them from a list. - match NRI value (range) to a list. - parse NRI values from string, for VTY. - common VTY functionality of adding/removing NRI values from argv. Add C tests for the above. Why we need public API for NRI ranges: In osmo-bsc alone, we need the same NRI API twice, 1: to manage/list NRI value ranges per-MSC, and 2: to manage/list NULL-NRI values. If we also consider (potentially) adding NRI support to osmo-msc, we need the same API twice again there. Hence it is useful to define re-used API up here in libosmocore. Related: OS#3682 Change-Id: Icb57a2dd9323c7ea11b34003eccc7e68a0247bf5
2020-06-09gsm0808: fix endieness of call identifierPhilipp Maier2-4/+14
The call identifier in the ASSIGNMENT COMMAND is encoded in the wrong endieness. 3GPP TS 48.008, section 3.2.2.105 specifies that the least significant byte should be transmitted first, which means that the endieness here is little endian. Lets make sure that the endieness is correctly transmitted, regardless of the host byte order. Change-Id: I6468e502f552f99ab54aec9d4b1c169fdc0adfb8 Related: OS#4582
2020-06-08lapd_core: Fix log line being about LAPD and not LAPDmHarald Welte1-1/+1
Change-Id: I92c8a9752e88164eedffb9f9a081288458f6eadb
2020-06-08lapd/lapdm: print user-defined string name instead of (dl=%p)Harald Welte6-323/+303
At the moment we print the pointer address to identify the log lines belonging to a specific connection. Since pointer addresses are difficult to work with, a human readable ID should be printed instead. e.g. "This is LAPD instance for SAPI3 on bts0/trx1/ts5/lchan3" Change-Id: Ie6742843fff809edffcac24c4dce4edf66bc71be Closes: OS#1938
2020-06-08NS: replace use of gprs_nsvc_create() with gprs_nsvc_crate2()Harald Welte5-13/+7
Change-Id: I2b10e1707b0976b685d1c14016481d5565888150
2020-06-08NS: Optionally disable NS-{RESET,BLOCK,UNBLOCK} when using UDP/IPHarald Welte3-24/+57
3GPP TS 48.016 is quite clear in that no NS-{RESET,BLOCK,UNBLOCK} procedures shall be used over an IP based transport. They are only for use in Frame Relay based transport. However, as libosmogb was first developed against ip.access nanoBTS, and their Gb implementation mandates those procedures, we unconditionally implemented those procedures back then. Let's give the user the option of disabling this behavior to become more spec compliant (and interoperate with more other vendors out there). Change-Id: Ic4eba1b4dcbeac00f5879db295e0a9f1a50f71d8
2020-05-31bts_features: introduce osmo_bts_unset_feature()Vadim Yanitskiy2-0/+7
This function may be useful in a case when most of the BTS models do support some feature, but just a couple models do not. It's much easier to unset that feature 2/10 times than set it 8/10 times individually for each BTS model. Change-Id: Ib5fa27287be7f1ecf2f82249b1e8c848465cbac0 Related: I431c8ab9478cbc40179903edc21043623d805da1
2020-05-31bts_features: fix: properly check the result of bitvec_get_bit_pos()Vadim Yanitskiy1-1/+1
If a feature index does not fit to the feature vector, this function would return a negative number that would be casted to true. This is wrong, we should return false instead. Change-Id: Id1ad92e7654a806bb920ae9507c88a122e8d09f0
2020-05-28Implement ITU-T I.460 multiplex / demultiplexHarald Welte9-1/+999
This implements a multiplexer and de-multiplexer for the ITU-T I.460 standard. The latter covers the transmission of sub-slots of 32/16/8k inside 64k timeslots. Change-Id: Id522f06e73b77332b437b7a27e4966872da70eda
2020-05-26fix osmo_mi_name_c() to always return talloced strings, via osmo_mi_name_buf()Neels Hofmeyr1-3/+5
Fix osmo_mi_name_buf() to snprintf() into the buf in *all* cases. osmo_mi_name_c() is implemented via osmo_mi_name_buf(), which returns compile-time string constants in special cases. That means that osmo_mi_name_c() does return non-allocated strings in these special cases. The caller of functions like osmo_mi_name_c() must always be able to rely on getting a talloced string, or run a danger of deallocating const pointers. Change-Id: I623959f01b72642bcdd18508097c5c405c59f6f1
2020-05-26api doc: clarify OSMO_NAME_C_IMPL() required FUNC_BUF signatureNeels Hofmeyr1-1/+3
Change-Id: Ibe722d38d28e5590a35e856dd15c2538e6ee0a3e
2020-05-26api doc: clarify 'returns' of gsm48_mi_to_string()Neels Hofmeyr1-2/+4
Change-Id: I81646ff8284061a60c208bd8f9233f66c3e410f8
2020-05-22Makefile.am: EXTRA_DIST: debian, contrib/*.spec.inOliver Smith1-1/+9
Change-Id: I13f28041adcc1530e5125775c4533d8ac0a88169
2020-05-20contrib: integrate RPM specOliver Smith3-10/+7
Remove OpenSUSE bug report link, set version to @VERSION@, make it build with CentOS 8 etc. Related: OS#4550 Change-Id: I59255889740195ec811a947a7130ae0918ea4b4d
2020-05-20gsmtap_makemsg_ex: NULL for unknown chan_typeOliver Smith1-1/+5
Related: osmo-bts Ic22ab71e520ab44429a93724250d349d16250801 Change-Id: Ib4147a33a75c3cf425c30da8b0678c7fba8a371d
2020-05-18enable vty xml dumping to stdoutNeels Hofmeyr2-25/+62
Allow dumping the VTY XML reference (for generating manuals) to a normal FILE* stream instead of a vty output buffer. We currently generate the VTY reference by starting the client program, connecting to the VTY telnet and dumping the reference. That is weirdly convoluted, especially since there has to be a valid config file that successfully starts up a minimal set of external links before the reference can be generated. IMO we should have dumped the XML reference to stdout from the start, and never to a VTY session. With this patch, it is trivial to generate the XML VTY reference by a commandline switch. The client program will set up the entire VTY, and immediately after parsing the cmdline options but before parsing a config file, just dumps the reference and doesn't even start establishing local ports. That would allow generating the XML reference on the fly during the build process of the manuals, without the need of a docker container or somesuch. A first implementation of such a commandline switch is `osmo-bsc -X`, added in I316efedb2c1652791434ecf14a1e261367cd2fb7 This patch jumps through a bit of a hoop to still allow dumping to a VTY buffer without code dup, to still allow dumping the XML reference through telnet VTY, until all our programs have implemented an -X switch (TM). Change-Id: Ic74bbdb6dc5ea05f03c791cc70184861e39cd492
2020-05-17gsm0808: 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-16contrib: import RPM specOliver Smith1-0/+460
Copy the RPM spec file from: https://build.opensuse.org/project/show/home:mnhauke:osmocom:nightly Related: OS#4550 Change-Id: Ib329b719fbeaf4618d299fa20514c76fe704cb48
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-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-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