Commit Graph

560 Commits

Author SHA1 Message Date
Max 3a2aa0975a Log peer's port in accept callback
* log port from which we accept() the connection in addition to address
* use macro helper for logging

Change-Id: I186974dae1819af8c92f9ea9eeb966ec7c9c9f55
2019-01-24 17:23:24 +00:00
Max 480073a660 Set local IP in ipa_server_link properly
When creating IPA link for server we might be called without explicit
address (which is legit - it means bind to all available
addresses). However in this case we won't have 'addr' field of
ipa_server_link initialized properly.

Fix this by following changes:

* don't copy NULL value as address
* use socket's local IP when no address set explicitly

Change-Id: I33679bb35f426d4cafb223b9200fccbf407e0cf6
2019-01-24 17:22:52 +00:00
Harald Welte 176a1fbab6 Bump version: 0.5.1.20-de57 → 0.6.0
Change-Id: I417065deb06ac7e8b3b8468b88cc803a41098c2d
2019-01-20 09:10:13 +00:00
Stefan Sperling 961776a2f9 log IPA tags correctly
Due to apparent copy-paste errors, wrong values were being
logged for IPA tags in ipa_bts_id_resp().

Fixes: 4c57eef663
Change-Id: I29a0401db0760219b9b9176709a88d589312261b
Related: OS#3355
2018-12-06 13:09:48 +01:00
Pau Espin de5758d307 osmo_ortp: Log domain and fix strings without endl char
Change-Id: Ib6df0df04cd6ba342753c84398274d04917ace40
2018-11-12 17:16:32 +01:00
Pau Espin 4179207e0e e1_input.h: Set correct type for input_signal_data->link_type
link_type field holds values from link->type as set in
e1inp_int_snd_event().

Change-Id: Iaa33b793f89f2d16c9d949503c5ecc195bbcd2a4
2018-10-03 13:18:40 +02:00
Pau Espin b5cfc6b019 ipaccess: Simplify handling of ipaccess e1line ts
Handle encoding specifics behind a macro to make code easier to
understand and follow.

Change-Id: Ibf251673bff95b7a0b066b19ef4dc6c0f94fff6b
2018-10-03 12:10:43 +02:00
Pau Espin dd95eb6480 ipacces: Log correct trx_nr during IPA GET
dev->trx_id points to a structure used for whole BTS and doesn't point
to related TRX ID, which is encoded in priv_nr.

Change-Id: I00b01790990c8d21fdbe0f5750fa02f13ddb2009
2018-10-02 20:05:33 +02:00
Stefan Sperling 0d7d0b0a86 ensure unix socket paths are NUL-terminated for bind/connect
The unix(7) man page recommends that sun_path is NUL-terminated
when struct sockaddr_un is passed to a bind() or connect() call.
Non-NUL-terminated paths only need to be dealt with at the
receiving end of a UNIX domain socket.

Commit b24efa5 erroneously assumed otherwise.

Change-Id: I9beecfa500db75cb679b1edcc352c893bf098b13
Fixes: b24efa551d
Related: OS#2673
2018-09-20 17:40:59 +02:00
Pau Espin 47e9e63bd5 debian: Conflict libosmoabis6 with libosmoabis5
In previous commit 9540f59b1d, libosmoabis
packaging was fixed to match its contained major lib version.
However, systems using nightly may run into issues when upgrading since
now libosmoabis6 in repo tries to overwrite libosmoabis5 in their system
and fails. By using Conflicts + Replaces it should do it now without
erroring.

Fixes: OS#3365
Change-Id: If98ae21670f13554da5aa46fe30741d56631fd8c
2018-09-04 17:31:34 +00:00
Stefan Sperling b24efa551d Properly deal with sockaddr_un socket path length limitations.
When parsing the configuration, reject a socket path which
exceeds the maximum size supported by the operating system.

In unixsocket_line_update() stop copying the line's socket path to a
local buffer. The path will be copied again in osmo_sock_unix_init().

Both changes are portable; we don't assume any particular socket
path length since the size differs between implementations of Unix,
and we rely only on information from the generic sys/un.h header.

Change-Id: I36344805a825f5d0e0c9d218d438d8fd985ed9ca
Related: OS#2673
2018-09-04 11:51:47 +02:00
Pau Espin 9540f59b1d debian: Fix libosmoabis soname package version
LIBVERSION for libosmoabis was increased during v0.4.0 release, but
didn't update the debian package name accordingly to match major.

Change-Id: I7ead154d72e6dadf795414c47fe276edadd08580
Fixes: OS#3365
2018-08-30 14:27:02 +02:00
Pau Espin ed122f3c25 ipaccess: Allow passing return code in e1inp_line_ops->sign_link()
Change-Id: Ia83eead3622d86f55c1dc5e91acc78dde73a0367
2018-08-28 18:25:02 +02:00
Pau Espin 7ad2b15bc7 ipaccess: Return -EBADF when closing socket in ipaccess_bts_read_cb
As we are closing the socket, there's no need for lower layers to
continue handling it, so let's return -EBADF.

Change-Id: I961b0ef7e598a09ce48a83038c0d90a415e0e11c
2018-08-28 18:08:59 +02:00
Pau Espin 082876bb65 ipa: Allow signalling fd destroyed in ipa_server_conn_read
Similar to what we do in other osmo_fd cb, check for read_cb returning
-EBADF and in that case don't attempt using the osmo_fd anymore, either
because the fd was already closed (no need to then signal WRITE) or
because osmo_fd struct itself has been freed.

Change-Id: I4b968b72285f23a9552519cea67398a43d5003d2
2018-08-28 18:08:59 +02:00
Pau Espin 2775798edb ipa: Allow signalling fd destroyed in ipa_client_read
Similar to what we do in other osmo_fd cb, check for read_cb returning
-EBADF and in that case don't attempt using the osmo_fd anymore, either
because the fd was already closed (no need to then signal WRITE) or
because osmo_fd struct itself has been freed.

Change-Id: I0e449a2bdf7f0411feeccd262cd731ca6fba3fc1
2018-08-28 18:08:59 +02:00
Pau Espin 3750dea968 ipa: Simplify code in ipa_server_conn_read
By doing this change we remove a duplicated error code path and thus
avoid having to maintain an extra code path with function pointers.

Change-Id: I5bce9f92209cc2fb37b78792e34f7898c71d2327
2018-08-28 17:56:59 +02:00
Pau Espin 493c8e6008 ipa: Simplify code in ipa_client_read
By doing this change we remove a duplicated error code path and thus
avoid having to maintain an extra code path with function pointers.

Change-Id: Ic044894980ae2b882d99eb30d9df50066671d8f3
2018-08-28 16:46:42 +02:00
Neels Hofmeyr fe6731181c ipa: don't crash on missing IPA ID GET message
ipaccess_bts_read_cb() only initializes signalling links if it has received an
IPA ID GET message on it, and so far happily accesses the uninitialized
sign_links list anyway if it hasn't.

Reproduce: simply don't send an IPA ID GET message when connecting to an IPA
server run by libosmo-abis, then continue to use the link --> segfault.

Fix the segfault: make sure that the e1inp_ts' type has been set, i.e. that
e1inp_ts_config_sign() has been called and the sign_links llist is initialized,
before calling e1inp_lookup_sign_link() on it.

../../../src/libosmo-abis/src/e1_input.c:511:2: runtime error: member access within null pointer of type 'struct e1inp_sign_link'
../../../src/libosmo-abis/src/e1_input.c:512:11: runtime error: member access within null pointer of type 'struct e1inp_sign_link'
ASAN:SIGSEGV
=================================================================
==5702==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000038 (pc 0x7f28a379ea34 sp 0x7ffd7d8933f0 bp 0x62e000000a98 T0)
    #0 0x7f28a379ea33 in e1inp_lookup_sign_link ../../../src/libosmo-abis/src/e1_input.c:512
    #1 0x7f28a37b97d4 in ipaccess_bts_read_cb ../../../src/libosmo-abis/src/input/ipaccess.c:778
    #2 0x7f28a37b0277 in ipa_client_read ../../../src/libosmo-abis/src/input/ipa.c:76
    #3 0x7f28a37b0277 in ipa_client_fd_cb ../../../src/libosmo-abis/src/input/ipa.c:139
    #4 0x7f28a2ac1a34 in osmo_fd_disp_fds ../../../src/libosmocore/src/select.c:217
    #5 0x7f28a2ac1a34 in osmo_select_main ../../../src/libosmocore/src/select.c:257
    #6 0x444ba3 in bts_main ../../../../src/osmo-bts/src/common/main.c:364
    #7 0x7f28a17ddb44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b44)
    #8 0x405e54 (/usr/local/bin/osmo-bts-trx+0x405e54)

Related: OS#3498
Change-Id: I2487ca37a0fe9aa56733f66bcad9dcf91fc11144
2018-08-24 17:50:22 +02:00
Pau Espin 67902bbeb9 ipaccess_rcvmsg: Fix bug introduced in previous commit
Commit 56ae85fd52 modified code in
ipaccess_rcvmsg to use osmo_fd_setup. During this change, a "|="
operator was converted to "=". Fix this change by manually ORing old and
new values passed to osmo_fd_setup.

Change-Id: Ie59072f07ca50d853c413fa038e447dcdee30a76
2018-08-23 14:36:51 +02:00
Pau Espin 56ae85fd52 ipaccess: Use osmo_fd_setup to set up callbacks
We have a public API in libosmocore, so let's use it istead of manually
filling each struct field.

Change-Id: I09479c3d5b0b9bd69a56c080b8c533a32824cc66
2018-08-22 13:11:25 +02:00
Harald Welte a60f5e13b6 debian/rules: Don't overwrite .tarball-version
The .tarball-version file should contain the *source version* uniquely
identifying the git commit, and not the Debian package name.

With https://gerrit.osmocom.org/#/c/osmo-ci/+/10343/ there is a correct
.tarball-version file in the .tar.xz of the nightly source packages.

Change-Id: I4ce87d474687b61bc2104a02015e954425736123
Related: OS#3449
2018-08-06 10:06:55 +00:00
Harald Welte 82eb55e5a1 Migrate from ipa_ccm_idtag_parse to ipa_ccm_id_resp_parse()
In libosmocore Change-ID I1834d90fbcdbfcb05f5b8cfe39bfe9543737ef8f
we have introduced ipa_ccm_id_resp_parse() as a bugfixed replacement
of ipa_ccm_idtag_parse().

The main difference is that the returned "value" parts now have
a correct reported "length", whereas before this commit they all
reported a one-byte too-long "length" for each IE.

Change-Id: Id4c9ff821a43a37cbacce905d44fee43d1b2c879
2018-08-01 13:22:55 +02:00
Neels Hofmeyr 4c57eef663 fix strncpy bugs in ipaccess.c, ipa_proxy.c
Change-Id: Iad53b603521c0a8f4857bd87dca777ba8e875cde
2018-07-27 18:51:30 +02:00
Pau Espin 026ff4574d Bump version: 0.5.0.10-a210-dirty → 0.5.1
Change-Id: I9a606d5d3f9ce6baf99e69d60529332a460a9504
2018-07-27 18:15:19 +02:00
Pau Espin a210684433 e1_input.c: Replace '.' in counter names with ':'
The '.' is illegal character in counter names, as they are exported
via CTRL interface, where '.' has a special meaning that cannot be
used by strings comprising the variable name.

Change-Id: I730d1acdd5562cd2c1758ceee31193010b14337d
2018-07-24 15:00:15 +02:00
Philipp Maier e7761c6f6f Revert "ortp: enable scheduled mode on rtp socket creation"
We discovered that enabling the scheduler caused a segfault on the
ARM build of osmo-bts. So we have to revert the following two changes:
Change-Id I3a63c23f5ede47773b6a249a48ecebd5d3b45ace
Change-Id I4b8f0349d5503bbe53745cc8903beb26f149f219

This reverts commit 5a236ce1d4.

Change-Id: Ic81062d79a304038a50658b955f7d05edb3fa28e
Related: OS#3299
2018-06-05 16:21:06 +02:00
Philipp Maier 05de362c81 Revert "ortp: make sure the ortp scheduler is started"
We discovered that enabling the scheduler caused a segfault on the
ARM build of osmo-bts. So we have to revert the following two changes:
Change-Id I3a63c23f5ede47773b6a249a48ecebd5d3b45ace
Change-Id I4b8f0349d5503bbe53745cc8903beb26f149f219

This reverts commit 7632278ea3.

Change-Id: Ie375b9eb0dc8ec4f8d4ca12940a7bc5dfc1f6235
Related: OS#3299
2018-06-05 16:19:10 +02:00
Philipp Maier 5a236ce1d4 ortp: enable scheduled mode on rtp socket creation
we use some functionalities of libortp that require to use rtp sessions
with the scheduled mode enabled. Since we do not enable the scheduled mode,
yet, we receive error messages in the log that complain about a non enabled
scheduled mode.

- Turn on scheduled mode using rtp_session_set_scheduling_mode() when
  osmo_rtp_socket_create() is called.

Note: this patch is related to chane:
I3a63c23f5ede47773b6a249a48ecebd5d3b45ace Unfortunately we observed a
segfault with ortp version 0.25.0 (ARM), which seems to be related to an
unintialized scheduling mode. We expect this patch to fix the problem.

Change-Id: I4b8f0349d5503bbe53745cc8903beb26f149f219
Closes: OS#3299
2018-05-31 17:43:07 +02:00
Philipp Maier c81b68f3e8 ortp: detect ssrc changes immediately
libortp detects an ssrc jump using a packet count thresold. This
threshold is set to 50 by default. This means that libortp has
to see 50 rtp packets with the new SSRC before it accepts the
new stream. In our application we want to detect the changed
SSRC (Handover) as fast as possible. So we should change the
threshold to zero.

- use rtp_session_set_ssrc_changed_threshold() to set a thresold
  of 0 packets when osmo_rtp_socket_create() is called.

Change-Id: Id88c2c44d29a409affc2e47fdb932e1187020593
Related: OS#3299
2018-05-30 14:31:34 +02:00
Philipp Maier 28eeb6bc93 ortp: reset rtp session on SSRC changes
When libortp detects a timestamp jump, we resynchronize the session
in order to restore proper rtp frame reception. However, we do not
resynchronize on an SSRC change. An SSRC change usually indicates
the change of an RTP stream source, which is a much more profound
event than a timestamp change, so we should even reset the session
on SSRC changes.

Also, not resynchronizing the session on an SSRC change causes
problems when the jitter buffer feature is used. In those cases
it takes libortp a long time until it finally detects the timestamp
jump and the session resyhcornization happens late.

- reset the ession on SSRC changes by calling rtp_session_reset()

Change-Id: I8688a55cd20d0e14493c357db80754851e12f2fb
Related OS#3299
2018-05-30 14:07:17 +02:00
Philipp Maier 7632278ea3 ortp: make sure the ortp scheduler is started
the function osmo_rtp_init() is initializing ortp at the start of the
application. However, it does not start the scheduler of ortp, which
leads into error log messages in some situatios.

- make sure that ortp_scheduler_init() is called with osmo_rtp_init()

Change-Id: I3a63c23f5ede47773b6a249a48ecebd5d3b45ace
Related: OS#3299
2018-05-29 16:07:50 +02:00
Stefan Sperling b0162077da fix double-free/use-after-free of pointers in struct e1inp_line
Ensure that pointers in cloned e1inp_lines point to valid memory.
Some members of struct e1inp_line can simply be deep-copied.
Use talloc reference counting for pointers to objects which may
be shared between clones (driver-private state and counters).
Prevents double-free bugs, e.g. when multiple links referring
to the same line are closed.

Also, do not forget to unlink struct e1inp_line's counter group from
the counter list. Fixes use-after-free in rate_ctr_timer_cb() during
osmo-bts shutdown.

Change-Id: I9f4724b4a5a064801591e9acf4f2fd1db006d082
Related: OS#3011
Related: OS#3137
2018-05-24 14:57:36 +02:00
Pau Espin 7edc25d9d5 ipaccess: Avoid using released line and bfd in ipaccess_fd_cb
Related: OS#3282

Change-Id: I52faa9e6717137a7dab9c4e006eaa50b7367fc3e
2018-05-23 20:39:29 +02:00
Pau Espin cfe2260c00 ipaccess: ipaccess_rcvmsg: Drop unneeded memcpy
Those values are not used anymore, since the old bfd is unregistered and
the values for the new one will be overwritten by osmo_fd_register.

Change-Id: I7ac74843cbed920a2fdc6ade7aef4d4de905939a
2018-05-23 20:38:15 +02:00
Pau Espin 7b89f12e66 Bump version: 0.4.0.21-60fd-dirty → 0.5.0
libosmotrau library version in debian package was wrong, fix it while
releasing.

Change-Id: I399618c7353a4150e3d571758b522dd2e9d9724f
2018-05-03 16:12:04 +02:00
Pau Espin 60fd2a0e85 git-version-gen: Check first for new tag format
Tags starting with "v*" are old ones. We first want to check for the new
ones, otherwise the wrong tag is selected as the last one.

Change-Id: Ic39bed2fcf7e3ccb6a83e2999d29d129e07c1a84
2018-05-02 19:36:36 +02:00
Pau Espin c04d8d2274 use osmo_init_logging2
Change-Id: Iab9d111aba8f9b423e6a541e928f68b38d561067
2018-04-17 14:43:08 +02:00
Pau Espin 43b5b69bb8 configure.ac: Fix condition check for RTP_SIGNAL_PTR_CAST define
While building libosmo-netif on a system with an old ortp (0.22), it
was seen that warning related to RTP_SIGNAL_PTR_CAST not being correctly
selected were being printed. The compilation didn't fail there as
expected because the issue was being handled as a warning instead of an
error, so the void* ptr case was always being selected.

Change-Id: Ib5e7569e68fdb921c63e0c12e20e73aafbebda46
2018-04-10 18:15:52 +02:00
Pau Espin db0700a5a3 e1_input.h: Remove dead declaration of unexistent API ipaccess_setup
The function was removed long time ago in
af8ed983ff.

Change-Id: I34debe01d1d8b6f4420354666d2a25807dacc25c
2018-04-06 13:19:28 +02:00
Stefan Sperling 49917c129b preserve 'when' flags of new osmo_fd in ipaccess_rcvmsg()
ipaccess_rcvmsg() disposes of a temporary osmo_fd structure after
the RSL link comes up. It copies data from its temporary osmo_fd
to the new one returned by sign_link_up(). However, in doing so,
it clobbered the 'when' flags, which could differ between the two
osmo_fd structures.
For instance, BSC_FD_WRITE could be set on the new osmo_fd but
not on the old one, in case sign_link_up() has already enqueued
outbound messages using the new osmo_fd.

Because of this behaviour, a patch committed to osmo-bsc to address
issue #2719 did not work as intended and had to be reverted.
After this change, that osmo-bsc patch should work as intended
and issue #2719 can hopefully be resolved.

Change-Id: I52f7c903212b38e9c87e4d45e52b231b6f1ae9f5
Related: OS#2719
2018-03-22 20:28:25 +01:00
Neels Hofmeyr d3b8b69977 jenkins.sh: use --enable-werror configure flag, not CFLAGS
Change-Id: I487ab6f2e391aa57404725de2c8ab5447ca9f725
2018-03-05 20:50:38 +01:00
Neels Hofmeyr bb83e6f7eb configure: add --enable-werror
Provide a sane means of adding the -Werror compiler flag.

Currently, some of our jenkins.sh add -Werror by passing 'CFLAGS="-Werror"',
but that actually *overwrites* all the other CFLAGS we might want to have set.

Maintain these exceptions from -Werror:
a) deprecation (allow upstream to mark deprecation without breaking builds);
b) "#warning" pragmas (allow to remind ourselves of errors without breaking
   builds)

As a last configure step before generating the output files, print the complete
CFLAGS and CPPFLAGS by means of AC_MSG_RESULT.

Change-Id: I20d5f18cf05c9e277d914ada259a95187b73fe39
2018-03-05 20:39:19 +01:00
Pau Espin 61460fd643 contrib: jenkins.sh: Disable doxygen in libosmocore build
Change-Id: I52fc3931ef072075561858bb7173f58a8503e499
2018-02-20 20:21:13 +01:00
Max f446367a63 IPA: log remote address
Wrap IPA logging to always print peer's address to simplify
troubleshooting.

Change-Id: I19ebaea45812aad6b3d3480cac0f1f833daf428d
2018-02-13 15:17:27 +01:00
Harald Welte f2a1607e27 debian/control: Fix Vcs-Browser
Change-Id: Ibcc861fe2125ee81097d0209b95dcbdc98c819a8
2018-02-09 13:31:48 +00:00
Max 7139352e67 cosmetic: update ipaccess_bts_handle_ccm()
* mark internal function parameter as const
* log unit IDs

Change-Id: Ifcf8baf4bf5670efaa8689ca7386597fe2797bda
2018-01-08 15:42:00 +01:00
Harald Welte d1dd22c38e Add a new osmo_rtp_set_source_desc() function to set the RTCP SDES items
This allows the users of libosmotrau to set the content of the SDES
items to something more useful than their compile-time defaults.

Change-Id: Ice794f9e0c6caeea1c67520c12efbfa375d1fb82
Related: OS#2701
2017-12-03 11:03:50 +01:00
Alexander Couzens 2d4888dd08 unixsocket: fix a potential string overflow
Change-Id: I8e3ec741247d728232f8c07c94eb63f068597d80
Found-by: coverity
2017-11-21 11:57:01 +01:00
Neels Hofmeyr 2e05f883f9 add --enable-sanitize config option
Change-Id: I59fea4a7199ca6aa71710d3aca0b25425df7d346
2017-11-17 02:05:35 +01:00