aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2024-02-22stream_cli: Call read callback even if connection failedjolly/workAndreas Eversberg1-1/+2
If connection fails, osmo_stream_cli_reconnect is called, to start a reconnect-timer. Addtionally the read callback is called, so that the user of the stream client gets a notifcation. Change-Id: Ie2335987c38863bad5de1d2d4dbdf4c8373f927f Related: OS#5753
2024-02-22stream_cli: Correctly setup and free osmo_io client instanceAndreas Eversberg1-8/+10
Completely free and setup osmo_io again when reconnecting. osmo_iofd_notify_connected() must be called before any registration of read or write, because osmo_io_iouring does not allow this. Change-Id: I91a6a76b9ff96034a7b333edf87af27490202932
2024-02-22examples/stream-*: Add options, to set local/remote peerAndreas Eversberg2-7/+14
This helps to test connections via a network and failing connections. The client may add "-r <peer>" to the command line, to set the address of the remote peer. The server may add "-l <peer>" to the command line, to select address of local peer. By default "127.0.0.1" is used. Change-Id: Ie6da55ef248436e521c5d8f21f8053356c46a114
2024-02-15stream_{cli,srv}: Fix memory leak, if sending a message failsAndreas Eversberg4-7/+15
Also the example client/server must not access msgb after sending it, especially if the msgb got freed due to a failure. Change-Id: I627a71b4f0183cd83835c328a5cdd67a413ae614
2024-02-09examples/stream-*: Support SCTP when called with "-s" argumentHarald Welte2-5/+35
Change-Id: I4137cdf1e21cb669b632fe5c126ec27475d98400
2024-02-08stream_{cli,srv}: Add support for SCTP in OSMO_IO modeHarald Welte3-7/+21
Let's enable the OSMO_IO_FD_MODE_SCTP_RECVMSG_SEND mode for SCTP sockets, allowing OSMO_STREAM_MODE_OSMO_IO to be used with SCTP. Change-Id: I6cf5bad5f618e71c80017960c38009b089dbd6a1 Depends: libosmocore Change-Id: I89eb519b22d21011d61a7855b2364bc3c295df82 Closes: OS#5753
2024-01-26build: include git-version-gen into the release tarballVadim Yanitskiy1-0/+1
Change-Id: I6abf594cbe1677f53e99ceb046ed69d68b7528ba
2023-12-12stream_srv_link: osmo_stream_srv_link_get_sockname() now returns the full ↵Pau Espin Pedrol1-11/+31
set of addresses As a result, internal stream_srv_link logging will also show the whole set of listening addresses. This is mostly fine since it mainly happens only once, during connection accept(), and this way it provides full view of where from and where to the client connected. Depends: libosmocore.git Change-Id I18a0e1a652a3e8ef3e97154355eb1d07a14ef0bd Related: SYS#5581 Change-Id: I216502a9aeafe638940f110bc9fddf2504b2ac3a
2023-12-08stream_cli: Introduce API osmo_stream_srv_get_sockname()Pau Espin Pedrol3-0/+15
Similar to what osmo_stream_srv_link and osmo_stream_cli already have. Change-Id: I171befd1fdf40c3cbb3fc7e4c3eedf82128b0712 Related: SYS#5580
2023-12-08stream_cli: osmo_stream_cli_get_sockname() now returns the full set of addressesPau Espin Pedrol2-3/+5
This is used by API callers, and internally to log connected/disconnected events. Related: SYS#5581 Change-Id: I249ee7cad824cf971faabe06d10de2426c1b0c8b
2023-12-08netif: sctp.h: Introduce value_string for enum sctp_sstat_statePau Espin Pedrol2-0/+19
This can be used by apps retrieving struct sctp_status through getsockopt(SCTP_STATUS). The relevant field is spinfo_state: osmo_sctp_sstat_state_str(st.sstat_state); Change-Id: Id7d8a9ad7b32406ac603e520b33809d7ae5c762f Related: SYS#6636
2023-12-08netif: sctp.h: Introduce value_string for enum sctp_spinfo_statePau Espin Pedrol2-0/+15
This can be used by apps retrieving struct sctp_paddrinfo through getsockopt(SCTP_GET_PEER_ADDR_INFO). The relevant field is spinfo_state: osmo_sctp_spinfo_state_str(pinfo.spinfo_state); Related: SYS#6636 Change-Id: I78a0bd8279a04f4011c7273e0f542981308e482f
2023-12-06stream: Add missing osmo_stream_srv_link_get_fd() APIPau Espin Pedrol2-0/+9
osmo_stream_srv and osmo_stream_cli already had that API introduced in order to use it instead of *_get_ofd(), since the later will eventually be deprecated due to incoming osmo_io. Change-Id: I1bd3f790d93af74c150938a59108b882ad2820f3
2023-12-06stream_cli: Fix opening sctp client socket if no local address setPau Espin Pedrol2-4/+14
Properly call osmo_sock_init2_multiaddr2() to use default binding address if user of osmo_stream_cli didn't set one on the object through the API. osmo_sock_init2_multiaddr2() was also borken under that scenario until recently (see Depends below). Until now, users of osmo_stream for SCTP (mainly libosmo-sccp) relied on always setting a proper local address to overcome this limitation. Depends: libosmocore.git Change-Id I2641fbaca6f477404b094dbc53c0c1a3dd3fd2fd Related: OS#6279 Change-Id: I0d9d0e48690c915f7b51ad09f452e551e01368b5
2023-11-21Introduce generic osmo_stream_{cli,srv}_get_fd() APIHarald Welte3-6/+30
The old osmo_stream_{cli,srv}_get_ofd() API only works for streams in OSMO_FD mode. However, it is legitimate for an application wanting to get low-level access to the file descriptor, for example to issue some {get,set}sockopt() calls on it. Change-Id: Ib0737f21150f6ac8d524b92c7ddb098f2afdeaab Related: OS#5753
2023-11-20stream_srv: osmo_stream_srv_get_ofd() works only in OSMO_FD modeHarald Welte1-0/+1
The corresponding client function osmo_stream_cli_get_ofd() already contained an OSMO_ASSERT, but the server side was missing this so far. The 'ofd' member only has meaning in the context of OSMO_FD, so calling that function from generic code is wrong! Change-Id: I50df259040e011135a31fe1aee231eba430fa94a Fixes: Change-Id I2f52c7107c392b6f4b0bf2a84f8c873c084a200c Related: OS#5753
2023-10-24stream_srv: Make osmo_stream_srv_clear_tx_queue() aware of osmo_ioDaniel Willmann1-2/+13
Change-Id: I818fe4e3792ed88ae4d6fd6afb677b39264ab662
2023-10-18stream_test: Fix memleaksarehbein1-15/+33
- Clean up all allocations, introduce clean memory management to entire test Related: OS#6222 Change-Id: Ica25fcd71e8bf8946def3ea7ce320354ea6edb3a
2023-10-18stream_test: Improve mem mgmt, fix connection mgmtarehbein2-81/+79
- Use tall_test as root context everywhere, don't create any other contexts - change .*_(cli|srv)_run_client() signature by adding talloc context as parameter - Open and Close server link inside test_recon() Related: OS#6222 Change-Id: I9ef02ed113bc049ae430b93d0eb69641e2ee809b
2023-10-09stream: Add and use helper function osmo_ipa_push_headers()arehbein5-10/+27
Related OS#5753, OS#5751 Change-Id: I61e1fe59166c46595efe8c1f32b8f2607cb6c529
2023-10-05stream (test): Fix Coverity CID 323456arehbein1-1/+1
Fix Coverity CID 323456 ("Control flow issues (NO_EFFECT)") by removing 'greater than 0'-check on unsigned integer-type variable. Change-Id: I2efb28feae4d4fa7516702f01026af09aa3777ac
2023-10-02stream: Add client-side (segmentation) support for IPAarehbein7-18/+315
With this commit, IPA segmentation is taken care of by setting the segmentation callback provided by libosmo-netif. The ipa-stream-server example needs to prepend IPA headers now because those are stripped by the segm. cb on both sides. Depends: libosmocore.git I3a639e6896cc3b3fc8e9b2e1a58254710efa0d3f Related: OS#5753, OS#5751 Change-Id: I822abf52c6ae396c90b5c50228a0a39c848d3de6
2023-10-02stream_test: Disable naglingarehbein1-0/+1
Disable nagling to make kernel packet processing time more predictable Change-Id: I7e8f6851df28e006fcb714673b97cf7b6be367bf
2023-09-29stream_srv: Fix connection error handlingDaniel Willmann1-12/+16
If read returned an error or the stream got closed then simply destroy the connection. If the user code called osmo_stream_srv_set_flush_and_destroy() then ignore any incoming messages and destroy the connection once the tx queue is empty. Change-Id: I84eea2717f3762830f3f5b115e6fc8545eaa4fd5
2023-09-25stream_srv: Set io_fd pointer to NULL after freeingarehbein1-0/+1
Change-Id: Idb815a3e4e51189f9f1f3cceedd570dff9caf401
2023-09-19ipa: Don't break strict aliasing rulearehbein1-1/+13
Somehow gcc doesn't always warn about this rule being broken. We are breaking the strict aliasing rule here and libosmo-netif currently does not make use of the '-fno-strict-aliasing' flag. It's possible that this has also been causing nondeterministic timestamps in libosmo-netif stream tests every once in a while. Related: OS#6164, OS#5753 Change-Id: Ibed543cdfcdda8c0256ce7d8818ff96d6d46e9b0
2023-09-12Bump version: 1.3.0.56-745c-dirty → 1.4.01.4.0Pau Espin Pedrol7-13/+84
Change-Id: I2f0d6617c89cff83b1937996006ffe7106db2557
2023-09-12stream: Add new stream_{cli,srv_link} parameters to set SCTP_INITMSG sockopt ↵Pau Espin Pedrol3-0/+48
values This will allow osmo_stream users (like libosmo-sccp) to set SCTP_INITMSG related parameters, like number on inbound/outbound streams, connect attempts, connect timeout. Related: SYS#6558 Change-Id: I5343c7659881b29e0201e72badbc2d07e1ef2dca
2023-09-08stream: Introduce API to set several transport parametersPau Espin Pedrol4-34/+85
This will allow extending capabilitites to set different parameters at the lower layers as we need them. This commit changes the behavior of osmo_stream_{cli,srv_link}: It now doesn't enable by default SCTP AUTH/ASCONF features using setsockopt. It is left up to the user of the API (libosmo-sccp in this case) to set it. Since this unilateral use of setsockopt() has only been added recently and we didn't release yet, it's fine changing it. libosmo-sccp will be changed to unconditionally set its using setsockopt. It is left up to the user of the API (libosmo-sccp in this case) to set it. Related: SYS#6501 Related: SYS#6558 Change-Id: I2607c1c926a625986cd851adc65dd8b4de83d6ab
2023-09-08stream: Use new libosmocore API osmo_sock_init2_multiaddr2()Pau Espin Pedrol3-8/+40
Use the new API available in libosmocore to set sockopts related to ASCONF SCTP features. The old flag OSMO_SOCK_F_SCTP_ASCONF_SUPPORTED has been dropped. This only affects master builds since there's no release ever done with that flag defined. Depends: libosmocore.git Change-Id I1f6fd09a79b0a2bd794e5669d933be25bbf1eeaa Related: SYS#6501 Related: SYS#6558 Change-Id: I2b2073de72625b4f4f99892179c9406163d28592
2023-09-04stream_test: Avoid leaking osmo_stream_srv_linkPau Espin Pedrol1-0/+3
Change-Id: I43b7327893c220447492d2c36c87b187a414cbdb
2023-08-25stream test: Fix test output checkarehbein2-0/+3
A previous commit added additional logging information, necessitating changes to the test code as well as to the output check. Related:OS#5753 Change-Id: Ib8f01c3651c13814c212328946415094da39d6a8
2023-08-25stream: Add server-side (segmentation) support for IPAarehbein5-10/+363
With this commit, IPA segmentation can be taken care of by setting the segmentation callback osmo_ipa_segmentation_cb(). Depends: libosmocore.git I3a639e6896cc3b3fc8e9b2e1a58254710efa0d3f Related: OS#5753, OS#5751 Change-Id: I6c91ff385cb5f36ab6b6c96d0e44997995d0d24c
2023-08-21stream: Use new flag OSMO_SOCK_F_SCTP_ASCONF_SUPPORTED for SCTP socketsPau Espin Pedrol2-3/+3
This is required if the user of the stream API wants to use SCTP extra features such as setting the Peer Primary Address through ASCONF. At a later point we may want to add new osmo_stream APIs to set extra flags for the socket, or maybe simply add a new API specifically to enable ASCONF for the stream. Depends: libosmocore.git Change-Id Iac07031927b66a9d32d2bb2faab817e4c922a359 Related: OS#6076 Change-Id: I807b3748b8535d8e75ceea812d7baaf153fa1d60
2023-08-21stream_cli: Forward SCTP MSG_NOTIFICATION to upper layersPau Espin Pedrol1-2/+41
Same mechanism as already used in stream_srv. Change-Id: I4cb94d264109f1b763cccd44c6ba049cc7509319
2023-08-21stream: Refactor sctp_recvmsg_wrapper() loggingPau Espin Pedrol3-73/+85
*Move the helper function to stream.c and pass a logging prefix string so that it can be used by both client and server. * Adapt log level based on message type. * Rework logging code to log everything in one line Change-Id: I0ed84cc2effb71b6ef1f6efb3f8b663c602a5a31
2023-08-07stream_srv: Log SCTP REMOTE_ERROR eventsPau Espin Pedrol3-0/+43
The event was enabled but was not being logged. Change-Id: I49f5a648fd474e320101424fb6873a37442339bf
2023-08-07stream_srv: sctp: Log error cause of COMM_LOST eventPau Espin Pedrol1-1/+2
RFC 6458 6.1.1: """ sac_error: If the state was reached due to an error condition (e.g., SCTP_COMM_LOST), any relevant error information is available in this field. This corresponds to the protocol error codes defined in [RFC4960]. """ Change-Id: Ie48360d22ce1e35eefb1a305dde106948dfa80e8
2023-08-07sctp: Document relevant RFC specsPau Espin Pedrol1-0/+6
Change-Id: Iae325b787fdb7fc95aa6922975a7e1fcf368527a
2023-08-07stream_cli: Proper handling of send() socket errorsPau Espin Pedrol1-3/+9
Upon EAGAIN, simply re-enqueue the message and return waiting for next poll. Upon any other error, force close + reconnect. Related: OS#6134 Change-Id: I462cb176ebc51f3e99ee796310e8665144c84ccc
2023-08-07stream_srv: Handle ESHUTDOWN and other write() errors destroying the socketPau Espin Pedrol1-4/+15
If internal send() fails with a fatal error, it should destroy the socket. The user will know about the event through the close_cb() called during osmo_stream_srv_destroy(). As a result, the socket is not closed when receiving SHUTDOWN by the peer (through SCTP MSG_NOTIFICATION), but keep it alive since the socket can still keep receiving data from the peer. Only fail if write() to that read-only socket is attempted. Related: OS#6134 Change-Id: I84ddebabdffe47733cb529bcfebec8757e6a172b
2023-08-07stream: Append data to current tail of message upon recv()Pau Espin Pedrol2-5/+6
The previous behavior was not standarized, and even erratic under some code paths (passing msgb_data() and size=msgb_tailroom()). This patch standarizes the behavior, and makes it possible to append content if the user wishes so instead of erasing old data in the msgb passed to it. Change-Id: I2cfcd4f61545e6a76d84495c3467999efccf22df
2023-08-07stream_srv: Improve logging lines accepting new connectionsPau Espin Pedrol2-3/+6
Change-Id: Iaca9a99417d2f1dbf449e2b20e5dfcdd5e05b683
2023-08-07stream_srv: call setsockopt(SO_NOSIGPIPE) also in srv socketsPau Espin Pedrol2-1/+17
Commit 5b0ad8bd851e4ce888b386be68c1821e4f2ca301 added call to setsockopt(SO_NOSIGPIPE) in order to avoid SIGPIPE being signalled on platforms not supporting send() flag MSG_NOSIGNAL (macOS, FreeBSD etc...). While it may be a topic to discuss whether we support those platorms or not, the fact that we call an extra setsockopt() during socket creation doesn't hurt much, and for sure we want to have the same behavior in client and server. Hence, this commit adds the same behavior pesent in srv sockets to cli ones. Change-Id: I867d8e244e473679abb7e7e7a9b531eeed046436
2023-08-07stream_srv: Use LOGSLNK() to print log linePau Espin Pedrol1-2/+2
Change-Id: I9aaa63b676b1cd77c7ea500f9bceda989db50db0
2023-08-07stream_cli: Increase log level of established conn to INFOPau Espin Pedrol2-1/+4
Change-Id: I49776db0b12ee46b629381d2fa2b501c2a63e390
2023-08-07ipa: Add segmentation callbackarehbein2-0/+76
Related: OS#5753 Change-Id: I87ef4c7023126b783dd79e7ed47be31e1b76f975
2023-08-07examples: Add extension header octet to examplearehbein3-2/+10
Mainly to make data/packets look (pseudo-)correct in Wireshark. Also: Add helper for allocating message buffers with extended headroom for IPA. Change-Id: I962b9edcba65cdc98da00d2f8753dc5acd481502
2023-08-04stream: Split cli/srv specific code out of stream.cPau Espin Pedrol6-1786/+1938
The dev/user in general is only interested about one side of the stream when looking at the code. Since the stream.c file is tarting to be quite large/bloated, this patch splits its content into stream_cli.c and stream_srv.c to make it easier to improve/extend and review. Keep common code between cli and srv in stream.c, and add a private header to contain references to it. Change-Id: I22af01bba2040eb320ba48fd1b46c090c98be159
2023-07-25stream: Fix osmo_panic log fmtsarehbein1-4/+5
Change-Id: Id082a9473b788f8de20cdc2ba4430b3289f4ce5a