aboutsummaryrefslogtreecommitdiffstats
path: root/include
AgeCommit message (Collapse)AuthorFilesLines
2022-03-01add osmo_sockaddr_set_port()Neels Hofmeyr1-0/+1
Do it like osmo_sockaddr_port() in reverse. Related: SYS#5599 Change-Id: I9512e44c3203daebb3fe3435fceef167613c1a73
2022-02-28BSSAP: HO Request Ack: add missing Codec List (BSS Supported)Neels Hofmeyr1-1/+5
Related: SYS#5839 Related: I3c0576505a3ceb3cd5cc31dc69c5bc4a86a4ea08 (osmo-bsc) Change-Id: Iab0a7b4d81592157fc111d1adb9e9f4cb53a94e9
2022-02-16gsm: [ABI BREAK] Support CellId SAI, change CellId CGI-PS id numberPau Espin Pedrol3-2/+12
Those are available in 3GPP TS 48.008 version 16.0.0 Release 16, section 3.2.2.17 Cell Identifier. It can be seen that we have a collision between the osmocom non-standard format and the SAI standard one. This is because CGI-PS is not really a TS 48.008 Cell Identifier, but only specified in TS 48.018 and has no ID number assigned. The CGI-PS was added there because the whole osmo-bsc neighbour configuration works with CellIds to manage neighbours, so it felt natural to extend the APIs to also provide means to use CGI-PS format (TS 48.018 even refers 48.008 existance and mentions there's no explicit ID). At the time this Cell Identifier was added, the firstly available number (11) was taken, which was of course a really bad idea since newer versions of the spec can at some point use it, which is the case if one checks for instance TS 48.008 Release 16 SAI Cell Id. There no perfect way to fix this bad decision at the time, but the CGI-PS is only used in osmo-bsc and only for RIM related purposes, so by changing the ID of CELL_IDENT_WHOLE_GLOBAL_PS, we only break RIM under some specific CIs being used, and when an osmo-bsc is built against older libosmocore and then used at runtime against a newer libosmocore (which should be rare). Hence, the downside is acceptable, and by moving the new ID number to be ouside of the spec proto TS 48.008 range (4 bits), we make sure we don't have the same problem again in the future. Related: SYS#5838 Fixes: ca33a71ca8eeaee98b1b53d5394b147a4ff0b429 Change-Id: Id25e563febdb7640174540136225f399515a0089
2022-02-09core/utils.h: make use of OSMO_LIKELY in OSMO_ASSERTVadim Yanitskiy1-1/+1
Theoretically, this should improve performance of the code where we frequently invoke OSMO_ASSERT(), like osmo-msc and osmo-bsc. Change-Id: I29b32a2477ec92762f8f0ce5e5c5a30810f6abbe
2022-02-08core/msgb.h: make use of OSMO_LIKELY / OSMO_UNLIKELYVadim Yanitskiy1-8/+8
Change-Id: Iff666b5fa0b320ae47b6c8c5dfd39debd2d9b8b7
2022-02-08core/utils.h: wrap OSMO_ASSERT() with do { ... } while (0)Vadim Yanitskiy1-1/+3
Using do-while is a common practice for complex macros. This allows invoking OSMO_ASSERT in simple if-else statements without braces. Change-Id: I42d9c315c9c30bce828564a63c496ee62e5c1431
2022-02-08core/utils.h: add OSMO_LIKELY / OSMO_UNLIKELY macrosVadim Yanitskiy1-0/+9
These macros are built on top of the __builtin_expect() function [1], which provides the compiler with branch prediction information. Similar macros exist in the Linux kernel: likely() / unlikely(). [1] https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html Change-Id: I0b029654ba050f079eed4a0574a3fa8019677067
2022-02-07add osmo_sockaddr_from/to_octets()Neels Hofmeyr1-0/+3
Shorthand for the INET/INET6 switch() to get/put the addr part, useful for encoding and decoding message buffers. Related: OS#5599 Change-Id: Ie9e33bfac525c59c30714663d2bfcc62ec9eeb81
2022-02-07add osmo_quote_str_buf3, osmo_escape_str_buf3Neels Hofmeyr1-0/+2
There already are osmo_quote_str_buf() and osmo_quote_str_buf2(), same for _escape_, but none of them return the snprintf() like string length. A private function does, publish this in the API. The returned chars_needed is required to accurately allocate sufficient size in string functions that call osmo_quote_str/osmo_escape_str. I am adding such in osmo-upf.git. Related: SYS#5599 Change-Id: I05d75a40599e3133da099a11e8babaaad0e9493a
2022-01-31add osmo_sockaddr_to_str_c(), osmo_sockaddr_to_str_buf2()Neels Hofmeyr1-0/+2
To easily log and print a sockaddr using OTC_SELECT, add osmo_sockaddr_to_str_c(). Implement osmo_sockaddr_to_str_buf2() using osmo_strbuf, so that we can return the chars_needed which osmo_sockaddr_to_str_c() uses. From previous osmo_sockaddr_to_str_buf(), call osmo_sockaddr_to_str_buf2() and return NULL if the buf_len was insufficient, to mimick previous behavior. This makes it more consistently returning NULL for insufficient buf_len, as shown in the tweak that is needed in socket_test.c. Before osmo_sockaddr_to_str_buf() would return a truncated port number, now it's all or NULL. I will use osmo_sockaddr_to_str_c() in the new osmo-upf implementation. Related: SYS#5599 Change-Id: I12771bf8a021e6785217b1faad03c09ec1cfef0e
2022-01-25logging: log to stderr when logging is not initializedPhilipp Maier1-0/+15
When the logging framework is not initialized we get an error: "ERROR: osmo_log_info == NULL! You must call log_init() before using logging in ..." There are sometimes situations where some code tries to log before logging was initialied. This is a problem because the actual log line with the debug info we need is covered up by the error message from the logging framework. Lets introduce a fallback logging function that is called when the the logging framework is not available. This function can just use fprintf to output to stderr. Change-Id: I9b1b0988e02322e3e44fd4ceea3e1bc2d4df3c45
2022-01-21ports.h: add osmo-pfcp-tool portsNeels Hofmeyr2-0/+4
Related: SYS#5599 Change-Id: I8a5f437d934b9bda11ea593b50bd18c7d5d71ce9
2022-01-21PFCP: add DLPFCP and osmo-upf port numbersNeels Hofmeyr3-1/+6
Related: SYS#5599 Change-Id: I0a46b147ec6a76d909df28136cfd2b764b2c75ea
2022-01-09log_taget_find() should use enum log_target_type, not intHarald Welte1-1/+1
This has shown up in -Wsign-compare Change-Id: I2f5ba81aa0328db7db29f49f26de4cea3f522789
2022-01-09utils: Fix -Wsign-compare warningsHarald Welte1-3/+3
Change-Id: I8b1118ca519b0a419a42eab8b7d4ba9e26a0bab5
2022-01-09bitvec: Fix -Wsign-compare warningsHarald Welte1-1/+1
Change-Id: I34f65cda83bcd7050bd0cc0fb9e5cb5d33a09086
2022-01-07iuup: Submit RNL-STATUS-Initialization.ind upon rx of InitPau Espin Pedrol1-2/+3
This allows init-passive users to get the configured sizes for the RFCIs and other similar information once engotiated with the peer. Realted: OS#1937 Change-Id: I63ee780b4aa162ea097410b234e73984000c0965
2022-01-05stats_tcp: use a default batch size of 5 instead of 1Philipp Maier1-1/+1
The configuration defaults for the socket statistics are currently set to a batch size of 1. This means that only one socket per timer expiration is scanned. This rate is probably a bit low. To speed things up a bit we should set the default to 5. Scanning 5 sockets at a time is still in the affordable range. Change-Id: I87abc74c00377191f7940c5b8f19d932618fc019 Related: SYS#5701
2022-01-05conv: Fix the traceback for tail biting codesSylvain Munaut1-0/+1
When picking the end state, looking only at the path metric is highly suboptimal because in a tail biting code, we _know_ that whatever treillis path is correct, it must start and end at the same state. So we only consider path meeting that condition. We know any path that doesn't isn't the right one. We only fallback to only path metric if no path met that condition. Fixes OS#4508 Signed-off-by: Sylvain Munaut <tnt@246tNt.com> Change-Id: I87e51d3880c0fe7bf3d6cd08fd46517a424a230c
2022-01-05VTY: implement 'no log gsmtap [HOSTNAME]' commandVadim Yanitskiy1-0/+1
Change-Id: I9a4efa1e35cbc22cea06a64a15a369522c32d3c4
2021-12-23select: gather statistics for TCP connectionsPhilipp Maier2-0/+17
osmocom applications are deployed in a variety of different situations. Dependung on the medium that interconnects the network components unexpected behaviour may occur. To debug problems with the interconnection between network components it might help to monitor the health of the related TCP connections. Change-Id: I1416f95aff2adcf13689646b7574845de169fa3d Related: SYS#5701
2021-12-22Introduce CRC and FSM for IuUP (user plane) as used in 3G RTP dataHarald Welte5-1/+351
Only support for SMpSDU mode is introduced in this commit. Not supported explicit list: - Transparent mode - ATM/AAL2 based Transport layer - GTP-U based Transport Layer - Iu Rate Control procedure - Time Alignment procedure APIs are provided to allocate the primitives properly inside the related msgb. This way primitives can be placed in the headroom, leaving the data part of the msgb for the IuUP payload, hence allowing re-use of the msgb and 0 copy of IuUP payload when forwarding data over RNL<->TNL. Since RNL and TNL primitives relu struct osmo_prim_header, which is not packed, they cannot be set to packed, and hence proper memory alignment in the msgb must be done to avoid misaligned accesses (Asan errors about it otherwise). Related: SYS#5516 Change-Id: Ibe356fa7b1abaca0091e368db8478e79c09c6cb0
2021-12-22include/: Adapt some headers to match contrib/struct_endianess.py formatPau Espin Pedrol3-36/+27
This way the related files are not changed when running the script to generate struct fields for big endian systems. Change-Id: I830e0961331a73f8dceb1a5a1c879798541752fd
2021-12-14treewide: remove FSF addressOliver Smith40-163/+0
Remove the paragraph about writing to the Free Software Foundation's mailing address. The FSF has changed addresses in the past, and may do so again. In 2021 this is not useful, let's rather have a bit less boilerplate at the start of source files. Change-Id: I5050285e75cf120407a1d883e99b3c4bcae8ffd7
2021-12-09logging: make LIBOSMOCORE_NO_LOGGING work as expectedEric Wild1-0/+8
The macro introduced in d02090bba538158c36fd838d4e50c47e40f11449 was not enough: the actual logging macros are being used, i.e. by the fsm, so wrap those as well, and provide a flag to disable this at build time. Change-Id: Ia4c78abe5f198139f96ffa289998855be2477585
2021-11-26logging: allow disabling macros using a new define: LIBOSMOCORE_NO_LOGGINGEric1-0/+4
This was previously unconditionally defined, so embedded targets were unable to get rid of the log macros and functions. Change-Id: I589f93d98a6bc5cf6221c56e2fe3f27bfdd200e8
2021-11-25gsmtap: Add gsmtap_sendmsg_free() as alternative to gsmtap_sendmsg()Harald Welte1-0/+1
gsmtap_sendmsg() places the burden of freeing the msgb in case of erroneous return codes on the caller. A review of existing users shows that this is overly optimistic and many calls get it wrong, opening up memory leaks. Let's add a new function gsmtap_sendmsg_free() which behaves like gsmtap_sendmsg() but always takes ownership: Either it is sent + freed, or it is just freed. Change-Id: I106b09f2a49bf24ce0e8d11fd4d4ee93e9cafdf5 Related: OS#5329
2021-11-15add osmo_time_cc, moved from osmo-bscNeels Hofmeyr2-0/+188
Related: SYS#4878 Related: Ica9f908a1a30f334a24c59471affa11225117e12 (osmo-bsc) Change-Id: Iabb17a08e6e1a86f168cdb008fba05ecd4776bdd
2021-11-11include: add enum for UTRAN cipherAlexander Couzens2-0/+20
Change-Id: I4b9baff2c2fbd0e339fc769cc69cce58d3a72cdf
2021-11-09stats: allow configuring reporter's name in the VTYVadim Yanitskiy1-0/+1
This allows configuring more than one reporter of the given type. Change-Id: Ia815c24dc974648985539913012b3b074ea317a9 Related: SYS#5713
2021-11-04gsm/protocol/gsm_04_08.h: add gsm48_meas_res_is_valid()Vadim Yanitskiy1-0/+6
Change-Id: Iae2bd508a08c4b5093d36e514c22218763e11edf
2021-10-29gsm/protocol/gsm_44_004.h: fix missing include of 'endian.h'Vadim Yanitskiy1-0/+2
Without this header, both OSMO_IS_{BIG,LITTLE}_ENDIAN macros are not defined, and thus the 'struct gsm_sacch_l1_hdr' is empty. Change-Id: I2c14a1b898fdb743191dab0e6be157ce916e8161
2021-10-29Revert "Prevent GCR encoder/decoder functions from being used directly"Vadim Yanitskiy1-2/+2
We need this API for communicating GCR over the MNCC and SIP. Change-Id: I06babb959fdc82f4e82d92260131d60c98b0abd2 Related: OS#5164
2021-10-26logging: Change stderr + file target to use non-blocking writeHarald Welte1-0/+5
So far, we used blocking, buffered fwrite() to write to stderr and file targets. This causes problems if there are [slow] consumers causing delays, such as gnome-terminal (when the program is started interactively) or systemd/journald (where we observe 64..128ms blocks on stderr). This patch introduces stderr/file based logging via write_queue and osmo_select_main(), i.e. switch from glibc-buffered, blocking to internally buffered, non-blocking writes. * when osmo_stderr_target is created via application.c, we create it in blocking stream mode for backwards compatibility, particularly for [smaller] programs that don't use osmo_select_main() * when the VTY code encounters 'log stderr' or 'log file FILENAME', we switch that respective target to non-blocking write-queue mode, as this means the application is in fact using osmo_select_main() * The config file can now state 'log stderr blocking-io' or 'log file FILENAME blocking-io' to explicitly enforce using blocking stream based I/O * The application can at any time use API functions to switch either way Closes: OS#4311 Change-Id: Ia58fd78535c41b3da3aeb7733aadc785ace610da
2021-10-21gsm_08_58: extend struct abis_rsl_osmo_temp_ovp_acch_capVadim Yanitskiy1-1/+11
This change adds new [bit-]fields in order to allow: * selectively enabling SACCH and/or FACCH, * setting the RxQual (BER) threshold. Change-Id: Ia28293a12de0af71f55e701fb65c46e905dae217 Related: SYS#5319
2021-10-21{ctrl,vty}/ports.h: Allocate ports for osmo-hnodebPau Espin Pedrol2-0/+5
Change-Id: I6514d040d88d145a321075911368645868e6280e
2021-10-13utils: introduce osmo_talloc_replace_string_fmt()Vadim Yanitskiy1-0/+2
Change-Id: I6b84fa0525555a98c531fc558e5dc1298fec00c1
2021-09-30cosmetic: get rid of 3 deprecation warningsNeels Hofmeyr3-3/+3
Some deprecated functions are still used in libosmocore .c code. Use OSMO_DEPRECATED_OUTSIDE() to get rid of those "resident warnings". Change-Id: I6e79acc87be37ac1aaec900e737e41450b46826a
2021-09-30refactor stat_item: get rid of FIFO and "skipped" errorNeels Hofmeyr1-37/+19
Intead of attempting to store all distinct values of a reporting period, just store min, max, last as well as a sum and N of each reporting period. This gets rid of error messages like DLSTATS ERROR stat_item.c:285 num_bts:oml_connected: 44 stats values skipped while at the same time more accurately reporting the max value for each reporting period. (So far stats_item only reports the max value; keep that part unchanged, as shown in stats_test.c.) With the other so far unused values (min, sum), we are ready to also report the minimum value as well as an average value per reporting period in the future, if/when our stats reporter allows for it. Store the complete record of the previous reporting period. So far we only compare the 'max' value, but like this we are ready to also see changes in min, last and average value between reporting periods. This patch breaks API by removing: - struct members osmo_stats_item.stats_next_id, .last_offs and .values[] - struct osmo_stats_item_value - osmo_stat_item_get_next() - osmo_stat_item_discard() - osmo_stat_item_discard_all() and by making struct osmo_stats_item opaque. In libosmocore, we do have a policy of never breaking API. But since the above should never be accessed by users of the osmo_stats_item API -- or if they are, would no longer yield useful results, we decided to make an exception in this case. The alternative would be to introduce a new osmo_stats_item2 API and maintaining an unused legacy osmo_stats_item forever, but we decided that the effort is not worth it. There are no known users of the removed items. Related: SYS#5542 Change-Id: I137992a5479fc39bbceb6c6c2af9c227bd33b39b
2021-09-29GPRS: Add PDP_TYPE_N_IETF_IPv4v6Keith1-0/+1
Change-Id: I1f82f9d8fc13dcc4474760329bd74ae9685b9031
2021-09-28cosmetic: gsm: meas_rep.h: Fix typo in commentPau Espin Pedrol1-1/+1
Change-Id: I35c47a69ad1e9a75de6cc82c44a87828ebbb7189
2021-09-28gsm: Mark gsm0858_rsl_ul_meas_enc() pointer param constPau Espin Pedrol1-1/+1
Change-Id: I9b2704250d8a3f6c6fc6cd2a5136b1408c8ed965
2021-09-23vty: add vty_out_uptime() print the uptime to the vtyAlexander Couzens1-0/+2
vty_out_uptime() calculates the time difference to a given timespec and print it in a human readable format (days, hours, minutes, seconds) to the vty. Related: OS#5028 Change-Id: I264a3f49096b96646e0a1f5366623ac20d860793
2021-09-21base64: reformat using Lindent to conform to our coding styleHarald Welte1-4/+4
Change-Id: I2286fa0d2cba7c11359bb48329135dfcd0d8a948
2021-09-21base64: Migrate over to osmocomHarald Welte2-16/+4
This containts the osmocom changes to the mbedtls base64 code merged in the previous commit. Change-Id: I82c1bf5f827c8def370dbcb80b146e9e4184c4a3
2021-09-21copy base64 implementation from mbedtlsHarald Welte1-0/+86
Using mbedtls commit f9c599cd8ac9d00c484d4f5b027e18c6af4f9fdf before they re-licensed to Apache 2.0, so we have a GPL-v2-or-later bsae64 implementation and avoid having code under a different license in the tree. This code is the unmodified import, so we can record any local changes compared to the original version. Change-Id: I39a9d3ab98257d21b9439b00528c744efa372c14
2021-09-20stat_item: cosmetic: s/desc/group_desc in osmo_stat_item_group_alloc()Neels Hofmeyr1-1/+1
There also is an osmo_stat_item_desc, so the name 'desc' makes it hard to read the code / the upcoming refactoring patches. It is an osmo_stat_item_group_desc, so call it group_desc. Related: SYS#5542 Change-Id: I07bc011450549a44ebf043e7d8a70718ddfd900e
2021-09-14add osmo_stat_item_get_group_by_name_idxname()Neels Hofmeyr1-0/+1
Add "missing" API for looking up a stat_item_group by its index-name. A subsequent patch, which adds stat_items to the CTRL interface, will use this to look up stat item groups by object name. In stat item groups, there are group names, having a number of indexes denoting different objects. An object can have, besides the index, also a name that is equivalent to the index. Apologies for the weird function name, it's still the best one I could come up with: "group_by_name" refers to the group name, and "idxname" refers to the name that the object index is associated with. We already have osmo_stat_item_get_group_by_name_idx(). Other contestants for name of this new function were: - osmo_stat_item_get_group_by_name_name() because there is a "name" instead of "idx", but I find it confusing. - osmo_stat_item_get_group_by_name_idx_name() but I find that the last "name" should be closer to the "idx". Related: SYS#5542 Change-Id: Ia1a77a1e4657ba624dd4f4bf7ad274e7751d0141
2021-09-12utils: add osmo_str_to_int() and osmo_str_to_int64()Neels Hofmeyr1-0/+3
Properly converting a string to an integer while validating against all possible errors is not trivial. It is a recurring theme in code review, and there are places in osmo code that do it wrong. End this by providing a simple API, if for nothing else then as an example of how to use strol() / strtoul() / strtoll() / strtoull() in an airtight way. A subsequent patch, adding stat items to the CTRL interface, uses this to properly validate indexes in CTRL variables and convert them to int. Related: SYS#5542 Change-Id: I4dac826aab00bc1780a5258b6b55d34ce7d50c60
2021-09-10vty: allow flushingEric1-0/+1
It was so far sufficient to wait for the buffers to drain at some random point in time, but this is not always the case, sometimes it is important that the output is flushed immediately. Change-Id: If984b9ad2eba9f400bc29a7aa8825e241fd1d2a9