Commit Graph

140 Commits

Author SHA1 Message Date
Harald Welte dfa6e681d8 fix regression in sctp-role / transport-role
We saw some fall-out in automatic testing where configs with sctp-role
would suddenly save as transport-role.  Let's avoid this by keeping
sctp-role for users of SCTP.

Change-Id: Ic666b62948880445e030c637298d4e369b4c7e8e
Fixes: 4d7e201 "VTY: rename 'sctp-role' to 'transport-role', add an alias"
Related: SYS#5424, OS#6380
2024-02-29 17:20:41 +07:00
Vadim Yanitskiy 4d7e20193c VTY: rename 'sctp-role' to 'transport-role', add an alias
Now that we're adding support for M3UA-over-TCP, the transport layer
role is no longer an SCTP specific paremeter, but rather a generic one.
This is also the case for the OSMO_SS7_ASP_PROT_IPA, which employs TCP,
and for which we can also choose between the client and server role.

The 'sctp-role' now becomes an alias to 'transport-role', so that
we keep backwards compatibility with old config files.

Change-Id: Iab6c898181d79a5ed2bea767ee90e55bc3af16a5
Related: SYS#5424
2024-02-27 00:45:56 +07:00
Vadim Yanitskiy 22929b1c04 Implement M3UA-over-TCP (in addition to SCTP)
RFC 4666 section 1.3.1 states that "TCP MAY be used as the underlying
common transport protocol" under certain scenarios.  There is even
IANA-allocated TCP port 2905 for that purpose (see section 1.4.8).

Since TCP is a stream oriented protocol, so we need to handle message
boundaries ourselves by reading the M3UA header to know the PDU length.

Change-Id: I8c76d271472befacbeb998a93bbdc9e8660d9b5d
Related: SYS#5424
2024-02-27 00:45:31 +07:00
Harald Welte 4120e0d2fc vty_test_runner: Don't wait for more than 10s when connecting to sockets
Change-Id: Iadb437ce0bafb28baa978d287dbb1006ec97f236
2024-02-10 16:07:06 +01:00
Harald Welte c934cadaeb vty_test_runner: Avoid bogus erro messages like "AssertionError: False is not true"
"self.assertTrue(False)" is abusing python unittests.  If you want to
fail, either call the fail() method, or simply raise an exception...

Change-Id: Ib683d6e166a9fca22dd2eb26e066e47034cda750
2024-02-10 16:07:06 +01:00
Harald Welte eae5eb498a Add new "cs7 instance <0-15> asp NAME disconnect" VTY command
This allows the user to administratively disconnect the current
transport connection of a given ASP.

If issued on the client side, the default layer manager will trigger
an automatic re-connect.  If issued on the server side, we expect the
client will re-connect.

Change-Id: I2077121ab860fafb70951454d029c3afa9ee2818
2024-02-10 16:07:06 +01:00
Pau Espin 00ec53c057 vty: Introduce show cs7 instance asp-assoc-status
Change-Id: I96ef4c0500991c9b86ab5991fb338ea20a18ff33
Depends: libosmocore.git Change-Id I3e1c84526b006baff435bbbca49dc6cf7d201cf5
Depends: libosmo-netif.git Change-Id I78a0bd8279a04f4011c7273e0f542981308e482f
Related: SYS#6636
2023-12-12 16:07:46 +01:00
Pau Espin c86bdae6f5 vty: Introduce show cs7 instance asp-remaddr
Depends: libosmocore.git Change-Id I3e1c84526b006baff435bbbca49dc6cf7d201cf5
Depends: libosmo-netif.git Change-Id I78a0bd8279a04f4011c7273e0f542981308e482f
Related: SYS#6636
Change-Id: Ie5ac1d0ee74d2b977b1f5319cd88566df7994fd0
2023-12-12 16:07:46 +01:00
Pau Espin 483894bfd1 vty: Introduce cmd 'show cs7 instance asp name ASP_NAME'
Allow printing only a specific asp by name. Useful when user is only
interested in a uniqe ASP and there's lots of them configured.

Related: SYS#6636
Change-Id: I08426272069ce5f3c8403b08dcaf686547bee336
2023-12-12 16:07:45 +01:00
Pau Espin a431b9230b vty: show cs7 instance asp: Print loc and rem addr retrieved from socket
Until now, we were in general printing the list of remote addresses that
were stored in config, because we didn't have an easy way to retrieve
the addresses from the socket. Since recently some libosmocore APIs make
that easy, so use them now.
If the socket is not yet created, then log the addrress list from the config.

Furthermore, take the chance to print now both local and remote
addresses.

Related: SYS#6636
Change-Id: I607e4c2dd37f07bf1c07c88681918184e92202ea
2023-12-12 16:07:17 +01:00
Pau Espin bbecd572a0 vty: show cs7 instance asp: Swap columns SCTP Role and Remote Address list
The Remote Address is by far the potentially largest column, as well as
the one with more variable length, so move it to the end for better formatting.

Change-Id: I4854219f8898266ae47b9117ef79dbad30a5b0fd
2023-12-12 15:54:19 +01:00
Pau Espin c5a4b772b1 asp: Support removing local & remote addresses
The local address is removed dynamically from the socket if it is
already created. For remote addresses, it doesn't make any sense (and
there's no API to do so) because the remote address list passed to it is
only used at connect() time, when the socket is created. During the
initial hanshake, the remote provides its own list of remote addresses.

Related: OS#6077
Related: OS#4607
Depends: libosmocore.git Change-Id Ifc6e7d643c2a0c53f479bfd0d5c36d08c0c01953

Change-Id: I554aee92285bd72eb90c6daf47b37055cb3067aa
2023-10-04 11:21:05 +00:00
Harald Welte 743deba334 sccp: Introduce initial support for SCCP LUDT + LUDTS messages
* LUDT/LUDTS is now properly received and passed along to the app.
* LUDT/LUDTS is now used if the data to transmit spans more than 255
  bytes.

Related: SYS#6566
Change-Id: Ic91abfc921f5e4f36045bfa325333112cddd9fa6
2023-09-21 16:35:40 +02:00
Pau Espin 945b252a48 sccp2sua: Produce smaller output if msg contains no optional section
Change-Id: I5c8fcb30b76ac7bafd4a99bc3004049644e7e3f9
2023-09-21 10:32:10 +02:00
Pau Espin abf26ce1ad Allow configuring per-ASP SCTP INIT parameters
Related: SYS#6558
Depends: libosmo-netif.git Change-Id I5343c7659881b29e0201e72badbc2d07e1ef2dca
Change-Id: I4c104f0313b549efab7fae2e81a163474e9bcd4b
2023-09-08 18:14:52 +02:00
Pau Espin 8b8458d153 asp: Allow setting IP address as SCTP primary upon conn establishment
This is an initial implementation to set the local SCTP Primary address
as well as the peer's Primary Address (through SCTP ASCONF messages).
The Primary address is only set upon conn establishment (after connect()
 for clients, or accept() for severs), which means no logic is
introduced to make sure that primary address is kept during the entire
operation of the SCTP association (for instance if the Primary address
becomes unavailable and the stack changes the primary, and later on that
address becomes available again, the primary addres won't be set back to
the initially configured one).

Related: OS#6076
Change-Id: I4a9fc1a4ad82ed20ece328bc53fca58299d744ca
2023-08-21 12:23:52 +02:00
Pau Espin e798ebdf6d tests/vty: test multiple local/remote IP addresses
Change-Id: I9e8c6499b26edea271ee8d8c4ab86506e765e000
2023-08-03 17:37:53 +02:00
Pau Espin a8aab23588 vty: Improve output of show cs7 instance <0-15> asp
Role and SCTP Role are now printed. Several formatting issues are fixed
or improved.

Related: SYS#6488
Change-Id: Id22bd4e74fb6f79950adba58862d379203d36760
2023-06-27 16:49:55 +02:00
Pau Espin 83db938859 osmo_sccp_simple_client_on_ss7_id(): Always follow VTY config of ASP if it was explicitly defined in VTY
The VTY config defaults are "role sg" and  "sctp-role server".
However, if not set explicitly in VTY,
osmo_sccp_simple_client_on_ss7_id() was replacing them to "role asp" and
"sctp-role client".
This is fine if the ASP is not defined/created at the VTY (aka
dynamically created with no config), but if the ASP is defined in the
VTY it becomes really confusing, since it's picking different defaults
than the usual ones.

Hence, follow always the same VTY defaults in
osmo_sccp_simple_client_on_ss7_id().

As a result of this change:
- Programs not defining the ASP over VTY keep the same behavior (ASP is
  created with role=asp and sctp-role=client)
- Programs defining ASP over VTY (eg. "asp asp-clnt-msc-0 5000 0 m3ua")
  explicitly setting "role" and "sctp-role": keep the same behavior
- Programs defining ASP over VTY but not explicitly setting "role" or
  "sctp-role", will get now the usual defaults instead.

So in summary, strange cases where osmo_sccp_simple_client_on_ss7_id()
is used (osmo-bsc, osmo-hnbgw, osmo-msc) and the dynamically created
ASP is created through VTY, then the config file must also explicitly
define the following lines:
role asp
sctp-role client

This patch also changes the "show running-config" VTY cmd to also always
show the configured role and sctp-role values, which are of vital
importance to understand a given setup.

Change-Id: Ie81987265118e48173211f88b27a006115dc62d4
2023-06-13 20:07:18 +02:00
Harald Welte 2a0ccafbf8 cosmetic: fix various typos in comments, log messages and VTY strings
Change-Id: I9a8afc07ae278100ffe34407db0e196f0c9ce8af
2023-06-13 17:24:27 +02:00
Neels Hofmeyr a0fbeeb4d2 SCCP: implement variable limit on Optional Data (CR,CC,CREF,RLSD)
When the Optional Data surpasses 130 bytes, it is not sent as part of
SCCP CR, CC, CREF or RLSD messages, but gets sent separately in a Data
Form 1.

Make this 130 user configurable. This is specified to be 130 bytes
exactly, but to interop with non-conforming peers, make this limit
adjustable per cs7 instance, via osmo_sccp_vty_init().

Add and test new VTY config:

	cs7 instance N
	 sccp max-optional-data (<0-999999>|standard)

Related: ITU-T Q.713 4.2 to 4.5
Related: Ia68dad973ef18513b52f5accb5264c557c7295ea osmo-ttcn3-hacks
Related: SYS#6423
Change-Id: If35697234796af8943691b2de62218e7dc93a08c
2023-04-24 18:45:37 +02:00
Vadim Yanitskiy 463888c1dc tests: execute osmotest{vty,config}.py against osmo-stp
Change-Id: Idd57757f251dd1c4d1c74d275b4c5d8beff304e5
2023-03-30 02:35:23 +07:00
Vadim Yanitskiy c5cae83315 tests: $(BUILT_SOURCES) is not defined, depend on osmo-stp
Change-Id: I4864f4d78095187f566bcde772b71665fa6e4729
2023-03-29 19:16:11 +07:00
Vadim Yanitskiy 2790599e56 tests: use -no-install libtool flag to avoid ./lt-* scripts
This option should be used for any executables which are used only
for testing, or for generating other files and are consequently never
installed.  By specifying this option, we are telling Libtool that
the executable it links will only ever be executed from where it is
built in the build tree.  Libtool is usually able to considerably
speed up the link process for such executables.

Change-Id: I9758aaaa56b2453f33f90400342ebd1fd412ec3a
2023-03-13 10:54:34 +00:00
Vadim Yanitskiy 002b4d29f9 tests/*/Makefile.am: -Wall is not a preprocessor flag
Change-Id: I1a143636dfc5d4ea85938472fd367ac88e3cc4ae
2023-03-13 10:54:34 +00:00
arehbein 41089524a3 Transition to use of 'telnet_init_default'
Related: OS#5809
Change-Id: Icc57c68337d55c6594c1c36e9bf41624d11dab0a
2023-02-28 10:32:07 +00:00
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