Commit Graph

114 Commits

Author SHA1 Message Date
Oliver Smith ef0d676741 tests: fix old-style function definition
Fix for:
  xua_test.c:575:6: error: old-style function definition [-Werror=old-style-definition]

Change-Id: Iccc942f9f25fb091045d906eb8be658b54c58529
2022-11-11 10:13:24 +01:00
Vadim Yanitskiy 7d8a674e88 tests: use 'check_PROGRAMS' instead of 'noinst_PROGRAMS'
When using 'check_PROGRAMS', autoconf/automake generates smarter
Makefiles, so that the test programs are not being compiled during
the normal 'make all', but only during 'make check'.

Change-Id: Icca22778831b043358acf0482948dbff32a11256
2022-04-13 19:55:33 +03:00
Pau Espin 64dda770c3 Add ss7 instances to osmo_ss7_instances in creation order
Otherwise when configuring ss7 instances in numerical order in the VTY
and then printing the VTY configuration they end up ordered this way:
cs7 instance 2
cs7 instance 1
cs7 instance 0

Related: SYS#5912
Change-Id: Id4d0a20cc5b0811b505b2d1051d496f8bd17d54c
2022-03-29 13:13:56 +02:00
Oliver Smith 043275129c treewide: remove FSF address
Remove the paragraph about writing to the Free Software Foundation's
mailing address. The FSF has changed addresses in the past, and may do
so again. In 2021 this is not useful, let's rather have a bit less
boilerplate at the start of source files.

Change-Id: Ia450b630e0b60b38835f599c93985bbe97c50d2f
2021-12-14 12:54:05 +00:00
Philipp Maier b3cb0c14bb osmo_ss7_vty: allow users to inspect routes also in ASP role
When libosmo-sigtran runs in ASP role, then the entire routing table
introspection (show) and routing table configuration VTY commands are
not present. Editing the routing table manually only makes sense in SG
role, but it is still useful to be able to inspect the routing table in
ASP and SG mode.

Change-Id: Ieaef4f0344b5b77ff5047013e9da1e938004e97c
Related: SYS#5392
2021-06-17 15:51:29 +02:00
Harald Welte 2cf796a2a5 ss7_asp_test.vty: Allow more asp node commands after shutdown
this will be required once we add new commands (quirk) in the
next few patches.

Change-Id: If1068cd94782df236948101166a76586e9845762
2021-05-11 20:36:31 +02:00
Pau Espin d7ecf7a150 tests: Replace deprecated API log_set_print_filename
Change-Id: Id09f903fc5008d074763441a26d71c4fbaf394d8
2021-02-19 13:10:35 +01:00
Pau Espin 5cac145d2c 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: I899e63ab2702bf25514f6585fb45f5bbf60a9ac9
Related: OS#5034
2021-02-19 13:06:02 +01:00
Oliver Smith 20642478f3 xua_test: 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 in 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 16:22:01 +01:00
Pau Espin 531ba5d729 Revert "Revert "Introduce SS7 IPv6 support""
Actual fix for the issue is applied in next commit.

This reverts commit ee81289297.

Change-Id: I8b66dd97f47f1b2b72c101b9ce4444e75eb744c0
2020-08-28 17:14:29 +02:00
Neels Hofmeyr ee81289297 Revert "Introduce SS7 IPv6 support"
This reverts commit 0b39f2cf7b.

Reason for revert:

Breaks ttcn test suites (at least for osmo-bsc) with osmo-stp error log:
"MTP-TRANSFER.req for DPC 187: no route!"

The breakage is fixed by only reverting the NULL -> "localhost" change
back to NULL. But the commit log indicated a reason for this, so rather
reverting the entire commit for now.

Change-Id: Ia97832f4e3ed646457d5c6eeba27352f1153edec
2020-08-28 08:10:06 +00:00
Pau Espin 0b39f2cf7b Introduce SS7 IPv6 support
In osmo_ss7_vty_go_parent, "127.0.0.1" is changed to "localhost" to let
local NSS decide whether to use IPv4 or IPv6. In newish systems, IPv6
::1 will be selected since IPv6 takes precedence over IPv4.

Similarly, the default source addr needs to be changed from NULL to "localhost"
since for some yet unknwon reason, getaddrinfo(AF_UNSPEC, NULL) returns
first IPv4 "0.0.0.0" and later "::", which is inconsistent with
getaddrinfo("localhost") result, resulting in src=IPv4(0.0.0.0) and
dst=IPv6(::1), which is incompatible and will fail.
In any case, this change doesn't affect users of osmo_sccp_simple_client
because the APIs set both src and dst addresses.

Change-Id: I69c48819b70635c92fa404cafd917af7802d517c
Depends: libosmo-netif.git Change-Id Ie6bb17a9af6ca21d5e350f9c9d2d74c97c5a00af
2020-08-24 10:34:38 +02:00
Harald Welte b080286674 Add "no traffic-mode" configuration to AS
As per RFC4666 it is optional whether or not a traffic-mode IE is
part of ASPAC requests from ASP to SG.  We implemented that so far
by having none as default, unless the user specified an explicit
traffic-mode in the VTY.  However, we had no command to remove that
explicit configuration and return to the implicit one.

Change-Id: Ibe2b298dd76dc4b02521dc411ae9d570eaf5a9a2
2020-06-13 16:15:41 +02:00
Neels Hofmeyr ed2d50d4e9 cs7 vty: add 'show cs7 config'
When 'cs7' was added, it was generally possible to get the full automatic
configuration spelled out by using 'show running-config'. Later, the vty was
modified so that automatically configured parts were omitted.

Since figuring out the 'cs7' configuration is far from trivial, it is very
convenient to get the program's current configuration spelled out in detail,
whether it is automatic or not. For this purpose, add a new 'show' command
which simply calls the ss7 VTY's write function with a new switch to disable
all omissions.

Change-Id: I84707561a6f54851c5599c39ea9bf1d971a2a1d7
2020-03-19 18:01:49 +00:00
Oliver Smith a8a646af16 osmoappdesc.py, tests: switch to python 3
Make build and external tests work with python3, so we can drop
the python2 dependency.

This should be merged shortly after osmo-python-tests was migrated to
python3, and the jenkins build slaves were (automatically) updated to
have the new osmo-python-tests installed.

Related: OS#2819
Depends: osmo-python-tests I3ffc3519bf6c22536a49dad7a966188ddad351a7
Change-Id: I344c49001fba23bdcfdef06ab174c52b60edd01c
2019-12-12 09:18:58 +00:00
Harald Welte a4555c3430 check for osmo_fsm_register() failures and propagate error
Change-Id: Id8861144e4880383a173b7e6ae7860beebac09d9
2019-12-01 17:36:50 +01:00
Vadim Yanitskiy c19962e1e1 osmo_ss7_vty.c: implement 'active' filter for show_cs7_as_cmd
Change-Id: I356d90642a500be6a70f60c8240ce1211fd0d934
2019-11-14 22:31:40 +00:00
Pau Espin 535e43268c xua: Avoid multiline log in xua_msg_dump()
In general we want to avoid multiline log messages since they make
parsing more difficult. Also output in VTY over telnet looks strange
(indentation incremented at each new line).

Change-Id: Id9084d0e0f976bb374186db93d6ff8062b99e238
2019-11-12 21:35:24 +00:00
Vadim Yanitskiy 7cc8c03088 tests/sccp/Makefile.am: use sccp.o from $(top_builddir)
This change suspends the warnings about option 'subdir-objects',
by using the existing object file from the build directory.

Change-Id: I4dc2abb19c58fce0a12cc9799019878194c667d1
2019-11-07 13:37:40 +00:00
Harald Welte b521a2ed09 vty: Permit configuration of ASPs in SCTP client mode
The M3UA specification states that either of the two roles should
be the SCTP client and the other the server.  It also states that
the default for the SGP is to operate as server.  However, it permits
other configurations.  Let's allow this to be configured by the VTY.

We need to ensure that while in ASP role, we don't send any NOTIFY
messages to the peer SG.

Change-Id: I7452a862d45da35dcd58654ca17222eb52d26f1f
Closes: OS#2005
2019-11-05 20:51:04 +00:00
Harald Welte 1a822635f8 Allow ASP role to be configured
So far, we had a static role model:
* SCTP servers (listening, such as OsmoSTP) are role SGW
* SCTP clients (connecting, such as OsmoMSC) are role ASP

While this is customary, it is not actually required by the
specification.  The SGW can establish the SCTP connection to an ASP
but still remain "SG" role.

Let's make things more flexible by having the role configurable.

Related: OS#2005
Change-Id: I2df9cd9747ad5c9a05d567d9a71bab6184c53674
2019-11-05 20:50:51 +00:00
Pau Espin c99724a9ec ss7: Set default traffic-mode to override
Change-Id: I8570ed6634eb20c0f9e4b712de6592b6c3b77227
2019-10-24 13:23:09 +02:00
Pau Espin 7240f56a70 vty: Print traffic mode during show cs7 instance as
Change-Id: Ief6b03f50751b8d8f4021e94d54f079681b64d51
2019-10-23 21:25:33 +00:00
Pau Espin 2c3ff8c81b tests: Introduce test for multi-homing STP features
Config file sets omo-stp instance to bind on 2 IP addresses, and then
the test verfies through linux /proc/net/sctp/* that binding is done
correctly and that it can be reached from another remote address to one
of the configured addresses.

Change-Id: Ifa11b1fc882dff415405f62024e94bed67228866
2019-10-22 19:38:53 +00:00
Pau Espin 80b1355819 ss7: Support multiple addresses in SCTP connections
After this patch, Several "local-ip" and "remote-ip" lines are accepted
under "listen" and "asp" VTY nodes, allowing to configure an SCTP
connection with multiple connections, hence allowing control of SCTP
multi-homing features.
libosmo-sccp clients such as osmo-bsc and osmo-msc also gain support for
this feature with this commit.

Related: OS#3608
Depends: libosmocore.git Ic8681d9e093216c99c6bca4be81c31ef83688ed1
Depends: libosmo-netif.git I0fe62f518e195db4e34f3b0ad1762bb57ba9d92a
Change-Id: Ibd15de7a4e00dbec78ff2e2dd6a686b0f3af22de
2019-10-22 19:38:53 +00:00
Harald Welte ecb2cf1a31 ipa: VTY config option to explicitly enable/disable SCCP patching
When receiving SCCP messages from an IPA peer/ASP, osmo-stp so far
unconditionally inserted origin/destination point codes int the SCCP
called / calling party addresses.

This behaviro is now made optional with the introduction of the
following per-AS configuration:
	"point-code override patch-sccp (disabled|both)"

The default behavior is switched from 'both' to 'disabled' at the same
time.

Change-Id: I535e2170adadfe755d2bcbf5bbf4556bebb77737
Closes: OS#4219
2019-10-19 22:31:04 +02:00
Pau Espin 2728abf9d9 Remove undefined param passed to {logging,osmo_stats}_vty_add_cmds
Since March 15th 2017, libosmocore API logging_vty_add_cmds() had its
parameter removed (c65c5b4ea075ef6cef11fff9442ae0b15c1d6af7). However,
definition in C file doesn't contain "(void)", which means number of
parameters is undefined and thus compiler doesn't complain. Let's remove
parameters from all callers before enforcing "(void)" on it.

Related: OS#4138
Change-Id: Iedd11f816002b686f0ddb54c0cf7ba4e229e21e3
2019-08-05 14:47:06 +02:00
Holger Hans Peter Freyther 1646d9b827 xudt: Implement address and data extraction
The cellmgr-ng unfortunately looks at the data being sent and can't
handle the presence of XUDT at all. Add the structure definition
and refactor extraction code to work on offsets. Add a unit test.

Change-Id: I45a7447cc1be432fff34849e0e35abc0410cf153
2019-05-01 23:52:31 +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
Harald Welte 99beede80c Fix output of route destination in 'show ss7 instance <0-15> route'
We were printing the mask of the route, but not the point code itself.

Best would probably be to print both?

Closes: OS#3835
Change-Id: Ifa4fdbad953d40f222beb470a082eed8c20991ef
2019-03-15 17:26:01 +00:00
Neels Hofmeyr 6a973bab9c build: move include/{mtp,sccp} to include/osmocom/
Anywhere else in the Osmocom code base, we arrange headers in
include/osmocom/foo/ and pass -I ${root_srcdir}/include/.
This way including an osmocom header always has the format
  #include <osmocom/foo/bar.h>
whether we are including from the local source tree or from $prefix.

For some reason not clear to me, the mtp and sccp folders, even though they are
being installed to $prefix/include/osmocom/, were kept *next* to the osmocom/
dir, instead of inside it. Fix that weird situation.

The motivation is that I wanted to use a definition from sccp_types.h in a
public-API header. That is impossible if it requires
  #include <sccp/sccp_types.h>
in a local build, but
  #include <osmocom/sccp/sccp_types.h>
for any other source tree using libosmo-sccp. After this patch, both are
identical and including works without quirks. (The other patch that needed this
has changed in the meantime on and no longer needs this, but this still makes
sense for future hacking.)

The installed result does not change, since both mtp/*.h and sccp/*.h have
always been installed to $prefix/include/osmocom/{mtp,sccp}/. This merely
changes their position in the source tree.

The most curious situation before this is that any patch #including
<osmocom/sccp/sccp_types.h> might not get a notice that the header didn't
exist, but might instead include an older system-installed file.

Change-Id: I1209a4ecf9f692a8030b5c93cd281fc9dd58d105
2018-10-21 12:35:11 +00:00
Neels Hofmeyr bb6e4bb676 make SCCP timers configurable
The previous hardcoded SCCP timers may cause SCCP connection releases, if the
peer is configured with far lower timers than libosmo-sccp. Testing with a
specific SCCPlite MSC, I experienced an iar of just over three minutes, meaning
that calls would be cut off by the MSC, since the osmo-bsc failed to send an
Inactivity Timer message until seven minutes have passed.

With this patch, SCCP timers are configurable by the user.

Define constant global default timers, and variable user-configurable timers
with each osmo_sccp_instance.

Add VTY UI to configure the timers. Users must call osmo_sccp_vty_init() to get
the sccp-timer config nodes under the 'cs7' node. Show the new UI in
ss7_asp_test.vty.

Note that even though this function is not new at all, until recently, all of
our SCCP users (osmo-bsc, osmo-msc, osmo-sgsn, osmo-hnbgw) failed to call
osmo_sccp_vty_init(), and thus also missed out on the various 'show' commands
defined in sccp_vty.c. In other words, to benefit from the timer
configurability, the patches to call osmo_sccp_vty_init() must first be merged
to the corresponding master branches.

If a 'sccp-timer' config command occurs, the cs7 instance must allocate an SCCP
instance in order to store the timer config. Do that by calling the recently
added osmo_ss7_ensure_sccp() function.

Hence remove the limitation that the SCCP instance must not be populated from
the "simple" setup function. If we want to configure SCCP timers beforehand,
there must be an SCCP instance for that, and there is no hard reason to require
a NULL SCCP instance, besides the desire to prevent this function from being
invoked twice.

Change-Id: I28a7362aa838e648ecc9b26ee53dbcade81a9d65
2018-09-27 17:53:40 +02:00
Neels Hofmeyr eb2068d501 sccp_vty: fix doc strings for show ... ssn,connections
For 'show cs7 instance 0 ssn', fix doc string for 'ssn', and add missing one
for the SSN arg. This fixes depending builds that see VTY test failures due to
the missing doc string.

For 'show cs7 instance 0 connectsion', fix doc string for 'connections'.

Change-Id: I214ea51fc6bfa2a9a4dd7c34b43add0c77ffe22e
2018-09-27 16:08:10 +02:00
Neels Hofmeyr 00170f0ebf vty: install 'show cs7' for sccp addrs on _ve nodes
The 'show cs7 instance 0 sccp-addressbook' command should not be inside the
'cs7' node. That defies the point of naming the instance again, and it falls
out of place of all the other 'show cs7' commands on the VIEW and ENABLE nodes.

Drop the old command within the 'cs7' node without substitution or deprecation.

At the same time, drop dash from 'show cs7 i 0 sccp-addressbook'

There are various other show cs7 commands already defined in sccp_vty.c, which
have 'sccp' as a separate string. Conform to that.

Change-Id: I80e0bc0a91bcd3fb75372045db34592d2d663d41
2018-09-27 14:44:30 +02:00
Neels Hofmeyr 2bfe4a07ef vty: tweak two printed strings
Fix typo "to long".

Say 'cs7 instance' instead of 'ss7 instance': we are interacting with a user on
the telnet VTY, and that user is configuring a 'cs7 instance'. Especially a
lowercase 'ss7' is potentially confusing ("is there an 'ss7' node?").

Changes show in ss7_asp_test.vty.

Change-Id: Iebb976531576268d58338895a4baadbca6137b80
2018-09-27 14:44:30 +02:00
Neels Hofmeyr 8a9f92bbea sccp_vty: define SCCP_STR once
Define SCCP_STR in sccp_internal.h, because I know that I want to also use it
in osmo_ss7_vty.c.

Fix "Signaling" to "Signalling" upon copying the old string.

Change-Id: Ic93e4771147070a9222c73f80b5f7c29ae7eec35
2018-09-27 14:44:30 +02:00
Neels Hofmeyr 4a3e8f5b19 add tests/vty: VTY UI transcript testing
Add ss7_asp_vty_test, a shim test program with the sole purpose of exposing the
cs7 VTY nodes.

Add ss7_asp_test.vty, transcript for verifying VTY nodes using above program.

Add --enable-external-tests to configure.

Run jenkins.sh with --enable-external-tests.

Change-Id: I6a28684fa24d6e7de568623444297028eba2ab8c
2018-09-27 14:44:30 +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
Pau Espin 7e3476dc76 use osmo_init_logging2
Change-Id: I0d45b9381125c496a691ac5da68190b7b3479fc3
2018-04-17 14:22:36 +02:00
Neels Hofmeyr ed287f2b87 osmo_sccp_addr_name / _dump: drop 'NO_GT' output
Do not print the GTI if gti is set to OSMO_SCCP_GTI_NO_GT and no GT is present
in the address.

If addr->gt.gti is set to OSMO_SCCP_GTI_NO_GT, i.e. currently always,
osmo_sccp_addr_name() and osmo_sccp_addr_dump() output
",GTI=NO_GT" in every address dump, which is useless clutter. Drop that.

However, if a Global Title is flagged in addr->presence, still output the GTI
to highlight situations where GTI might mismatch the presence of a GT.

Change-Id: I9f87b2b703223ecb5d0442b6199c5b779fe544a1
2017-12-24 16:52:53 +01:00
Neels Hofmeyr 73a7435d28 xua_test: sanitize: fix msgb leak
Change-Id: Ie57e803bb6361f39042084a21cada754a6506606
2017-11-18 10:19:04 +00:00
Neels Hofmeyr a17ecfa7b1 sccp_test: sanitize: don't memcmp NULL pointers
Change-Id: I0159a875c1e11f4f9728d9e09f5c365b8174673a
2017-11-18 10:19:04 +00:00
Neels Hofmeyr 3867a7422a sccp_test: sanitize: fix msgb mem leaks
Change-Id: I6d5ff3e4c053db5a2af9d548250f0307e00317bb
2017-11-18 10:19:04 +00:00
Harald Welte f4a127ef99 initialize msg->l2h in sccp_msgb_alloc()
Change-Id: I5fb11075593696b110bfd3e0541e3aa790029903
2017-11-12 04:41:29 +09: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 037d46abc1 fix osmo_sccp_addr_dump(): actually print RI
Adjust xua_test accordingly.

Change-Id: I93e0aa706867e7b1de7f7a6071e3c8af89772af0
2017-08-09 13:54:44 +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