| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
Cell ID lists with CI were misparsed because parse_cell_id_ci_list()
failed to report the amount of consumed bytes to its caller.
Also add a regression test which uncovered the bug.
Change-Id: Ife4e485e2b86c6f3321c9700611700115ad247b2
Depends: If6b941720de33dca66b6b1aa2cb95a3275708b7f
Related: OS#2847
|
|
|
|
|
|
|
|
| |
This makes gsm0808_dec_cell_id_list() properly decode 3-digit MNCs.
Add a test which encodes/decodes a LAI_AND_LAC list with 3-digit MNCs.
Change-Id: If6b941720de33dca66b6b1aa2cb95a3275708b7f
Related: OS#2847
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The cell ID list decoder merged in 11a4d9dd91216fe353e94bfdbbab53bc4f891c0d
has a bug which was introduced part-way through the review process in
gerrit at https://gerrit.osmocom.org/#/c/6509/
When Neels suggested "why not just {...}id_list[MAXLEN] once?" I changed
the cell identifier list from a union of arrays to an array of unions.
After this change, elements smaller than the largest type in the union
were not laid out consecutively in memory anymore. E.g. uint16_t lac
values now occur at offsets of sizeof(id_list[0]) instead of offsets
of sizeof(uint16_t).
The problem is that I forgot to adjust the decoder accordingly, so the
decoder writes to the wrong offsets and returns cell identifier lists
which appear to contain uninitialized values when read back by API
consumers.
I found this problem while adding new regression tests to libosmocore to
test encoding and decoding. This commit adds one such tests for LAC list
decoding, which failed due to the above bug. I plan to write more tests,
however because this first test already uncovered a severe issue I chose
to submit a fix now and work on additional tests in later commits.
Change-Id: Ie1a5a9d858226be578cf11a03cf996d509bd51fb
Related: OS#2847
|
|
|
|
|
|
|
|
|
|
|
|
| |
Global and LAI+LAC cell IDs were being misparsed due to an off-by-one.
This code was incorrectly converted from osmo-bsc, where an additional
offset of one byte was needed to skip the cell identifier field.
In libosmocore, these parsing routines receive a buffer pointer which
is already positioned at the start of the cell identifier field.
Change-Id: I7f3e8ace26176e9cbfe2542961d2a95662aa4d97
Related: OS#2847
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Introduce gsm0808_dec_cell_id_list2() with supports additional types of
cell identifier lists. The new parsing routines are based on similar
routines used by the paging code in osmo-bsc's osmo_bsc_bssap.c.
Likewise, introduce gsm0808_enc_cell_id_list2() with support for the
same additional types of cell identifier lists.
The old API using struct gsm0808_cell_id_list is deprecated.
The previous definition was insufficient because it assumed that all
decoded cell ID types could be represented with a single uint16_t.
It was declared in a GSM protocol header (gsm/protocol/gsm_08_08.h)
despite being a host-side representation of data in an IE.
The only user I am aware of is in osmo-msc, where this struct is used
for one local variable. osmo-msc releases >= 1.1.0 make use of this API.
While here, fix a small bug in a test:
test_gsm0808_enc_dec_cell_id_list_bss() set the cell ID type to 'LAC'
but obviously wants to use type 'BSS'.
Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb
Related: OS#2847
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
An internal symbol '_talloc_zero' of talloc library was used
during a msgb allocation. This is not actually good because:
- it may be removed or modified by talloc developers;
- the behaviour may be changed by talloc developers;
- it's marked as internal using 'underscore';
- there is public API to do the same.
So, let's use the public API.
Change-Id: I1080c9071e997944cc0f9fc3716129e9395437ad
|
|
|
|
|
|
|
|
|
|
|
|
| |
Printing an error message when msgb allocation failed was initially
intended, but have been commented out for years. This would
facilitate the bug hunting process, especially on embedded
platforms with limited resources (e.g. amount of RAM).
The GLOBAL logging subsystem with FATAL level is used
for printing such messages.
Change-Id: I3e2d1beabd6936fc28a1ad664c083ff1698bb644
|
|
|
|
|
|
|
|
| |
The MSGB API is not a part of OpenBSC anymore, so let's remove
dead includes, which were probably left here during the
migration process.
Change-Id: Ief562a6e5b220a84902f95862d67279f953ee726
|
|
|
|
| |
Change-Id: I6b473aadaa22d95f2a8cc87580c638ccd7e531a4
|
|
|
|
|
|
|
|
| |
In osmo_mnc_from_str() do not try to return some values even if the validation
fails; hence don't try to decode a NULL pointer. That whole idea was half-baked
and a can of worms to begin with.
Change-Id: Ibaaa128ac60b941a015a31134eb52aef56bc6e22
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
osmo-bsc and osmo-bts share enums and value strings to describe
feature data that is exchanged via OML (manufacturer id) on startup.
Also the functions to set and get the respecitive bits in the feature
bitvectors are in osmo-bsc and osmo-bts. This is a code duplication
and should be resolved.
- add enum osmo_bts_features (replaces enum gsm_bts_features)
- add osmo_bts_features_descs (replaces gsm_bts_features_descs)
- add osmo_bts_set_feature (replaces gsm_btsmodel_set_feature)
- add osmo_bts_has_feature (replaces gsm_btsmodel_has_feature)
Change-Id: Id0c35aef11aa49aa40abe7deef1f9dbd12210776
|
|
|
|
| |
Change-Id: I1f9e13645033c61ffaed97e457deb5e78a6bec58
|
|
|
|
| |
Change-Id: I5bebc6e01fc9d238065bc2517058f0ba85620349
|
|
|
|
|
|
|
|
|
|
|
| |
osmo_mnc_from_str() preserves leading zeros in the string and is useful for
VTY config parsing (osmo-bsc, osmo-msc, osmo-sgsn, osmo-pcu).
osmo_{plmn,mnc}_cmp() takes care of the slight intricacy of ignoring the 3-digit flag
if the MNC is anyway >99. Will be used by osmo-sgsn.git and osmo-bsc.git. (All
current users just care about identical MNC, but a proper cmp doesn't hurt.)
Change-Id: Ib7176b1d65a03b76f41f94bc9d3293a8a07d24c6
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Enable representing three-digit MNC with leading zeros. The MNCs 23 and 023 are
actually different; so far we treated both as 23. Re-encode an incoming BCD or
string of 023 as it were, i.e. not dropping the leading zero as 23.
Break ABI compatibility by changing the size and ordering of structs
gprs_ra_id, osmo_plmn_id, osmo_cell_global_id, ... by adding an mnc_3_digits
flag.
Change ordering in gprs_ra_id because the canonical oder is {Mobile Country
Code, Mobile Network Code}, so have the mcc member first.
ABI compatibility cannot be maintained for struct gprs_ra_id, since it is a
direct member of structs bssgp_bvc_ctx and bssgp_paging_info, and even just
adding a flag to the end would cause ABI changes of those structs. Similarly,
osmo_plmn_id is a direct member of osmo_location_area_id, and so forth.
Add new API to set and read this additional flag to preserve leading zeros:
- osmo_plmn_to_bcd(), osmo_plmn_from_bcd() after
gsm48_mcc_mnc_to_bcd() and gsm48_mcc_mnc_from_bcd().
- gsm48_decode_lai2(), gsm48_generate_lai2() after
gsm48_decode_lai(), gsm48_generate_lai().
- gsm0808_create_layer3_2() after gsm0808_create_layer3() and gsm0808_create_layer3_aoip().
- various osmo_*_name() functions in gsm23003.h (osmo_rai_name() still in
gsm48.h close to struct gprs_ra_id definition). The amount and duplication of
these may seem a bit overboard, but IMO they do make sense in this way.
Though most code will soon see patches unifying the data structures used, in
some cases (vty, ctrl) they are required singled out. Without these
functions, the formatting ("%0*u", mnc_3_digits ? 3 : 2, mnc) would be
duplicated all over our diverse repositories.
In various log output, include the leading MNC zeros.
Mark one TODO in card_fs_sim.c, I am not sure how to communicate a leading zero
to/from a SIM card FS. The focus here is on the core network / BSS.
To indicate ABI incompatibility, bump libosmogsm and libosmogb LIBVERSIONs;
adjust debian files accordingly.
Implementation choices:
- The default behavior upon zero-initialization will be the mnc_3_digits flag
set to false, which yields exactly the previous behavior.
- I decided against packing the mnc with the mnc_3_digits field into a
sub-struct because it would immediately break all builds of dependent
projects: it would require immediate merging of numerous patches in other
repositories, and it would make compiling older code against a newer
libosmocore unneccessarily hard.
Change-Id: Id2240f7f518494c9df6c8bda52c0d5092f90f221
|
|
|
|
|
|
| |
Forthcoming jitter buffer code in libosmo-netif will make use of it.
Change-Id: I2434f9dfa401f736bc62a2ddce920e587cd8c517
|
|
|
|
|
|
|
|
| |
If no event names are defined for an FSM, show a placeholder
message which points out the problem instead of segfaulting.
Change-Id: I87457945a7b76aa052305c9c531722be1ea0c1d1
Related: OS#3007
|
|
|
|
|
|
|
|
|
|
|
|
| |
Event names are displayed in VTY commands so all FSM should have them.
Print an error message if an FSM is registered without event names.
We could also return an error code, however at present no caller checks
the return value of osmo_fsm_register() so this would be pointless.
Add event names to the test FSM and update expected output accordingly.
Change-Id: I08b100d62b5c50bf025ef87d31ea39072539cf37
Related: OS#3008
|
|
|
|
|
|
|
|
|
|
|
|
| |
For all other decode operations we report the BER, but not for the
RACH. This results in osmo-bts-trx not being able to report BER
to the higher layers, which is possible on other BTS backends.
Let's close this gap by introducing gsm0503_rach_ext_decode_ber()
and gsm0503_rach_decode_ber() with the usual n_errors / n_bits_total
arguments.
Change-Id: I2b1926a37bde860dcfeb0d613eb55a71271928c5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is a desire to install osmo_fsm vty commands automatically in
a library context, rather than requiring every application which
directly or indirectly uses osmo_fsm to run osmo_fsm_vty_add_cmd().
However, the function install_element_ve() asserts that elements
about to be installed have not already been installed.
This means we cannot shift responsibility into a library context
without first making sure that osmo_fsm commands are only installed
once per combined application+library context, because applications
won't know which commands any of its libraries has already installed.
A simple solution is to use a global flag which is checked by
osmo_fsm_vty_add_cmd() before installing osmo_fsm commands, and
is set once the commands have been installed. This way, no harm
is done if osmo_fsm_vty_add_cmd() is called multiple times.
Change-Id: I10b0b1c1c1bf44c3b8eafc465c1ee06ea2590682
Related: OS#2967
|
|
|
|
|
|
|
|
|
|
|
| |
This breaks all existing / older osmocom-bb builds, and hence
cannot be accpeted. See also https://gerrit.osmocom.org/#/c/6679
Related: OS#2985
This reverts commit 3c38e60cd55814a7b4c34f22e0b2e6e671f883c4.
Change-Id: Icfc52ca4e5cbe3a444d98037d27fa101e3614e06
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The function _osmo_fsm_inst_term() terminates all child FSMs befor
it calls fi->fsm_cleanup(). This prevents the cleanup callback to
perform last actions on the child FSMs (e.g.
osmo_fsm_inst_unlink_parent()).
- Since moving the cleanup callack to the beginning of the function
would alter the termination behavior and possibly cause malfunction
in already existing implementation that use OSMO fsm, a new
optional callback that is called immediately at the beginning of
the terminatopn process is added.
Change-Id: I0fdda9fe994753f975a658c0f3fb3615949cc8bb
Closes: OS#2915
|
|
|
|
|
|
| |
Don't just return, free the allocated msg first.
Change-Id: I51431ae7baca33ce5bab085cc3efe25f1a10b6d1
|
|
|
|
|
|
|
| |
gsmtap_sendmsg() does not free the msgb if it returns a failure rc, so the
callers must check the rc and free the msg.
Change-Id: I7cf64ed9b14247298ed8b4ab8735627f8235a499
|
|
|
|
|
|
|
|
|
|
|
|
| |
If less than the msgb size was written by write(), we want to return -EIO.
Hence do not return zero when write() wrote zero bytes, return -EIO in that
case as well.
Previously, if write() returned zero, gsmtap_sendmsg() would return zero
*without* freeing the msg, hence neither would the (ideal) caller. So this
fixes a corner-case memleak.
Change-Id: I099ae1c663c018da5db884f7e9d52c45af3ed817
|
|
|
|
|
|
|
|
|
|
|
|
| |
Not freeing on error does enable callers to try to re-send as well, so it is a
kind of useful feature, even though I find it likely for callers to either
forget about freeing the msg on error or double-free by accident...
I considered changing gsmtap_sendmsg() to always free, but since it is public
API, I chose to keep and document its current behavior properly instead. We
don't know what callers may exist out there.
Change-Id: Id3266ce36442024f16eaf6afa3f516d201930c41
|
|
|
|
|
|
|
| |
Sometimes we want to create an FSM instance before we know its name. In
that case we should be able to update the id later.
Change-Id: Ic216e5b11d4440f8e106a297714f4f06c1152945
|
|
|
|
|
|
| |
The code is based on Osmocom-BB implementation.
Change-Id: I78f6968edaa3ed535673411fb2a80060a472290f
|
|
|
|
|
|
|
|
| |
Add generic function which allows caller to set Mobile Identity
explicitly. This allows to use IMEI or IMEISV for example. Make
gsm48_generate_mid_from_imsi() into wrapper around new function.
Change-Id: Id79be7abfff75ecd0d248bbeed93e605abeec9b3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This was causing build failures in applications using this library
feature:
Documentation error (missing docs):
<command id='show talloc-context (application|all) (full|brief|DEPTH) tree ADDRESS'>
<param name='ADDRESS' doc='(null)' />
Documentation error (missing docs):
<command id='show talloc-context (application|all) (full|brief|DEPTH) filter REGEXP'>
<param name='REGEXP' doc='(null)' />
Documentation error (missing docs):
<command id='show talloc-context (application|all) (full|brief|DEPTH) tree ADDRESS'>
<param name='ADDRESS' doc='(null)' />
Documentation error (missing docs):
<command id='show talloc-context (application|all) (full|brief|DEPTH) filter REGEXP'>
<param name='REGEXP' doc='(null)' />
Change-Id: I785c852e3313d20eade79746a7cd485d2d5908ea
|
|
|
|
|
|
|
|
| |
This reverts commit 5ec91980ac2224aa1e9bf070a0e382d0d8c2b729.
More or less like I expected, it creates fall-out. osmo-msc master builds are failing, as are the open build service builds. The patch has therefor *not* been sufficiently tested.
Change-Id: I8d961d7bbd91b6a8d7691f24cb67720c3d001c7e
|
|
|
|
|
|
|
|
|
|
|
|
| |
The function _osmo_fsm_inst_term() terminates all child FSMs befor
it calls fi->fsm_cleanup(). This prevnts the cleanup callback to
perform last actions on the child FSMs (e.g.
osmo_fsm_inst_unlink_parent()).
move the function call to _osmo_fsm_inst_term_children() below the
call to fi->fsm->cleanup().
Change-Id: Ie89d435417306c6bf897274eabc3ed0a46485c26
|
|
|
|
|
|
|
|
|
|
| |
Most GSM related specifications require the receiver to use the
*first* occurrence of repeated IEs. The Osmocom TLV parser so
far did the opposite: It reported only the *last* occurrence in
case of repeated IEs. Let's change our implementation to be
more in-line with relevant specs, such as 3GPP TS 24.008 8.6.3.
Change-Id: Icde09e075f68c842a7a96cf7160c8e44b77cf82d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In If1bd79026a3c680ccf7587d545d12f7759a998fc, an erratic logging output crept
in for an earlier patch state and was merged by accident; fix 'logging print
file (0|1|basename)' output.
Add value string to map LOG_FILENAME_* enum to VTY args, use for both command
evaluation as well as printing the vty config.
The default is 'logging print file 1', hence we could omit an output when '1'
is chosen. But for clarity, always output the current setting.
Change-Id: I1c931bff1f1723aa82bead9dfe548e4cc5b685e0
|
|
|
|
|
|
|
|
|
|
| |
* match return type of osmo_gsup_encode() with osmo_gsup_decode() to allow
propagating error to caller
* check return value of osmo_gsup_encode() in GSUP test
* return errors instead of braking app with aseert
Change-Id: Idaa1deecb6d9e15329bd51867b4f6a03357461f0
Related: OS#2864
|
|
|
|
|
|
|
|
|
|
| |
Add wrapper for osmo_strlcpy() which uses sizeof() to automatically
determine buffer's size and use it for GSMTAP logging. This is pretty
common use case for osmo_strlcpy() so it's a good idea to save some
typing by using generic define.
Related: OS#2864
Change-Id: I03d0d3d32a8d572ad573d03c603e14cdc27a3f7b
|
|
|
|
| |
Change-Id: I1b2f6fc6f455b0ba2a5732c567a4867bca97c3b0
|
|
|
|
|
|
|
| |
Some times I *really* regret ever having merged OSMO_VALUE_STRING,
as it generates completely unusable and way too long strings :(
Change-Id: I8de7c01f9ea1d66c384e57449c4140186f5ce6c5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
At the moment it is not possible to unlink a child from from
its parent, nor is it possible to assign a new parent to a
child FSM.
- osmo_fsm_inst_unlink_parent():
Make it possible to unlink childs from a parent.
- osmo_fsm_inst_change_parent():
Make it possible to change the parent of a child.
Change-Id: I6d18cbd4ada903cf3720b3ad2a89fc643085beef
|
|
|
|
|
|
|
|
| |
Since commit e094157e125a70b9a384ba3cec01261624f4eb59, TCH frame
length definitions were added to libosmocodec.
No need to define them again.
Change-Id: Id8c6132534e36ea1e368432bb259fd4f3a531f90
|
|
|
|
| |
Change-Id: I535d4eba5bad9094a1e9e662f32cd2bfac5b0cef
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The function inet_ntoa() stores its result in a static buffer and
returns the pointer. When inet_ntoa() is called subsequently it
overwrite the content of its static buffer with the new result.
Since we osmo_sock_local_ip() is a library function we should use
the more safe variant inet_ntop() in order to prevent unintentionally
overwriting data that the caller might still need. Such an error
would be hard to find.
- Use the more safe inet_ntop() inestead of inet_ntoa()
Change-Id: I9852b57736432032542bd96b6fdd4a2f08fc1f64
|
|
|
|
|
|
|
|
|
| |
The socket that is opend to probe the correct local ip-address is
not closed when the test is done.
- Close socket when it is not needed anymore
Change-Id: I7f3562a344b58f6298d2068314be1626a96e1b1d
|
|
|
|
|
|
|
|
| |
As MNCC is rather hard to debug (wireshark cannot trace UNIX domain
sockets), let's add our own decoder that we can use from related
debug log statements in the respective programs.
Change-Id: I216aaf70868ba5f3860a60c4b2442957531a3011
|
|
|
|
|
|
|
| |
Add a VTY command that allows configuring the output of source filename. So
far, this was not configurable by VTY at all.
Change-Id: If1bd79026a3c680ccf7587d545d12f7759a998fc
|
|
|
|
|
|
|
|
|
|
|
| |
In the C API, add another enum log_file_type value, and when set print only the
basename of the source file path.
Rationale: especially when not building directly in the source dir, the paths
to the source files can become rather long. Usually, just the basename of the
file is sufficient to identify the source line.
Change-Id: If3e4d5fb2066f8bf86e59c82d1752b1a843cf58e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a separate flag and API to switch the category-in-hex output:
log_set_print_category_hex().
Add log_set_print_filename2() to modify only the print_filename flag. The old
log_set_print_filename() function still affects both flags. Explain the
rationale in the comment for log_set_print_filename().
There is no need to deprecate log_set_print_filename(); it might cause compiler
warnings and break strict builds unnecessarily.
Add VTY command 'logging print category-hex (0|1)'.
Since there is no VTY command to switch filename output, nothing needs to be
adjusted there (a command will be added in a subsequent patch).
Change-Id: Iba03a2b7915853c6dccaf6c393c31405320538b4
|
|
|
|
|
|
|
|
|
|
|
|
| |
If color output is disabled, skip the empty snprintf() to (not) clear the ANSI
color.
Also, no need to use a format string of "%s", just pass the string constant
directly.
That is a micro optimisation as well as clarification of the code.
Change-Id: Ie7cb06de160830d2f8ee5718246c0fe311f68d49
|
|
|