| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
So far we had a function to allocate a new bssgp_bvc_ctx, but not
the opposite one. Let's finally introduce it, so it will be used
at least in OsmoPCU.
Please note that the new symbol has 'bssgp_' prefix, not 'btsctx_'.
Change-Id: Ia78979379dbdccd6e4628c16f00d0c06d9212172
|
|
|
|
|
|
|
|
|
|
| |
In a multi-threaded environemnt, it's likely that each thread will have
its own, distinct set of file descriptors that it wants to watch.
Hence, let's make the osmo_fd_* functions configure not one global
list of file descriptors, but a thread-local list of file descriptors.
Change-Id: I5082ed3e500ad1a7516e1785bc57e008da2fac9a
|
|
|
|
|
|
|
| |
New fields are put inside a union to keep backward compatibility with
potential older users of the struct.
Change-Id: I235635800c0de47b1e2b9ec9c7191418f6003554
|
|
|
|
|
|
|
|
| |
Only known user of API is in osmocom-bb and it compiles fine after the
change.
Related: OS#4244
Change-Id: Ia10345008b3aca50b30482ef3b852b03eca71995
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some compilers don't like declaration of enums in header files like we
do sometimes for structs:
enum gsm_band;
void foobar(enum gsm_band band);
triggers:
error: use of enum 'gsm_band' without previous declaration
Fixes: b99f4ca2d8517d99cdf8aa183dbfda7b233bb781
Related: OS#4244
Change-Id: I6c2102c763f565bbe3c8dd7e5b4e04c4a45fff67
|
|
|
|
|
| |
Related: OS#4244
Change-Id: I32e9cc1c2397b44f0d48db2acdf782a821365b63
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Often, an IP address of 0.0.0.0 is considered an unset value (for clients
requiring a server address; not for listening on "any").
osmo_sockaddr_str_is_set() does return false when the port is 0, but there is
no simple way to tell whether the IP address is actually set to a server
address.
Add osmo_sockaddr_str_is_nonzero() to return false if:
- the port is zero, or
- the IP address is zero (0.0.0.0 or ::0), or
- the IP address cannot be parsed.
A practical use example: osmo-msc so far accepts an RTP IP address of 0.0.0.0
as valid. I noticed when trying to trigger error handling from a ttcn3 test.
osmo-msc can use this function to reject invalid addresses from MGCP messages.
Related: I53ddb19a70fda3deb906464e1b89c12d9b4c7cbd (osmo-msc)
Change-Id: I73cbcab90cffcdc9a5f8d5281c57c1f87b2c3550
|
|
|
|
| |
Change-Id: I4b34dbd5f0176d1d8aa8cc96f642ed35d4214b7e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a simpler and more general solution to the problem so far solved by
osmo_fsm_term_safely(true). This extends use-after-free fixes to arbitrary
functions, not only FSM instances during termination.
The aim is to defer talloc_free() until back in the main loop.
Rationale: I discovered an osmo-msc use-after-free crash from an invalid
message, caused by this pattern:
void event_action()
{
osmo_fsm_inst_dispatch(foo, FOO_EVENT, NULL);
osmo_fsm_inst_dispatch(bar, BAR_EVENT, NULL);
}
Usually, FOO_EVENT takes successful action, and afterwards we also notify bar.
However, in this particular case, FOO_EVENT caused failure, and the immediate
error handling directly terminated and deallocated bar. In such a case,
dispatching BAR_EVENT causes a use-after-free; this constituted a DoS vector
just from sending messages that cause *any* failure during the first event
dispatch.
Instead, when this is enabled, we do not deallocate 'foo' until event_action()
has returned back to the main loop.
Test: duplicate fsm_dealloc_test.c using this, and print the number of items
deallocated in each test loop, to ensure the feature works. We also verify that
the deallocation safety works simply by fsm_dealloc_test.c not crashing.
We should probably follow up by refusing event dispatch and state transitions
for FSM instances that are terminating or already terminated:
see I0adc13a1a998e953b6c850efa2761350dd07e03a.
Change-Id: Ief4dba9ea587c9b4aea69993e965fbb20fb80e78
|
|
|
|
|
|
|
|
|
|
|
| |
The calculation of the beginning of a block for TCH/F, TCH/H and FACCH
can be challenging since those channels are affected by the diagonal
interleaving of the TCH channels. However, GSM 05.02 Section 7 Table 1
of 5 specifies how the blocks are distributed over the TDMA frame
interval. Lets add a mapping function that is based on that table
Related: OS#3803
Change-Id: I3d71c66f8c401f5afbad9b1c86c24580dab9e0ce
|
|
|
|
|
|
|
|
|
| |
This API will be used by libosmo-netif's osmo_stream for SCTP sockets,
which in turn will be used by libosmo-sccp to support multi-homed
connections.
Related: OS#3608
Change-Id: Ic8681d9e093216c99c6bca4be81c31ef83688ed1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
log_enable_multithread() enables use of locks inside the
implementation. Lock use is disabled by default, this way only
multi-thread processes need to enable it and suffer related
complexity/performance penalties.
Locks are required around osmo_log_target_list and items inside it,
since targets can be used, modified and deleted by different threads
concurrently (for instance, user writing "logging disable" in VTY while
another thread is willing to write into that target).
Multithread apps and libraries aiming at being used in multithread apps
should update their code to use the locks introduced here when
containing code iterating over osmo_log_target_list explictly or
implicitly by obtaining a log_target (eg. osmo_log_vty2tgt()).
Related: OS#4088
Change-Id: Id7711893b34263baacac6caf4d489467053131bb
|
|
|
|
|
|
|
|
|
|
|
| |
This is useful for timers expected to have a range of valid or expected
values.
Validation is done at runtime when timer values are set by the app or by
the user through the VTY.
Related: OS#4190
Change-Id: I4661ac41c29a009a1d5fc57d87aaee6041c7d1b2
|
|
|
|
| |
Change-Id: I9b4c7e737c83c65e358496e4540c14be5abc5474
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
OSMO_GSUP_SUPPORTED_RAT_TYPES_IE corresponds to the Supported RAT Types
Indicator from 3GPP TS 29.002. See 8.1.2 MAP_UPDATE_LOCATION service,
which indicates the capabilities of the MSC/VLR to the HLR.
So far, have room for eight RAT types in the gsup_msg. That is an arbitrary
random choice without any rationale.
OSMO_GSUP_CURRENT_RAT_TYPE_IE is useful to communicate the currently
used RAN / RAT type of the current subscriber during Location Updating Request.
Change-Id: I93850710ab55a605bf61b95063a69682a2899bb1
|
|
|
|
|
|
|
|
|
| |
Nothinh really forbids this case, it's totally fine allocating all space
of msgb as headroom. osmo-pcu actually does that in
gprs_rlcmac_ul_tbf::snd_ul_ud().
Related: OS#4029
Change-Id: Ibe05d08e3169a2603e891f76682a3b352a93ec7a
|
|
|
|
|
|
|
|
|
| |
logging_internal.h
This list is really not needed by applications and currently only used
internally in logging.c and logging_vty.c.
Change-Id: I5dca069512bfcd0826194427c5482fad8bfd0232
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The ECU implementation for FR is currently tested by calling the related
functions directly and by using the generic ECU abstraction layer. However,
the test "test_fr_concealment" only tests directly. Lets add a version
that uses the generic ECU abstraction layer as well.
The generic ECU abstraction layer obsolets the public API functions
osmo_ecu_fr_reset() and osmo_ecu_fr_conceal(), lets tag those functions
as dprecated.
Change-Id: Ib0c8a9b164f14ea4fa00688f760a76cdb4890af4
|
|
|
|
| |
Change-Id: Ic0a3a407c592262104af315f845f0bbd116ab26b
|
|
|
|
| |
Change-Id: I3d548fcc7d500baf37134b14af91bc7b284ce6ad
|
|
|
|
|
|
|
| |
First user is osmo-bts in I6b7bb2e1d61502b61214f854a4ec5cbb7267545b.
Related: OS#2356
Change-Id: I814cb3328d99faca9220adb5a80ffb934f219d7d
|
|
|
|
|
|
|
|
|
| |
Global symbol osmo_log_info is declared in logging.c as non-const,
because it is modified. As soon as logging_internal.h is included into
logging.c, the compiler warns about osmo_log_info being declared twice
differently.
Change-Id: Iea961c3caeb12ddf60c99d4dca644bb9ab538767
|
|
|
|
|
|
|
|
|
|
|
|
| |
I missed code review, so here are my comments in form of a follow-up patch
for Id56a1226d724a374f04231df85fe5b49ffd2c43c.
- Fix 'as_unit' arg name to 'val_unit' as in the C file and API doc.
- Explain rounding-up behavior of value conversion in API doc.
- Use osmo_tdef_get_entry() instead of a loop.
Related: OS#4190
Change-Id: Ia91c2f17e40fb9e79ffa5a7f28ce9c3605664402
|
|
|
|
|
|
|
| |
enum node_type is defined in osmocom/vty/command.h
va_list is defined in stdarg.h
Change-Id: Ia439a7097ae7a9765e229e5f66e07af3fe490ecc
|
|
|
|
|
|
|
|
|
| |
This API is already useful for users willing to set a given timer to a
given value. It will also contain code later that checks for value being
inside valid range for that timer.
Related: OS#4190
Change-Id: Id56a1226d724a374f04231df85fe5b49ffd2c43c
|
|
|
|
|
|
|
|
|
|
| |
As 3GPP doesn't specify how the BSC shall communicate ETWS Primary
Notifications over Abis/RSL, we have to use a vendor-specific RSL
message for this. And in order to know if the peer supports this
feature, we introduces BTS_FEAT_ETWS_PN.
Change-Id: I89c24a81ada6627694a9632e87485a61cbd3e680
Related: OS#4046, OS#4047
|
|
|
|
|
| |
Change-Id: I36fc2ffc22728887d1cb8768c7fcd9739a8ec0fc
Related: OS#4046, OS#4047
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We don't want to expose the details of a given ECU implementation to
the user (e.g. osmo-bts), but have a generic abstraction layer where
an ECU implementation can simply register a few call-back functions
with the generic core.
As the developer and copyright holder of the related code, I hereby
state that any ECU implementation using 'struct osmo_ecu_ops' and
registering with the 'osmo_ecu_register()' function shall not be
considered as a derivative work under any applicable copyright law;
the copyleft terms of GPLv2 shall hence not apply to any such ECU
implementation.
The intent of the above exception is to allow anyone to combine
third party Error Concealment Unit implementations with libosmocore,
including but not limited to such published by ETSI.
Change-Id: I4d33c9c7c2d4c7462ff38a49c178b65accae1915
|
|
|
|
|
|
|
|
| |
The CBSP code assumed that gsm0808_decode_cell_id_u() would return
the number of bytes it has consumed/parsed. But it actually always
returns '0', whcih makes us run in an endless loop :(
Change-Id: I5758af4ec11a827d4b888a3a16c4ec22de90a7d6
|
|
|
|
|
|
|
| |
The pointless '(R)->ip?' condition of the previous commit made me want to
protect against R == NULL instead.
Change-Id: Ie2f47ad8ae585aaf67a6476c67f8e014820a72bc
|
|
|
|
|
|
|
| |
Since (R)->ip is a char[], it is always non-NULL. The (x ? : "") condition is
completely pointless. Remove it.
Change-Id: I13ed06776a784cfa99bbdfca2bb4dfe12913a1ec
|
|
|
|
|
|
|
|
|
|
| |
Rather than having applications maintain their own talloc cotexts,
let's offer some root talloc contexts in libosmocore. Let's also
make them per thread right from the beginning. This will help
some multi-threaded applications to use talloc in a thread-safe
way.
Change-Id: Iae39cd57274bf6753ecaf186f229e582b42662e3
|
|
|
|
| |
Change-Id: Icaec95a9c6105fd17bc1151fdc77394f4efd3b70
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The intention of osmo_tdef_get()'s val_if_not_present argument was to return a
default timeout, or to optionally abort the program for missing timer
definitions if the default timeout is < 0. This was the case in the original
implementation of this API in osmo-bsc, but in the migration to libosmocore,
the argument was by accident changed to an unsigned type. In consequence, the
assertion in the implementation that was intended to abort the program seemed
bogus to coverity, and was fixed by removal in
I7a544d2d43b83135def296674f777e48fe5fd80a -- the wrong direction, as is obvious
from the API doc for osmo_tdef_get().
Note that osmo-bsc master passes -1 in various places and expects the
program-abort behavior that was missing from the libosmocore implementation.
Change the val_if_not_present argument to a signed type, and revert removal of
the assertion, so that passing -1 has the effect described in the API doc:
program abort on missing timer definition.
This bug was not detected because it is hard to write tests that expect a
program abort to happen, hence no tests for this API feature exist.
Related: OS#4152
Change-Id: Ie61c3c85069916336e6dbd91a2c16f7634816417
|
|
|
|
| |
Change-Id: I64c6d3dc08ff87b673ba6225f98546e86f91bcfd
|
|
|
|
| |
Change-Id: I5eb17edadf89ac47b4ca86c9e822037f7c0e518e
|
|
|
|
| |
Change-Id: I1e2c62cb9047648907c91b99f764f6caba8f4493
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Rather than having the encoder/decoder library print some log
messages in case of encoding/decoding errors, let's provide something
akin to 'errno', but with a string instead of a numeric error code.
The 'osmo_cbsp_errstr' global variable (if set) contains a
human-readable string describing the most recent encoding/decoding error.
It exists separately for each thread and hence can be used safely in
multi-threaded environments.
Change-Id: Id9a5a595a76ba278647aee9470ded213d8464103
|
|
|
|
|
|
|
|
|
|
| |
This introduces definitions as well as a parser+encoder for the
Cell Broadcast Service Protocol (CBSP) as specified in 3GPP TS 48.049.
CBSP is used on the interface between CBC and BSC.
Related: OS#3537
Change-Id: I5b7ae08f67e415967b60ac4b824db9e22ca00935
|
|
|
|
|
|
|
|
|
|
|
|
| |
The link quality, defined by C/I (Carrier-to-Interference) ratio,
can be computed from the training sequence of each burst, where we
can compare the "ideal" training sequence with the actual training
sequence and then express that in cB (centiBels, dB * 10).
By analogy with both RSSI and ToA, it can be used to filter out
false-positive detections and ghost Access Bursts.
Change-Id: Ie2a66ebd040b61d6daf49e04bf8a84d3d64764ee
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 4e284b637943980a405a8c44f2712b749ded428f.
Unfortunately, some projects such as OsmoMSC, OsmoBTS and OpenBSC
do contain OSMO_ASSERT statements without a semi colon. Thus,
this change causes compilation errors when building them.
Please note that only the OSMO_ASSERT's definition is reverted,
while changes to other files (adding missing semicolons) are kept.
Change-Id: I6da4d7397d993f6c1af658cb5ae1e49c92a1b350
|
|
|
|
|
|
|
|
|
| |
When using `OSMO_ASSERT(exp);` clang will warn about
an empty expression because the semi colon was superflous.
Use do {} while (0) to enfore the need of a semi colon.
This might break other test.
Change-Id: I2272d29a81496164bebd1696a694383a28a86434
|
|
|
|
| |
Change-Id: I52b9f6b5f3e96d85a390ba2af21d7814df8aaeec
|
|
|
|
| |
Change-Id: I697af428a2ea9a0ccd3f04ba8ec4664935ae29f8
|
|
|
|
|
|
|
|
|
|
|
| |
the DEBUG macro name and ARRAY_SIZE macro function are frequently
used in other projects. If these projects also use libosmocore,
the macros will be redefined. This also generates a warning message
during compilation.
Not redefining the macros removes the warning message and possible
(but unlikely) mis-redefinition.
Change-Id: I0ba91eae8eacc5542d1647601b372e417ed1713c
|
|
|
|
| |
Change-Id: I6b486b52a3733d5fd5e8ba18acbc9374e2e8bd7e
|
|
|
|
| |
Change-Id: I085da06f31a0a6862ae2ba041fafc134cc240f7e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
So far, the public API of osmo_fsm only allowed integral seconds as
timeout. Let's change that to milli-seconds in order to cover more
use cases.
This introduces
* osmo_fsm_inst_state_chg_ms()
* osmo_fsm_inst_state_chg_keep_or_start_timer_ms()
Which both work exactly like their previous counterparts without the _ms
suffix - the only difference being that the timeout parameter is
specified in milli-seconds, not in seconds.
The value range for an unsigned long in milli-seconds even on a 32bit
platform extends to about 48 days.
This patch also removes the documentation notice about limiting the
maximum value to 0x7fffffff due to time_t signed-ness. We don't use
time_t but unsigned long.
Change-Id: I35b330e460e80bb67376c77e997e464439ac5397
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TS 04.06 specifies a N200 re-transmission counter that depends on the
channel type, which we didn't care about at all so far. Let's have the
caller tell us the channel type so we can internally look up the correct
N200 value for it.
At the same time, permit the user to specify T200 re-transmission timer
values for each SAPI on both DCCH and ACCH, which is required at least
in the BTS as per GSM TS 12.21. Also, extend the timer resolution of
the API from seconds to milli-seconds, which is more applicable as
particularly on the FACCH the recommended values are in the 200ms range.
Change-Id: I90fdc4dd4720d4e02213197c894eb0a55a39158c
Related: OS#3906
Related: OS#2294
Related: OS#4037
|
|
|
|
|
|
|
|
|
| |
This function parses a single Cell ID list element into a
'union gsm0808_cell_id_u'. This function is going to be used
by the upcoming CBSP support.
Related: OS#3537
Change-Id: I08b33881667aa32f01e53ccb70d44d5b79c7c986
|