Commit Graph

155 Commits

Author SHA1 Message Date
Pau Espin df5fb9adf2 hnb-test: Fix memleak in hnb_read_cb
Change-Id: I6ecbce6aab11e1382ff9f71d901e1c6ac145f835
2021-11-02 13:33:56 +00:00
Pau Espin bc7c69d170 hnbap: Use specific prefix for HNBAP generated code
Other libraries already use ASN1C_PREFIX except the HNBAP one. Let's use
it here to avoid collisions.

All new include/osmocom/hnbap/HNBAP_*.h and src/hnbap/HNBAP_*.c are
generated using the updated src/hnbap/Makefile.am.
Files such as src/*.c, test/* and include/osmocom/hnbap/hnbap_common.h
are modified manually to update structs/enums to new prefix.

Related: SYS#5516
Change-Id: I6c062f631527ae42811bfec134933671c05ecba6
2021-10-26 16:42:07 +02:00
Pau Espin e395b75619 hnb-test: Fix rc var may be used uninitialized
Warning observed compiling with gcc 11.1.0.

Change-Id: I6ca53dd57572338f15971633441da895843a164d
2021-10-26 14:31:33 +02:00
Pau Espin dba8b0c334 Provide libosmo-rua as a public shared library
It is needed by the new osmo-hnodeb project.

Related: SYS#5516
Change-Id: I8b800baacbfe3a3c424c51b418b5ac2e2848b3ba
2021-10-22 15:43:17 +02:00
Pau Espin 35f2bd60ae Provide libosmo-hnbap as a public shared library
It is needed by the new osmo-hnodeb project.

Related: SYS#5516
Change-Id: I0d0862e9d59d3b206f3f7dfae4b39ae4032bb762
2021-10-22 15:42:27 +02:00
Pau Espin 2127a71515 src/*/Makefile.am: Fix trailing whitespace
Change-Id: Ie22df146cfaf6aaf9c7cef884a964e6a3dfcc8ad
2021-10-22 15:42:05 +02:00
Pau Espin 40c1729c61 src/tests/Makefile.am: Drop reference to non-existent RANAP_FILES var
It was no longer needed since .la was used.

Change-Id: I3f196d5c2bb35826709bfc32d10e6b3683b552ee
2021-10-21 15:06:03 +02:00
Pau Espin 1f6c117d07 hnb-test: Fix typo in vty cmd description
Change-Id: Id33e2e8caa37dc359d564188747cd4c1b8bc4064
2021-07-05 12:18:47 +02:00
Pau Espin a94752e684 tests: Replace deprecated API log_set_print_filename
Change-Id: Ic53a0a9afb8038759bb3ab1d4c5970f23632e84e
2021-02-19 13:19:01 +01:00
Pau Espin 2c6aed38bd tests: Explicitly drop category from log
Let's disable category here since we don't care about its formatting here.

In any case, every test relying on logging output validation should
always explicitly state the config to avoid issues in the future if
default values change.

Change-Id: Ia633cae0a26f294e276b431a82256abb1b57ebba
Related: OS#5034
2021-02-19 13:18:42 +01:00
Pau Espin e6342e1cab tests/hnb-test: Disable building unsued code
Change-Id: I17f20cea8aa63ed79168653292b99c90b8c03caf
2021-01-14 11:31:32 +01:00
Pau Espin 8653233b57 tests/hnb-test: Initialize logging with existing struct log_info
Change-Id: Ic92e60dda41a9e4d139294b1e851fff5c4f26143
2021-01-14 11:29:47 +01:00
Pau Espin 4c928485ba tests/hnb-test: Fix signedness of assigned pointer
Change-Id: I320ad86b83b0308b43489e8d95f63d6ed55821b5
2021-01-14 11:27:34 +01:00
Pau Espin 84c3e8649a tests/hnb-test: Fix uninitialized use of rc variable
Change-Id: I168e4f7cd48cbaa387e6b05868107250795a0f0c
2021-01-14 11:26:15 +01:00
Pau Espin 634fd81f3d tests/hnb-test-ranap: Fix missing include for ranap_bcd_decode
Change-Id: If8b799777598377048512c338f6384560b445ba3
2021-01-14 11:26:15 +01:00
Pau Espin 101fba211a tests/hnb-test-ranap: Fix incorrect signedness in pointer
Change-Id: I04b1c0446124d66dae1e8fb99d9b82782d12bde7
2021-01-14 11:26:15 +01:00
Pau Espin 96a94bc482 tests/hnb-test: check return code of hnbap_encode_ueregisterrequesties
gcc warns about set but not used variable otherwise.

Change-Id: Ia49b7e88a66a4a744c2b14db6331cc0de431f60b
2021-01-14 11:26:15 +01:00
Pau Espin b4ff1f42b8 tests/hnb-test: Fix signedness of imsi_buf
Change-Id: I3b0a6218ac6242d03642972d5b244815ce9d97a0
2021-01-14 11:26:15 +01:00
Pau Espin 89f4c80541 tests/hnb-test: Drop unused variables
Change-Id: I12870a1cf2462b7cc2868a54f58416e03a856084
2021-01-14 11:24:31 +01:00
Pau Espin 825a1e40a8 tests/hnb-test-ranap: Fix incorrect pointer type cast
osmo_hexdump expect it to be a const unsigned char*, and gcc warns about
incorrect signedness.

Change-Id: I7e0622f502a4442d700340b0f1c2f8cd01e90ecd
2021-01-14 11:10:08 +01:00
Pau Espin 4f35665b9f Fix OneDefinitionRule Asan violation in tests and osmo-hnbgw
With new gcc 10.1.0, tests failed at runtime when built with ASAN
enabled, since some global variables where defined multiple times.
See OS#4556 for a sample Asan error.

Fixes: OS#4556
Change-Id: I12a667ea8a9f16404c13c9218b246d2e3acfe3e8
2020-05-19 20:32:58 +00:00
Pau Espin 6f66feb42d tests: Fix trailing whitespace
Change-Id: I3ef7a3f1c3247615619a0d01c92d8f80572b0dfe
2020-05-19 20:32:58 +00:00
Harald Welte 7712808e07 Fix compilation with gcc-10
/usr/bin/ld: test_common.o:(.bss+0x0): multiple definition of `talloc_asn1_ctx'; test-helpers.o:(.bss+0x0): first defined here

See also https://alioth-lists.debian.net/pipermail/debian-mobcom-maintainers/Week-of-Mon-20200413/000652.html

Change-Id: I4ce41158bb27e6b9242613106f226fc86995c53c
2020-04-20 20:01:53 +02:00
Vadim Yanitskiy 065c192475 tests/test-ranap: cosmetic: remove unused variable 'rc'
Change-Id: Ie931d11efd7bb083558852a7f329c984c17fec62
2020-04-07 21:11:13 +07:00
Vadim Yanitskiy 81fd48d741 tests/test-helpers: fix endianness: do not print uint32_t as raw bytes
This unit test would not pass on big-endian machines.

Change-Id: I60dbcaa89b031c9a81c35e1dd0d9c963d486014c
2020-04-07 21:05:37 +07:00
Vadim Yanitskiy 89062aeb21 tests/test-helpers: fix some -Wpointer-sign warnings reported by GCC
Change-Id: I7ebc99fe919fe7ba515c9d8ba601dceb820bf11f
2020-04-07 21:01:12 +07:00
Pau Espin ca74126d54 tests/test-ranap.c: Fix wrong printf format
Caught by compiler:
test-ranap.c:54:30: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 2 has type ‘RANAP_MaxBitrate_t’ {aka ‘long int’} [-Wformat=]
test-ranap.c:78:30: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 2 has type ‘RANAP_CauseMisc_t’ {aka ‘long int’} [-Wformat=]

Change-Id: Icc4e81beaa35e13aea3adfed983016c78b730061
2020-03-20 20:23:04 +01:00
Pau Espin 4ab00db868 tests/hnb-test-ranap.c: Fix wrong printf format
Catched by compiler:
hnb-test-ranap.c:76:44: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘RANAP_CN_DomainIndicator_t’ {aka ‘long int’} [-Wformat=]

Change-Id: Ie4cd6a36fd0e9a871a1815d600e8a321a3d2a208
2020-03-20 20:19:49 +01:00
Martin Hauke c593da5d45 tests: Missing return statement
Change-Id: I4fae9f84a83af280846b07eaa139ff4a05784a2e
2020-02-15 23:01:39 +01:00
Harald Welte 11b1ddee21 ranap_msg_factory: Fix criticality of PDUs
Seveal of our RANAP messages were using criticality values at the
PDU level differing from what RANAP_PDU_Descriptions.asn states
for the respective procedures.  Let's fix that.

This was discovered while working on the initial IuCS TTCN3 tests,
where the receive templates require the criticality to match.

Change-Id: I98eec0bdc0d0cb1b9284bd5d042b1f4403abef95
2019-04-20 22:53:49 +02:00
Oliver Smith f601526970 tests: use -no-install libtool flag to avoid ./lt-* scripts
This ensures that the rpath of the generated binaries is set to use only
the just-compiled so-files and not any system-wide installed libraries
while avoiding the ugly shell script wrapper.

Change-Id: I92c7391631becc09d277981179c23f2e4dba3b54
2019-03-19 13:46:08 +01:00
Neels Hofmeyr 3050864b73 hnb-test: log accurate three-digit MNC with leading zeros
Depends: Id2240f7f518494c9df6c8bda52c0d5092f90f221 (libosmocore)
Change-Id: Ie3dd206bca2f38a0ef7ee7f9d3b6bf2eacc899a4
2018-02-28 19:26:07 +01:00
Neels Hofmeyr c6ed1c3ae8 test_common: fix compiler warning: include ranap_common.h
test_common.c:85:2: warning: implicit declaration of function ‘ranap_set_log_area’

Change-Id: Ice192e1f7f1bdafe0941160f43e573349aaceb75
2017-11-22 03:11:40 +01:00
Neels Hofmeyr d9cb19a8fb tests: sanitize: fix mem leaks, clean after tests
Fix various mem leaks in the testing code.

Add test_common_cleanup() in test_common.c, to free talloc contexts; call in
test-{helpers,hnbap,ranap}.c. Upon talloc ctx cleanup, ensure that they are
actually empty, in order to catch newly introduced mem leaks.

If non-empty, print talloc context reports.

Change-Id: Ic66c005f2a264774e18bb54e58b87bef5944511c
2017-11-22 03:11:40 +01:00
Harald Welte 47bba70cec Add "-Wall" to the compile rules of the non-asn1c-generated source code
This is actually default in all other osmocom projects, and it's a
big surprise that it hadn't been enabled for osmo-iuh.  Now we finally
can see that there are e.g. unused static functions in the code.

Change-Id: I8d52b11e3f476ffd77f3ab185b679817cd3b2163
2017-11-21 08:25:52 +01:00
Neels Hofmeyr b0c650e7b0 vty: skip installing cmds now always installed by default
vty_install_default() and install_default() will soon be deprecated.

Depends: I5021c64a787b63314e0f2f1cba0b8fc7bff4f09b
Change-Id: I61b79f633d36814b53e40f1a92b5847c9ff4fde0
2017-11-08 02:28:31 +00:00
Neels Hofmeyr 0f88c11009 migrate osmo-hnbgw to libosmo-sigtran's SCCP/M3UA
libosmo-sigtran now has a "proper" SCCP/M3UA stack, so we can make our hnb-gw
3GPP compliant by switching from the old SUA code to the new universal SCCP
user API with support for (currently) M3UA and SUA.

Main changes:

Use one cn_link to STP: We will connect to the core network using an (Osmo)STP
instance that routes to MSC and SGSN, so we want one SCCP link instead of two.
The only difference between IuCS and IuPS is a different remote osmo_sccp_addr.

This has various effects through the messaging code; the patch is a bit larger
than I would like, but it is hard to separate out truly independent smaller
changes.

CS or PS domain was previously flagged in the separate cn_link, as ctx pointer
for two separate sccp_sap_up()s. Now there's just one such ctx, so determine
is_ps from the RANAP Domain Indicator, or from the conn's hnbgw_context_map:

- Add is_ps to context_map_alloc_by_hnb().
- To find a matching context, the RUA ID alone is no longer sufficient, also
  match is_ps (possible optimization todo: separate lists).

We would send separate CS or PS Reset messages based on the cn_link, instead
send both CS and PS Reset at the same time for the single cn_link. This could
be adjusted to detect presence of MSC or SGSN instead.

Pending: adjust the VTY config to reflect that there is only one remote
address. Place a TODO comment for that.

Smaller changes:

rua_to_scu(): populate called and calling addresses for N_CONNECT and
N_UNITDATA.

Remove DSUA.

Don't build dummy_cn, which is still implemented on SUA. Mark todo to maybe
re-include it based on M3UA later.

In hnbgw_cnlink, place sccp related items in a separate sub-struct.

Do not keep an llist of cn_links, just have the one. Remove iteration and list
management.

Change jenkins script to build libosmo-sccp master.

Patch-by: hwelte, nhofmeyr
Change-Id: I8ac15fa2fd25bedb26297177e416976a5389b573
2017-07-05 13:04:15 +02:00
Neels Hofmeyr 8e29b23119 new_rab_par_voice(): add bitrate params, call with (6700, 12200)
The guaranteedBitrate lowers from 12200 to 6700, which is mimicking the values
found in a trace from a production 3G environment. So far we have no reason to
choose these values other than knowing that other operators seem to do this.

This came up while trying to fix voice RAB for the nano3G, but this patch had
no effect on that. Now that it's here, we might as well keep it.

Change-Id: Ia7eecca43d62a6a020466e9b8dc8b566ca988f9f
2017-02-02 04:58:54 +01:00
Neels Hofmeyr 135bc06c35 ranap: make X.213 NSAP 160 bits long, zero padded
For IPv4 addresses, only 56bit of X.213 NSAP are used. The sysmocell5000
accepts such a field that is 56bits long, but the ip.access nano3G does not
(and crashes instead). Both work when zero-padded to 160bits size.

So far we used to send the IPv4 address as "raw" 32bits to the nano3G to avoid
the crash. With this zero padding we no longer need such a workaround and can
use identical config for both cells.

Change-Id: I070bbfe887ab93d08322df30571050a381d082d5
2017-02-02 04:53:41 +01:00
Neels Hofmeyr ad14ff96c3 cs RAB: add nAS_SynchronisationIndicator
This is mimicking the IEs found in a trace from a production 3G environment. We
have no reason to add this other than knowing that other operators seem to do
this.

This came up while trying to fix voice RAB for the nano3G, but this patch had
no effect on that. Now that it's here, we might as well keep it.

Change-Id: I14c22b0befb308bac2eded662fe13a58c8478743
2017-02-01 14:02:11 +01:00
Neels Hofmeyr 4ff1a5a957 fix msgb talloc context initialization
Properly initialize msgb talloc context in hnbgw and all tests, using the new
msgb_talloc_ctx_init().

test-ranap.c: since msgb talloc ctx is now in test_common_init(), remove msgb
talloc init here.

Change-Id: I807c799aff1239184728551ed77fdafa73bd683f
2016-10-13 04:17:40 +02:00
Neels Hofmeyr 793b273a70 fix build: look for generated sources in builddir, not srcdir
Fixes 'make check' from a different dir than the source tree.

Change-Id: I97606dadef3c2184f9538b0198029047cc3af71c
2016-10-10 13:34:38 +02:00
Neels Hofmeyr c83e49fc8d log VTY telnet bind only once
After libosmocore 55dc2edc89c1a85187ef8aafc09f7d922383231f which outputs
'telnet at <ip> <port>' from telnet_init_dynif(), there's no need to log the
telnet VTY bind here anymore.

Change-Id: Icd9e670c1d30c156f7bd5d0d34892150aeba95e9
2016-09-26 22:44:18 +02:00
Neels Hofmeyr 7b48749783 ranap: include port in RTP TransportLayerInformation
Remove an #if 0 to properly include the port information (verified to work).

Adjust test expectations.

Change-Id: I45fb134959dea9bcdfbfd9d8a061e67c3cc80fb7
2016-09-16 02:41:38 +02:00
Neels Hofmeyr a872421e43 build: parallel build: require ../libosmo-ranap.la from tests/
This rule is bad because it re-invokes $(MAKE), but it seems to fix the
parallel build. It should probably be done differently.

Change-Id: I8107e08e4c211f20d671f520bf6bab9356f3c90e
2016-09-09 06:43:32 +00:00
Neels Hofmeyr df63de2e37 build: move headers to include/osmocom/*
This came up while fixing 'make distcheck'; this is certainly not the easiest
way but it makes sense to have the headers in include/, like we do in openbsc.

The easy alternative might be to add -I$(top_srcdir)/src to src/Makefile.am.

Remove -I$(top_srcdir)/src from src/tests/Makefile.am, no longer needed.

Change-Id: I5a82e029dcdc4df0a60a31271a4883393fe59234
2016-09-09 06:43:32 +00:00
Neels Hofmeyr 2f1b1189da build: distcheck: add missing bits for testsuite distcheck
Got some errors during 'make distcheck', copying the way openbsc.git does these
things.

Change-Id: I13d76cd56dfb8fe4eb02d6fcada78a9e3311b51b
2016-09-09 06:43:32 +00:00
Neels Hofmeyr 347f8ef218 build: distcheck: add missing distclean files
Change-Id: I24d72b2b1bae52a1b2cf8a989396d2aac31d119e
2016-09-09 06:43:31 +00:00
Neels Hofmeyr 8345792281 build: fix ranap gen, use same for gen hnbap and rua gen
fix extraneous rebuild for each make invocation: touch the ranap.stamp file in
src/ as the make target suggests.

fix for 'make distcheck': ranap gen: move generated sources to builddir, not
srcdir. Thus we also -I the builddir include to pick up those headers.

hnbap and rua have the same situation as ranap (they generate numerous files
from a single make rule). Use the same makefile semantics for those two
(commit for ranap gen omitted the same changes for hnbap and rua).

The generated headers are thus moved to include/osmocom/*/, so adjust #include
statements accordingly (*_common.h, *_ies_defs.h).

Also move hnbap_common.h to include/osmocom/hnbap and rua_common.h to
include/osmocom/rua, since the *_ies_defs.h want to include them; and since
*_ies_defs.h are now in include/osmocom/*, we want a '<foo>' include now.

Also adjust gitignore.

Change-Id: I32213666fcdfc144008fa7d46497c0938d093e86
2016-09-09 06:43:31 +00:00
Neels Hofmeyr 52c6ae25be tests: don't log filename nor color in unit tests
In experr, we had line numbers in log output, which might change. Also, for
make distcheck, the path of the source file might have some '../../' added in
the log output (to indicate the src dir as seen from the build dir).

Fix both by dropping source file and line.

Also drop color while at it.

Change-Id: Ie76384c4176ce0a7d89d093f2efb848fe3f19400
2016-09-09 06:43:30 +00:00