Age | Commit message (Collapse) | Author | Files | Lines |
|
Define a txlush() callback which can be set on a connection and
which will be invoked whenever the tx queue is empty upon entry
to osmo_stream_srv_send().
Change-Id: I4c63584af69f9a1ee5622a709756916bfef474ee
|
|
On destroying a client or server stream, deallocate any msgbs that are still
pending in the queue.
In libosmo-sccp, the ss7_test.c in test_as(), messages are queued and were,
before this, left floating after the stream was destroyed, causing a sanitizer
memory leak. This patch fixes the leak.
Depends: Ia291832ca445d4071f0ed9a01730d945ff691cf7 (libosmocore)
Change-Id: Iaad35f03e3bdfabf3ba82b16e563c0a5d1f03639
|
|
In previous implementation, if no reconfiguring is needed, a new socket
would be created without closing the old one, leaking the previous
socket. Instead, if we don't need reconfiguring, we return 0 as no
operation is required.
Change-Id: I6c1a7fff63e44840fb5e2bc7ace5e9a61e304987
|
|
Change-Id: I43bb1c4a889421907a1a08eb29c96f2330ab00ec
|
|
Change-Id: I5fa2696c5090994c417ca882c5225cbd7c1be2c7
|
|
This fixes a related dpkg-shlibdeps warning
Change-Id: I0325e7a6dea5195f1634230930570bf4dfe3810c
|
|
Short changelog:
* Add Doxygen documentation
* SCTP support in stream.c
* new udp-test-client and udp-test-server programs
* better / more verbose error handling in examples
* new osmo_dgram_tx_set_local_{addr,port}() functions
* use IPA definitions from libosmogsm, rather than repeating them
* encode RTP header M field of RFC3550/4867 in OSMUX header
* new osmo_stream_srv_link_set_nodelay()
* new osmo_stream_srv_link_set_proto()
* new osmo_stream_cli_set_nodelay()
* new osmo_stream_cli_set_proto()
* new osmo_stream_cli_set_local_addr()
* new osmo_stream_cli_set_local_port()
* new osmo_stream_cli_reconnect()
* new osmo_stream_cli_open2() with reconnect argument
* more vrebose osmux_snprintf()
* remove mistaken reference to AGPL in rs232.c
* fix memory leak in osmo_stream_srv_link_set_addr()
* add osmo-pcap-test for SLL and Ethernet
* extend osmux-test
Change-Id: Ibf75fcd6643351ce3946faa155ae1db8c33a5e35
|
|
Change-Id: Ied83e6b117a420d734a88e3aff925a874c3dd520
|
|
Change-Id: Idb3fcf25be9558bfc2f822352c07ebc2cb7d5caa
|
|
Previous implementation handled all types as if they were Osmux AMR
frames. For Dummy frames, we account the padding but we don't care about
the padding content. For Signalling ones, as they are not in the
specification yet, it is better avoid using unespecified fields and
return an error because it's still not known how extra data will be
handled in the input msgb.
Change-Id: I48565472b47c2a0e5db50881fbb005537af8c70d
|
|
The current code still expects to parse only AMR osmux frames, but that
will be fixed in following patches.
Change-Id: Ic2f4d1d3cc88af912bb43c8ecd90eacc6ff7190f
|
|
Change-Id: Ic9557c6519b44b5985daf7d2d14ec063790441fb
|
|
Previously recv() returning 0 for UDP socket was considered as error
although it's legitimate return value for empty UDP packets. Relax the
error check to avoid confusing error messages.
The function behavior is the same:
* msg is not altered while receiving 0-length UDP packet
* return value is 0
The only result of the relaxed error check is the absense of error log
message for 0-length UDP packet.
Change-Id: I32e5fcbf5ed92cc923660ac59e6a37fd3f0703a7
Fixes: OS#2219
|
|
There's no need for the rs232 code to include a files from
libosmoabis. The only users of libosmoabis left now are the LAPD
examples:
examples/lapd-over-datagram-network.c
examples/lapd-over-datagram-user.c
Change-Id: Ie1bc0dd811362cec546486edc41d632740ed19cd
|
|
This patch inconditionally initializes the buffer we get to
nul-terminate it, whenever possible. It's a very simple solution to
catch three overly corner cases:
1) snprintf() returns -1, very much unlikely in practise.
2) msg->len == 0: In such case, I would expect this function is never
called with an empty message, but let's be safe in this case too.
3) If your buffer is empty, it doesn't nul-terminate the buffer.
Change-Id: I97e517f2d98e83894ea707c63489559302ff6bd2
|
|
SNPRINTF_BUFFER_SIZE() looks too complex, previous version maintains two
different variables to account for the remaining space in the buffer,
one of them is always decremented based on what snprintf() returns,
which may result in underflow. These variables are swapped - not used
consistently - all over this code.
Replace this macro by a simplified version, with one single parameter to
account for remaining space. This macro also deals with two corner
cases:
1) snprintf() fails, actually never happens in practise, but
documentation indicates it may return -1, so let's catch this case
from here to stick to specs.
2) There is not enough space in the buffer, in that case, keep
increasing offset, so we know how much would have been printed, just
like snprintf() does.
Thanks to Pau Espin for reporting, and Holger for clues on this.
I have run osmux_test and, at quick glance, it looks good.
Change-Id: I5b5d6ec57a02f57c23b1ae86dbd894bad28ea797
|
|
Instead of the result of the last snprintf() call.
Change-Id: I10066d73387be96a4e1f3349d700405beb138076
|
|
The buffer for osmux_test is increased as the former doesn't seem to be
able to cope with the whole output.
Change-Id: Ic838dd9d7ad89b4510ccfa58c0390c69a075b616
|
|
When running osmux_test on my PC, the process was aborted with a "stack
smashing detected" error.
Change-Id: I8a7cc422c181c0c5712ac8976a5be5f0ad44a9c0
|
|
Fixes compilation warning
Change-Id: I0146a19bf852c9e27d265a098dc9d7a337424e10
|
|
Use new function available in libosmocore to set up timers. Compile
tested only.
Change-Id: Id3dd32102c7362f3b280d2c058c2decebccb357a
|
|
We didn't check for cases where setsockopt_nodelay() fails. Let's check
for that and bail out + close the socket.
Change-Id: I0adbc4cec35be7c36bdf01d4d8fefd6097e9be5d
Fixes: coverity CID#166970
|
|
We couldn't figure out what "crx" as supposed to mean and assume
it is a typo. Fix the code and call it ctx, this is fixing the
API documentation as well.
Change-Id: I27ed1178fdbbcf3fc0e1070dc19b4ecf9a327a04
|
|
AMR frame contains 160 samples at 8000Hz -> 20 ms long
Change-Id: I36dc69f9caf591dd1b578bc914a2ce426c7f2813
|
|
This way we can use fake time and osmux_test take 700ms instead of
>2sec to run.
Change-Id: Ic39cab74400aca8262a00c0d06884230b1a15ca3
|
|
According to RFC4867 (RTP payload format for AMR):
"The RTP header marker bit (M) SHALL be set to 1 if the first frameblock
carried in the packet contains a speech frame which is the first in a
talkspurt. For all other packets the marker bit SHALL be set to zero (M=0)."
This information bit provides a way for the receiver to better
synchronize the delay with ther sender.
This is specially useful if AMR DTX features are supported and
enabled on the sender.
Change-Id: I0315658159429603f1d80a168718b026015060e9
|
|
This commit should fix a bug present if for instance batch_factor < 8
and osmux_batch_enqueue is called from osmux_replay_lost_packets and
enough packets were lost from last received packet.
Change-Id: I5d643810949aeca4762f0cad05eed534d35087f7
|
|
Change-Id: I9fcc8e94b2fcd843b10cb3f8f009f2348eb3a4af
|
|
Enabling sender_dry_event in SCTP_FLAGS breaks reliable delivery of DATA
chunks to the scoket user on Linux. Let's avoid enabling that, while
still enabling various other interesting events.
See https://bugzilla.redhat.com/show_bug.cgi?id=1442784 for all related
details.
Change-Id: Ib616cd07a6044ca2ee7e05093b22df3369c62b56
|
|
We were using the wrong variable when setting the SCTP_NODELAY,
resulting in the setsoctkopt() fialing.
Change-Id: Ic04cb8bb5ff41f177f7f5b7f7e2a2ecc686dd4c0
|
|
So far we seem to assume that the accept_cb does all handling of socket
fd cleanup. However, there are cases where there is no accept_cb set,
the accept_cb returns error, or an earlier sctp_sock_activate_events()
or the activation of non-blocking mode fails.
For those cases, close the socket and return an error code.
Fixes: CID#57915
Change-Id: I3a3ce9194ab7ca5c1921fc79c2a1c9e10a552cf0
|
|
In a659590e29412588bca2243b8329e82286244b00 we fixed endianness issues
with the Stream ID field, but at the same time mistook the PPID field
for 16bits. In reality it is 32bits, and hence our 'htons' is rendering
wrong PPID values.
Change-Id: I1b60523044835ee630dba9a43d26af4f1ebd1ced
|
|
Using this function, the user can configure if sockets related to the
respective stream client or server should have the NODELAY socket
option set in order to avoid Nagle algorithm or related algorithms
that may introduce packet delay on the transmitter side.
Change-Id: Ibeb9ba227bab18f7f4f16518c0022c4f003cc8e9
|
|
In their infinite wisdom, the inventors of SCTP designed an API (the
sockets API described in RFC6458), where some members are in host byte
order (like the stream identifier), while other members are in network
byte order (like the PPID).
Let's handle this properly (we assumed both are network byte order), and
also use 16-bit htons/ntohs fo the PPID, rather than htonl/ntohl.
Change-Id: I777174ca2915c6de0063db41a745c71b4a09bbec
|
|
* when using osmo_*_destroy(), always call *_close() internally to
make sure we don't free memory holding references to sockets that are
still open
* when closing the socket, always make sure to set the fd to -1 in all
cases, to avoid attempts to avoid later close() on a new file using
the same fd number as the socket closed previously.
Change-Id: I29c37da6e8f5be8ab030e68952a8f92add146821
|
|
during osmo_*_set_addr(), we must make sure to talloc_free() any old
address before copying in the new address. Not all functions did this,
and those that did implemented it manually. Let's use
osmo_talloc_replace_string() which is exactly intended for this case.
Change-Id: Ie1b140a160c66e8b62c745174865d5ba525cb2c2
|
|
This uses the new osmo_sock_init2() features introduced in libosmocore
Change-Id Idab124bcca47872f55311a82d6818aed590965e6 to bind *and*
connect a given socket during creation.
Change-Id: I013f4cc10b26d332d52d231f252bb0f03df8c54b
|
|
Change-Id: I87e08bd84236ae5d5c057bca96d122e568a6b52a
|
|
We should have doxygen documentation for all libosmo-* APIs.
libosmo-netif is currently devoid of any API docs. Let's start with the
stream and datagram socket related functions.
Change-Id: I589a5e60d9df2b8a65fbaf68f80e3ae0039d8c2a
|
|
Change-Id: If0875cfa3eba9ef36acc0c4bfd0d168a45c380b9
|
|
without setting the BSC_FD_* flags prior to reconnection, the re-connect
would happen silently and the client program would not be notified via the
connect_cb().
Change-Id: Iaf8ec8662cf83476eee1b76fa41dc57f063f0ad3
|
|
In case the application is using the read-callback and a read returns 0,
then the application itself would want to trigger the reconnect. This
is different from the osmo_stream_cli_recv() case where the reconnect
can be handled internally to the library.
Change-Id: I41314bad4a9f44e8a61b9d2ba33d1a76b25bd145
|
|
if osmo_stream_cli_destroy() is called while the reconnect timer is
running, we would end up in a crash.
Change-Id: If6597130f472f1e2b8d9682002250ecd54675bb0
|
|
We use the magic value '-1' in case the file descriptor is not yet
initialized. If somebody calls osmo_stream_*_close() before this
changes, we used to crash. Let's check for this and avoid a crash.
Also, after close let's change the fd to -1 again to mark the fd
invalidity.
Change-Id: I3aa04999ab01cb7971ee2dad45dfc31ab4142868
|
|
The reconnect behavior was likely broken in commit
de3f57a8293a5b39435d6f283da23e0172bad8bb
If the user requests a re-connect, we should start it. Not only in case
the connection drops later, but also if the initial connection itself
fails.
Change-Id: I817e026404cbd9145cae2ce90bc57a1db1d2e12b
|
|
Change-Id: I5baf369dbf3948565614476980a32be59abaf42a
|
|
Change-Id: I7c73d1a0b15cfb2a729687cde6f9a8e62a230fd7
|
|
osmo_sock_init() never returns -1 + errno EINPROGRESS. It will return a
positive fd in case the connect operation is in progress. Therefore,
the related code in osmo_stream_cli_open2() was impossible to execute.
Change-Id: Id3483d1d1d4d2eabba94729ea29e5c93b33abff0
Fixes: Coverity CID 57861
|
|
Change-Id: Ia777221cd0472cd1e7aa79e5146b07048a545dd8
Fixes: Coverity CID 57860
|
|
When the setsockopt() in sctp_sock_activate_events() indicates an error,
let's print an error message in the log about this.
Change-Id: I5920154e23debe6d01eaa156005db0842f1a18cc
Fixes: Coverity CID 57634
|