aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2016-02-05Add T4 bit map compression routineszecke/pre-release/0.9.3-t4Max9-3/+631
Add bit map encoder and decoder functions: decoder is fully functional while encoder is good enough for testing - no backtracking to find the best possible compression is implemented. If somebody is willing to implement MS side of EDGE than this has to be expanded. Add corresponding tests. N. B: the encoding is implemented according to ETSI TS 44.060 which is slightly different from T4 used for fax according to CCITT G31D (RFC 804). Ticket: OW#2407 Sponsored-by: On-Waves ehf Signed-off-by: Max <msuraev@sysmocom.de>
2016-02-05Expand bitvec interfaceMax4-7/+396
Add bit filling, shifting and other functions necessary for bit compression implementation. Add corresponding tests.
2016-01-30bivec: Fix the output of the testcaseHolger Hans Peter Freyther2-12/+16
osmo_hexdump_nospc/osmo_hexdump is an old school C routine with a static internal array. This means that printf will most likely one of the two strings twice. For Linux/glibc this is the first string (for whatever reason?) and for FreeBSD it is the last call of the osmo_hexdump_nospc. We could have noticed by both strings being of the same length besides the different length input. The second issue is that we cast a hexstring to uint8_t and dump the string as hex. So the two strings should not match at all. Fix it by printing the hex string as plain hex and separating the two printf calls. Update the test output.
2016-01-30bitvec: Test and fix regression for C++->C conversionHolger Hans Peter Freyther4-11/+42
bitvec_read_field/bitvec_write_field in the PCU used a C++ reference and when porting to C it was decided to pass the parameter by value and this lost the "back propagation" of the new index. Change the parameter to be an in/out parameter and this way do not have a silent semantic break in the osmo-pcu (where we copy the reference in csn.1 by value) and have a true compile failure. Add Max's simple test for bitvec_unhex function leaving the checking of bitvec_read_field and the side effect in the datastructure about the number of bits still open.
2016-01-30Add doxygen comments to clarify function useMax1-1/+14
2016-01-27bitvec: Fix build on older gccHolger Hans Peter Freyther1-1/+3
bitvec.c: In function 'bitvec_unhex': bitvec.c:389: error: 'for' loop initial declarations are only allowed in C99 mode bitvec.c:389: note: use option -std=c99 or -std=gnu99 to compile your code
2016-01-26Add bitvec-related functions from Osmo-PCUMax2-0/+104
Allocation, pack/unpack, field access and helper routines used extensively by Osmo-PCU. Whenever memory allocation happens, alocator context is passed explicitly by caller.
2015-11-09test: Fix compiler warnings on 64bit systemsHolger Hans Peter Freyther6-17/+18
Use %td to print ptrdiff_t use %zu to print size_t, include time.h on FreeBSD. Some more compiler warnings are left but they require more thinking.
2015-11-09ipa: recv is declared in different headers on BSDHolger Hans Peter Freyther1-0/+2
Include the headers mentioned by the manpage ipa.c:346:9: warning: implicit declaration of function 'recv' is invalid in C99 [-Wimplicit-function-declaration] ret = recv(fd, msg->tail, needed, 0);
2015-11-09vty: Use NULL to have a null pointer instead of '\0'Holger Hans Peter Freyther1-3/+3
'\0' gets translated to zero but the argument to vector_set is a pointer and it gets converted to a pointer. vty.c:985:21: warning: expression which evaluates to zero treated as a null pointer constant of type 'void *' [-Wnon-literal-null-conversion] vector_set(vline, '\0'); ^~~~ vty.c:1095:21: warning: expression which evaluates to zero treated as a null pointer constant of type 'void *' [-Wnon-literal-null-conversion] vector_set(vline, '\0'); ^~~~ vty.c:1097:21: warning: expression which evaluates to zero treated as a null pointer constant of type 'void *' [-Wnon-literal-null-conversion] vector_set(vline, '\0'); ^~~~
2016-01-22Ignore test binariesMax1-0/+3
2016-01-22bitvec: Fix interface to consistently use unsigned intMax2-12/+12
Use unsigned int for the length throughout the interface. We will never have a a negative length. Sponsored-by: On-Waves ehf
2016-01-22bitvec: Fix unaligned memory access in osmo_revbytebits_bufMax1-2/+1
The undefined behavior sanitizer found the 32bit load from an unaligned memory address. This will cause an exception on ARMv5te and a manual fix-up. [hfreyther: On armv6, x86 the usage of memcpy leads to shorter amount of instructions but on armv5te the memcpy is not expanded leading to a branch. Use the version of max until we have the time to benchmark it] Sponsored-by: On-Waves ehf
2016-01-22Fix sporadic out-of-bounds errorMax1-13/+21
This code dealing with bit shifting sometimes gets 1 byte beyond array boundary while calculating index. This is now explicitly checked and prevented. Ticket: OW#1198 Sponsored-by: On-Waves ehf
2016-01-21kasumi: Fix build with gcc5 that changed behavior of inlineHolger Hans Peter Freyther1-1/+1
GCC 5 has changed inline semantics (https://gcc.gnu.org/gcc-5/porting_to.html) and apparently that now fails to link.
2016-01-18debian: Avoid linking with -Bsymbolic-functionsHolger Hans Peter Freyther1-0/+3
Our tests want to be able to change symbols from the library and even by using --wrap=XYZ it is not possible right now. One option would be to use static linking but that is not always enabled, the other is to skip tests on Ubuntu and the third one is to disable that linking mode. This means that the dynamic linker needs to spend some more time but we do spend this time on all other distros and this looks acceptable.
2016-01-18comment typoNeels Hofmeyr1-1/+1
2016-01-15msgb/test: Add test case for error casesJacob Erlbeck2-0/+24
Include a test for msgb_trim. Sponsored-by: On-Waves ehf
2016-01-15msgb: Assert len >= 0 in msgb_trimJacob Erlbeck1-0/+2
Currently msgb_trim only checks for len > data_len and returns -1 in that case, allowing the caller to fix it somehow. Using a negative length will always lead to a corrupt msgb, but this is not being checked. This commit adds a check for len < 0 and a conditional call to MSGB_ABORT. Sponsored-by: On-Waves ehf
2016-01-15msgb/test: Add tests for msgb_resize_area and msgb_copyJacob Erlbeck2-0/+149
Sponsored-by: On-Waves ehf
2016-01-15msgb/test: Add functions to catch and check exceptionsJacob Erlbeck2-1/+32
Currently the msgb error handling cannot be fully tested, since in many cases osmo_panic will be called. This will in turn call abort(). Using an osmo_panic_handler that just returns will not help, since many msgb functions rely on MSGB_ABORT to not return at all. This commit uses an alternative osmo_panic_raise handler that just calls longjmp to return to the test function. Since some of this activity is logged to stderr where the strings may contain variable parts like pointer addresses, stderr checking is disabled in testsuite.at. Sponsored-by: On-Waves ehf
2016-01-15msgb/test: Add test for msgb message buffersJacob Erlbeck4-2/+136
This tests several API functions of the msgb by checking the invariant and by dumping resulting message buffers as hex. Sponsored-by: On-Waves ehf Conflicts: tests/Makefile.am
2016-01-15bitvec: Add get/set byte sequencesJacob Erlbeck6-2/+162
The new functions bitvec_get_bytes and bitvec_set_bytes copy byte sequences from bitvecs to uint8_t arrays and vice versa. While the bytes in the bitvecs do not need to be aligned, the uint8_t arrays always are. In case the bytes in the bitvec are aligned, the implementation uses memcpy. Note that the implementation like the other existing functions assume MSB first encoding. [hfreyther: Squash the comment fix into this commit as well] Sponsored-by: On-Waves ehf
2016-01-15gsm: Add APN conversion functionsJacob Erlbeck7-3/+216
These functions are currently part of openbsc but also needed by other projects. The function have been renamed as follows: gprs_apn_to_str -> osmo_apn_to_str gprs_str_to_apn -> osmo_apn_from_str Sponsored-by: On-Waves ehf
2016-01-06update TODO-RELEASE regarding the talloc change.Harald Welte1-0/+1
Shipping our own private copy of talloc was a good idea in 2008, when it was not readily available on most target platforms. Today, the situation is quite different, as it is a standard library on major Linux distributions.
2015-12-25osmo_prim_op_names should be externHarald Welte1-1/+1
2015-12-24Fix some recently added formats on 64bitNeels Hofmeyr1-3/+5
86ec311896dd5d4 adds compiler warnings on 64bit. The build is clean otherwise, so let's keep it that way.
2015-12-23Add osmo_prim_op_names[] symbol and _SAP_SS7_BASE defineHarald Welte3-1/+14
2015-12-21msgb: Add msgb_test_invariant functionJacob Erlbeck1-0/+40
This adds a function that verifies whether a mgsb is consistent. Sponsored-by: On-Waves ehf
2015-12-21msgb: Let msgb_hexdump be more tolerantJacob Erlbeck1-7/+39
This patch makes msgb_hexdump accept out of range lXh pointers and shows info about them instead of aborting the dump entirely. Sponsored-by: On-Waves ehf
2015-12-21msgb: Add msgb_resize_area and msgb_copyJacob Erlbeck2-0/+94
These functions originate from openbsc/src/gprs but are generic msgb helper functions. msgb_copy: This function allocates a new msgb, copies the data buffer of msg, and adjusts the pointers (incl. l1h-l4h) accordingly. msgb_resize_area: This resizes a sub area of the msgb data and adjusts the pointers (incl. l1h-l4h) accordingly. Sponsored-by: On-Waves ehf
2015-12-21some comments / fixed typosNeels Hofmeyr5-3/+7
2015-12-19LaPDm: Refuse SUSPEND/RESUME/RECONNECT in BTS modeHarald Welte1-0/+17
The primitives for SUSPEND, RESUME and RECONNECT are only permitted on the MS side of the LAPDm link, not on the BTS side. So we should check for this and reject, accordingly.
2015-12-17ns: Force a defined state when sending NS RESETJacob Erlbeck3-0/+108
Currently the state is assumed to remain the same while the reset procedure is active. While this works correctly in general, a single unexpected BLOCK_ACK or UNBLOCK_ACK can change the state but will not stop the reset procedure. The leads to repeated RESET messages, where the corresponding RESET_ACK is ignored. This is a stable state which can only be left by manual intervention or by reception of a RESET message from the peer. This commit changes the RESET timeout handler to set the state to BLOCKED/RESET when sending the new NS RESET message. Note that this should ensure a clean restart even if the state has been screwed up. It does not fix the handling of BLOCK_ACK or UNBLOCK_ACK in abnormal cases. Addresses: gprs_ns.c:349 NSEI=8895 Tx NS RESET (NSVCI=8895, cause=O&M intervention) gprs_ns.c:878 NSVCI=8895 Rx NS RESET ACK (NSEI=8895, NSVCI=8895) gprs_ns.c:887 NS RESET ACK Discarding unexpected message for NS-VCI 8895 from SGSN NSEI=8895 Ticket: OW#1551 Sponsored-by: On-Waves ehf
2015-12-17stats: Fix compiler warning about losing constHolger Hans Peter Freyther1-1/+1
stats_statsd.c: In function ‘osmo_stats_reporter_statsd_send_item’: stats_statsd.c:154:15: warning: initialization discards ‘const’ qualifier from pointer target type char *unit = desc->unit; ^
2015-12-17ns/stats: Add missing osmo_stat_item_group_free to gprs_nsvc_deleteJacob Erlbeck1-0/+1
The stat item group is not removed by gprs_nsvc_delete which will corrupt the group list. Addresses: valgrind tests/gbproxy/gbproxy_test [...] ==4541== Invalid write of size 4 ==4541== at 0x4071ACA: __llist_add (linuxlist.h:65) ==4541== by 0x4071ACA: llist_add (linuxlist.h:81) ==4541== by 0x4071ACA: osmo_stat_item_group_alloc (stat_item.c:112) ==4541== by 0x407EDFD: gprs_nsvc_create (gprs_ns.c:244) ==4541== by 0x408109D: gprs_ns_instantiate (gprs_ns.c:1388) ==4541== by 0x804CFD3: test_gbproxy_ident_changes (gbproxy_test.c:1501) ==4541== by 0x805FBD3: main (gbproxy_test.c:5803) Sponsored-by: On-Waves ehf
2015-12-14talloc: Depend on libtalloc-dev being present as wellHolger Hans Peter Freyther1-1/+1
2015-12-13RSL: Add enum + TLV definitions for ip.access style embedded IEsHarald Welte4-0/+58
2015-12-10talloc: Untested change to unbreak buildHolger Hans Peter Freyther1-1/+1
In case talloc is not installed in the default search path we need to place @TALLOC_CFLAGS@ into the include directory as well.
2015-12-09gsm_03_41: Fix structure definitions for big-endian machinesRuben Undheim1-0/+31
this was detected by debian packaging, as the associated gsm_03_41 test case fails on big endian machines like ppc.
2015-12-08update debian packaging from libosmocore6 to libosmocore7Harald Welte2-2/+2
2015-12-08utils: add TALLOC_CFLAGS to buildHarald Welte1-1/+1
this is an attempt to fix the FreeBSD build
2015-12-08stats: Add OSMO prefix to STAT_ITEM_NOVALUE_IDJacob Erlbeck2-4/+4
This symbol is globally visible and therefore should have an OSMO prefix like the other identifiers exported by stat_item.h. Sponsored-by: On-Waves ehf
2015-12-08stat: Explicitly support stat_items without unitJacob Erlbeck3-2/+16
Add OSMO_STAT_ITEM_NO_UNIT for stat items without an unit. The statsd reporter uses gauges ("g") to report them. Sponsored-by: On-Waves ehf
2015-12-05remove our internal copy of talloc, use system libtallocHarald Welte17-2089/+28
Shipping our own private copy of talloc was a good idea in 2008, when it was not readily available on most target platforms. Today, the situation is quite different, as it is a standard library on major Linux distributions.
2015-11-26stats: Add TODO comment to rate_ctrJacob Erlbeck1-0/+3
Currently the counters are scanned twice, once for interval computation and once for reporting. This adds a reminder to move the interval computation code to a special stats reporter which just shall update the fields. Sponsored-by: On-Waves ehf
2015-11-26stats/test: Add memory leak checkJacob Erlbeck1-4/+9
Adds a rudimentary leak check for the counters and stat items. Sponsored-by: On-Waves ehf
2015-11-26stats/test: Add test for reportingJacob Erlbeck2-17/+369
This tests uses a dedicated test reported to check several aspects of the value reporting. - addition/removal of stats reporter - addition/removal of counters/items - setting of max_class - initial value flush - updating single counters/items - reporter retrieval - enable/disable Sponsored-by: On-Waves ehf
2015-11-26stats: Reorder functions in stats.cJacob Erlbeck1-59/+61
Due to prior refactoring, the functions do not have an sensible order in the file. This commit tries to improve that a little bit. Sponsored-by: On-Waves ehf
2015-11-26stats: Move statsd related code into a separate fileJacob Erlbeck4-144/+180
This commit moves the stats specific code parts into stats_statsd.c while keeping the generic parts in stats.c. The code in stats.c no longer contains references to statsd symbols. Note that the VTY code still needs to know about every stats reporter backend. Sponsored-by: On-Waves ehf