Commit Graph

36 Commits

Author SHA1 Message Date
Harald Welte 471f859d77 Use same msgb allocation size like before osmo_io introduction
In Change-Id Ia1910f3b99d918ec2a34d5304c3f40ba015c25c9 we introduced
osmo_io support for xUA + IPA.  However, when we did that, the msgb
allocation sizes of libosmo-sigtran were neglected, and rather the
defaults of osmo_io used.

This commit returns libosmo-sigtran to the exact msgb allocation +
headroom sizes used before the osmo_io migration.

Related: OS#5752
Closes: OS#6403
Depends: libosmo-netif.git Change-Id Ie19c8294ddb12dfe5e0fd44e047c47e6f9cbd384
Change-Id: I0c6dcff4523e4c04aae43a4585b5e0c3617ef1a6
2024-03-16 10:18:40 +01:00
Harald Welte 4c1751ddca m3ua: Add some TODO comments on where we fall short of our potential
Change-Id: I75d7b8f3fb6a06f6941b6dff4072287fdbb1d33e
2023-09-01 10:39:20 +02:00
Harald Welte 1532791798 M3UA/SUA: Don't add empty routing context IE in DUNA/DAVA/DUPU
Before this patch, the code generating a DUNA or DAVA message would
potentially generate a ROUTE_CTX IE with zero-length content, rather
than skipping such an IE altogether if no routing context[s] are given.

Change-Id: I19d0382cd2d428a91ac716182b9d86dcdc2c2ebd
Related: SYS#6511
2023-07-10 08:36:40 +00: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
Harald Welte d51a8de505 M3UA/SUA: Implement handling of SCON (signaling congestion)
If we receive any M3UA/SUA SNM SCON mesasages, distribute them
to any other active ASP to make everyone aware of the congestion
situation.

This makes STP_Tests_M3UA.TC_ssnm_distribution_scon pass and hence
should turn the entire osmo-stp test suite "green"

Change-Id: Iac7aeba980fbbd8b58f8872a29ba10745eb0a730
2022-05-05 18:45:42 +02:00
Harald Welte f71096a2b0 spelling fixes in comments
Change-Id: I4ecd9a1c5241cfd3a3e1daf05f7826876371369f
2021-11-15 18:05:04 +01:00
Harald Welte ff7404c742 stp: Add basic RX/TX rate counters on AS and ASP level
This adds some very basic rx/px rate counters to the SS7 AS and ASP

OsmoSTP> show rate-counters
SIGTRAN Application Server 0 (as-rkm-1):
             rx:msu:total:      86078 (1888/s 86078/m 0/h 0/d)
             tx:msu:total:          0 (0/s 0/m 0/h 0/d)
SIGTRAN Application Server Process 0 (asp-dyn-0):
         rx:packets:total:      86081 (1888/s 86081/m 0/h 0/d)
         tx:packets:total:          5 (0/s 5/m 0/h 0/d)

Change-Id: Idb811ca81adfe47152d484f6b981e661dc569e15
2021-11-15 18:05:01 +01:00
Oliver Smith 76985a9aa2 m3ua: fix m3ua_encode_dupu
Fix wrong header and swapped user / cause values (see RFC 4666). This
makes TC_ssnm_distribution_dupu pass.

Change-Id: I717b64d13d12a2781c90e4d2f83643331797bed4
2021-07-23 17:13:19 +02:00
Eric Wild 387304c41d m3ua: fix leaky usage of m3ua_tx_xua_asp
m3ua_tx_xua_asp will at some point convert the xua msg to a msgb by
copying and then send it, the xua msg still needs to be freed by the
caller.

Closes: OS#5185
Change-Id: Id8584b99f30f2db602d4d129e4114821697272ab
2021-07-11 21:10:21 +02:00
Harald Welte 3639af549c m3ua/sua: Add new snm_inactive quirk
This quirk allows the M3UA + SUA code to accept SSNM/SNM traffic despite
being in AS-INACTIVE state.  This is forbidden by the RFCs but there
are some implementations that apparently just don't care what is
specified.

Change-Id: I193dd546b3e3c00e29f192d0d1bf7819b3e194be
Closes: OS#5148
2021-05-13 18:11:53 +02:00
Harald Welte 0f769392a5 m3ua/sua: Add quirk for allowing inbound DAUD from SG in ASP role.
The M3UA RFC talks about this message being used in ASP->SG direction,
not the other way around.

Closes: OS#5147
Change-Id: I36ff172b47142a877b37bbd149073bef35b36a74
2021-05-13 18:11:53 +02: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 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 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 deca2bd75e M3UA: Accept DATA without routing context IE if only a single AS in ASP
There are some M3UA implementations out there who use a routing context
during the ASPAC procedure, but who then don't use it in subsequent DATA
transmission.

This behavior seems to be at the edge of what's possible within the
spec; if you don't configure a routing context, The RCTX IE it is not
required to be sent. And if you have multiple routing contexts/AS within
one ASP, it *must* be sent. But the situation where a routing context
has been configured (but not multiple) is not explicitly covered.

Change-Id: I59f47a999f40411aadc88b8f362d8d2b89a66332
Closes: OS#4594
2020-06-21 15:51:12 +02:00
Pau Espin cb66698c8d m3ua: Log incorrect selected AS
Change-Id: Idfdf6279de1fed453b5f83a5329c50716a79aca9
2019-10-22 17:34:29 +02:00
Kira Obrezkova 2164784670 This patch fixes typos on which Lintian complains
Change-Id: I657c694a9a7474182a97f90aa8424403ca9c58db
2019-07-17 10:56:37 +00:00
Neels Hofmeyr 5a188137dc comment: explain xua_msg free in m3ua_rx_xfer()
Change-Id: I6211c8809eefeb94289c4c497553561b043ee619
2018-07-18 22:14:03 +00:00
Harald Welte b393b3f4cc Add SPDX-License-Identifier + missing copyright statements
Change-Id: I113232bbeaa7a835871df7f9b883ba573d8a2534
2017-11-13 01:25:47 +09:00
Neels Hofmeyr 3468d5dce4 add/tweak various logging to help figure out complex routing
Add function osmo_ss7_point_code_print2() to be able to print two point codes
in the same log message.

Change signatures of two static functions to aid logging:
add invalid ref arg to sccp_scoc_rx_inval_src_ref(),
pass conn instead of inst to sccp_scoc_rx_inval_opc().

Change-Id: Ia3243606d6cad7721f7da7f6caba2caa90ae2bbd
2017-06-25 22:35:01 +02:00
Harald Welte b30b011e34 m3ua_decode_notify(): Ensure status_ie is valid before using it
Change-Id: I3cdd0fbdffcbeeb68dbc979385de045220ea0b0c
Fixes: coverity CID#166939
2017-04-27 12:11:24 +02:00
Harald Welte 3a09645ca6 m3ua: Generalize + Export function to generate MTP-TRANSFER xua_msg
Change-Id: If82956317ec703341514ad81057eceb3d0714f47
2017-04-15 23:01:13 +02:00
Harald Welte d95958b5fb SUA/M3UA: Implement T(r) recovery timer of Application Server FSM
When an AS goes "down" it first entres a recovery state, in which any
to-be-transmitted messages are enqueued until the timer T(r) expires.

Once the timer expires, the messages are discarded.  If the AS goes
ACTIVE before timer expiration, queued messages are sent.

Change-Id: I22725bf35306299a00c66d7b3637f5e198c26247
2017-04-14 22:48:41 +02:00
Harald Welte 0be0a4e035 m3ua: cosmetic clanup. We can simply return the M3UA errror code
Change-Id: I6ed04a4f78e618938484aeab62dbcfb3f310998d
2017-04-10 11:48:36 +02:00
Harald Welte 63c6cb27a6 M3UA: Reject Message Class XFER / Type != DATA
This was discovered (and fix validated) using m3ua-sgp-mtr-i-003 of
Michael Tuexen's m3ua-testtol.

Change-Id: I7498f606b031f5a6dfb538d9900c744da6aed36f
2017-04-10 11:48:36 +02:00
Harald Welte 1710c7e71f M3UA: Ensure XFER messages are not sent on stream 0
According to the RFC, Stream ID 0 MUST not be used for XFER/DATA
messages.

This was discovered (and fix validated) using m3ua-sgp-mtr-v-003-alternate
of Michale Tuexen's m3ua-testtool.

Change-Id: I80b941426b5106e091bd1becff0ae97958aff97c
2017-04-10 11:48:36 +02:00
Harald Welte f21eaabe24 M3UA: Respond with "Unexpected Message" if ASPTM is received too soon
This was discovered (and fix validated) using m3ua-sgp-aspsm-i-003
of Michale Tuexen's m3ua-testtool.

Change-Id: I8b63e7b5e39a7ef8dd66bf014110a04f5f3dc2a2
2017-04-10 11:48:35 +02:00
Harald Welte 72f12f7543 m3ua: Remove inbound routing context before routing
After verifying the routing context of an incoming M3UA message, remove
the routing context before passing into MTP routing.  In the forwarding
case, we might want to set a new routing context on the outbound link,
and we don't want the routing context IE to show up twice.

Change-Id: I7a534cb1da275369c70766c059aaae8157ce6833
2017-04-10 11:48:35 +02:00
Harald Welte d36571a776 xua: report N-ERROR and N-NOTIFY primitives to layer manager
Change-Id: I5c2060f0397d2bf510b085a5bb07e7ab176f2742
2017-04-10 11:48:35 +02:00
Harald Welte 02e7530671 xua: move notfiy parameters from xua_internal to sigtran_sap and rename them
Change-Id: I295b9d6755a4bb52a817d2791a302bdd9fc775dd
2017-04-10 11:48:35 +02:00
Harald Welte 3e463a3862 M3UA: RKM DEREG-REQ should contain routing context, not routing key
The mandatory IE checking is requiring the wrong IE

Change-Id: I73ecd163e2143341687ee4bca15a0bc69719c594
2017-04-10 11:48:35 +02:00
Harald Welte 4e818c3cfd Add M3UA RKM (routing key management) support, SGW side only
Change-Id: I9b1cf438a42519c0fe2f555c1672fafa499122a1
2017-04-10 11:48:35 +02:00
Harald Welte c860f9a41e sigtran: fix various memory leaks (msgb and xua_msg)
The general rule for 'struct xua_msg' is now that it is free'd by the
function that also allocates it in the first place.  Any downstream
consumer of the xua_msg may interpret it, but not hold any references or
free() it.

Change-Id: I708505d129da5824c69b31a13a9c93201929bada
2017-04-10 11:48:35 +02:00
Harald Welte d11fa298c5 m3ua: Include RC IE of AS in Tx; validate RC IE on Rx
Change-Id: I7db36a23185f82d8d68e318afe89ec5127c40333
2017-04-10 11:48:35 +02:00
Harald Welte 2d3a709527 Add new 'osmo_ss7' SS7 core code with M3UA, ASP/AS FSM, ...
This is what aims to be a rather complete/proper implementation of the
SIGTRAN + SS7 protocol suite.  It has proper abstraction between the
layers with primitives, finite state machines for things like the AS and
ASP state machines, support for point code routing, etc.

What's not implemented at this point:
* re-integration of pre-existing SUA (pending)
* actual MTP2 and physical E1/T1 link support
* different trafic modes like broadcast/fail-over/load-balance

Change-Id: I375eb80f01acc013094851d91d1d3333ebc12bc7
2017-04-10 10:41:16 +02:00