aboutsummaryrefslogtreecommitdiffstats
path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2018-04-09fsm_test: terminate the main loop instead of exit on timeoutNeels Hofmeyr2-2/+7
In fsm_test.c, we have FSM instance cleanup after the select main loop, but we exit(0) in the timer cb; hence the final code is never called. Rather clean up the instance and hence also test that, by using a global flag to exit the main loop upon timeout. Adjust expected stderr output. BTW, in a subsequent commit, I want to move the fsm instance id testing to below the main loop, to more clearly group the tested bits. Change-Id: Ia47811ffcc1bd68d2630c86be7ab98fc1f338773
2018-04-09add osmo_quote_str(),osmo_quote_str_buf() and testNeels Hofmeyr2-0/+88
Rationale: with osmo_escape_str(), you get the escaped contents of the string, but not so graceful handling of NULL strings. The caller needs to quote it, and for NULL strings not quote it. osmo_quote_str() is like osmo_escape_str() but always quotes a non-NULL string, and for a NULL string returns a literal NULL, i.e. it should (tm) give the exact C representation of a string. That's useful in testing, to show exactly what char* situation we have, without jumping through hoops like if (str) printf("\"%s\"", osmo_escape_str(str, -1)); else printf("NULL"); Copy the unit test for osmo_escape_str() and adjust. To indicate that the double quotes are returned by osmo_quote_str(), use single quotes in the test printf()s. I considered allowing to pick the quoting characters by further arguments, but that complicates things: we'd need to escape the quoting characters. Just hardcode double quotes like C. Change-Id: I6f1b3709b32c23fc52f70ad9ecc9439c62b02a12
2018-04-06use osmo_init_logging2() with proper talloc ctxNeels Hofmeyr14-21/+47
Ironically, when deprecating osmo_init_logging() in I216837780e9405fdaec8059c63d10699c695b360, I forgot to change the callers within libosmocore itself, i.e. in the various regression tests. Change-Id: Ia36c248f99353d5baaa2533f46a2f60a8579bdf8
2018-04-05fix ctrl_test sanitizer issuesNeels Hofmeyr1-1/+12
Add logging to root ctx, add msgb ctx to root ctx, free wqueue to simulate the msgb being sent, and assert final talloc size. Change-Id: Ief3d5e7b6c4d781b3854e230e45a67d5281b94cd
2018-04-05ctrl: fix deferred commands (and hence fix osmo-bts-sysmo 'clock-info' cmd)Neels Hofmeyr2-5/+2
The CTRL interface has a ctrl_cmd_def_* API that allows deferring a CTRL command reply until later. However, the command handling currently fails to acknowledge this and deallocates the struct ctrl_cmd anyway. Fix: in struct ctrl_cmd, add a defer pointer to be populated by ctrl_cmd_def_make(). A cmd thus marked as deferred is not deallocated at the end of command handling. This fix needs no change in calling code. (Another idea was to return a different code than CTRL_CMD_HANDLED when the command is to be deferred, but that would require adjusting each user of ctrl_cmd_def_make(). The implicit marking is safer and easier.) Show that handling deferred commands is fixed by adjusting the expectations of ctrl_test.c's test_deferred_cmd() and removing the now obsolete exit_early label. One symptom of the breakage is that osmo-bts-sysmo crashes when asked to report a trx's clock-info, which is aggravated by the fact that the sysmobts-mgr does ask osmo-bts-sysmo for a clock-info. The crash appears since Id583b413f8b8bd16e5cf92a8a9e8663903646381 -- it looked like just fixing an obvious memory leak, which it did as shown by the unit test, but deferred ctrl commands actually relied on that leak. Both fixed now. Related: OS#3120 Change-Id: I24232be7dcf7be79f4def91ddc8b8f8005b56318
2018-04-05ctrl: test deferred cmd, show current failureNeels Hofmeyr2-0/+108
Handling a deferred command currently deallocates the struct ctrl_cmd upon exiting the initial command handling, while it should actually stay around for the asynchronous/deferred handling of the ctrl command. Show the current bug by means of a ctrl test. The test will be adjusted to expect the correct result when the bug is fixed in a subsequent commit (I24232be7dcf7be79f4def91ddc8b8f8005b56318). Change-Id: Ibbc847fc583bdd8e5e53a008258805e634ea12b4
2018-03-24cosmetic: gsm0808_test: drop extraneous assertionNeels Hofmeyr1-1/+0
Recent commit I77cd4b9142510c6914298b720d9c19ab68f9ebef left an obsolete assertion around. It is already done in the if-body now. Change-Id: I1bb2ea363e8a9d86b24338df3584abc93ebc6dd4
2018-03-23fix gsm0808_enc_cell_id_list2 for leading-zero MNCNeels Hofmeyr1-4/+1
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
2018-03-23show failure in gsm0808_enc_cell_id_list2() in gsm0808_testNeels Hofmeyr1-4/+8
Change-Id: I763b18d2922701ad97382269747ff0cbb7bd657b
2018-03-23gsm0808_test: cosmetic: test non-hex MCCNeels Hofmeyr1-6/+6
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
2018-03-23gsm0808_test: cosmetic: re-arrange struct init; print hexdump on failureNeels Hofmeyr1-24/+32
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
2018-03-23gsm_08_08: correct speech codec defaultsPhilipp Maier1-7/+7
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
2018-03-19fsm: Update the name as well if the id is updated and accept NULLDaniel Willmann1-0/+4
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
2018-03-16add a regression test for TLV parsing with repeated IEsStefan Sperling1-0/+31
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
2018-03-16add a test for CELL_IDENT_WHOLE_GLOBAL cell identifier listsStefan Sperling1-0/+61
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
2018-03-16fix parse_cell_id_lac_and_ci_list()Stefan Sperling1-0/+42
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
2018-03-16fix bug in parse_cell_id_ci_list()Stefan Sperling1-0/+35
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
2018-03-15use gsm48_decode_lai2() in gsm0808_dec_cell_id_list()Stefan Sperling1-0/+57
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
2018-03-15fix cell identifier decoding in libosmocoreStefan Sperling1-0/+37
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
2018-03-13support for more cell ID list types in libosmocoreStefan Sperling1-25/+22
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
2018-03-05fix osmo_mnc_from_str(): don't try to parse NULLNeels Hofmeyr2-15/+15
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
2018-03-01gsm23003_test: fix: compare members instead of bcmpNeels Hofmeyr1-1/+3
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
2018-03-01timer: Introduce osmo_clock_gettime to override clock_gettimePau Espin Pedrol4-2/+108
Change-Id: I5bebc6e01fc9d238065bc2517058f0ba85620349
2018-02-28gsm: add osmo_mnc_from_str(), osmo_mnc_cmp(), osmo_plmn_cmp() for 3-digit MNCNeels Hofmeyr2-0/+72
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
2018-02-28gsm0408_test: add test cases for MNC with leading zerosNeels Hofmeyr2-0/+149
Change-Id: I9b387e09293a6bbef84b9620ccf21ee2f9ec751c
2018-02-28gsm0408_test: test new gsm48_{decode,generate}_lai2() functionsNeels Hofmeyr2-0/+50
Change-Id: I4c8492b8055803d2857f1ef30aede088778b085b
2018-02-28gsm0408_test: check for new mnc_3_digits flagNeels Hofmeyr2-4/+5
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
2018-02-26print BIG FAT ERROR message if osmo_fsm lacks event namesStefan Sperling2-4/+11
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
2018-02-26coding: Add BER-reporting RACH decode functionsHarald Welte1-2/+2
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
2018-02-22gsm0408_test: also test gsm48_generate_lai() and gsm48_decode_lai()Neels Hofmeyr2-0/+53
Change-Id: Idd6cee090464bc92b654332904a9a08edf16e5c9
2018-02-22gsm0408_test: RA test: include min/max value casesNeels Hofmeyr2-0/+22
(Preparation for adding 3-digit MNC) Change-Id: Ifbc167de0cc039858112677b8d0cd14a2c8af086
2018-02-22gsm0408_test: include BCD and leading zeros in test outputNeels Hofmeyr2-5/+8
(Preparation for adding 3-digit MNC) Change-Id: I7f8ae05fa3e4a6fc004212757b05ca8a14c9ef45
2018-02-20gsm0408_test: cosmetically re-order MCC to come before MNCNeels Hofmeyr2-7/+7
For consistency in human readability, MCC simply should come first, always. Change-Id: Idb86a7088fac4d8a8c41190ab46f9801635f4eee
2018-02-20cosmetic: gsm0408_test: RA test cases as array-of-structNeels Hofmeyr1-8/+12
(Preparation for adding 3-digit MNC) Change-Id: Ic6c645ebf82d5f8d9d51c4c4cc804a0172008156
2018-02-15Add test for gsm48_generate_mid_from_imsi()Max2-0/+14
Change-Id: Ibe5c0831268c788ceecd10fd7b22ece6480da817
2018-02-08tests: utils_test: Fix test failure when compiling with -O0Pau Espin Pedrol1-0/+1
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
2018-02-08tests: coding_test: Fix compilation with -O0Pau Espin Pedrol1-2/+2
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
2018-02-05GSUP: change osmo_gsup_encode() return typeMax1-1/+3
* 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
2018-01-22GSUP: don't fail test on first errorMax2-4/+30
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
2018-01-22tests/ussd: prevent uninitialized memory accessVadim Yanitskiy1-2/+1
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
2018-01-21Embedded: add sercomm stubsMax3-8/+12
The sercomm functions are unavailable in case of embedded build. Add stub and link the tests against it. Change-Id: I9bc5cb2f822b1a3ffdc6ec29f46b6bac8288314e
2018-01-21Embedded: disable stats testMax1-1/+5
As of 67bdd80a96bdfc49d1aadbd32cca2b53f123d180 the stats.c is effectively disable so we should disable the corresponding tests as well. Change-Id: I42ff7a6619c0a5926fdc2ec779cf04689c567e15
2018-01-17tests/ussd: fix wrong GSM 04.80 payload lengthVadim Yanitskiy1-3/+7
Previously the same length value was used for both ussd_request and interrogate_ss payloads, despite they are different. Change-Id: I90ae7c51b75dcdb9d8ee042af23d127e6db8771d
2018-01-15libosmocodec: implement ECU (Error Concealment Unit) for FRPhilipp Maier4-2/+352
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
2018-01-13ussd_test.c: fix rc / len debug output confusionVadim Yanitskiy2-52/+52
Both len and rc values were swapped in the test output. Change-Id: Iebd82531c6ced5d16b15dad4ff4ce654c82db309
2018-01-08Use existing function for TLLI encodingMax1-4/+4
Use bssgp_msgb_tlli_put() instead of copy-pasted code. Change-Id: I06d60566a19dcae701f8648c19fbd8db6d586f77
2018-01-08Add function to properly encode RAIMax2-7/+6
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
2017-12-20ctrl: tighten CTRL input parsingNeels Hofmeyr3-114/+74
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
2017-12-20rate_ctr: fix osmo-sgsn DoS: don't return NULL on already used indexNeels Hofmeyr1-5/+5
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, &gtphub_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
2017-12-18ctrl: on parse errors, return a detailed message to senderNeels Hofmeyr1-1/+1
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