aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2020-08-13Bump version: 0.7.0.24-b1e0 → 1.0.01.0.0Harald Welte1-0/+46
Change-Id: Ic461c50c89e3e877e6f498974be6f5fc6e067f28
2020-07-06stream: Fix some SCTP code not disabled if --disable-libsctp is usedPau Espin Pedrol1-0/+2
Some previous commit added some code to workaround some kernel ABI unstabilities but forgot to add the code inside a conditional preprocessor block. Fixes: 157ad6d7075ad56038c984ebf8634f1bc7c6c59c Change-Id: Ibee01222d8d11cf2520cdbd4d0d5bed6b72d2107
2020-06-03src/stream.c: Don't leak socket during SCTP_EVENTS getsockoptHarald Welte1-0/+1
In Commit Icc49f347cdc0bb77a5c0e230597d662ac35b4acc I forgot to close the socket :/ Change-Id: I384c61dac0eac8ad999ff0d62350c2fcf3e57ea9
2020-06-02src/stream: Work around more Linux kernel ABI breakageHarald Welte1-20/+93
Back in Change-Id Ia95dd1f9ffed9f743c049e05797b1a6f1f9f8c69 we tried to work-around kernel ABI breakage introduced in kernel >= v5.5, but it seems that there have already been similar ABI breakages in v4.11 and v4.12. See https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/uapi/linux/sctp.h?id=b6e6b5f1da7e8d092f86a4351802c27c0170c5a5 and https://marc.info/?l=linux-sctp&m=158729301516157&w=2 for the most recent incarnation. See https://osmocom.org/issues/4573#note-6 for all known cases of SCTP_EVENTS ABI breakage. Closes: OS#4573 Change-Id: Icc49f347cdc0bb77a5c0e230597d662ac35b4acc
2020-05-25amr: fix off-by-one in osmo_amr_bwe_to_oa()Philipp Maier3-10/+10
The for loop in osmo_amr_bwe_to_oa, that converts the body part of the AMR payload runs one byte too far. This may cause that some of the padding bits in the end are not set to zero. The loop is designed to convert n-1 bytes and the nth byte is done separately at the end. Change-Id: I91e755b83aaac722079879c026d913cc446812d1
2020-05-22Makefile.am: EXTRA_DIST: debian, contrib/*.spec.inOliver Smith1-1/+6
Change-Id: Ibd97cb239570b1d056ccbf02b101d4c5fe4d4211
2020-05-19contrib: integrate RPM specOliver Smith3-7/+5
Remove OpenSUSE bug report link, set version to @VERSION@, make it build with CentOS 8 etc. Related: OS#4550 Change-Id: I8b4646ffc8c79d717ada2f0d8da14a721000c2e4
2020-05-16amr: Whitespace fixAlexander Chemeris1-1/+1
Change-Id: I7da6813a501ee97ca54611f627870c7eb842ddbe
2020-05-16amr: Fix OA<->BWE conversion.Alexander Chemeris4-82/+163
Size of a single AMR frame doesn't always shrink by a byte when converted from octet-aligned to bandwidth-efficient mode. It does shrink for AMR modes 2, 3, 4, 6, and 7 but doesn't shrink for AMR modes 0, 1, 5, and SID frames because we only remove 6 bits. So old code generated truncated AMR packets for those AMR modes. This patch fixes the length calculation by properly counting bits. Proper bit counting is also bringing us one small step closer to properly handlig multi-frame AMR packets. Change-Id: I0462e054a0adc9080456f3eeea9cab7c229cdb70
2020-05-16contrib: import RPM specOliver Smith1-0/+89
Copy the RPM spec file from: https://build.opensuse.org/project/show/home:mnhauke:osmocom:nightly Related: OS#4550 Change-Id: I81f40799d71d493b60496261464364440390bc1c
2020-05-14Revert "amr: Fix OA<->BWE conversion."neels4-144/+74
This reverts commit 002a51e2180cf19bf5e11e16d78271998d0b3f5c. Reason for revert: amr_test fails with sanitizer build: Sample No.: 6 bw-efficient: a7bfc03fc03fc03fc03fc03fc03fc03fc03fc03fc03fc03fc03fc03fc03fc03f 1010011110111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111 ../../../src/libosmo-netif/src/amr.c:63:24: runtime error: index 15 out of bounds for type 'size_t [9]' ../../../src/libosmo-netif/src/amr.c:63:24: runtime error: load of address 0x7f69498e56b8 with insufficient space for an object of type 'size_t' 0x7f69498e56b8: note: pointer points here 00 00 00 00 00 00 00 00 00 00 00 00 5f 00 00 00 00 00 00 00 67 00 00 00 00 00 00 00 76 00 00 00 ^ ================================================================= ==489935==ERROR: AddressSanitizer: global-buffer-overflow on address 0x7f69498e56b8 at pc 0x7f69498abec7 bp 0x7ffeafb35330 sp 0x7ffeafb35328 READ of size 8 at 0x7f69498e56b8 thread T0 #0 0x7f69498abec6 in osmo_amr_bytes ../../../src/libosmo-netif/src/amr.c:63 #1 0x7f69498ac661 in osmo_amr_bwe_to_oa ../../../src/libosmo-netif/src/amr.c:193 #2 0x5648b11afb96 in osmo_amr_bwe_to_oa_test ../../../src/libosmo-netif/tests/amr/amr_test.c:134 #3 0x5648b11af31d in main ../../../src/libosmo-netif/tests/amr/amr_test.c:235 #4 0x7f6948d5de0a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x26e0a) #5 0x5648b11af3d9 in _start (/n/s/dev/make/libosmo-netif/tests/amr/amr_test+0x43d9) 0x7f69498e56b8 is located 8 bytes to the left of global variable 'amr_ft_to_bits' defined in '../../../src/libosmo-netif/src/amr.c:32:15' (0x7f69498e56c0) of size 72 0x7f69498e56b8 is located 48 bytes to the right of global variable 'amr_ft_to_bytes' defined in '../../../src/libosmo-netif/src/amr.c:44:15' (0x7f69498e5640) of size 72 SUMMARY: AddressSanitizer: global-buffer-overflow ../../../src/libosmo-netif/src/amr.c:63 in osmo_amr_bytes Change-Id: I8232521c513722435e71dc90bdbfee10f8f83496
2020-05-14amr: Fix OA<->BWE conversion.Alexander Chemeris4-74/+144
Size of a single AMR frame doesn't always shrink by a byte when converted from octet-aligned to bandwidth-efficient mode. It does shrink for AMR modes 2, 3, 4, 6, and 7 but doesn't shrink for AMR modes 0, 1, 5, and SID frames because we only remove 6 bits. So old code generated truncated AMR packets for those AMR modes. This patch fixes the length calculation by properly counting bits. Proper bit counting is also bringing us one small step closer to properly handlig multi-frame AMR packets. Change-Id: I9fc5fb92e9bada22a47a82fcfb0925e892e50ced
2020-05-09Use OSMO_FD_* instead of deprecated BSC_FD_*Pau Espin Pedrol6-29/+29
New define is available since libosmocore 1.1.0, and we already require 1.3.0, so no need to update dependenices. Let's change it to avoid people re-using old BSC_FD_* symbols when copy-pasting somewhere else. Change-Id: I269690c1c9e4d19b5b69eef206b95e71f7931188
2020-05-08stream: Attempt to workaround kernel ABI breakageSylvain Munaut1-0/+16
See https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/uapi/linux/sctp.h?id=b6e6b5f1da7e8d092f86a4351802c27c0170c5a5 and https://marc.info/?l=linux-sctp&m=158729301516157&w=2 A kernel structure changed size, a new field was added at the end. Attempt to submit with the known "old" size. Signed-off-by: Sylvain Munaut <tnt@246tNt.com> Change-Id: Ia95dd1f9ffed9f743c049e05797b1a6f1f9f8c69
2020-04-18debian/control: Drop incorrect libortp-dev dependencyPau Espin Pedrol1-2/+1
Previous commit wrongly added this dependency while fixing formatting. Fixes: c9a86ff30636c1c7cf2af2f246796e622ed01169 Change-Id: I7c67709139187b88a222e854a2e80b4038a6ac3f
2020-04-11configure.ac: fix libtool issue with clang and sanitizerEric1-0/+5
As pointed out at https://github.com/libexpat/libexpat/issues/312 libtool does not play nice with clang sanitizer builds at all. For those builds LD shoud be set to clang too (and LDFLAGS needs the sanitizer flags as well), because the clang compiler driver knows how linking to the sanitizer libs works, but then at a later stage libtool fails to actually produce the shared libraries and the build fails. This is fixed by this patch. Addtionally LD_LIBRARY_PATH has no effect on conftest runs during configure time, so the rpath needs to be set to the asan library path to ensure the configure run does not fail due to a missing asan library, i.e.: SANS='-fsanitize=memory -fsanitize-recover=all -shared-libsan' export CC=clang-10 ASANPATH=$(dirname `$CC -print-file-name=libclang_rt.asan-x86_64.so`) export LDFLAGS="-Wl,-rpath,$ASANPATH $SANS $LDFLAGS" Change-Id: If9aa8a066d81cf378d6bbc0fa95ad6e985408af8
2020-01-28stream: Rename cli state NONE to CLOSEDPau Espin Pedrol2-6/+6
It makes a lot more sense calling it this way since it matches the state of the stream at that point. Change-Id: Ic02aec3f7f095e0e0e1f940425f577be5048e98f
2020-01-28stream: Add new WAIT_RECONNECT cli statePau Espin Pedrol2-10/+14
It's not really needed right now from logic point of view, since we reused NONE for that. But it makes logging and logic clearer, and will make it easier if we decide to move it to FSMs at a later point in time. Other state value_string names are also modified with its whitespace removed since anyway we'd need to change them to match WAIT_RECONNECT length. Let's drop the space because imho it's not that useful and anyway if we move to FSMs at some point then we won't have them anyway. Change-Id: I7b9a6da87081c418b0d14bab5f34369c5eca6fe8
2020-01-28stream: Re-arrange cli states to fix 100% cpu usage bugPau Espin Pedrol1-16/+11
With previous state, osmo_stream_cli_close() could be called from osmo_stream_cli_open()(), and in that case state was kept as NONE while ending up with an associated fd being registered in the select loop. As a result, osmo_stream_cli_fd_cb() could be called while in state NONE, which was not expected and would simply return without modifying fd state flags, causing it to be called again and again. Related: OS#4378 Change-Id: Ie3342f882893a71ad1538c17ad9ee9fa4433eaa4
2020-01-28stream: Drop data during write() while in state NONEPau Espin Pedrol1-1/+1
It should not happen anyway because no fd should be active if state is NONE, but still it's an extra check. Change-Id: I6d58762b7d10078eb8d0981c13d35cb6f85cfe86
2020-01-12add/clean big-endian packed structs (struct_endianess.py)Neels Hofmeyr3-27/+16
Change-Id: If408153af472a41dcea8d6f6aedd22adb16963d5
2020-01-09stream.c: Improve logging during sock send()Pau Espin Pedrol1-4/+4
Change-Id: Iff275c809ec2bb34f471d15bfdc92296566b76a7
2020-01-09configure.ac: Drop unneeded check for dahdiPau Espin Pedrol1-2/+0
This check was added during libosmo-netif's initial commit, and there's nothing requiring DAHDI in here. It's most possible a copy-paste artifact when creating configure.ac. Change-Id: Ief25a12696d797eaf50b0373e8310add93b9dc9e
2020-01-09configure.ac: Introduce --{enable,disable}-libsctp configure flagPau Espin Pedrol2-16/+38
Similar to what we do in libosmocore already, we want to deterministically enable or disable support for the feature without having into account if the system has a libsctp. If libsctp is missing and support is enabled, then fail. Extra checks are also added: * Check netinet/sctp.h header * Check libosmocore was built with libsctp support (API osmo_sock_init2_multiaddr() we require). * In stream.c make sure it can be built without HAVE_LIBSCTP, and that set_addrs() fails for more than 1 address (since that feature is only supported through osmo_sock_init2_multiaddrs()). Change-Id: I4b3e1f1894f13ac1175a71a5139c02a2633be26d
2020-01-07struct amr_header: copy comments to little endian partNeels Hofmeyr1-4/+4
I will soon apply struct_endianess.py to this code, and then the comments that are now only in the big endian part would be lost. Copy them to preserve them. Change-Id: Ie4279928bd77a5d425d0e7a3c4d58bac3cf0230a
2020-01-02Bump version: 0.6.0.16-6413a-dirty → 0.7.00.7.0Pau Espin Pedrol5-5/+28
Change-Id: Iabfa9a706c6456bf554ba59badbc3cbfc9210423
2019-11-20osmux_test: don't use color loggingNeels Hofmeyr3-214/+216
Change-Id: I7b0c8d311123f4fa0aeedf3938c8628a4442daf7
2019-10-22libosmo-netif.pc.in: Append -lsctp to Libs.privatePau Espin Pedrol1-0/+1
It will be used by the linker when linking statically against libosmo-netif. Change-Id: If25064d43363bace563e992828350f6d28543854
2019-10-21stream: Fix fd param passed to close() in error conditonPau Espin Pedrol1-2/+2
Fixes: CID#205089, CID#205087 Change-Id: I65714f214b9962862cda01605c7c2c578c78d3c7
2019-10-18tests: osmux_test: Hardcode h_output values set by random()Pau Espin Pedrol1-0/+3
osmux implementation randomizes those values. It seems build in OBS sometimes provide different values than the ones expected in the test result. Let's hardcode them to make sure we always have the same values regarless of the random() implementation. Values chosen are the one matching the current expected test output so it doesn't need any change. Change-Id: Icc553c83ddff41900ae3d5990a655c29c9073e01
2019-10-15stream: osmo_stream_cli: Support setting multiple addrPau Espin Pedrol2-12/+85
This API will be later used to set multiple addresses for SCTP sockets. Depends: libosmocore.git Ic8681d9e093216c99c6bca4be81c31ef83688ed1 Related: OS#3608 Change-Id: I09f0d989f2309abdeb304fe570355abed2cd107b
2019-10-15stream: osmo_stream_srv_link: Support setting multiple addrPau Espin Pedrol3-4/+39
This API will be later used to set multiple addresses for SCTP sockets. Depends: libosmocore.git Ic8681d9e093216c99c6bca4be81c31ef83688ed1 Related: OS#3608 Change-Id: I0fe62f518e195db4e34f3b0ad1762bb57ba9d92a
2019-10-10stream.c: remove duplicated line setting variablePau Espin Pedrol1-1/+0
Change-Id: I03b05179f5656ab81e5e14cd146f82a471f7b071
2019-10-04tests: osmux_test: Provide More accurate logging expectanciesPau Espin Pedrol3-13/+1096
Change-Id: I85722ebcb5486426dfe76cdca1b8a0692bb5b111
2019-10-04osmux: squash LOGP message to one linePau Espin Pedrol1-2/+1
It seems different compiler versions (jenkins and my workstation) are generating different line number for that message, and it makes osmux_test fail when improving logging on next commit. Change-Id: Ie2bb0ecf4cc165b9a1080e2558b33ba37014278c
2019-10-04tests: osmux_test: Use fake time also for monotonic clockPau Espin Pedrol1-4/+29
Currently osmux related code uses both gettimeofday on some parts and clock_gettime(CLOCK_MONOTONIC) on others (for different purposes). Let's fake both clocks and not only the one used by gettimeofday API. Change-Id: I4e1a0eb4f8c4ea1bc0f963afa18b116d3af9978c
2019-10-04osmux: osmux_snprintf(): Remove dangling whitespace at the end of dummy framesPau Espin Pedrol1-1/+3
Change-Id: I1ef73807c3300cbcc332f32e6bb905d9b30557be
2019-10-04osmux: osmux_snprintf(): Append comma between osmux frames in msgPau Espin Pedrol1-1/+4
Change-Id: I7acaba9429466db6cb5700b206d6b42da5e4627a
2019-09-19stream_test: Log fake timePau Espin Pedrol3-66/+82
It allows easy verification that timing is correct and makes it easier to debug time related race conditions. Change-Id: I86eb1d7a8096011fd273f067255eb8d6484be65c
2019-09-19stream_test: Use fake timePau Espin Pedrol1-1/+8
By using fake own-controlled time we get two benefits: * Test doesn't take 9 seconds to run anymore * More fine-grade control of different events happening (and associated race conditions). Change-Id: I16b2884b289bfe40dfb8d743dce01bb4c208d117
2019-09-04stream: Fix scheduling of queued messages during connecting statePau Espin Pedrol1-1/+6
If messages are sent using osmo_stream_cli_send() while the stream is still (re)connecting, they won't have a chance to be sent until the stream is connected, and hence they are queued until CONNECTING->CONNECTED is done. However, at that time (osmo_stream_cli_fd_cb), the WRITE flag was dropped unconditionally, which meant already queued packets didn't have the opportunity to be sent by the same callback until first message is enqueued and WRITE flag is set (again by osmo_stream_cli_send()). Let's make them be sent as soon as possible once the connection is available. Related: OS#4188 Change-Id: I289495f9aad6389c5f2623fb072d676235b7d24c
2019-09-04stream: Introduce API osmo_stream_cli_is_connectedPau Espin Pedrol2-0/+9
Can be used by users to fetch current status of the stream. Change-Id: I5402430e5f39eef22dfa18f33807ab6b1e771f1b
2019-08-07Bump version: 0.5.0.2-6563-dirty → 0.6.00.6.0Pau Espin Pedrol5-9/+17
Change-Id: I3af3b7aaff5c6dc3ac94e942191e27af4bf5392a
2019-07-10contrib/jenkins.sh: run "make maintainer-clean"Oliver Smith1-0/+1
Related: OS#3047 Change-Id: I37908c12dae9d268b8bde186e2743a2d7fd13536
2019-05-17osmux: Extend osmux_out_handle and add new API to set rtp payload_typePau Espin Pedrol7-11/+22
Previously payload_type was always hardcoded to 98 for generated rtp packets from incoming osmux frame. Change-Id: I5cbeb494a8932953d9fd2dc24dacf8cd97fd84e4
2019-05-10Bump version: 0.4.0.1-738f → 0.5.00.5.0Harald Welte2-1/+38
Change-Id: Iea2da939e259d0a9e7c5dad14d7a961434c276ef
2019-03-20amr: use sizeof(struct amr_hdr) when working with amr header lengthPhilipp Maier1-3/+3
The header of an AMR header payload is 2 bytes long. At the moment we use just a constant of 2 when we refer to the header length, but we have a struct amr_hdr defined. Lets use sizeof(struct amr_hdr) to make it more clear that we are refering to the header length. Change-Id: Ic7ca04b99a97d7d3b91717b0c3e6c55ef3001a3e
2019-03-19Deprecate osmo_stream_cli_open2()Max3-7/+120
This supposed to be variant of osmo_stream_cli_open() with explicit control over reconnection logic but it's plain broken: doxygen docs contradict the code, actual reconnection logic is affected by timeout parameter directly which is set in different function. It seems like we haven't been affected by this so far because we always use it in auto-reconnection mode which is triggered by default due to positive reconnection timeout value (5 sec) automatically used in the absense of explicitly set timeout. Looking at commit history, this function already been source of confusion in the past. Instead of trying to fix this mess, let's just deprecate it entirely and properly document use of osmo_stream_cli_set_reconnect_timeout() to control reconnection logic. The only known user is libosmo-sccp which won't use it as of 0a93a683f3cb8e5977eb4a666ab207db6e7d7af9 commit. Change-Id: Id988ed0274b363db049f59cbf6a193727c8c3c8a
2019-03-14tests: AM_LDFLAGS = -noinstall for all testsOliver Smith1-2/+1
Fix a symbol lookup error when building a new test on systems where a previous libosmonetif.so is installed. Symptoms described here in detail: https://osmocom.org/issues/3812#note-10 -no-install causes libtool to generate output files that link against libraries in the build tree, instead of linking against the future installation paths and generating a wrapper script. The wrapper script should override the library paths, but at least on Debian, it does not work as it should. Test binaries won't be installed anyway, so we can safely use -no-install and work around the problem. See also: https://autotools.io/libtool/wrappers.html https://www.gnu.org/software/libtool/manual/html_node/Link-mode.html Related: OS#3812 Change-Id: I94ccff42dfba71aaf59bb30ca312db0bac58c27d
2019-03-14gitignore: add amr_testOliver Smith1-0/+1
Change-Id: I1ea7aad144a505412969c6c301349f8d47964422