Commit Graph

560 Commits

Author SHA1 Message Date
Oliver Smith 39dffb6c29 contrib: import RPM spec
Copy the RPM spec file from:
https://build.opensuse.org/project/show/home:mnhauke:osmocom:nightly

Related: OS#4550
Change-Id: If40896b4711fe6739ec2ed35756c0afe821c8c00
2020-05-16 20:00:39 +00:00
Harald Welte db1bc21d73 trau_frame: Fix AMR frame decoding
Change-Id: I9b2dbca05217ee78cade2a47a02857f7cf7e0cd7
2020-05-14 15:48:09 +00:00
Harald Welte 4119e5124d Fix subchan_demux_test compiler warning on some gcc versions
In commit Ia082b9fddf03d02afd007825a1588a3ef0dbedae we switched
from 'uint8_t *' to 'const ubit_t *' - change the test case
accordingly.

Change-Id: I7d24b891a21e6e485738ddf4a302583579b012d5
2020-05-13 18:52:25 +02:00
Harald Welte 2f182e4047 trau_frame.h: Fix definition of TRAU_FT_OM_UP
Change-Id: Ifd3393fca2ce65f93e8ec6c150474011a5713ccd
2020-05-11 08:40:01 +02:00
Harald Welte a684b84f11 subchan_demux: Use ubit_t where appropriate
the subchan_demux code predates ubit_t; let's use it to clarify
certain pointers refer to arrays of unpacked bits.

Change-Id: I944f05473954920d57e12d5514cf928fc78f2ea4
2020-05-11 08:40:01 +02:00
Harald Welte 6913b9a4e4 trau_frame: use 'ubit_t' for unpacked bits
Change-Id: I497dbb7e9e199c6276e585b977bd941a2b442b3b
2020-05-11 08:40:01 +02:00
Harald Welte 5226e5b926 subchan_demux: Use 'ubit_t' for unpacked bit buffer; use const
Change-Id: Ia082b9fddf03d02afd007825a1588a3ef0dbedae
2020-05-10 19:11:44 +02:00
Sylvain Munaut eb55e2f8d9 e1_input: Add VTY command to enable PCAP debug output
This command is also usable at run-time to dynamically
enable / disable e1 tracing on all active lines

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I0b4251702aecd6721b9d63c320351ef6cb513454
2020-05-09 10:45:20 +02:00
Sylvain Munaut 4b45e9d1a6 e1_input: Allow to change the pcap fd and/or unset it
This will update the pcap fd in all open lines and close
the previous one (if applicable).

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I5c7dd740ba0a90b40c69a53b3dcc9d6d6a98f660
2020-05-08 18:10:15 +02:00
Eric Wild 73a73c0381 configure.ac: fix libtool issue with clang and sanitizer
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: Ia3644168bfea13bda5e09b8bfe1d2c65abd32ad7
2020-04-11 01:15:40 +02:00
Harald Welte 54c919ec48 ortp: disable SO_REUSEADDR + SO_REUSEPORT
ortp >= 0.24.0 doesn't differentiate between SO_REUSEADDR and
SO_REUSEPORT, and has both enabled by default.  The latter means that
we can end up with non-unique port bindings as we will not fail to
bind the same port twice.

This should have caused visible problems not only when operating multiple
osmo-bts on one machine (rare), but also with a single osmo-bts. Once the range
(default 16384-17407 ) wraps, there is a risk of new sockets (for new cals)
colliding with old ones. As two ports (RTP+RTCP) are used per call, this means
every 512 voice calls we expect the BTS to wrap. And from that point onwards
there's a risk of overlapping with previously allocated sockets.

Change-Id: I4fc9eee561c7958c70c63b4ffdc6cb700b795e28
Closes: OS#4444
2020-03-09 11:24:45 +01:00
Harald Welte 9104597d76 Add rtp_test to show the double-bind bug of OS#4444
Change-Id: I6742e5504cfb827031031e4d8d49a616ab203a94
2020-03-09 11:24:38 +01:00
Oliver Smith 3c51482e3d osmo_ortp: add osmo_rtp_socket_set_dscp()
Related: OS#4438
Change-Id: I41603db8c1286660ad57ac1c78a8fb393a2b080b
2020-03-07 15:07:27 +01:00
Eric Wild ef1f327c96 add ipa ping/pong keepalive for OML/RSL links between bts and bsc
Patch-by: ewild, osmith
Related: OS#4070
Change-Id: I30e3bd601e55355aaf738ee2f2c44c1ec2c46c6a
Depends: (libosmo-abis) Ie453fdee8bfd7fc1a3f1ed67ef0331f0abb1d59b
2020-01-24 14:35:09 +01:00
Oliver Smith 65ae42c62c ipaccess.c: line_already_initialized: int -> bool
Change-Id: I1cff638664029ef1a592b98cd499e1d8b703ada1
2020-01-22 11:24:52 +01:00
Harald Welte eed3916dee e1d: Implement varions non-LAPD timeslot modes
So far, the e1d input driver only contained code for LAPD signaling
slots, let's extend it with support for all the other slot types, as
well as support for run-time re-configuration.

Change-Id: I53369004145681bf9178543fe407dfc75e4ae63a
2020-01-12 15:30:51 +01:00
Harald Welte accd677414 e1d: Don't connect to e1d at program start time
Let's not print an error at program/library start time if osmo-e1d
cannot be reached.  This error is confusing to everyone who may
have a libosmo-abis with e1d support compiled in, but who is not
(currently) using any lines via this driver, but others drivers.

Change-Id: If0d033f8a2ab4f0e72549a811ffccc66b91fb0a8
2020-01-12 14:24:24 +01:00
Harald Welte 28898d1fa7 e1d: Use LOGPIL/LOGPITS logging macros to give context
Change-Id: I88ba83783ae1d8368990ec30cdc7ecff88884e41
2020-01-12 14:24:24 +01:00
Harald Welte ccf84ea3dd e1d: Use line->port_nr to specify e1d interface/line
This way we can support more than one E1 line via osmo-e1d.  As
neither mISDN nor DAHDI distinguish between mutliple cards of single
ports vs. multi-port cards, we havee to map both interface + line number
into a single uint8_t.

Change-Id: I3b6975624a0155a68d2c67bfdbc1fb751fb50b13
2020-01-12 14:24:24 +01:00
Harald Welte 52e14129f2 e1d: Remove bogus vty_show function.
It's optional for an input driver to provide this function, and e.g.
mISDN doesn't provide it, either.

Change-Id: I56ed4244121f2019ece80d15bd07d5a8ce958273
2020-01-12 14:24:24 +01:00
Harald Welte 6f674dea42 e1d: Remove EXCEPTFD handling
The file decscriptor 'except' handling was only added in the DAHDI
input module as the DAHDI kernel side is actually using those. I
don't think we can even use this in any way over unix domain sockets.

Change-Id: I718629179181a1de3b82e23447549f593046d91f
2020-01-12 14:24:24 +01:00
Harald Welte 43436034ee e1d: Don't use perror() directly, use osmocom logging instead
Change-Id: I98f337f8f517b98f9b78dc173e5761687609abd8
2020-01-12 14:24:24 +01:00
Harald Welte c6c70766b3 e1d: add missing forward-declaration of e1inp_e1d_init()
Change-Id: I0060e2c9772eb5c0293712cb0da7cc0477eb8abd
2020-01-12 14:24:20 +01:00
Harald Welte 52b0d45b8a e1d: Use HAVE_E1D in C source, not ENABLE_E1D
The config.h files contains HAVE_E1D.

Change-Id: Ib7d2db6703300b7d537c78ad9285948673d8b1d3
2020-01-12 14:24:15 +01:00
Sylvain Munaut b559a53263 e1d: Initial osmo-e1d support
osmo-e1d is part of the Osmocom 'software defined E1 interface,
which consists of a USB device for the actual E1 hardware interfacing,
and a daemon (osmo-e1d) implementing a libusb-based driver.

This commit adds initial support for talking to osmo-e1d using
the related libosmoe1d library.  You need to use '--enable-e1d'
at configure time to enable it.

Change-Id: Ia0431c124e3b5b4108aee7b109d8c4bb0d8b45d4
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2020-01-12 14:22:18 +01:00
Harald Welte b5af0991b3 introduce and use logging macros with context on E1 line / timeslot
Change-Id: I447a2360757fed97ed50f9db1e2efbf2f90e46a0
2020-01-12 13:31:35 +01:00
Harald Welte 510ae993a0 dahdi: Don't use perror() directly, use osmocom logging instead
Change-Id: I287e10ee49a8ac26eef903568b29a3b2abf3b43e
2020-01-12 12:17:54 +01:00
Neels Hofmeyr a160e4bfdb add/clean big-endian packed structs (struct_endianess.py)
Change-Id: I09c56f59631828ad219a5edd7d95cac8df462c84
2020-01-07 17:49:51 +01:00
Pau Espin c313d44272 Bump version: 0.7.0.8-4c2c-dirty → 0.8.0
Change-Id: If7099f91a3610d61d16e769406ac27f54e7363f3
2020-01-02 20:53:32 +01:00
Vadim Yanitskiy 4c2c088518 input/ipa_keepalive.c: make sure IPA keepalive FSM is registered
Change-Id: I36997b31f50fb1e051686a58dac09bc9ed391d17
Fixes: CID#206090
2020-01-01 13:59:59 +01:00
Harald Welte d4be696bbc Enable DAHDI support by default; require --disable-dahdi otherwise
libosmo-abis was built with DAHDI support, if the related header files
were present at built time, and without if not.  This kind of automagic
enabling/disabling of features is wrong.  Let's require DAHDI support by
default, and force the user to take a conscious decision by using an
explicit --disable-dahdi if he doesn't want it.

At the same time, update debian/control to list dahdi-source as build
dependency.

Change-Id: Id9f7f063e7ca9e3ab4aa96fc93f243caf50fb66a
Closes: OS#4248
2019-12-01 20:03:39 +00:00
Vadim Yanitskiy b43ce42411 e1_input.c: make reference counting get() / put() more verbose
Change-Id: I1c730d6d146b365712b28e3d37e038344ea850bc
2019-12-02 02:45:00 +07:00
Vadim Yanitskiy 69ae238f1e input/ipaccess.c: fix debug message on receipt of IPAC_MSGT_ID_GET
Change-Id: I83c52c9733852cfebf183819fb36bd634d84bf7d
2019-12-02 02:45:00 +07:00
Vadim Yanitskiy 1c94f6a50e input/ipaccess.c: propagate errors from ipa_parse_unitid()
Change-Id: Ic190daae31936959de8efb5a6de8744c016d5643
2019-12-02 02:45:00 +07:00
Harald Welte 7c1c8cc710 dahdi: Use ioctl(DAHDI_SPECIFY) instead of legacy /dev/dahdi/%u
It appears that opening "/dev/dahdi/channel" and using
ioctl(DAHDI_SPECIFY) is possible at least since dahdi 2.4 (from 2010),
and opening "/dev/dahdi/%u" has been deprecated ever since.  One
advantage of the new interface is that you can use channel numbers
larger than 250, which is quite easily possible if you have more than
eight E1 lines on a system.  It also makes libosmo-abis work on systems
where there are no udev rules for creating the legacy device nodes.

Change-Id: Id6c8f27d7ae948b50e9cf5a38f039d782ff78e1d
2019-11-14 22:06:23 +00:00
Pau Espin b6e28bf77b ipa: Allow setting local addr and port for struct ipa_client_conn
Change-Id: I3133c6b01647506a5b9c67e4699bcad3ff59f843
2019-11-08 17:30:28 +01:00
Alexander Couzens e11afdaa0e ipa: ipa_server_link_close() add checks of link state
When closing a link which failed on open,
ipa_server_link_close() would crash it when calling osmo_fd_unregister.

Change-Id: I672d4de25464c3829b08aff26b1a6d4ad92e7684
2019-09-15 23:08:38 +02:00
Harald Welte 30249a15d5 Bump version: 0.6.0.13-b4a7 → 0.7.0
Change-Id: Ia5ecb2f69ce5436cae8d7a2d300e446ff24e84bc
2019-07-21 21:32:08 +02:00
Eric Wild 51b610095d extend the ipa keepalive fsm
The new and improved fsm supports multipe use cases:
1) plain old ipa server/client operation
2) ipa client/server operation with custom send callback (i.e. to bypass
the tx queue)
3) all of the above + custom timeout callback
4) fully generic operation that will pass opaque data to the callbacks

The current code will always kill the fsm and deallocate it upon
timeout, so the timeout callback will now return a value: 1 means the
fsm will be automatically terminated, 0 means no action, which allows
manually stopping/starting the fsm to reuse it.

Change-Id: Ie453fdee8bfd7fc1a3f1ed67ef0331f0abb1d59b
2019-07-21 19:27:40 +00:00
Harald Welte b4a7db0f36 ipaccess.c: Avoid calling close(-1) on error path
Change-Id: Idabb9805a4a10c95ba0e01bc3f80ed8db87a9f85
Closes: CID#157118
2019-07-21 13:43:31 +00:00
Debian Mobcom Maintainers 418775c7a5 spelling
===================================================================

Change-Id: I22c98915648760a83abd5f0004af26d426a5e518
2019-07-17 10:55:43 +00:00
Oliver Smith 5318f43dae contrib/jenkins.sh: run "make maintainer-clean"
Related: OS#3047
Change-Id: Ib261f25e2c7b48283a6142259991aadfcf40cdec
2019-07-10 11:59:22 +02:00
Eric Wild 6eb186c097 add TCP_USER_TIMEOUT to keepalive
The patch sets TCP_USER_TIMEOUT to the same timeout value,
since keepalive only applies to idle connections, but we obviously want
to fail as fast as possible even if there is data to send and it's not
acked.

Change-Id: I5e7425958472aa5d758e09bfbefc7d7d37bf6f5f
2019-06-21 15:24:41 +00:00
Eric Wild b8242720b8 ipaccess: allow tcp keepalive for ipa clients
This allows using the e1_line x keepalive y z setting for clients like
osmo-bts.

Change-Id: Iadf22934ca6d3c44adac5573709ba53e75fa07da
2019-06-21 13:27:09 +00:00
Harald Welte 3e03bc2997 ipa_keepalive_fsm: Suppress error messages for INIT -> INIT transition
If we receive an OSMO_IPA_KA_E_STOP in INIT state, we are trying to
re-enter INIT, which is not permitted as per the FSM definition.

Adding this permission avoids the below error message from hitting the
logs every time this happens:

<0003> input/ipa_keepalive.c:158 IPA-KEEPALIVE(server)[0x612000000520]{INIT}: transition to state INIT not permitted!

Change-Id: I8db2f2e708fc4fbb81f5019973098a80e8f540d2
2019-04-06 20:26:25 +02:00
Harald Welte 02c5e9d1d0 ipa_keepalive_fsm: Fix OSMO_IPA_KA_E_STOP allstate event
We had the allstate_action function registered, and that function
implemented handling of OSMO_IPA_KA_E_STOP.  However, the
allstate_event_mask was not set, rendering this functionality
inaccessible.

Change-Id: I83fd991bdacb7bab794878e47c7797fecf8b9286
2019-04-06 20:22:43 +02:00
Harald Welte 3d60dbd021 Add IPA keep-alive FSM implementation
The IPA keep-alive FSM code takes care of periodically transmitting
and IPA CCM PING and expecting an IPA CCM PONG in return.

Change-Id: I2763da49a74de85046ac07d53592c89973314ca6
2019-03-19 17:19:02 +01:00
Sylvain Munaut bab7ae7e88 rtp: Add 'autoconnect' feature to the osmo_rtp_socket
The bound RTP socket will wait for incoming RTP packets and as soon as it
sees one, will 'connect' to it, so all replies will go to that sources and
incoming messages from other sources will be discarded. This obviously only
works once.

Change-Id: I5b54ca4296901fcf37794faf29e0b2acca27bd1b
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2019-03-19 13:57:06 +00:00
Oliver Smith c674e9fcdf tests: use -no-install libtool flag to avoid ./lt-* scripts
This ensures that the rpath of the generated binaries is set to use only
the just-compiled so-files and not any system-wide installed libraries
while avoiding the ugly shell script wrapper.

Change-Id: Idd458471069ef8912704cc7602c6e8c71c0b62be
2019-03-19 13:46:08 +01:00
Harald Welte c0a0ec494f ipa: Make ipa_server_conn_destroy() re-entrant
In some situations, the user code called by the closed_cb call-back
might be tempted to call itself ipa_server_conn_destroy(), which would lead
to a double-llist_del during osmo_fd_unregister() and also a subsequent
double talloc_free().  Let's prevent such misuse by existing early in
such situations.

Change-Id: I0fef264ed5b4218906cdbca243ffa11b891025c6
2019-03-08 16:35:43 +01:00