Commit Graph

11 Commits

Author SHA1 Message Date
Oliver Smith d4998abd46 xua_msg: fix gcc 4 + -std=gnu11 error
Fix 'error: initializer element is not constant' with debian 8's gcc
4.9.2, triggered by XUA_HDR. Create a new _XUA_HDR without the type cast,
and use it inside of const struct definitions (xua_test.c). The new
macro is needed, because removing the type cast from the original
XUA_HDR would break other uses.

Related: OS#5004
Change-Id: I890432ee976043d012b01023f7dd2cfecf79d115
2021-02-02 13:17:32 +01:00
Neels Hofmeyr 21ff9ae426 add osmo_sccp_addr_cmp(), osmo_sccp_addr_ri_cmp()
osmo-msc identifies its BSC and RNC peers by SCCP address, and compares those
by memcmp(), which is not really accurate. Rather provide a meaningful
osmo_sccp_addr_cmp() API to determine whether SCCP addresses are identical.

Go for a full cmp that would also allow sorting.

Change-Id: Ie9e2add7bbfae651c04e230d62e37cebeb91b0f5
2019-04-12 06:28:34 +02:00
Pau Espin 1ba800e36c tests: xua_test: Fix array len computation
As warned by gcc 8.1.0:
In file included from libosmo-sccp/include/osmocom/sigtran/osmo_ss7.h:7,
                 from libosmo-sccp/include/../src/xua_internal.h:3,
                 from libosmo-sccp/tests/xua/xua_test.c:21:
/include/osmocom/core/utils.h:13:34: error: division ‘sizeof (const uint8_t (*)[12] {aka const unsigned char (*)[12]}) / sizeof (const uint8_t[12] {aka const unsigned char[12]})’ does not compute the number of array elements [-Werror=sizeof-pointer-div]
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
                                  ^
libosmo-sccp/tests/xua/xua_test.c:371:45: note: in expansion of macro ‘ARRAY_SIZE’
 #define PARTARR(x, data) { .tag = x, .len = ARRAY_SIZE(data), .dat = (uint8_t *) data }

Change-Id: Iad5703d68fee26fc83958741512820d2539e604e
2018-05-16 14:47:42 +02:00
Pau Espin 920b22c473 tests: xua_test: Fix use of wrong buffer for dest addr
All the others parts use that buffer as its name indicates.

Change-Id: Ide7fe148cc762153330b08f66737816ceed96cb2
2018-05-16 14:47:42 +02:00
Neels Hofmeyr 73a7435d28 xua_test: sanitize: fix msgb leak
Change-Id: Ie57e803bb6361f39042084a21cada754a6506606
2017-11-18 10:19:04 +00:00
Harald Welte db736f432a implement unit tests for osmo_sccp_addr_{parse,encode}()
The recent bug with chopped-off point codes in SCCP Address handling
has shown that this code could need proper test cases.  This patch
adds a testsuite for SCCP address encoding and decoding.

Related: OS#2441
Change-Id: I612352736ab33462ca0dd97798a2c437eadccb86
2017-10-27 18:00:12 +02:00
Neels Hofmeyr 6df7a4a6ee fix compiler warning: xua_test: hexdump pointer type
Was recently introduced by a70b4599f6.

Change-Id: Iab5529f6919fd22902a8b39e8a52079f08deb851
2017-06-29 17:52:08 +00:00
Neels Hofmeyr a70b4599f6 fix sanitize make check: xua_test: initialize gt_out.
The sanitize build fails because gt_out is not initialized to zero, but is
later mem-compared to a zero-initialized struct.

Zero-initialize gt_out.

Also print in the test output both byte dumps. It helped to figure out the test
failure and might as well stay.

Change-Id: Ice8ee9c2a6bde4924f3ae6d95aa9268ebef9f070
2017-06-23 03:21:24 +02:00
Pau Espin 19c5c07525 xua_test.c: remove useless keyword in struct declaration
Fixes following warning:
warning: useless storage class specifier in empty declaratio

Change-Id: I5cea7b6ec2cc755ad8cec69b771f6e3b297e607d
2017-06-22 06:23:04 +00:00
Harald Welte 1e25c3a0ac xua_msg: Add xua_from_nested() helper function for nested IEs
... and add a test case to ensure it continues to work.

Change-Id: Iee434886598b528d23ddce0490dcc782e0f5d6ae
2017-04-10 11:48:35 +02:00
Harald Welte 192cf0c2ac Add tests for xUA code + SCCP/SUA transcoding
Change-Id: I7ce038d72dca18fb83d5a12519c9a48267e52ab8
2017-04-10 11:48:34 +02:00