Commit Graph

374 Commits

Author SHA1 Message Date
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
Holger Hans Peter Freyther ece5323fd3 debian: Split the libraries into separate packages
This way one can install two ABI incompatible versions of the
library at the same time. This will ease future transition. Create
a dummy/compatible package.
2013-12-12 12:12:22 +01:00
Holger Hans Peter Freyther 91de2d0065 debian: Add depedency to newer libosmocore and update the changelog 2013-12-12 12:08:59 +01:00
Holger Hans Peter Freyther e0bd2f6d4e build: Ignore newer automake generated file 2013-12-12 11:48:28 +01:00
Jacob Erlbeck 3ea52e4f4c ipa-proxy/vty: Removed enable/ipa node
This was basically a link to configure/ipa which is not cleanly
supported by the current VTY framework.

The test program uses the default implementation for
go_parent_cb/vty_go_parent() and is_config_node, since config-ipa is
a top level config node which is assumed by default.
2013-11-11 14:54:53 +01:00
Jacob Erlbeck 1c9dcc1236 vty: Use same prompt string format like in libosmocore
Ensures a single blank after the '#'. Use (config-foo) instead (foo)
for config nodes.
2013-11-11 14:54:53 +01:00
Jacob Erlbeck 37f0695626 vty: Use new vty_install_default() function
This patch removes the local 'end' and 'exit' implementations and
uses the generic ones provided by libosmocore instead, which are
enabled automatically when vty_install_default() is used.
2013-11-11 14:54:53 +01:00
Holger Hans Peter Freyther e58d33153d ortp: Fix the version check for ORTP by not using the cached result
The second check used the cached result for ORTP. Store the result
in ORTP_VERSION and my system properly detects that it is running
on < 0.21.

The HAVE_ORTP_021 will always be defined so just use #if and not
the #ifdef to fix the build.
2013-10-06 13:37:08 +02:00
Harald Welte 2bfc01dfd8 enable support of libortp >= 0.21, which has an API breakage
in libortp >= 0.21, rtp_session_set_local_addr() has one extra
argument for the RTCP port.
2013-10-06 12:23:35 +02:00
Harald Welte 51b796122c Merge branch 'laforge/ipa-client-fixes' 2013-10-06 11:56:41 +02:00
Harald Welte a98a6254bf it's called 'truncated' message, not 'trunked' 2013-10-06 11:55:19 +02:00
Harald Welte 6eddd478e2 ipaccess.c: call sign_link_up() only _after_ tx ID_ACK/ID_RESP
in order to keep the message ordering right, we first send the
ID_ACK/ID_RESP messages, before handing sign_link_up() into the
application.  This ensures that no OML messages get transmitted before
the ID_ACK/ID_RESP has been completed
2013-10-06 11:55:19 +02:00
Harald Welte 51de9ca3a6 IPA: remove automatic reconnect logic
When an IPA link is in client (BTS) mode, we should not automatically
re-connect in the lowest (ipa) layer.  Instead, we properly close the
socket if the link is dead, and we call link->updown_cb() to notify
the user that the link is down.

The e1inp/ipaccess layer translates this into a line->sign_link_down()
callback that propagates up to the user.
2013-10-06 11:55:18 +02:00
Harald Welte a3e9dd5757 ipaccess: rename ipaccess_bts_cb() to ipaccess_bts_read_cb()
this is consistent with ipaccess_bts_write_cb().
2013-10-06 11:54:39 +02:00
Harald Welte e68055bf11 ipa: protect against multiple subsequent calls to ipa_client_conn_close()
This would create linked list coruption in osmo_fd_unregister().

The fact that multiple calls of osmo_fd_unrgeister() on the same fd
happen is due to the fact that ipaccess_drop() and others already close
the file descriptor.
2013-10-06 11:54:38 +02:00
Harald Welte 10b41306db ipaccess: Properly resolve 'line' in error case
If a write on an IPA file descriptor fails, then we call
ipaccess_drop().  However, only in the BSC side the assumption that
bfd->data == e1inp_line holds true. On the BTS side, ofd->data
references to the ipa_client_conn structure.  In order to avoid the
problem, call ipaccess_drop() with an explicit reference to the line in
which the link was dropped.
2013-10-06 11:54:38 +02:00
Harald Welte 84f67b2832 Don't establish RSL at same time as OML link on IPA type lines
If we have a BTS-side e1inp_line, we can only establish OML at the
time of line_update.  We have to wait with RSL until the BTS explicitly
tells us the RSL destination IP and port (received via OML from BSC).

This is now handled in a new function called
e1inp_ipa_bts_rsl_connect().
2013-10-06 11:54:38 +02:00
Harald Welte d331f862dc Remove duplication between libosmocore ipaccess.h and libosmoabis ipaccess.h 2013-10-06 11:54:38 +02:00
Pablo Neira Ayuso ef13269e07 input: fix compilation warning due to missing include osmocom/core/backtrace.h
input/ipa.c: In function 'ipa_server_link_create':
input/ipa.c:344:2: warning: implicit declaration of function 'osmo_generate_backtrace' [-Wimplicit-function-declaration]

input/ipaccess.c: In function 'ipaccess_bts_cb':
input/ipaccess.c:873:2: warning: implicit declaration of function 'osmo_generate_backtrace' [-Wimplicit-function-declaration]
2013-07-08 01:22:58 +02:00
Pablo Neira Ayuso cdda0a87e4 ipa: stricter accept callback handling in ipa_server_link_create
Add assertion as suggested by Holger. This function does not make
much sense with the accept callback set. While at it, check return
value of the accept callback and release the peer socket in case
such callback returns an error.

Reported by Holger.

Reference: CID 1040692
2013-07-08 01:22:57 +02:00
Pablo Neira Ayuso 33f7175764 e1_input: fix compilation warning in e1inp_tx_ts
e1_input.c: In function 'e1inp_tx_ts':
e1_input.c:620:6: warning: variable 'len' set but not used [-Wunused-but-set-variable]

Fix it by performing a stricter checking on the muxed bits
before transmission. Let's see if this spots some hidden bug
in this code.
2013-07-08 01:22:57 +02:00
Holger Hans Peter Freyther f69b8123f9 dahdi: Fix potential but unlikely out of bounds access
The line->port_nr is compared to the array size of the span config
and then the array can be potentially accessed one element outside
of the array.

Fixes: Coverity 1042368
2013-07-06 18:54:58 +02:00
Holger Hans Peter Freyther 219a6a4add misdn: Fix a file descriptor leak in _mi_e1_line_update
The socket is created to get information about the ISDN system
and can be released once we have found the information.

Fixes: Coverity CID 1040691
2013-07-06 18:49:59 +02:00
Pablo Neira Ayuso 2e11f5c7dc e1_input: fix compilation warning in e1_set_pcap_fd
CC     e1_input.lo
e1_input.c: In function 'e1_set_pcap_fd':
e1_input.c:143:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]

e1_set_pcap_fd returns now the result of write. OpenBSC is still
assuming that this function returns nothing, so it simply ignores
this return value by now.
2013-07-05 15:18:52 +02:00
Pablo Neira Ayuso 4bab3bf415 input: ipaccess: stricter string handling in ipa_bts_id_resp
These strings are locally set via the BTS configuration, not the
network, but make sure we don't overrun the buffer.

Reference: CID 1040690
2013-07-05 15:05:30 +02:00
Pablo Neira Ayuso a8c4871a2a input: ipa: close descriptor if no accept callback is set
Reported by Holger.

Reference: CID 1040692
2013-07-05 14:48:24 +02:00
Pablo Neira Ayuso b948701f8c input: ipaccess: fix possible NULL dereference
Unlikely to happen, but add assertion for correctness.

Reported by Holger.

Reference: CID 1042352
2013-07-05 14:41:42 +02:00
Holger Hans Peter Freyther 3a5b4364e8 ipa_proxy: The ret variable was not initialized/assigned
Remove the unused variable and return -ENOMEM in case of an error
and return 0 at the normal exit.

Fixes: Coverity CID 1040689
2013-07-04 20:05:50 +02:00
Holger Hans Peter Freyther 8cbd9f4d09 e1_input_vty: Help coverity in understanding this code
In theory argc could be negative and this code would crash with
a null pointer dereference on the line pointer. Check for <= to
avoid this warning.

Fixes: Coverity CID 1040699
2013-07-04 20:00:33 +02:00
Holger Hans Peter Freyther a677cbc0cb ipa: Fix the size of the streamid array used in the proxy code
We want to store stream ids 0 to 0xff. This means we need to have
256 entries in this array.

Fixes: Coverity CID 1040697, CID 1040696, CID 1040695, CID 1040694
2013-07-04 19:52:41 +02:00
Holger Hans Peter Freyther 9d4fe51424 hsl: Remove the input handling for the HSL BTS
I have removed HSL support from OpenBSC, the E1/Abis code is now
unused and can be removed.

Fixes: Coverity CID 1040693
2013-07-04 19:50:09 +02:00
Alexander Huemer 3eed8a115a Makefile.am: Use AM_CPPFLAGS
Since automake 1.13 INCLUDES is depricates and causes a warning
2013-06-12 07:51:41 +02:00
Holger Hans Peter Freyther 5731dd74f7 misdn: Set ret to 0 when using the LAPD from userspace
Warning:
input/misdn.c:252:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is
      true [-Wsometimes-uninitialized]
        if (mline->use_userspace_lapd) {
            ^~~~~~~~~~~~~~~~~~~~~~~~~
input/misdn.c:289:9: note: uninitialized use occurs here
        return ret;
               ^~~
input/misdn.c:252:2: note: remove the 'if' if its condition is always false
        if (mline->use_userspace_lapd) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
input/misdn.c:241:9: note: initialize the variable 'ret' to silence this warning
        int ret;
               ^
                = 0
1 warning generated.
2013-03-09 17:37:42 +01:00
Holger Hans Peter Freyther 4b6860db44 lapd: Do not override t203_sec initialization.
This was spotted by clang3.3 and got broken in git revision
f42280b6a2 when moving to the
C99 initializer.

Warning:
input/lapd.c:106:30: warning: initializer overrides prior initialization of this subobject
      [-Winitializer-overrides]
        .t203_sec       = 20,   .t203_sec       = 0,
                                                  ^
input/lapd.c:106:14: note: previous initialization is here
        .t203_sec       = 20,   .t203_sec       = 0,
                          ^~
1 warning generated.
2013-03-09 17:37:42 +01:00
Harald Welte e7a3f43d86 ortp: Don't write error callbacks to stderr, but use osmocom logging 2013-02-19 13:35:22 +01:00
Andreas Eversberg 41bc615c3f RTP: Allow disabling jitter buffer by setting a buffer size of 0 2013-02-14 17:21:26 +01:00
Holger Hans Peter Freyther cf5b08bcd2 debian: Create a debug package for the libosmo-abis code 2013-02-13 20:14:53 +01:00
Harald Welte d426d458ca Permit libortp to use the connect() syscall, enabling later getsockname()
If we bind a local socket to INADDR_ANY, then getsockname() will always
return 0.0.0.0 for the local IP address _unless_ the socket was
previously connected to a specific remote IP/port using connect().

This will have the side effect that we only accept RTP packets from the
one IP/port that we have connect()ed to, but that is actually
intentional and useful in our applications.
2013-02-09 11:01:19 +01:00
Daniel Willmann bd3f854f3c tests: Don't delete atconfig in clean
This file is created in ./configure so we shouldn't remove it with make.

Otherwise ./configure && make clean && make check fails
with:

make[3]: *** No rule to make target `atconfig', needed by `check-local'.
Stop.
2012-12-26 11:21:38 +01:00
Holger Hans Peter Freyther 2dfcd9ecc1 debian: Update the changelog for the release of the new version 2012-11-06 13:38:47 +01:00
Holger Hans Peter Freyther cbb78ab998 debian: Do not override the CFLAGS as this can cause miscompilation
We have witnessed how the bits test got miscompiled. Do not introduce
our own version of the CFLAGS but use the defaults of the debian project
2012-11-06 13:38:47 +01:00
Pablo Neira Ayuso a49c24d965 ipaccess: relax default behaviour on errors coming from signalling layer
This patch relaxes the behaviour on error coming from the signalling
layer. This is probably too strict for recoverable errors.

Don't release msgb in this case, as this is controled by the signaling link
layer.

Thanks to Lennart Müller <mueller.lennart@googlemail.com> for the report.
2012-10-16 18:18:33 +02:00
Tobias Engel bcb9531366 Test parsing of GSM 08.60 frame sync header
Tests if the frame synchronization header is correctly recognized.

The problem tested for is the following:
The sync header consists of 16 zero-bits followed by 1 one-bit. Before,
subchan_demux only tested for the 16 zero-bits. But if the previous
frame ended in one or more zero-bits these were then already counted as
belonging to the sync header, leading to a frame that was shifted by one
or more bits.
2012-10-12 16:24:00 +02:00
Holger Hans Peter Freyther bc5dcb11a7 tests: Add a test stub for the subchan_demux tests
Tobias has worked on CSD support and Dieter has helped with a CSD
trau fix. This is a stub that should allow to easily write a test
case for the syncing issue observed by Tobias.

Run the tests:
$ make check

In case of failure:
$ vi tests/testsuite.dir/1/testsuite.log

Add the actual content:
$ edit tests/subchan_demux/subchan_demux_test.c

Update the test result:
$ ./tests/subchan_demux/subchan_demux_test > tests/subchan_demux/subchan_demux_test.ok
2012-10-12 16:23:31 +02:00
Tobias Engel f684976724 Adds support for GSM 08.60 data frame en-/decoding
There is no interworking function (IWF) here. The contents of an uplink
frame simply gets copied into a downlink frame. For this to work both
sides of the call need to connect with the same speed and parameters.
2012-10-12 16:23:02 +02:00
Dieter Spaar 08c103251c Make sure sync header was fully received
The sync header consists of 16 zero-bits followed by 1 one-bit. Before,
subchan_demux only tested for the 16 zero-bits. But if the previous
frame ended in one or more zero-bits these were then already counted as
belonging to the sync header, leading to a frame that was shifted by one
or more bits.
2012-10-12 16:22:36 +02:00
Holger Hans Peter Freyther d72c478b06 misc: Ignore files generated by vim 2012-10-11 08:19:10 +02:00
Holger Hans Peter Freyther 5c65e79edc tests: Add boilerplate to be able to have tests in libosmo-abis 2012-10-11 08:18:43 +02:00
Pablo Neira Ayuso 84e5cb9b34 ipaccess: fix leak of IPA control messages in the BTS side 2012-08-30 21:50:32 +02:00