Commit Graph

832 Commits

Author SHA1 Message Date
Max 71fc322431 Set working directory in systemd service file
By default systemd will execute service with root directory
(or home directory for user instance) which might result in
attempts to create files in unexpected place. Let's set it
to 'osmocom' subdir of state directory
(/var/lib for system instance) instead.

Related: OS#4821
Change-Id: If21e3471ec129892ff8b410db30d8ce0e4014e05
2022-09-09 18:39:08 +07:00
Max e5d615efdc SIGTRAN: cache Optional Data for SCCP CR/CC/RLSD
The length limit of optional Data parameter is 130 bytes according to ITU-T Rec Q.713 §4.2..§4.5. If we receive CR, CC or
RLSD message with bigger data - cache it if necessary and send via separate DT1 message after connection becomes active.

Fixes: OS#5579
Change-Id: I0033faf9da393418930252233ce74d62cd1cef8a
2022-09-07 17:36:30 +07:00
Max 56b7700910 SIGTRAN: arrange the comments in the encoder to match the spec
Related: OS#5579
Change-Id: Ib986137057856afb8725541d912db210a9a46294
2022-09-07 17:33:03 +07:00
Max e7228dbdd2 examples: update vty code
* document optional data parameter
* use argc to check for optional parameter presence

Related: OS#5579
Change-Id: I52d0823b7843aa61594e728a0fac19d884ff78fe
2022-08-22 20:33:12 +07:00
Max bb760c5915 SIGTRAN: add osmo_sccp_tx_disconn_data() helper
SCCP RLSD message might have up to 130 bytes of optional data according to ITU-T Rec Q.713 §4.5 - add helper which
allows sending it and use it in example code.

Related: OS#5579
Change-Id: I92ae22d2cab5863245fba3d904a300055fda34fe
2022-08-22 20:33:12 +07:00
Max 768f36440f SIGTRAN: error if attempting to send exceedingly big data
Previously DT1 message sent via osmo_sccp_tx_data() was silently truncating data if it was over 256 bytes. Let's fail
explicitly and let caller handle this.

Related: OS#5579
Change-Id: I8a67bc40080eb1405ab3b0df874e3ea20941a850
2022-08-22 18:36:51 +07:00
Max 196ddcbb05 SIGTRAN: add function to check connection existence
Add convenience helper to check if particular connection ID exists and use it to
properly report errors when attempting to send messages over non-existent connections.

Change-Id: Iffedf55b4c292ee6b2f97bcdeef6dc13c050ce01
2022-08-22 18:36:51 +07:00
Max 28a8e3e836 SIGTRAN: don't advance FSM on failed connection request
Return proper error code from packet encoding routine and check for it before switching FSM state as it creates
confusing mismatch with actual protocol state.

Related: OS#5579
Change-Id: I8431c77632014e2551d1da779afddffcd1bb541c
2022-08-22 18:33:23 +07:00
Max 43d7455089 Add basic readme for example code
Related: OS#5579
Change-Id: I4c76a48a76ca9afc960ea2f08229bacc79b6fe77
2022-08-21 21:53:40 +07:00
Max f4301b7f45 [cosmetic] sccp_scoc.c: constify function parameters
Related: OS#5579
Change-Id: I398e3efa3e097de8907617cfdf363e1d3b96f666
2022-08-21 21:52:45 +07:00
Max d388dead51 SCCP: Log more data on CR size error
Related: OS#5579
Change-Id: I4d7fc44fde5b900907ec5ebec0450040a764802a
2022-08-18 21:15:19 +07:00
Max 4f9c66dc0f SCCP: enforce optional data length limits
Limit length of optional Data parameter to 130 bytes to conform with ITU-T Rec Q.713 §4.2..§4.5 while receiving SCCP messages.

Related: OS#5579
Change-Id: Icc3bd0a71b29cf61a259c5d97e7dd85beb4397bd
2022-08-17 11:36:04 +07:00
Max 12e76b8859 cosmetic: improve usage help of example code
* document -C option for example server
* move misplaced comma
* drop empty #define from example code

Change-Id: I342dc227afbfe6c3540eb3285677c568d2fe3166
2022-08-17 11:27:25 +07:00
Pau Espin e6cecee78c xua_snm: assert to guard against NULL ptr
This is similarly done for same IE in other functions, so let's do it
here too in order to make coverity happy, and avoid random access ptr
probably ending up in obscure crash.

Fixes: Coverity CID#272994
Change-Id: I72059ffaa608bb4f5c4bd274645878e0b31ed6e0
2022-06-29 18:23:44 +02:00
Pau Espin 1032df2d88 Bump version: 1.5.0.20-e9cc-dirty → 1.6.0
Change-Id: Ibe4efb64b8de506a007559e2fcf13cc9dc0d9d60
2022-06-28 18:22:14 +02:00
Harald Welte e9cc5c9376 update git URLs (git -> https; gitea)
Change-Id: Idac4924a077b5389e85efaf62081589fc3de06ad
2022-06-17 23:18:23 +02:00
Harald Welte 206583846c [cosmetic] sccp_scoc: Fix typo in comment
Change-Id: I26168658b58250f58c3616e51010b969df8029a4
2022-06-17 22:20:28 +02:00
Harald Welte 70802f76d9 [cosmetic] sccp_scoc.c: fix comments about corresponding SCCP msg types
Change-Id: I0d7a81f72147f8022ddadfe28d04679097dfa492
2022-06-16 21:40:47 +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
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
Harald Welte 218789e833 sccp_demo_user: enable stats / rate_counter timers
Change-Id: I135704d401de2cf439e51882e22323b31db14a2a
2022-02-24 20:40:24 +01:00
Harald Welte a1bf0c96ec sccp_demo_user: Allow user to specify logmask on command line
Change-Id: Ie1cf37b3501e26330b038b7ee17a5273d81c92d8
2022-02-24 20:40:24 +01:00
Harald Welte 3424c5ed99 sccp_demo_user: make sure the command-line specified point codes are used
Change-Id: I983066199e5d8f056895fdad370e3b4439b4dba4
2022-02-24 20:40:24 +01:00
Harald Welte d8c7a40a60 sccp_demo_user: Add 'show stats' to VTY
this allows us to inspect statistics of the demo user via VTY

Change-Id: Ica48d4e0c9cedb9adb94ae08c5201207b8836e1c
2022-02-24 20:40:24 +01:00
Harald Welte d0cd3157b7 sccp_demo_user: Add command line argument to specify protocol (m3ua/ipa)
Change-Id: Iecb03df43709903b1cfe248e68d6624b995c563d
2022-02-21 22:27:57 +01:00
Pau Espin 7b4aea4aa6 xua_asp_fsm: Fix gcc false positive warning
As of GCC 11.1.0, it starts printing a warning about uninitialized
variable. It is a false positive since tmode is really only used in the
case where traffic_mode is not zero, in which case tmode is set.

Let's restrict the scope of tmode to fix the issue and also make it
clearer where the variable is used.

"""
In file included from /git/libosmo-sccp/src/xua_asp_fsm.c:25:
/git/libosmo-sccp/src/xua_asp_fsm.c: In function ‘xua_asp_fsm_inactive’:
/git/libosmo-sccp/include/osmocom/sigtran/osmo_ss7.h:274:16: error: ‘tmode’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  274 |         return get_value_string(osmo_ss7_as_traffic_mode_vals, mode);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/git/libosmo-sccp/src/xua_asp_fsm.c:476:39: note: ‘tmode’ was declared here
  476 |         enum osmo_ss7_as_traffic_mode tmode;
      |
"""

Change-Id: I4fc38724aba3a3f178ba0b45444e1394db44d039
2022-02-01 16:59:52 +00:00
Oliver Smith ebccb824a0 osmo_ss7_vty: add osmo_sccp_addr_by_name_local
Add a new function similar to osmo_sccp_addr_by_name, but search in a
specific ss7 instance's addressbook instead of searching in the global
address book. This is needed for osmo-bsc-nat, which uses two separate
instances at the same time.

Related: SYS#5560
Change-Id: I0f38b0d038b0dd8cd355e7284e5b56d438811bd9
2022-02-01 11:08:34 +00:00
Oliver Smith e3e79e2806 include/osmocom/sigtran/sccp_sap.h: cosmetic fixes
Move return type to the same line as the name of the function to follow
coding guidelines.

Change-Id: I10475aa395a1cfd49ff62c758f99f9689a0038d0
2022-02-01 11:08:34 +00:00
Philipp Maier 5cac653a98 sccp_user: do not force the role ASP when configured differently
The current implementation of osmo_sccp_simple_client forces the ASP to
run in ASP role. Even then when the user has configured it differently
via VTY. The osmo_sccp_simple_client should respect the VTY
configuration.

Change-Id: Ib57c513407747d36e503a4fb01c50c69dea0cb85
Related: SYS#5796
2022-01-26 11:02:02 +01:00
Pau Espin d9e54d7a34 xua_default_lm_fsm.c: Fix typo in comment
Change-Id: I4095878fb05c3128be556ab36dfc7ab88d309c9a
2022-01-21 10:57:03 +01:00
Oliver Smith 853ce2ec13 osmo_ss7_instance_destroy: use for_each_entry_safe
Fix segfault in each loop.

Change-Id: Ieaec3584375b0e6b943638fe1e50b4d74a627216
2021-12-21 18:58:20 +01:00
Oliver Smith 0aa3164b93 src/sccp_scmg: fix typo
Change-Id: Ifd6264da2da2e7cc62485dcde9b6c462d4858626
2021-12-21 18:58:20 +01: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
Pau Espin 77700b6eb5 ss7: Use sctp value_string from libosmo-netif
Depends: libosmo-netif Change-Id Ica6f01851fb94e31f4ef097494bb1b8a95597ba6
Change-Id: I42323eb5d02d4f67daac7b0a4365f5f6f6057666
2021-11-23 15:50:04 +01:00
Pau Espin 2d9e84b703 Bump version: 1.4.0.39-484f-dirty → 1.5.0
Change-Id: I963499ba9f78924660127312f4469b0781fed805
2021-11-16 14:44:42 +01:00
Harald Welte 484fc3875b osmo_ss7: properly unlink rate_counter on AS/ASP free
When introducing rate_couters, I forgot to call
rate_ctr_group_free().  I thought free'ing the parent object
via talloc is sufficient, but that obviously misses the point that
rate_counters have an internal linked list from which they must be
unlinked.

Change-Id: I8d27f025c22776d0153d867e36c073ef716eb974
2021-11-16 11:20:11 +01:00
Harald Welte e9727688cd rate_ctr: Use legal counter group prefixes / names (no '.' allowed)
This avoids log messages like
DLGLOBAL <0016> rate_ctr.c:92 'sigtran.as' is not a valid counter group identifier

Change-Id: I08666a1c3c1345cd3b0e55d544f6ac4a6df62fbf
2021-11-16 11:13:11 +01: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
Harald Welte 5ad97995e9 sccp_scmg: Add missing line eneding to log statement
Change-Id: I7ec5c86fbef429cd1e23be87b773823f2e736f2f
2021-11-14 20:36:21 +01:00
Harald Welte 8aa64eb92a sccp: Add minimalistic support for XUDT / XUDTS
XUDT and XUDTS can be used in two situations:

a) because the sender wants to use segmentation
b) because the sender wants to include a hop counter

In this patch, we implement support for case "b" only.

Change-Id: Ic5b9486f1aeb4bb90cfe702a7ce996f5d82ded2c
Related: OS#5281, SYS#5674
2021-10-26 16:27:14 +02:00
Pau Espin 8275949838 osmo_ss7.c: Fix typo in doc for osmo_ss7_asp_peer_add_host()
Change-Id: Idba9ed3dc1d8968d304f88fdb1ebef422dd982e9
2021-10-07 13:38:58 +02:00
Pau Espin f594b7dfd2 osmo_sccp_simple_client_on_ss7_id(): Allow set internally proper IPv4/v6 default hosts
Allow user apps to relay the decision of proper default local/remote
hosts values to the library. Proper configuration of these addresses can
be quite cumbersome to get correctly, or confusing at least. That's due
to the multi-homing feature of SCTP where both IPv4 and IPv6 are
involved.

We were already doing this kind of automatic setup in
osmo_ss7_vty_go_parent(), where we do validations and assign addresses
based on IPv6 availability.
On the other hand, apps using osmo_sccp_simple_client_on_ss7_id() API
usually pass  "localhost" as default address. In Linux, when IPv6 is enabled
localhost is resolved as "::1", and "127.0.0.1" when IPv6 is disabled.

Let's instead allow apps to relay the setup to the lib, so same addresses
can be applied both during VTY command as well as if there was no VTY
setup at all.

Related: OS#5186
Change-Id: I82e203612571b7651d758d8148661f706a1642ba
2021-10-07 13:38:32 +02:00
Pau Espin c83f3a870d cosmetic: Fix typos in documentation
Change-Id: I1164490c140cc5ca82e5977d24f5971ba216014b
2021-10-05 16:09:24 +02:00
Pau Espin 4dfb938f9c cosmetic: Fix extra empty line
Change-Id: Ibd499fc9376523e6dcfe8ba6792603c237db59f5
2021-10-05 15:59:02 +02: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
Oliver Smith 1a75755f9b m3ua: reject deregistration of static routing keys
Make STP_Tests_M3UA.TC_rkm_unreg_never_registered pass.

Closes: OS#4239
Change-Id: Ie5d84d06e7d5d32c8a22f770f71a5449f4a78484
2021-07-23 10:02:16 +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
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