Commit Graph

811 Commits

Author SHA1 Message Date
Harald Welte f414447bfd don't log "SCTP connection close" if an IPA/TCP connection closes
The xua_srv_conn_closed_cb() function is shared/generic.  Let's simply
write "connection closed" to avoid any confusion.  As the ASP name is
printed, it should be clear which L4 protocol was used.

Change-Id: I506ccc2665a6b0af0fde3961e7e7937af7a81219
2021-04-25 18:49:17 +02:00
Harald Welte fe770ee0b1 ipa_asp_fsm_del_route(): Log what happens if we bail out early
Let's inform the user about situations in which we'd want to delete
the route for an IPA client, but we run into some problem and
bail out early.

Change-Id: Ie3f57d22901f169afb2c844476b5839cc36752aa
Related: SYS#5422
2021-04-25 15:01:33 +02:00
Harald Welte 9db6213620 ipa: Use VTY-configured default network indicator
When we receive a message from an IPA/SCCPlite connection, we only
have SCCP global titles and no underlying M3UA.  We since have
to introduce a fake M3UA header.  While we correctly set the SI,
OPC and DPC, we didn't set the NI to what is configured as default
for the cs7 instance in the VTY.  For international, this problem
was hidden by the fact that international is '0' and hence our
default memory initialization.

Change-Id: I02c618fa0a0aa2a859fcd56397df9637043c8e6e
Closes: SYS#5421
2021-04-25 14:29:30 +02:00
Harald Welte e5ffedf526 Add README.md describing what this repo is about
Change-Id: I965dadf1ef4a8340f6995ec745607c28e7bb1f89
2021-03-21 22:56:42 +01:00
Pau Espin 6304393363 Bump version: 1.3.0.51-6858-dirty → 1.4.0
Change-Id: I017147905ffb69829d010f3e8416c8c5d80e7040
2021-02-23 17:57:33 +01:00
Pau Espin 685816f97f stp: generate coredump and exit upon SIGABRT received
Previous code relied on abort() switching sigaction to SIG_FDL +
retriggering SIGABRT in case the signal handler returns, which would
then generate the coredump + terminate the process.
However, if a SIGABRT is received from somewhere else (kill -SIGABRT),
then the process would print the talloc report and continue running,
which is not desired.

Change-Id: Idca8e360968cb6998591737348ce520954e251b2
Fixes: OS#4865
2021-02-23 17:40:46 +01:00
Harald Welte 2181d644bc manuals: generate vty reference xml at build time
Rremove osmo-stp_vty_reference from the source tree.

In manuals/Makefile.am use the new BUILT_REFERENCE_XML feature recently added
to osmo-gsm-manuals, and add a build target to generate the XML using the new
osmo-stp --vty-ref-xml cmdline switch.

Change-Id: I5bcbbdf7b737d2ce36ea877bc78c8cf191a64e1b
Depends: I613d692328050a036d05b49a436ab495fc2087ba
Related: OS#5041
2021-02-23 17:20:08 +01:00
Harald Welte 6d8d9b3ced main: add --vty-ref-mode, use vty_dump_xml_ref_mode()
Change-Id: Ia5abf7457ee7e97ec3fcd5520e5ef82ef808667a
Related: OS#5041
Depends: Ie2022a7f9e167e5ceacf15350c037dd43768ff40
2021-02-23 17:20:08 +01:00
Harald Welte 7eedb6b03c Add osmo_ss7_pointcode_print_buf() to API
Like osmo_ss7_pointcode_print(), but prints into an user-supplied
buffer.

Change-Id: I5fc7d7746eb90a9d404b6b50bf9ded6789a1c33c
2021-02-23 17:20:08 +01: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 25234f9158 gitignore: Ignore autofoo *~ churn
Change-Id: Ia9f01761b595d9b082d78b05d71ff549b8e33d91
2021-02-19 13:06:27 +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
Harald Welte afbcc5d532 xua_snm: Implement handling of DUPU messages
A DUPU message in SUA and M3UA indicates the unavailability of
a (MTP-level) user, i.e. the entire SCCP, ISUP, ... is not available.

If we receive a DUPU (destination user part unavailable) message in ASP
role, then we must
 * distribute it to any other ASPs for which we operate in SG mode
 * pass it as MTP-STATUS.ind to SCCP, which can then generates
   N-PCSTATE.ind to the SCCP User

Change-Id: I1559ed0f761a8495b222df48c6bd43798e220471
2021-02-10 19:58:38 +01:00
Harald Welte 7daae9bd67 sccp: more SCMG handling: SSA and SSP message handling
When a SSP (Subsystem Prohibited) or SSA (Subsystem Available) SCMG
message is received, we must generate the respective primitives towards
the SCCP user.

Change-Id: I149166a25113f5d3e3536f9297bf89ff3139b9e3
2021-02-10 19:58:00 +01:00
Harald Welte 0d53666108 sua: per-ssn DUNA/DAVA notification
Unlike M3UA, in SUA a DUNA/DAVA message can contain not just the point
code that became available / unavailable, but it can also include a SSN.

In that case, it is just the SSN that became available/unavailable, and
not the entire point code.  Hence, a N-STATE.ind and not a N-PCSTATE.ind
must be delivered to the SCCP user.

Change-Id: Ie9a45b905bc17e7b695e15fe12ba4bbadcd032bf
2021-02-10 19:56:03 +01:00
Harald Welte bf85d6f433 xua: introduce xua_msg_get_u32p() helper
Change-Id: Id7780074b82bc668ae148456750b1a01799decd1
2021-02-08 18:11:12 +01:00
Harald Welte d2dc5ed987 sccp: Add minimalistic SCMG implementation
SCMG (SCCP Management) is a special sub-system that normally resides
at SSN=1.  In Osmocom we so far ignored its existence.  However,
in terms of interop with other implementation, we should implement
at least some basic features.

The only procedure implemented in this initial commit is the response
to an incoming SST (Subsystem Test) message.  If we don't respond to
this message, a remote SCCP entity could assume the SSN is dead on
our side, rendering communication impossible.

Change-Id: I04b162476f7652ef0540b5ea7299e9447efd1d09
2021-02-08 18:11:08 +01:00
Harald Welte 943affdd48 sccp: Notify users of point code available/unavailable
* add N-PCSTATE.ind and N-STATE.ind definitions to SCCP user SAP
* add minimal SCMG (SCCP Management) and LBCS (Local Broadcast)
* generate MTP-PAUSE.ind/MTP-RESUME.ind based on received xUA DUNA/DAVA
* generate N-PCSTATE.ind towards the local SCCP users

Change-Id: Idb799f7d7ab329ad12f07b7cbe6336da0891ae92
Related: OS#2623, OS#3403, OS#4701
2021-02-08 18:00:56 +01:00
Harald Welte 6cb841b92b xua: Implement SNM availability/unavailability messaging
M3UA and SUA have one sub-protocol called [S]SNM, through which the
SG informs the ASP about certain destinations (point codes) becoming
available (DAVA) or unavailable (DUNA) in the SS7 network.

This patch adds support for
* generating DAVA/DUAN on a SGP when the AS FSM changes to/from AS-ACTIVE
* receiving DAVA/DUNA on an ASP and informing other "SG role" AS/ASP
* processing DAUD from ASP received by SG, generating relate DAVA/DUNA
  responses

Related: OS#2623
Change-Id: Id92be4691b0fd77598a6edb642c028bbd8c5b623
2021-02-08 18:00:56 +01:00
Harald Welte f5d90c46e1 SUA: Verify routing context IE of incoming CL and CO messages
When receiving user-data (connectionless / connection-oriented),
we must make sure that there either
a) no routing context IE in the message, and only one AS within the ASP, or
b) a valid routing context IE for an AS within the ASP

This important input validation has been done in M3UA for a long time,
but somehow never been implemented on the SUA side so far.

Change-Id: Icc232250513009137add3b45fecbb5d2a07c0645
2021-02-08 11:42:33 +01:00
Harald Welte a0228a74e0 m3ua: Move find_as_for_asp() to shared xua_find_as_for_asp()
This way the function can be re-used by SUA.

Change-Id: I0dfc5a7a24dd068002e837dc47eb0778c503cac5
2021-02-08 11:42:30 +01:00
Harald Welte aabb38a77b m3ua: re-factor m3ua_rx_xfer(): Externalize AS for ASP lookup
Let's factor-out the lookup of the AS into the separate function
find_as_for_asp().  This enables us to reuse this code in upcoming
support for SNM messages.

Change-Id: If58ea24efe7d54994a7ca2f0a97944bd297a8cc6
2021-02-08 10:41:03 +00:00
Harald Welte bdf5ae5f02 Introduce osmo_ss7_asp_get_log_subsys()
This will allow us to write generic code that uses DLM3UA/DSUA depending
on the ASP protocol.

Change-Id: I7c015b3a2727deff4fc4e6f3bc7bdeeb57e86166
2021-02-08 10:40:46 +00:00
Harald Welte 1153675012 xua_msg: Add xua_msg*_get_str() to obtain string IE
We copy the contents to a static thread-local buffer to ensure
zero termination of the string received by a remote entity.

Change-Id: I8cbb7aeaf0cb64db0ce01c21e5fca9ab3cd932b6
2021-02-08 10:40:46 +00:00
Harald Welte 2aebd133ac sccp_sap: Fix string for N-PCSTATE primitive
Change-Id: Ib42f46661e27b1730badc3647ca2e021e93021b7
2021-02-07 18:28:48 +00:00
Harald Welte 3bd913398a osmo_ss7: const-ify input arguments to osmo_ss7_as_has_asp()
Change-Id: Id23d90ffea855680cd7d4a16b89e652eed0cf39f
2021-02-07 12:43:47 +01:00
Harald Welte 30c2edb099 xua_msg: const-ify input arguments to xua_*_get_u32()
Change-Id: I517943bd11d73195de9418fb1c5d4151dab77873
2021-02-07 12:43:47 +01:00
Harald Welte c584d87d0c xua_msg_add_data() Mark input argument as 'const'
We only read from it.

Change-Id: I12c17273b9d64a084f59d91fc06ae1512d70855b
2021-02-06 17:45:33 +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
Oliver Smith ed11cc8385 configure.ac: set -std=gnu11
Change-Id: Iabe929a29a3c7fed2726329215097f7254cf20ca
2021-01-28 09:28:00 +00:00
Oliver Smith 1e2ff4a8b8 contrib/jenkins: don't build osmo-gsm-manuals
Related: OS#4912
Change-Id: I511b2e1f4c3a9e0897cff4241ab5df12327de10d
2021-01-13 13:10:28 +01:00
Harald Welte 48e2988539 update VTY / copyright message
* extend year to 2020
* Pau and Vadim have contributed significatnly
* fix typo (ot -> to)

Change-Id: I5c23e704dd958faf450b2427ff706ac65d4848f4
2020-11-11 20:46:45 +01:00
Pau Espin e7c8067df0 contrib/jenkins: Enable parallel make in make distcheck
Change-Id: I667b245e468b9a2bcc5c9a1a04d59a940e71b24c
Related: OS#4421
2020-10-12 18:28:55 +02:00
Philipp Maier 320c71d45c vty: add attributes to VTY commands indicating when they apply
Change-Id: If77aea2223891663d465f162614ce8db18168c09
Related: SYS#4937, OS#1601
2020-10-06 22:50:10 +02:00
Vadim Yanitskiy b4bac73245 vty: use install_lib_element() and install_lib_element_ve()
See https://lists.osmocom.org/pipermail/openbsc/2020-October/013278.html.

Change-Id: I727e27f4d4d9550e34cb0073134a9ed7faae3c66
Depends: I8baf31ace93c536421893c2aa4e3d9d298dcbcc6
Related: SYS#4937
2020-10-04 16:48:35 +07:00
Neels Hofmeyr 7a4f614ba9 add osmo_sccp_addr_to_id_c()
Change-Id: Iadd34a167a7712796b2501f6a75b5a8d26a828eb
2020-09-23 21:13:18 +02:00
Neels Hofmeyr 134e463230 add osmo_sccp_addr_to_str_c osmo_sccp_inst_addr_to_str_c
Change-Id: Ia7f9d891ea92abd20855374b936aac8b28ae15df
2020-09-22 22:47:24 +02:00
Pau Espin c6a598d21c sccp_helpers: Support printing IPV6 SCCP addresses
Change-Id: Ibdae89ed251e46814a4af65c6384225575a29039
2020-09-14 12:35:21 +02:00
Pau Espin 2221ad87f4 xua_msg: Get Rid of confusing double network byte order swap
The ipv4 addr in addr->ip.v4 is already in network byte order, as it's
usual in struct in_addr (see sua_addr_parse_part()).
So the code in there was simply calling ntohl() because
msgb_t16l16vp_put_u32() is calling htonl() on the given parameter before
storing it. Let's simply use msgb_t16l16vp_put() directly and avoid a
double byte swap which only adds confusion.

Change-Id: I70a94ee1b459d56116f0c6a6c7c3b778a939b7ea
2020-09-14 12:35:21 +02:00
Pau Espin 95e2ec698d sua: Support SUA_IEI_IPv6
Change-Id: I5bd69e8400fd2d9251b5d4edd9bf3514e1194b5a
2020-09-14 12:16:02 +02:00
Neels Hofmeyr b114b73e5d add OSMO_SCCP_ADDR_T_MASK for osmo_sccp_addr_cmp()
Avoid magic number 0xffffffff and rather provide a mask value for all address
components.

Change-Id: I13ff0858e496c4392b8e1590d62f7eb80f191a07
2020-09-05 00:10:01 +02:00
Pau Espin 44456920e5 Fix default ASP local addr if remote addr contains only IPv4
Otherwise it would end up attempting to connect "::" -> "1.2.3.4" which
would fail during osmo_sock_init2_multiaddr(). If local address is unset
(default), but only IPv4 addresses are set on the remote, then one must
use "0.0.0.0" instead.

Change-Id: I33faf1291e9105bba2e816c01a6b4854cf13d5e0
2020-09-04 10:55:12 +00:00
Neels Hofmeyr ec3e7e43ab enum osmo_sccp_ssn: rename to OSMO_SCCP_SSN_SMLC_BSSAP_LE
Quoting 3GPP TS 23.003 8.2:

 1111 1010 BSC (BSSAP-LE);
 1111 1011 MSC (BSSAP-LE);
 1111 1100 SMLC (BSSAP-LE);

Hence the SMLC one should also be named *_BSSAP_LE.

I'm certain no other osmocom code is using this SSN yet, but anyway keep a
backwards compat shim #define.

Change-Id: I3e0c1be0ebbd3883d024174d1e7e9167a8281cfb
2020-09-03 23:56:13 +02:00
Pau Espin b35dc5fc81 Fix (2) change in ss7 server default listen addr, keeps backward-compatibility behavior
This patch is a fixup or extension of commit
96d348efbf, which only fixed the default
values for "asp" VTY node, but not for the xua server's "listen" node.
As a result, without this patch, by default the SCTP server socket will
only listen on IPv4's "0.0.0.0", since NULL is resolved by getaddrinfo
to it instead of "::" as first candidate.

Fixes: 96d348efbf
Change-Id: Ifbc8df854d1f1e9b07b11911ad5da8cdf9f2080a
2020-09-01 13:40:16 +02:00
Pau Espin d94d58c523 Fix matching IPv6 anyaddr :: in osmo_ss7_asp_find_by_socket_addr
Change-Id: I36dd8f1978e3b7b785660745378c9cf77a21a566
2020-08-28 17:14:32 +02:00
Pau Espin 2d5b4ef2be Validate correctly against IPv6 addresses in osmo_ss7_asp_peer_set_hosts()
Until now, host list validation was only taking into account a set of
ipv4-only addresses. As a set can contain now IPv4 and Ipv6 addresses at
the same time, we need to do ANYADDAR validation against addresses of
that specific version inside the set.

Change-Id: I18f3cc59149d478259d7afc456bdc5213c1406e5
2020-08-28 17:14:32 +02:00
Pau Espin 96d348efbf Fix change in ss7 server default listen addr, keeps backward-compatibility behavior
Previous commit changed the default bind/listen address of the server
from NULL (0.0.0.0) to 127.0.0.1, hence breaking some setups where no
"local-ip" was defined and hence from then on were only listening on
localhost by default.

Let's instead bind to "::" if IPv6 is available, which covers any IPv6
and/or IPv4 address. If not available, keep binding to 0.0.0.0.
Similarly, if IPv6 is available set default remote to both ::1 and
127.0.0.1 to allow it working against processes listening on IPv4 or
IPv6 addresses.

Change-Id: Id4718267df2390f70cec519042dc12bac0cd2876
2020-08-28 17:14:32 +02: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
Pau Espin fc3d9a963e vty: log and return warning if adding ss7 host to set fails
Change-Id: Ib86ef3c3db6096a1e38690b9e598a58387e6b38e
2020-08-28 16:27:02 +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