Commit Graph

272 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther 7c9337b775 jenkins: Add the build script from jenkins here
This can be used to replicate a build issue more easily.
2016-04-13 18:52:43 -04:00
Neels Hofmeyr 0db1d43c0d ipa driver: make bind address vty configurable
Add VTY function to set the ipa bind address:
    e1_input
     ipa bind A.B.C.D

Add a priv pointer to struct e1inp_driver in order to communicate the bind
address parameter to ipaccess_line_update(). Add two "internal.h" functions to
get/set it in the ipa driver struct.

Add static ip_bind_addr() to use the IP address set from the VTY or, if NULL,
use "0.0.0.0". Apply in ipaccess_line_update().
2016-02-25 12:12:28 +01:00
Alexander Huemer 86fc3c8787 export lapd_tei_alloc(), used in libosmo-netif 2015-11-07 12:33:40 +01:00
Holger Hans Peter Freyther 3cef39b03c debian: Bump so version to link against new libosmovty2
Debian doesn't have reverse dependencies so we need to bump the
SO version to have libosmoabis and libosmotrau link against our
new version.
2015-11-03 09:42:24 +01:00
Holger Hans Peter Freyther 71bc9e2ac8 ortp: Guard the jitter stats with a version check
ortp 0.18 has introduced the jitter_stats but we only check for
0.21 an later. It is okay that at some point the jitter stats
will be reported. For previous versions it is 0.
2015-09-21 12:18:37 +02:00
Holger Hans Peter Freyther fe01908428 ortp: Export statistics for the bts or similar
We might want to know how many things arrived at the BTS and
ortp is already counting for us. We don't intend to use RTCP
so I am not sure what the last "sender report" is and how
accurate the jitter is.
2015-09-21 10:55:12 +02:00
Harald Welte b37c5d48f0 configure.ac: Add subdir-objects 2015-08-15 10:50:53 +02:00
Holger Hans Peter Freyther 3a580f263a subchan: Remove unused const variable
nullbytes has never been used, I assume the code ended up
using memset instead of copying from nullbytes.

Fixes:
subchan_demux.c:47:22: warning: unused variable 'nullbytes' [-Wunused-const-variable]
static const uint8_t nullbytes[SYNC_HDR_BITS];
2015-03-22 09:25:19 +01:00
Holger Hans Peter Freyther 050d60a9a1 debian: Switch to multi-arch support 2015-03-14 20:01:48 +01:00
Holger Hans Peter Freyther 2f0dd0c019 New upstream release 2015-01-18 19:27:07 +01:00
Holger Hans Peter Freyther 9087859057 ipa: Add API to clear the tx queue
Jacob noticed that after a re-connect old messages would be
sent. This can be the wanted behavior but add a method that
allows a caller to clear the tx queue. The implementation has
not been verified and there is no existing unit test where
I could easily add this code to.
2015-01-18 17:52:08 +01:00
Holger Hans Peter Freyther adfa01f041 misdn: Close the file descriptor if the ioctl is failing
Fixes: Coverity CID#1040691
2014-12-26 18:13:55 +01:00
Jacob Erlbeck 1acf4cbd75 ipa: Declare all structs used
A few declarations are missing.

This patch adds forward declarations for struct used for pointers
only and an include directive (osmocom/core/select.h) to get a full
definition of struct osmo_fd.

Sponsored-by: On-Waves ehf
2014-12-22 14:48:26 +01:00
Holger Hans Peter Freyther 687046ba2f ipa: Set the BSC_FD_WRITE in ipa_client_conn_open
When the link is being created BSC_FD_WRITE and BSC_FD_READ are
being ored into the flag. When the socket connects the first time
the ipa_client_fd_cb function is called and the link->state is
moved from connecting to connect.

In case the connection drops and ipa_client_conn_open is called
again the BSC_FD_WRITE flag might not be set. This means that after
the socket is connected, ipa_client_fd_cb will not be called. This
means that the updown_cb will not be called until after the first
write or read on the socket. It might even lead to missing some
data.

When re-connecting set the write flag again.
2014-12-12 17:39:58 +01:00
Holger Hans Peter Freyther 37fcd93a50 ipa: Partially revert the e1inp_ipa_bts_rsl_connect_n commit
The check was always hit by osmo-bts master leading to the RSL
connection never being made. This is because the type of the line
will be set _after_ the RSL connection has been made. E.g. inside
osmo-bts/src/common/abis.c:

static struct e1inp_sign_link *sign_link_up(void *unit, struct e1inp_line *line,
                                            enum e1inp_sign_type type)
{
        struct e1inp_sign_link *sign_link = NULL;

        switch (type) {
	...
        case E1INP_SIGN_RSL:
                LOGP(DABIS, LOGL_INFO, "RSL Signalling link up\n");
                e1inp_ts_config_sign(&line->ts[E1INP_SIGN_RSL-1], line);
	...

Only the call to e1inp_ts_config_sign will set the type to be
E1INP_TS_TYPE_SIGN. Before the call the type is still _NONE and
the connect was rejected.
2014-10-26 08:29:20 +01:00
Holger Hans Peter Freyther d9d1b5c19f misc: Work with src != builddir
libosmo-abis/0.3.0+gitrAUTOINC+b6d2834eef-r2.14.0/git/src/input/dahdi.c:25:26: fatal error: ../../config.h: No such file or directory
 #include "../../config.h"
2014-09-25 18:47:12 +02:00
Holger Hans Peter Freyther b6d2834eef Prepare a new release of libosmo-abis 2014-09-08 07:57:09 +02:00
Holger Hans Peter Freyther e6ad794cad test: Fix the compilation of the test
This test didn't compile as it called the wrong method. It is a
manual test anyway and tend to bitrot. I didn't execute the
resulting test binary. Hmm, now I did and it segfaults on something
that appears to have been introduced a long time ago. Manual
tests are as good as no tests (besides they take more time than
writing no test). ;)
2014-08-29 09:08:01 +02:00
Holger Hans Peter Freyther c97b9e64e3 Add missing TODO-RELEASE entry to remind us of the ABI bump on release 2014-08-29 09:05:48 +02:00
Andreas Eversberg f422a753a7 Support for multiple RSL connections with ABIS/ipaccess (BTS side)
In order to support multiple TRX, multiple RSL connections can be
establised. e1inp_ipa_bts_rsl_connect() requires an additional parameter
to set the TRX number.

The ts[] array (member of struct e1inp_line) refers to OML and RSL.
ts[0] refers to OML link, ts[1] to RSL link of first TRX, ts[2] to
RSL link of second TRX (if exists) and so on.

The code was successfully tested with osmobts-trx and UmTRX with two
transceivers.

The user of e1inp_ipa_bts_rsl_connect() (which is osmo-bts) can use
the new function like this (backwards compatibility function provided):

src/common/oml.c
-	rc = e1inp_ipa_bts_rsl_connect(oml_link->ts->line, inet_ntoa(in), port);
+	rc = e1inp_ipa_bts_rsl_connect_n(oml_link->ts->line, inet_ntoa(in), port,
+		trx->nr);
2014-08-28 12:50:29 +02:00
Harald Welte c9295ea2dd fix compiler warning in write_pcap_packet()
if we don't evaluate the result of write(), there's no point in
storing the result in a variable.
2014-08-21 02:41:41 +02:00
Harald Welte b65f58f6f9 move various generic IPA related functions to libosmocore
libosmo-abis is about forming A-bis interfaces/lines by means
of E1 or the IPA multiplex (or possibly other link layers).

The IPA multiplex is used in other contexts, such as the Control
interface, or the A interface.  In that context, it makes sense to have
generic IPA related functions in libosmocore.
2014-08-20 23:41:07 +02:00
Harald Welte 46fc7e2df7 ipa: Add E1INP_SIGN_OSMO to use IPAC_PROTO_OSMO via e1_input
In order to make use of the IPAC_PROTO_OSMO stream_id of the IPA
multiplex via the e1_input abstraction layer, we need to define
E1INP_SIGN_OSMO and treat it like other signalling (OML/RSL).

This is required for the upcoming code that uses IPAC_PROTO_OSMO
to remotely insert routing table entries into the OML router (e.g. from
osmo-bts).
2014-08-18 20:51:03 +02:00
Harald Welte f5efba40e7 ipa: add ipaccess_tlv_to_unitdata()
this function takes the parsed TLVs of an IPA ID RESP message and
fills a 'struct ipaccess_unit'.
2014-08-18 20:51:03 +02:00
Harald Welte c1edf604ae ipa: declare more already public functions
ipaccess_idtag_parse(), int ipaccess_send_id_req() and
paccess_parse_unitid().

In the mid to long term, the entire IPA/CCM handling should be
moved out of the processes and into a proper state machine inside
libosmocore or libosmoabis.
2014-08-18 20:51:03 +02:00
Harald Welte 783715b204 Split generic CCM handling out of ipaccess_bts_read_cb()
The generic functionality of responding to IPA CCM messages doesn't need
to be intertwined with our e1input abstraction.  We split this out
as new exported function ipaccess_bts_handle_ccm() and modify
ipaccess_bts_read_cb() to make use of that function.
2014-08-18 20:51:03 +02:00
Holger Hans Peter Freyther 46c40b8e58 ipa: Move the second null check into the first one
Move the second null check before we actually dereference the
msg.

Fixes: Coverity CID 1231854
2014-08-18 20:25:07 +02:00
Harald Welte 3091e17571 declare ipa_msg_push_header() as public function 2014-08-18 14:54:47 +02:00
Harald Welte e7e1b75564 ipa: ensure updown_cb() gets called on reconnect
If the ipa_client_conn is lost and ther user issues a new
ipa_client_conn_open(), then we need to re-set our internal state
to IPA_CLIENT_LINK_STATE_CONNECTING, as otherwise we wouldn't call the
updown_cb() once the link is up again.
2014-08-18 14:54:47 +02:00
Harald Welte f0d4a2213a ipa: Set msgb->l1h to the beginning of the IPA header
l2h points to the OML/RSL header, so it is only logical that l1h points
to the IPA header. Also, this is what osmo-bts/msg_utils.c expects.
2014-08-18 14:54:47 +02:00
Harald Welte 205e90314d ipa.h: Wrap function declarations to make them more readable
purely cosmetic change.
2014-08-17 11:48:44 +02:00
Holger Hans Peter Freyther fb6e1e993e rtp: Randomize the initial timestamp for RFC compliance
Pick a random timestamp when creating the session.

RFC 3550:
The initial value of the timestamp SHOULD be random, as for the
sequence number.

Fixes: SYS#403
2014-06-24 11:02:01 +02:00
Holger Hans Peter Freyther bf6f1f4a37 rtp: Randomize the initial sequence number for RFC compliance
The usage of random() is not that unpredictable but the closest
we can get right now.

RFC 3550:
The initial value of the sequence number SHOULD be random
(unpredictable) to make known-plaintext attacks on encryption
more difficult, even if the source itself does not encrypt
according to the method in Section 9.1, because the packets
may flow through a translator that does.  Techniques for
choosing unpredictable numbers are discussed in [17].

Fixes: SYS#403
2014-06-24 10:59:43 +02:00
Holger Hans Peter Freyther d67f3f04ab ipa: Add function declaration for IPA header creation
These functions are called from OpenBSC and are supposed to be
public API of libosmo-abis.
2014-05-06 07:01:05 +02:00
Pablo Neira Ayuso 754d5d4b6c ipa_proxy: make sure ipa instance name is nul-terminated
Reported by coverity. CID 1206565.
2014-04-26 12:44:18 +02:00
Holger Hans Peter Freyther ecd0a36ce8 release: Prepare the 0.2.0 release of libosmo-abis 2014-03-31 15:49:13 +02:00
Jacob Erlbeck 98af3c3a6d ipa: Change ipa_msg_recv() to support partial receive
Currently ipa_msg_recv() fails, when messages are received partially.

This patch provides a new function ipa_msg_recv_buffered() that uses
an additional ** to a message buffer to store partial data.  When
this happens, -EAGAIN is returned. If NULL is used, the function
behaves similar to ipa_msg_recv() and fails on partial read.
In addition in case of errors the return value is now always -EXXX
and the contents of errno is undefined.

Note that this feature needs support by the calling code insofar that
*tmp_msg must be set to NULL initially and it must be freed and
set to NULL manually when the socket is closed.

Note also that ipa_msg_recv() is then a wrapper around
ipa_msg_recv_buffered() which mimics the old error behaviour by
setting errno explicitely to -rc and returning -1 when an error has
happened.

Ticket: OW#728
Sponsored-by: On-Waves ehf
2014-03-31 14:33:18 +02:00
Jacob Erlbeck 36106ae244 ipa/test: Add test program for IPA message reception
This patch adds tests for ipa_msg_recv(), where messages are sent
either complete or partitioned.

Sponsored-by: On-Waves ehf
2014-03-24 11:05:10 +01:00
Holger Hans Peter Freyther f465a4c16f ipaccess: Move the #endif before the curly brace
Fix the compilation on FreeBSD that does not use these names
but they are prefixed with TCPTV_KEEP... instead.
2014-02-03 09:34:02 +01:00
Holger Hans Peter Freyther f6415ea5a6 debian: Build the new upstream release 2014-01-20 10:33:52 +01:00
Holger Hans Peter Freyther ba9aa8941b Prepare the v0.1.6 release of libosmo-abis 2014-01-20 10:22:45 +01:00
Holger Hans Peter Freyther 901ef1cbbb ipaccess: Change the visibility of the ipa messages 2014-01-20 08:11:51 +01:00
Jacob Erlbeck 8fe1571ea9 ipaccess: Make TCP keep-alive configurable
This patch changes the implementation to use the keep-alive
configuration fields instead of constants.

Ticket: OW#1060
Sponsored-by: On-Waves ehf
2014-01-20 08:10:43 +01:00
Jacob Erlbeck 86dae84bed input: Make keep alive configurable (generic)
This patch adds a generic keep alive configuration layer that mainly
consists of additional fields in e1_input structs and VTY commands
and extensions.

Ticket: OW#1060
Sponsored-by: On-Waves ehf
2014-01-20 08:10:43 +01:00
Jacob Erlbeck a4ec51e108 ipaccess: Use keep alive for all connections
Keep alive has only been used for OML so far.

This patch refactors the socket configuration into an own function
and uses it for RSL, too.

Ticket: OW#1060
Sponsored-by: On-Waves ehf
2014-01-20 08:10:43 +01:00
Daniel Willmann 859807261e ipaccess: Enable TCP keepalive by default on all BTS connections
This way we can find out fast if the connection is broken.

Ticket: OW#1060
2014-01-20 08:10:43 +01:00
Holger Hans Peter Freyther 63ddf4645c ipaccess: Fix crash when no IPA message is sent first on the RSL port
The issue was that the link has not been configured yet and the
list has not been initialized yet (it is NULL for next/prev).
Check if the ts is not configured before searching a link.

Reproduce with:
 (Sockets.StreamSocket remote: 'localhost' port: 3003)
	nextPutAll: #[0 1 0 0];
	flush.

Backtrace:
 #0  e1inp_lookup_sign_link (e1i=0x27af8c0, tei=0 '\000', sapi=0 '\000') at e1_input.c:437
 437			if (link->sapi == sapi && link->tei == tei)
(gdb) bt
 #0  e1inp_lookup_sign_link (e1i=0x27af8c0, tei=0 '\000', sapi=0 '\000') at e1_input.c:437

 #1  0x00007f338ee87d49 in handle_ts1_read (bfd=0x27afe60) at input/ipaccess.c:436
 #2  ipaccess_fd_cb (bfd=0x27afe60, what=1) at input/ipaccess.c:586
 #3  0x00007f338f0976ce in osmo_select_main (polling=0) at select.c:158
 #4  0x0000000000407394 in main (argc=<optimized out>, argv=0x7fff1aa4fed8) at bsc_hack.c:346
(gdb) p *e1i
 $1 = {type = E1INP_TS_TYPE_NONE, num = 2, line = 0x222e860, lapd = 0x0, {sign = {
      sign_links = {next = 0x0, prev = 0x0}, delay = 0, tx_timer = {node = {
          rb_parent_color = 0, rb_right = 0x0, rb_left = 0x0}, list = {next = 0x0,
          prev = 0x0}, timeout = {tv_sec = 0, tv_usec = 0}, active = 0, cb = 0, data = 0x0}},
    trau = {demux = {chan_activ = 0 '\000', subch = {{
            out_bitbuf = '\000' <repeats 319 times>, out_idx = 0, consecutive_zeros = 0,
            in_sync = 0}, {out_bitbuf = '\000' <repeats 319 times>, out_idx = 0,
            consecutive_zeros = 0, in_sync = 0}, {out_bitbuf = '\000' <repeats 319 times>,
            out_idx = 0, consecutive_zeros = 0, in_sync = 0}, {
            out_bitbuf = '\000' <repeats 319 times>, out_idx = 0, consecutive_zeros = 0,
            in_sync = 0}}, out_cb = 0, data = 0x0}, mux = {subch = {{tx_queue = {next = 0x0,
              prev = 0x0}}, {tx_queue = {next = 0x0, prev = 0x0}}, {tx_queue = {next = 0x0,
              prev = 0x0}}, {tx_queue = {next = 0x0, prev = 0x0}}}}}}, driver = {misdn = {
      fd = {list = {next = 0x7f338f2a7950, prev = 0x250f890}, fd = 19, when = 1,
        cb = 0x7f338ee87c40 <ipaccess_fd_cb>, data = 0x27af2c0, priv_nr = 2}}, ipaccess = {
      fd = {list = {next = 0x7f338f2a7950, prev = 0x250f890}, fd = 19, when = 1,
        cb = 0x7f338ee87c40 <ipaccess_fd_cb>, data = 0x27af2c0, priv_nr = 2}}, dahdi = {fd = {
        list = {next = 0x7f338f2a7950, prev = 0x250f890}, fd = 19, when = 1,
        cb = 0x7f338ee87c40 <ipaccess_fd_cb>, data = 0x27af2c0, priv_nr = 2}}, rs232 = {fd = {
        list = {next = 0x7f338f2a7950, prev = 0x250f890}, fd = 19, when = 1,
        cb = 0x7f338ee87c40 <ipaccess_fd_cb>, data = 0x27af2c0, priv_nr = 2}}}}
2013-12-28 21:21:30 +01:00
Holger Hans Peter Freyther 7ae8503370 debian: Depend directly on the two libraries needed for libosmo-abis
Do not pull in libosmocore but let the abis/trau library pull in
the DSO that is actually linked to.
2013-12-12 12:43:15 +01:00
Holger Hans Peter Freyther d65ccd50fa debian: Enable the hardening options for this library 2013-12-12 12:30:29 +01:00
Holger Hans Peter Freyther 05a337c8b4 debian: Address warnings and increase standards version 2013-12-12 12:23:10 +01:00