| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
Recent commit I77cd4b9142510c6914298b720d9c19ab68f9ebef left an obsolete
assertion around. It is already done in the if-body now.
Change-Id: I1bb2ea363e8a9d86b24338df3584abc93ebc6dd4
|
|
|
|
|
|
|
|
|
| |
Use non-deprecated API to decode encode in gsm0808_enc_cell_id_list2().
Adjust gsm0808_test.c to now expect the correct results instead of previous
failure.
Change-Id: I1ce78883995e0d484368046b69db5afb2b4adc97
|
|
|
|
| |
Change-Id: I763b18d2922701ad97382269747ff0cbb7bd657b
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The test currently sets the MCC by a hex value, which is a weird choice. The
MCC gets BCD'd and hence we will see the decimal values 1:1 in the encoded
octets as hex digits. Using hex as input obscures that:
Right now it sets mcc = 0x123, which is actually 291 in decimal, and we hence
see "92 .1" in the expected BCD result. Using 0x124 in the test source actually
makes it hard to see where the 0x123 went.
Change the MCC to decimal notation (123, 124, 125) and adjust the expected
encoded output.
Change-Id: I973835c54a90fefe50d2b3581324d12556715f58
|
|
|
|
|
|
|
|
|
|
|
| |
I am going to ehance the test to actually include leading-zero MNC, but first I
would like to simplify how the test source struct is initialized, before I edit
around in it.
Also, when the memcmp() fails, print hexdumps of expected and actual result for
comparison. I needed it to figure out a test failure, might as well keep it.
Change-Id: I77cd4b9142510c6914298b720d9c19ab68f9ebef
|
|
|
|
|
|
|
|
|
|
|
|
| |
The speech codec defaults are not correct. The defaults recommended
in 3GPP TS 28.062, Table 7.11.3.1.3-2 are limited by 3GPP TS 48.008,
Section 3.2.2.103. Some defaults are actually reserved for future
use. Also the endianess of the 16 bit values is reversed.
- correct values so that they match the specification
- transmit bytes in the correct endianess
Change-Id: I6c3a34d39a375d71c4128fd38f06629e8b98b100
|
|
|
|
|
|
|
|
|
| |
If the name stays the same the log messages will still log with the old
id. Since we can now change the id we need to update the name as well.
NULL as id was allowed before so we should allow that as well.
Change-Id: I6b01eb10b8a05fee3e4a5cdefdcf3ce9f79545b4
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since commit bf383a1d83661af26ccd6521c49b655fb22531d4 tlv_parse()
will return the first occurrence of a repeated IE. Add a test to
verify this behaviour. This test passes with the current code and
fails if bf383a1d83661af26ccd6521c49b655fb22531d4 is reverted.
While here, fix lies in documentation about the return value of tlv_parse()
and fix a typo in another comment.
Change-Id: I041f38548c5e4236920991d6c681c1c1e04de9ca
Related: OS#2904
|
|
|
|
|
|
|
|
|
| |
Add a regression test which encodes and decodes a cell identifier
list of type CELL_IDENT_WHOLE_GLOBAL.
Change-Id: Ie633d9e55c6a30555c0153d35aaf9f982d6e0088
Depends: If0fafbc7171da2a3044bfa9a167208a1afa1c07b
Related: OS#2847
|
|
|
|
|
|
|
|
|
|
|
| |
The implementation was entirely broken, reading data from wrong offsets
and always writing to the first element of the decoded list.
Also, add a new test for this function which found the problems.
Change-Id: If0fafbc7171da2a3044bfa9a167208a1afa1c07b
Related: OS#2847
Depends: Ife4e485e2b86c6f3321c9700611700115ad247b2
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
In certain builds (for me a build with no -O2 flag) the recently added
gsm23003_test test_mnc_from_str() fails, because bcmp() compares all bytes of
sizeof(struct test_mnc_from_str_result), which has valid data for 7 bytes plus
one padding byte that may contain arbitrary values. Instead of bcmp(), rather
compare the actual members one by one.
Change-Id: I28b28457c7b0462c950612fd9b87b5c7181d8bad
|
|
|
|
| |
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
|
|
|
|
| |
Change-Id: I9b387e09293a6bbef84b9620ccf21ee2f9ec751c
|
|
|
|
| |
Change-Id: I4c8492b8055803d2857f1ef30aede088778b085b
|
|
|
|
|
|
|
| |
Note that on the input side, the 3-digits flag may be left false when the MNC
is >99 anyway. On the decoded side, the flag is set accurately.
Change-Id: I89765613d8c5bd939a6957f7443ac88475f1b93c
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Change-Id: Idd6cee090464bc92b654332904a9a08edf16e5c9
|
|
|
|
|
|
| |
(Preparation for adding 3-digit MNC)
Change-Id: Ifbc167de0cc039858112677b8d0cd14a2c8af086
|
|
|
|
|
|
| |
(Preparation for adding 3-digit MNC)
Change-Id: I7f8ae05fa3e4a6fc004212757b05ca8a14c9ef45
|
|
|
|
|
|
| |
For consistency in human readability, MCC simply should come first, always.
Change-Id: Idb86a7088fac4d8a8c41190ab46f9801635f4eee
|
|
|
|
|
|
| |
(Preparation for adding 3-digit MNC)
Change-Id: Ic6c645ebf82d5f8d9d51c4c4cc804a0172008156
|
|
|
|
| |
Change-Id: Ibe5c0831268c788ceecd10fd7b22ece6480da817
|
|
|
|
|
|
|
|
|
| |
It seems with default flags in_buf was being memzeroed by the compiler.
When compiling with -O0, that's not the case anymore and printf prints
after first 16 bytes, printing extra garbage which doesn't match the
expected output.
Change-Id: I736c1e4d625f647d3bb794fa717256e9dbf36e87
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
inline keyword is a hint for the compiler to inline the function, but
it's not mandatory. If no static or extern is specified, the definition
is only visible in the current unit but the identifier still has
external linkage.
When running with -O0 it seems the compiler (gcc 7.2.1) decides to use
the external linkage but at the same time it seems it's not generating
the function symbol. Fix it by explicitly stating that we want to use
static linking for this function.
coding/coding_test.o: In function `test_xcch':
libosmocore/tests/coding/coding_test.c:86: undefined reference to `dump_ubits'
libosmocore/tests/coding/coding_test.c:87: undefined reference to `dump_sbits'
Change-Id: I18018adec05ce1c2ddbca38653311d74c7454ce8
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
|
|
|
|
| |
Instead of forcing test failure via assert on first error encountered,
let it run until completion and print detailed error log. This
simplifies troubleshooting by letting user to see more errors from
single run and more details on each of the errors. Update test output
with explicit test results.
Change-Id: I016a28fe04f7b194e22c15e936095004c5f079d1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously an incorrect length value was passed to both
gsm_7bit_decode_n_ussd() and gsm_7bit_encode_n_ussd()
functions during test_7bit_ussd() execution, due to:
octets_written = strlen(decoded);
The problem is that a 7-bit encoded string takes less memory
than its 8-bit equivalent. So, here strlen() returns one-byte
bigger value, that octets_written is. This then causes the
uninitialized memory access.
Found using Valgrind:
Conditional jump or move depends on uninitialised value(s)
at 0x506DCCC: gsm_7bit_decode_n_ussd (gsm_utils.c:248)
by 0x40134B: test_7bit_ussd (ussd_test.c:104)
by 0x400F5D: main (ussd_test.c:161)
Conditional jump or move depends on uninitialised value(s)
at 0x506DBB7: gsm_7bit_decode_n_hdr (gsm_utils.c:220)
by 0x506DC9E: gsm_7bit_decode_n_ussd (gsm_utils.c:246)
by 0x40134B: test_7bit_ussd (ussd_test.c:104)
by 0x400F5D: main (ussd_test.c:161)
Conditional jump or move depends on uninitialised value(s)
at 0x506DBCB: gsm_septet_lookup (gsm_utils.c:153)
by 0x506DBCB: gsm_7bit_decode_n_hdr (gsm_utils.c:224)
by 0x506DC9E: gsm_7bit_decode_n_ussd (gsm_utils.c:246)
by 0x40134B: test_7bit_ussd (ussd_test.c:104)
by 0x400F5D: main (ussd_test.c:161)
Change-Id: Ic31805b6a5a917dfc6284edba6ffdd21246ac20c
|
|
|
|
|
|
|
| |
The sercomm functions are unavailable in case of embedded build. Add
stub and link the tests against it.
Change-Id: I9bc5cb2f822b1a3ffdc6ec29f46b6bac8288314e
|
|
|
|
|
|
|
|
| |
As of 67bdd80a96bdfc49d1aadbd32cca2b53f123d180 the stats.c is
effectively disable so we should disable the corresponding tests as
well.
Change-Id: I42ff7a6619c0a5926fdc2ec779cf04689c567e15
|
|
|
|
|
|
|
| |
Previously the same length value was used for both ussd_request
and interrogate_ss payloads, despite they are different.
Change-Id: I90ae7c51b75dcdb9d8ee042af23d127e6db8771d
|
|
|
|
|
|
|
|
|
|
|
| |
When a bad GSM voice frame is received, it's being replaced
by a silence frame. This may cause unpleasant audio effects.
This change implements a functionality to craft a replacement
frame from the last known good frame. Currently, only FR is
supported, support for other codecs may be added latter.
Change-Id: I06a21f60db01bfe1c2b838f93866fad1d53fdcd1
|
|
|
|
|
|
| |
Both len and rc values were swapped in the test output.
Change-Id: Iebd82531c6ced5d16b15dad4ff4ce654c82db309
|
|
|
|
|
|
| |
Use bssgp_msgb_tlli_put() instead of copy-pasted code.
Change-Id: I06d60566a19dcae701f8648c19fbd8db6d586f77
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add gsm48_encode_ra() which takes appropriate struct as [out] parameter
instead of generic buffer. Using uint8_t buffer instead of proper struct
type prooved to be error-prone - see Coverity CID57877, CID57876.
Old gsm48_construct_ra() is made into tiny wrapper around new
function. The test output is adjusted because of the change in function
return value which was constant and hence ignored anyway.
Related: OS#1640
Change-Id: I31f9605277f4945f207c2c44ff82e62399f8db74
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Validate that incoming CTRL commands...
- have decimal IDs,
- return error on trailing characters,
- have invalid characters in variable identifiers,
- send detailed error messages as reply to the requestor.
Adjust ctrl_test.{c,ok}, which best show the change in behavior.
Message handling causes log messages on stderr; previously, stderr was empty.
Add '[ignore]' in testsuite.at so that the nonempty stderr doesn't cause test
failures.
Change-Id: I96a9b6b6a3a5e0b80513aa9eaa727ae8c9c7d7a1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Recent patch I563764af1d28043e909234ebb048239125ce6ecd introduced returning
NULL from rate_ctr_group_alloc() when the index passed already exists.
Instead of returning NULL, find an unused group index and use that, adjust the
error message.
In stats_test.c, adjust, and also assert allocated counter group indexes
everywhere.
Rationale:
The original patch causes osmo-sgsn to crash as soon as the second subscriber
attempts to establish an MM context. Of course osmo-sgsn is wrong to a) fail to
check a NULL return value and crash and b) to fail to allocate an MM context
just because the rate counter group could not be allocated (it still rejects
the MM context completely if rate_ctr_group_alloc() fails).
Nevertheless, the price we pay for rate counter correctness is, at least in
this instance, way too high: osmo-sgsn becomes completely unusable for more
than one subscriber.
Numerous other places exist where rate_ctr_group_alloc() is called with a
constant index number; from a quick grep magic I found these possible breaking
points:
osmo-sgsn/src/gprs/gb_proxy.c:1431: cfg->ctrg = rate_ctr_group_alloc(tall_bsc_ctx, &global_ctrg_desc, 0);
osmo-sgsn/src/gprs/gprs_sgsn.c:139: sgsn->rate_ctrs = rate_ctr_group_alloc(tall_bsc_ctx, &sgsn_ctrg_desc, 0);
osmo-sgsn/src/gprs/gprs_sgsn.c:270: ctx->ctrg = rate_ctr_group_alloc(ctx, &mmctx_ctrg_desc, 0);
osmo-sgsn/src/gprs/gtphub.c:888: b->counters_io = rate_ctr_group_alloc(osmo_gtphub_ctx,
>phub_ctrg_io_desc, 0);
osmo-bsc/src/libfilter/bsc_msg_acc.c:87: lst->stats = rate_ctr_group_alloc(lst, &bsc_cfg_acc_list_desc, 0);
osmo-pcu/src/bts.cpp:228: m_ratectrs = rate_ctr_group_alloc(tall_pcu_ctx, &bts_ctrg_desc, 0);
osmo-pcu/src/tbf.cpp:793: tbf->m_ctrs = rate_ctr_group_alloc(tbf, &tbf_ctrg_desc, 0);
osmo-pcu/src/tbf.cpp:879: tbf->m_ul_egprs_ctrs = rate_ctr_group_alloc(tbf, &tbf_ul_egprs_ctrg_desc, 0);
osmo-pcu/src/tbf.cpp:880: tbf->m_ul_gprs_ctrs = rate_ctr_group_alloc(tbf, &tbf_ul_gprs_ctrg_desc, 0);
osmo-pcu/src/tbf.cpp:970: tbf->m_dl_egprs_ctrs = rate_ctr_group_alloc(tbf, &tbf_dl_egprs_ctrg_desc, 0);
osmo-pcu/src/tbf.cpp:977: tbf->m_dl_gprs_ctrs = rate_ctr_group_alloc(tbf, &tbf_dl_gprs_ctrg_desc, 0);
osmo-pcu/src/tbf.cpp:1475: ul_tbf->m_ctrs = rate_ctr_group_alloc(ul_tbf, &tbf_ctrg_desc, 0);
osmo-pcu/src/bts.cpp:226: m_ratectrs = rate_ctr_group_alloc(tall_pcu_ctx, &bts_ctrg_desc, 1);
We can fix all of these callers and then reconsider returning NULL, but IMO
even into the future, rate counter group indexes are not something worth
failing to provide service for. For future bugs we should keep the automatic
index picking in case of index collisions. We will get an error message barfed
and can fix the issue in our own time, while the application remains completely
usable, and even the rate counters can still be queried (at wrong indexes, but
life is tough).
Related: I49aa95b610f2faec52dede2e4816da47ca1dfb14 (osmo-sgsn's segfault)
Change-Id: Iba6e41b8eeaea5ff6ed862bab3f34a62ab976914
|
|
|
|
|
|
|
|
|
|
|
| |
The recently added ctrl_cmd_parse2() returns non-NULL cmd with error messages
upon parsing errors. In handle_control_read(), use ctrl_cmd_parse2() and send
those back to the CTRL command sender as reply.
Retain the previous "Command parser error" reply only in case ctrl_cmd_parse2()
should return NULL, which shouldn't actually happen at all.
Change-Id: Ie35a02555b76913bb12734a76fc40fde7ffb244d
|
|
|
|
| |
Change-Id: Id11bc326be2f0bc2746a928354e416495a18baf7
|
|
|
|
|
|
|
|
|
|
|
|
| |
In ctrl_handle_msg() (code recently propagated from handle_control_read()),
talloc_free() the parsed ctrl_cmd in all code paths. In particular, a free was
missing in case ctrl_cmd_handle() returns CTRL_CMD_HANDLED.
CTRL_CMD_HANDLED is triggered by GET_REPLY / SET_REPLY parsing, as show by
ctrl_test.c. With the memleak fixed, adjust expected test output and make a
detected mem leak abort the test immediately.
Change-Id: Id583b413f8b8bd16e5cf92a8a9e8663903646381
|
|
|
|
|
|
|
| |
The "memleak!" output shows messages that lack a talloc_free() of the parsed
ctrl command buffer. The leak shall be fixed in a subsequent patch.
Change-Id: I2c3e4d08b769b9cd77593362ea36a28d681cd042
|
|
|
|
|
|
|
| |
Subsequent patches that tighten CTRL input validation will make the results
more interesting.
Change-Id: Idd4cc7d193db1a7d761f72ed33ed46eea450a78f
|
|
|
|
| |
Change-Id: I12d3828dcc925f97fde11c360f1d60f3bd8cad8b
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To report invalid characters in identifiers, it is desirable to escape any
weird characters. Otherwise we might print stray newlines or control characters
in the log output.
ctrl_test.c already uses a print_escaped() function, which will be replaced by
osmo_escape_str() in a subsequent patch.
control_cmd.c will use osmo_escape_str() to log invalid identifiers.
Change-Id: Ic685eb63dead3967d01aaa4f1e9899e5461ca49a
|