aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2023-03-22WIP: 3GPP TS 29.018 definitions for Gs interfacelaforge/gsHarald Welte2-1/+91
Change-Id: I4730f15142276fbdf5678c99d24b19cc9a9a76b1
2023-03-17isdn: fix identical operands in v110_adapt_IR8000_to_2400()Vadim Yanitskiy1-1/+2
Change-Id: I7df8b214e813cbd14726d5043f666547353e2947 Fixes: CID#310966
2023-03-17gsmtap: add missing entries to gsmtap_type_names[]Vadim Yanitskiy1-0/+4
Change-Id: I67dc578c62f89039f35856da1f29caab4b5db1d8 Fixes: fae779ac5 "GSMTAP: Import changes from Wireshark" Fixes: f9b1e5556 "gsmtap.h: Introduce new GSMTAP type for LTE NAS messages" Fixes: 161d42a61 "gsmtap: Add definitions for E1/T1 payload (LAPD, TRAU, FR) in GSMTAP"
2023-03-14error log: osmo_sock_init2_multiaddr() v4/v6 mixNeels Hofmeyr1-1/+5
Provide some more information for the error case when local and remote addresses mix v4 and v6. Change-Id: I0fd12b08e0788ce3af6dc519ff8c82ad196a115f
2023-03-14on_dso_load_select: run after on_dso_load_ctxOliver Smith2-3/+4
Add priorities to ensure on_dso_load_select runs after on_dso_load_ctx. Otherwise osmo_ctx->global (used via define OTC_GLOBAL) points to NULL and causes a segfault in osmo_fd_lookup_table_extend. Use numbers 101 and 102, as "0 to 100 are reserved for the implementation" and cause an error from GCC. Fixes: OS#5946 Fixes: c46a15d8 ("select: Optimize osmo_fd_get_by_fd") Change-Id: Ia2518e82530b93c535f8f5105513e21559b895ba
2023-03-14logging.c: Sanitize calls to osmo_fd_unregister()Pau Espin Pedrol1-2/+3
It makes no sense to call osmo_fd_unregister() on a negative fd. Let's also make sure we set fd to negative value after unregistering + closing, even if the struct is going to be freed afterwards. Change-Id: I0790a63e603028c11cc475d483c6528e4d9aa9ab
2023-03-14select.c: osmo_fd_unregister(): Avoid assert hit with old buggy users of the APIPau Espin Pedrol1-3/+15
Change-Id: If77b84d603a42a216d550d9708eb62f645634a61
2023-03-14select.c: Clarify osmo_fd_unregister() can only be called on registered osmo_fdsPau Espin Pedrol1-0/+1
Change-Id: I5e397e121f2fe2254c7f4b474e6eefd7aebe7a83
2023-03-14select.c: Clarify osmo_fd_(un)register() API expectations of registered fdPau Espin Pedrol1-0/+6
Those restrictions were implicitly required for a while and most of the users of this API already followed them, but just a few didn't. All known users have now been fixed. Let's explicitly document the restrictions imposed by the API to ease avoiding similar issues in the future. Change-Id: I53d95aad15b33dd66aa5c7dd11745a35c4481f33
2023-03-13select: Optimize osmo_fd_get_by_fdPau Espin Pedrol1-8/+44
Optimize osmo_fd_get_by_fd() from O(n) to O(k) by means of allocating dynamically growing array. Make use from the fact that the kernel always tries to use the smallest possible unused value when allocating a new fd. Change-Id: I8b71547df8bed84192cb160479fa3debf9b7eade
2023-03-11coding: clean up Makefile.amVadim Yanitskiy1-4/+3
* Remove TALLOC_{CFLAGS,LIBS} - talloc is not used directly * Keep conditional ENABLE_PSEUDOTALLOC for embedded builds Change-Id: I18f0a65a47c37989f03928f99c4687bf8007d437
2023-03-10logging: Unregister osmo_fd before closing fdPau Espin Pedrol1-1/+1
Change-Id: I0754ac3110b63d2a380068010830af6c85b0a653
2023-03-09cosmetic: stats_tcp: Fix typo in commentPau Espin Pedrol1-2/+4
Take the chance to shorten a bit the lengthy lines Change-Id: I3215dea7e3198b728745a779ad1b6ebfa3795cb5
2023-03-08gsm: TS 44.021 modified V.110 frame encoding/decoding supportHarald Welte3-1/+310
3GPP TS 44.021 specifies the format for modified V.110 frames as used on the GSM air (radio) interface. Implement encoders and decoders for this modified V.110 format. Related: OS#1572 Change-Id: I60a2f2690459359437df20cf4da9043fa7c3ad11
2023-03-08isdn: Add V.110 encoder/decoderHarald Welte3-1/+592
V.110 defines a B-channel protocol for transmission of synchronous and asynchronous serial data of V-series interfaces via terminal adapters over ISDN. Let's add (unoptimized but easy to debug) functions for encoding and decoding of V.110 frames for various bit-rates. Related: OS#1572 Change-Id: I1b5fd3847d3bfb0a0f763e0574893962ec699680
2023-03-07fix _thread orderEric1-1/+1
As per gnu extension doc -> https://gcc.gnu.org/onlinedocs/gcc-6.2.0/gcc/Thread-Local.html : ".. When used with extern or static, __thread must appear immediately after the other storage class specifier." Change-Id: Ied1d3cf3ad2ff424bd0a2682aff29a8939b419b8
2023-03-06Makefile.am: Make libraries depend on .map filesHarald Welte6-0/+7
Without this, an update to the .map file doesn't re-trigger a re-link of the library. Change-Id: If0ea6f41730a28b04562d45efa6ca376abaf3f6b
2023-03-06gsm: gsm_gsmtime2fn(): constify paramPau Espin Pedrol1-1/+1
Change-Id: Ib29d5a8e7dcf50fb086f967857b0afa076573163
2023-03-05libosmocore.map: Add two missing entries for gsmtap*2() APIHarald Welte1-0/+2
Those functions were introduced in I51b3604ba79e42c474aa17007e7e308a12afcea8 but the recent introduction of libosmocore.map didn't list them Change-Id: I4ac14aae13ff60c110444da989761cd1e86f8925 Fixes: I13169c00a59fb59513dfc598de5a71d094492422
2023-02-28add gsm0808_amr_modes_from_cfgNeels Hofmeyr2-0/+99
Provide the definitions from 3GPP TS 28.062, Table 7.11.3.1.3-2 as generally usable API. Likely users: - upcoming patch to improve conversion between S0-S15 and MultiRate config, I900fda192742fa8f6dd54e9131ef1704b14cc41a - osmo-msc to figure out conversion between SDP AMR mode-set and 3GPP TS 48.008 Permitted Speech S0-S15. - osmo-bsc to choose AMR modes for channel activation from cfg / permitted speech from MSC. Related: SYS#5066 Change-Id: Icef7dd626d3d4641c66b8dd87e2047fc0ab547d1
2023-02-28doxygen: fix various typos in commands \param and \returnsVadim Yanitskiy11-14/+14
Change-Id: If87cec3739449c6a54e24fb2cb81e746d8244da2
2023-02-28libosmocore.map: add tall_{ctr/msgb}_ctxOliver Smith1-0/+2
These should not be used, but add them for backwards compatibility with building older versions of osmo-bsc, osmo-iuh, osmo-pcap against current libosmocore. Fixes: 213fc420 ("Add libosmocore.map") Change-Id: I4cfccf3622844d0923818bb8d8ce206f70e44a0d
2023-02-28GSMTAP: add missing parameter docstringsMax1-2/+4
Change-Id: I774b89e0358bdcf7c71c7fd9c9940f634a7d3822
2023-02-27Add libosmocore.mapDaniel Willmann2-1/+571
Generated with: nm src/core/.libs/libosmocore.so --defined-only |grep " T \| D \| B " | cut -c 20- >> src/core/libosmocore.map Change-Id: I13169c00a59fb59513dfc598de5a71d094492422
2023-02-27gsm0808_enc/dec_channel_type: fix transparent flagOliver Smith1-2/+2
According to 3GPP TS 48.008 3.2.2.11, it is inverted. 0: Transparent service 1: Non-transparent service Change-Id: I2e5786ad053ee871079b4a8d95caccd6b03b59b6
2023-02-27Interleaving for CSDHarald Welte2-0/+54
This patch adds the [de]interleaving for CSD (circuit switched data), nominally for TCH/F 9.6, but the same is also used for TCH/F 4.8, TCH/H 4.8, TCH/F 2.4 and TCH/F 14.4. Related: OS#4396, OS#1572 Change-Id: I6b16c2d0d7febf3883da662b2c7fec543335de12
2023-02-27gsm: use OSMO_ASSERT() in osmo_iuup_msgb_alloc_c()Vadim Yanitskiy1-1/+1
This patch is a preparation for the upcoming change making use of the built-in static_assert(), which is available since C11. When using built-in static_assert(), gcc v12.2.1 fails: iuup.c: In function 'osmo_iuup_msgb_alloc_c': iuup.c:194:33: error: expression in static assertion is not constant 194 | osmo_static_assert(size > IUUP_MSGB_HEADROOM_MIN_REQUIRED, iuup_msgb_alloc_headroom_bigger); ../../include/osmocom/core/utils.h:86:24: note: in definition of macro 'osmo_static_assert' 86 | static_assert((exp), "(" #exp ") failed") | ^~~ This one is not really a *static* assert(), because it operates on the user supplied argument 'size', which is not guaranteed to be an integer literal. Neither it triggers a compilation failure as expected, nor does it abort at run-time. It simply does nothing. Change-Id: I53db679728250e0c60ed277efb18142073ffe9c4
2023-02-25convolutional coding for CSDHarald Welte1-0/+4
This patch adds the convolutional code definitions for CSD (circuit switched data) on TCH/F channels with user bit rates of 2400, 4800, 9600 and 14400 bps. Related: OS#4396, OS#1572 Change-Id: I412131d7ee2e676402bf8d88394af17c4447b664
2023-02-25gsm/{bsslap,bssmap_le}: zero-initialize structs using memset()Vadim Yanitskiy2-9/+10
In the unit tests we're using memcmp() to compare decoding results against the expected results. This is a reasonable approach, but there is a pitfall: not only the struct fields are compared, but also the padding bytes preceding/following them. When using gcc's extension zero-initializer {} or even the standard approved { 0 } zero-initializer, padding bytes are not guaranteed to be zeroed. Even worse, according to [1], the init behavior is inconsistent between gcc and clang and optimization levels. All decoding functions in {bsslap,bssmap_le}.c currently use gcc's extension zero-initializer {}. This is not a problem when building with CC=gcc, but with CC=clang the bssmap_le_test fails due to mismatch of padding bytes in struct lcs_cause_ie: [4] PERFORM LOCATION RESPONSE: ERROR: decoded PDU != encoded PDU [5] PERFORM LOCATION RESPONSE: ERROR: decoded PDU != encoded PDU [6] PERFORM LOCATION ABORT: ERROR: decoded PDU != encoded PDU Out of the known struct initialization methods, only the memset() has consistent behavior and sets all bytes to zero, including the padding ones. Using it fixes the bssmap_le_test for CC=clang. [1] https://interrupt.memfault.com/blog/c-struct-padding-initialization Change-Id: Ib16964b16eb04315efc416164ed46c15b5dc7254 Fixes: OS#5923
2023-02-24gsm: ensure completeness of osmo_bts_features_{descs,names}[]Vadim Yanitskiy1-0/+7
It already happened several times [1][2] that new features were added to enum osmo_bts_features, but the osmo_bts_features_{descs,names}[] were left unchanged. Let's add static_assert()s to prevent this. Change-Id: I8e3b7d3996e9f3e16c6d4e0d1d406fa538d5e9be Related: [1] f4f5d54ea2cb47a51aeaec2b5fb990664755900a Related: [2] 18c6a8183f92915e77368ecffb1cbf7f555453a3
2023-02-24gsm: add missing features to osmo_bts_features_names[]Vadim Yanitskiy1-0/+2
Change-Id: I0ff47a79d611cd1c2d23ac5b4d53dca27e402821 Fixes: 812dfbf3a756088ef8ae083044c690783ef84067
2023-02-22Rename OSMO_AUTH_ALG_XOR to OSMO_AUTH_ALG_XOR_3GHarald Welte2-3/+3
Let's disambiguate. Our existing OSMO_AUTH_ALG_XOR was always only the XOR-3G algorithm. Now that we recently introduced XOR-2G, let's rename (with backwards compatibility #define). Change-Id: I446e54d0ddf4a18c46ee022b1249af73552e3ce1
2023-02-21Implement the XOR-2G authentication algorithmHarald Welte3-1/+81
We've so far only been supporting XOR-3G algorithm as specified in TS 34.108 (in both 3G and 2G-derivation mode). However, XOR-3G used for 2G auth is different from the XOR-2G algorithm as defined in Annex A of TS 51.010-1. Let's add support for that one, too. Change-Id: I0ee0565382c1e4515d44ff9b1752685c0a66ae39
2023-02-21gsm0808_dec_channel_type: fix dec of ch_rate_typeOliver Smith1-1/+1
According to 3GPP TS 48.008 V16.0.0 § 3.2.2.11, the "Channel and rate type" fills the whole octet 4, so don't cut it off. This fixes decoding of e.g. GSM0808_SIGN_FULL_PREF_NO_CHANGE, which I noticed while writing a test. Related: OS#5911 Change-Id: Ib5fba18eb82736c4f52f315ae1197159b7090e69
2023-02-20Move libosmogsm TS 44.060 declarations under include/osmocom/gsm/Pau Espin Pedrol2-5/+2
Currently there's a big mess where include dir osmocom/gprs/ is used by both libosmogsm and libosmogb. Most of the header files under osmocom/gprs/ are actually all the headers of libosmogb (there's no osmocom/gb/ dir). But a couple files are actually RLC/MAC (TS 44.060) related are are also stored in there. Those files have no relation/use in Gb, and are actually interused with GSM (eg System Information 13 Rest Octets). Hence, it makes sense to have the RLC/MAC related parts inside osmocom/gsm/ as they should be in libosmogsm (and they actually are, see gprs_rlc.h function implemented in src/gsm/gsm48_rest_octets.c). The fact that some libosmogsm headers were placed in osmocom/gprs instead of osmocom/gsm already created some issues, like libosmocore.spec.in putting "%_includedir/%name/osmocom/gprs/" under libosmogb, which is wrong. As a first step to fix the mess, we move the 2 RLC/MAC headers currently under osmocom/gprs/{gprs_rlc,protocol/gsm_04_60}.h under a single header gsm/protocol/gsm_44_060.h The two old headers are left existing for backward compatibility and now simply include the new libosmogsm header, plus a warning asking users to switch to the new header so we can eventually get rid of them. This means libosmogb depends on libosmogsm, which is fine and was already the case beforehand (libosmogb using functions like gsm48_encode_ra() and linking against it in src/gb/Makefile.am). Change-Id: I70cc21bf25a7081070738abacb409ed19094c3b2
2023-02-20gsmtap_util: remove whitespace at the end of linePhilipp Maier1-1/+1
Change-Id: Ib7afbfb1f7a95beab16fed11d07ae244b4fcfcdc
2023-02-20GSMTAP: add gsmtap_source_init*2()Max1-4/+45
Those allow selecting source host:port for UDP socket sending GSMTAP data. It's handy when you have several GSMTAP sources operating simultaneously. Change-Id: I51b3604ba79e42c474aa17007e7e308a12afcea8
2023-02-20gsm0808_enc_channel_type: Add spare byteMatan Perelman1-0/+1
Related: OS#5911 Change-Id: I6e05e4989924b2258122113eb134e946e9cf0107
2023-02-20GSMTAP: fix typoMax1-1/+1
Change-Id: I152c605a01069117563d9502046fa5540fa148d9
2023-02-19gsm: fix invalid check in gsm48_decode_ssversion()Vadim Yanitskiy1-1/+1
Change-Id: I648a4b052d0ec7af97d513630aa4279884436dda Fixes: OS#5910
2023-02-18i460_mux: make osmo_i460_subchan_count publicPhilipp Maier2-2/+5
There may be situations where we must check if there are still I.460 subchannels active, so lets make the function osmo_i460_subchan_count public Change-Id: I0454ffe5809f21504c1e263a781c06596d452d4b Related: OS#5198
2023-02-17Fix typo endianess -> endiannessOliver Smith1-1/+1
Rename contrib/struct_endianess.py to contrib/struct_endianness.py, and fix the typo everywhere. This is in preparation to call the script in CI on all repositories. Related: OS#5884 Change-Id: Idc4af9098ba1de26243464c772d6ea8be330646a
2023-02-16i460_mux.c fix apidocPhilipp Maier1-9/+8
Change-Id: Ib701e3f8f4261087c2fd2719a52e4d785db11ddc
2023-02-15socket: propagate error in osmo_sock_unix_init() to the callerMax1-4/+4
Change-Id: Ia90d2ca3106b58dc5953d930f13df829d5b6966f
2023-02-13gsm0808_enc/dec_channel_type: support dataOliver Smith1-18/+84
Related: OS#4393 Change-Id: Ib7b75c9d86aace329decf20003b68de459021c64
2023-02-09gsm0808_dec_channel_type: add missing len checkOliver Smith1-0/+3
Stop iterating if the extension bit (0x80) is set but elem is too short to read another byte. Related: OS#4393 Change-Id: Id37109dba0f5d40f4b83f0cef9b1dbd9d6bb2c68
2023-02-07Bump version: 1.7.0.119-b31a-dirty → 1.8.01.8.0osmith/1.8.1Pau Espin Pedrol6-6/+6
Change-Id: I5e953cedc041371a9c192f58348b673a787f542e
2023-02-04Add SI10 supportMax1-1/+1
Add data structures and checks for System information Type 10. Related: OS#5783 Change-Id: I3a5da543f083f31e873c67b5ec1b5a439187d8f3
2023-02-02gprs_ns2_fr: use osmo_netdev to monitor and operate network devicePau Espin Pedrol4-138/+65
As a result libosmogb doesn't depend directly on libmnl anymore, but through libosmocore. Change-Id: Ib0e499e09c50135a5c4a361332d6120f660a1a45
2023-01-30SI: add missing headerMax2-1/+2
Previous SI10 patch added function without exposing it via public header. Let's fix this. Fixes: 600d4eeab71665c0aec0a11a226d231f109534ca Change-Id: Ia7530e9c8a21f6f99f3aac7baea5cbb38763c4f3