aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2024-06-05[cosmetic] libosmosim/class_tables: Add a quick reminder about the casesHarald Welte1-0/+8
Change-Id: I5280b6431b18ec36c3186460bebeb6321996c35f
2024-06-05libosmosim: class_tables: Fix GlobalPlatform CLA=8x INS=CA/CB GET DATAHarald Welte3-2/+19
in their infinite wisdom, GlobalPlatform made GET DATA a command that can be either APDU case 2 or case 4. As the specify Le must be 0x00, we can conclude that P3 == 0x00 must be Le, while P3 != 0x00 must be Lc and hence case 4 */ Change-Id: Ic8a17921f5a42d227791f1de39f90b4967c2e1b6 Related: SYS#6865
2024-06-05libosmosim: class_tables: Resolve conflicting CLA=8x INS=F2 definitionsHarald Welte3-6/+29
In their infinite wisdom, GlobalPlatform re-defined the CLA 8x / INS F2 command alreay specified by ETSI TS 102 221. This wouldn't be as bads if they had the same "Case". However, ETSI has case 2 while GP has case 4. Lucikly, the P1 coding of ETSI [so far] states all the four upper bits must be 0, while GP always has one of those bits set. Before this patch, it is possible that a Modem/Phone will send an 8xF2 command and intends it as a GlobalPlatform command (with Lc > 0 and command data portion), while this code assumes it is an ETSI UICC command with Lc=0 and hence no command data portion. This will make communication break when using simtrace2 'cardem'. Change-Id: I8dd317ef8f942542e412b18c834a0467c51291c3 Related: SYS#6865 Related: https://lists.osmocom.org/hyperkitty/list/simtrace@lists.osmocom.org/thread/HPRTPGPZITHHASCJISCBAKHGBFZCFANP/
2024-06-05README.md: cosmetic: fix a typoVadim Yanitskiy1-1/+1
Change-Id: If29f86e09715f849847081edd8821cdc5acd3949
2024-06-04add jhash.h, copied from linux/jhash.hNeels Hofmeyr6-2/+265
Allow using arbitrary length data as hashtable key: Copy jhash.h implementation from the linux kernel. Apply osmo_ prefix to all global symbols. Add jhash_test to ensure the code import works as intended. First application will be a hashtable keyed by umts_cell_id in osmo-hnbgw.git. Related: SYS#6773 Change-Id: I0c9652bbc9e2a18b1200e7d63bb6f64ded7d75fa
2024-05-31include/osmocom/gsm: add rtp_extensions.hMychaela N. Falconia2-0/+24
Previous patches add definitions of GSM0808_IE_THEMWI_RTP_EXTENSIONS and RSL_IE_OSMO_RTP_EXTENSIONS to BSSMAP and RSL; this new header file provides definitions for individual bits in the single value octet of the new IE. Related: OS#6448 Change-Id: I0eccfe5ddcf44f8f20440acb01e2d4870ec0cd91
2024-05-31rsl: define RSL_IE_OSMO_RTP_EXTENSIONSMychaela N. Falconia2-0/+2
This addition to Abis RSL is an Osmocom-specific IE, intended for Osmocom flavor of Abis over IP. It requests the use of non-standard enhanced RTP transport formats. Complete description of this new IE is contained in this Technical Memorandum: https://www.freecalypso.org/specs/tw-tm-004-v010001.txt Related: OS#6448 Change-Id: I9ac692062e05f859ba56235375bdc10f212cb2c0
2024-05-31bts_features: add feature flags for TWTS001 and TWTS002Mychaela N. Falconia2-0/+6
TW-TS-001 and TW-TS-002 (Themyscira Wireless Technical Specifications) are enhanced RTP payload formats that replicate the functionality and semantics of 3GPP TS 48.060 and 48.061 (respectively) over IP transport. Companion spec TW-TS-003 defines a BSSMAP extension whereby the CN tells the BSS that it wishes to use these otherwise non-standard RTP formats - but these RTP extensions need to originate at the BTS, as their main purpose is to pass along information that is otherwise lost in RTP transport with standard payload formats. Define feature flags whereby OsmoBTS can tell OsmoBSC that it supports these RTP extensions. Related: OS#6448 Change-Id: Ia2cd1d5fa37e9d10927ca5d6cad79ec538fd0a11
2024-05-31gsm0808: add knowledge of TW-TS-003 BSSMAP IEMychaela N. Falconia2-2/+4
Themyscira Wireless Technical Specification TW-TS-003 adds a non-standard IE to GSM 08.08 BSSMAP whose purpose is to signal the use of enhanced RTP payload formats that go against the stipulations of TS 26.102 (referenced from 48.103 for AoIP), but allow an IP-based GSM network implementation to mimic the workings of TDM-based GSM more faithfully. Spec reference: https://www.freecalypso.org/specs/tw-ts-003-v010002.txt Related: OS#6448 Change-Id: Idd6f1838bdc0cd71a2f6357e9b6d8b8fa4f7c46c
2024-05-23fix update_exp: s/soft_uart.ok/soft_uart_test.okNeels Hofmeyr1-1/+1
Change-Id: I2fb70b684978fa8a591d1d9e3cace919d590d1ef
2024-05-15core: fix LOGPIO(): add missing space after 'iofd(...)'Vadim Yanitskiy1-1/+1
Without a space the logging looks like this: iofd(virt-rnc0-0)Cancelling read Change-Id: I84d305ce6cfc69352a64cb9e42229f88f09893c0
2024-05-07{fsm,vty}: add a VTY command to generate FSM state graphsVadim Yanitskiy1-0/+39
This command generates a state transitions graph for the given FSM. The output format is DOT/Graphviz, which can be rendered using offline or online (web) tools. It's useful for quickly getting a graphical representation of the FSM states and their interconnections. https://en.wikipedia.org/wiki/DOT_(graph_description_language) https://graphviz.org/doc/info/lang.html Change-Id: I09ee0a8c3fc4b1aa991ab5c93c0b654fccd7ea4c
2024-04-24osmo_io: Add iofd param to segmentation_cbPau Espin Pedrol2-7/+37
See related ticket for full rant and historical facts about this callback. Since anyway we are still developing osmo_io stuff and there will be ABI breaks when releasing new version, let's udpate the callback signature too. Related: OS#6437 Change-Id: Ib8d77e30b1ea759ee5ac2a69d704e81ea71e3079
2024-04-22vty: fix memleak in host_config_set()Vadim Yanitskiy1-1/+1
Not only we call this function from vty_read_config_file(), but also from config_write_file_cmd. Thus we leak memory when doing 'write file FILE' in the VTY. Change-Id: I356818aae3addab6db39de9a625453b7435b7cc1
2024-04-22tests: rename logging_test_gsmtap -> logging_gsmtap_testVadim Yanitskiy4-7/+7
This way the naming is consistent with existing tests and matches the 'tests/*/*_test' pattern in .gitignore. Change-Id: I280fc0cc1bda9ba445af71f00bc8f1ccfd2b2091
2024-04-22tests: do not copy *.cfg files to the build directoryVadim Yanitskiy4-11/+18
When running 'make check' in-tree ($builddir == $srcdir), those *.cfg files end up in tests/ and show up as git-add candidates. Instead of copying them, just let the test binaries know where to find those files via the cmdline parameters. Change-Id: I74e428f0548418fdecada3d25049d6e110e790fe
2024-03-28sockaddr_str: add conversion to,from osmo_sockaddrNeels Hofmeyr4-0/+28
Add functions to pass struct osmo_sockaddr to the osmo_sockaddr_str_{to,from}* API directly. So far the interface to osmo_sockaddr_str_ is: osmo_sockaddr_str_from_sockaddr(&my_sa_str, &my_osa->u.sas); I'm working a lot with osmo_sockaddr at the moment, and the cumulated time of forgetting to add 'u.sas' and having another compilation cycle because of those is justifying this additional API. Change-Id: I0df84b4bb8cb5d8434b735fa3a38e7f95be43e91
2024-03-23Add funding link to github mirrorHarald Welte1-0/+1
see https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/displaying-a-sponsor-button-in-your-repository Change-Id: I52d8c7cece35337eb33325146eccc8db005c55e3
2024-03-20Revert "Revert "logging: add log level cache""Hoernchen4-1/+146
This reverts commit 7f1fb3ea817578f3f2f63e8065aa50f8355caa3b - slightly amended with the new log_cache_enalbe() function. The cache is hence disabled by default, and applications can enable it, if they wish to benefit from it. Reason for the original revert was: some fallout expected due to log manipulation in test code Change-Id: I539872fc9e3c50b407e6bc388f1e091fa2c826c3
2024-03-20osmo_io_uring: Run check of tests/osmo_io with io_uring alsoAndreas Eversberg4-2/+16
Related: OS#5751 Change-Id: I82db9a15bc483a5447d86352512afaafa2bcfbb6
2024-03-19osmo_io: Make {write,sendto,sendmsg} completion callback optionalHarald Welte1-15/+6
There are situations (like multicast datagram transmit) where we don't really care about the result of a write operation, and hence don't need a write completion callback. As the completed message buffer is free'd by core osmo_io, there is no leak in doing so. Change-Id: I0c071a29e508884bac331ada5e510bbfcf440bbf
2024-03-19osmo_io: Massive improvement of API documentationHarald Welte2-53/+223
* introduce a new "Osmocom I/O interface" group to show up in API docs * expand the documentation to turn it into something useful for somebody wanting to write an application using it. Change-Id: I6315cfc7ff34a0f8971517edf035e1efcef3ed5c
2024-03-15osmo_io: Dont use __linux__ but !EMBEDDEDHarald Welte2-4/+4
osmo_io (unlike its io_uring backend) is not linux specific, so putting it in an "#ifdef __linux__" block is plain wrong. A side-effect is that all our doxygen comments are not processed as __linux__ is not set while doxygen parses the source file. Change-Id: I260443ba3cd0bb81dade434208dea4ea70fe8ad8
2024-03-14Fix file descriptor that is passed to io_uring_register_eventfd()Andreas Eversberg1-1/+1
Fix Change-Id I03752c0114cc6fad0c31fff6fff43072f36a50a7 Change-Id: Ie085c7cb3eb57e0da10485be8f90208cb41b0073
2024-03-14core: fix missing '\n' in iofd_uring_connected_cb()Vadim Yanitskiy1-1/+1
Change-Id: I43df86cdbd3e52d4f8f7bc0e48478b6f9b288e9f
2024-03-14io_uring: check all operations in osmo_iofd_uring_init()Harald Welte1-4/+17
check all operations in osmo_iofd_uring_init() and panic if any of them fails. Change-Id: I03752c0114cc6fad0c31fff6fff43072f36a50a7
2024-03-14io_uring: more verbose error messages if io_uring setup failsHarald Welte1-2/+2
"Assert failed 0 osmo_io_uring.c:94" is rather useless in terms of an error message. Let's improve upon that. Change-Id: I0ac9ae59e99c3704b3ce33919c9e7d11024476e3
2024-03-12socket: Add remote PID and local FD to AF_UNIX socknamePau Espin Pedrol1-3/+28
This allows identifying precisely an AF_UNIX socket. Change-Id: Ic465e557ea49de8e044d1ef6d91fc3c852c88ff2
2024-03-12socket: Support AF_UNIX in osmo_sock_get_name_buf()Pau Espin Pedrol1-7/+46
Right now stream_cli/srv print "<error-in-getsockname>" when using an AF_UNIX socket. This commit fixes the problem. Change-Id: I224c3712a029ee338ee1209a67d820b887170910
2024-03-12ctrl: re-introduce duplicate declaration of ctrl_cmd_send()Harald Welte1-0/+2
In Change-Id Ic81af56e7ea6921ba39168727ef64c308e9c6754 we removed the duplicate declaration of ctrl_cmd_send(), which was declared both in control_if.h and in control_cmd.h. Unfortunately this broke legacy openbsc.git, so let's re-introduce it. Change-Id: I1d415c5e80cfb7ef9e11d33c0c3eaece40ebb1da
2024-03-08osmo_io_poll: Use -errno as result on write errorAndreas Eversberg1-1/+1
This was done for read error in a previous patch. This is required because osmo_io_uring does not support errno, instead it uses the result code. To have a unified API, set the result code equally. Related: OS#5751 Change-Id: I405094449a6644db37534757f2fbccbcff982f23
2024-03-07osmo_io: Avoid implementing non-existant situationsHarald Welte1-7/+4
Both of our back-ends have a register_fd and unregister_fd back-end. Let's simplify the code by not treating them as optional, which introduces code paths that we never take, adds small runtime overhead and makes the code harder to follow. Should we ever introduce more backends which might not need those call-backs, we can either have empty functions or think about how to make them optional. Change-Id: I0077151eb676f61320b3fa2124448852aa8fd4a9
2024-03-07osmo_io: avoid OSMO_ASSERT one each API callHarald Welte1-2/+7
There's only one way to set the osmo_iofd_ops, which is by environment variable during the constructor time at shared library load time. There's hence no point in doing OSMO_ASSERT() on each and every call to osmo_iofd_notify_connected() at runtime. We can move those kind of asserts to the one-time load-time constructor instead. At the same time, we can extend those asserts to all the mandatory call-backs to be provided by the backend. Change-Id: Id9005ac6bb260236c88670373816bf7ee6a627f1
2024-03-07osmo_io: Don't pretend to support backends without close_cbHarald Welte1-2/+2
Let's not pretend we support backends without a close_cb. In such situations nobody would actually close(2) the file descriptor, but we would set iofd->fd to -1, effectively creating a file descriptor leak. Both of our two back-ends provide a close_cb, and we don't need to consider hypothetical future back-ends that would not like to register such a call-back. Related: OS#6393 Change-Id: Id285f1d7b73ae5805aa618897016ae8b73bf892d
2024-03-07osmo_io: Log error message in case call-backs incompatible with modeHarald Welte3-2/+20
Change-Id: I50ba6a76c0144f249d67488874a6c4edf01ec6f2
2024-03-07osmo_io: Guard osmo_iofd_register() with invalid file descriptorHarald Welte1-0/+5
Let's return an error if both osmo_iofd_setup() and osmo_iofd_register() are called with an invalid file descriptor like -1. Either one of them must have been called with a valid file descriptor. Change-Id: Ie4561cefad82e1bf5d37dd1a4815f4bc805343e6
2024-03-04osmo_io: do check_mode_callback_compat() only if ioops is set at ↵Andreas Eversberg1-1/+1
osmo_iofd_setup() Setting ioops is optional when calling osmo_iofd_setup(). If it is not set, do not call check_mode_callback_compat() to check for compatibility. Closes: Coverity CID#349578 Change-Id: I1e25f3e420f25a44cbf73a4da9a498b7561e9ddd
2024-03-02cbsp: Add osmo_cbsp_segmentation_cb for message segmentationlaforge/cbspHarald Welte3-0/+22
This call-back can for example be used as segmentation call-back for libosmo-netif stream_cli/stream_srv or directly for osmo_io. Related: OS#5755 Change-Id: I5e922c54b3431d759b38e81e55076125c5a34008
2024-03-02ctrl: Don't expose write_queue in ctrl_cmd_send() apiHarald Welte5-7/+19
ctrl_cmd_send() should always have taken a 'struct ctrl_connection' as argument, not directly its write_queue member. Let's offer a ctrl_cmd_send2() which fixes the problem, and deprecate the old ctrl_cmd_send(). Related: OS#5751 Change-Id: Ic81af56e7ea6921ba39168727ef64c308e9c6754
2024-03-02osmo_io_uring: Check if osmo_fd_register fails at iofd_uring_notify_connected()Andreas Eversberg1-2/+4
If it fails, do not set the IOFD_FLAG_NOTIFY_CONNECTED flag and log an error message. Closes: Coverity CID#349579 Change-Id: I34e8cc9a2b9df0c624841e5f9268a15c32418da1
2024-02-29osmo_io: Assign const name when stealing TX msg from iofd ctxAndreas Eversberg1-3/+1
All TX messages are moved from iofd instance to the user's context. iofd may be destroyed, but the message is still available to the user. To prevent a use-after-free bug, the context name must be changed from iofd->name to a constant that does not belong to iofd. Change-Id: Ib8dae924fa2d94a7f636136ba7279b965a18cf5b
2024-02-29osmo_io: Add osmo_io_get_ioops() functionHarald Welte3-0/+10
This function can be used by user code to obtain the currently-set io operations, it's the inverse of osmo_io_set_ioops(). Change-Id: I03398c811b9534f50c6644b21eea89a04be29fb0
2024-02-29osmo_io_poll: Declare local functions "static"Andreas Eversberg1-8/+8
Change-Id: I6ba88cd7bbd5b5ef42eb460679696f105c9158cb
2024-02-29osmo_io_uring: Detach msghdr from iofd before calling ↵Andreas Eversberg1-1/+9
iofd_handle_send_completion() msghdr must be detached, because subsequent callback at iofd_handle_send_completion() may destroy the iofd (which in turn frees this msghdr, if still attached) and frees the msghdr, causing a double free. Related: OS#5751 Change-Id: Ia349f73de2145fa360b20dd40deb73a8ffc71f07
2024-02-28osmo_io_uring: Cancel pending request, free msghdr on completionAndreas Eversberg1-4/+19
There is always a completion after cancelling a uring request. Because uring requests use msghdr pointer as user data, we cannot just free the msghdr after cancelling. Upon completion (received after cancelling), the user data still points to the msghdr. To prevent a use-after-free bug, msghdr is not freed, but detached from iofd instance. Then upon completion, the msghdr (if it was detached from iofd) is freed. Additionally it is not required to keep IOFD_FLAG_IN_CALLBACK set anymore, if there is a msghdr attached to iofd. As described above, all msghdr get detached, if iofd is freed (uring request get cancelled) during callback. Related: OS#5751 Change-Id: Ic253f085dd6362db85f029f46350951472210a02
2024-02-28osmo_io_poll: Use -errno as result on read errorAndreas Eversberg2-1/+2
Related: OS#5751 Change-Id: Ida63b74feecddf96bab7b2ade4e9ad216fe56e06
2024-02-28osmo_io: Reject writing messages with length of 0Andreas Eversberg1-0/+15
io_uring will reject to transmit messages with length of 0. Change-Id: I94be5ec7344d92157f7853c6c0ddf7007513ba8e Related: OS#5751
2024-02-28osmo_io: Use poll/select to notify socket connection at osmo_io_uring.cAndreas Eversberg2-1/+76
In order to receive a connect notification from SCTP socket, poll/select event must be used instead of a write notification via io_uring completion event. Once the connect notification has been received, subsequent write notifications via io_uring are used. Change-Id: I4eca9ea72beb0d6ea4d44cce81ed620033f07270 Related: OS#5751
2024-02-28osmo_io: sendmsg/recvmsg supportHarald Welte6-20/+169
Add support osmo_io operations resembling sendmsg() and recvmsg() socket operations. This is what will enable the implementation of higher-layer functions like equivalents of sctp_recvmsg() and sctp_send() in libosmo-netif and/or other users. Change-Id: I89eb519b22d21011d61a7855b2364bc3c295df82 Related: OS#5751
2024-02-28osmo_io: Move notify_connected function to backendAndreas Eversberg4-2/+29
This relocation is necessary as the backend (osmo_io_fd or osmo_io_uring) requires a different approach in handling connect notifications. As a result, a function call has been introduced to struct iofd_backend_ops. In a subsequent patch, the process for the osmo_io_uring backend will be modified to handle SCTP connect notifications using poll/select. If connect notification is requested using poll/select, the file descriptior must be registered to osmo_fd, using osmo_fd_register. If read / write notification is requested by application, the file descriptior must be registered also. A flag is used prevent calling osmo_fd_register / osmo_fd_unregister multiple times, which would cause a crash. Change-Id: I905ec85210570aff8addadfc9603335d04eb057a Related: OS#5751