Commit Graph

25 Commits

Author SHA1 Message Date
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
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
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
Harald Welte 6cd8d12437 Allocate SCCP user primitives with headroom
In I19cb83302aaa404ab1a2d92e6f2aec43d0380426 I set the headroom of
msgb's for SCCP User primitives to zero, assuming that we wouldn't
need any headroom in those primitives.

According to pespin, osmo-msc however needs this headroom:

DLSCCP <002e> sccp_user.c:156 Delivering N-CONNECT.indication to SCCP User 'OsmoMSC-A'
msgb(0xadfba0): Not enough headroom msgb_push (0 < 264)

So let's make sure the new SCCP User primitives are allocated with the
same headroom, just like before I19cb83302aaa404ab1a2d92e6f2aec43d0380426.

Change-Id: I92d7648f8ffd034341e2f12aa79dd3d16ec3a98d
2017-12-10 22:35:08 +01:00
Harald Welte 9af7028ebe sccp_helpers: don't return msgb with l2h set
It's a bad idea to use sccp_msgb_alloc() for SCCP User Primitive msgbs.

The rationale is quite simple: The SCU msgb's are used for wrapping
osmo_prim.  The user payload data (e.g. BSSAP) in such primitives is
found at msgb->l2h.  However, user payload data is optional.  So in a
SCU primitive without user data, we must have msgb->l2h == NULL.

The old behavior resulted in bogus data (actually the sccp_user_prim)
to be contained in the DATA section of SCCP messages such as RLSD/RLC.

Also, the old implementation of scu_msgb_alloc() discarded the 'name'
argument and replaced it with a static "SCU" which was of course another
bug.

Change-Id: I19cb83302aaa404ab1a2d92e6f2aec43d0380426
Related: OS#2732
2017-12-10 14:16:16 +01:00
Harald Welte b393b3f4cc Add SPDX-License-Identifier + missing copyright statements
Change-Id: I113232bbeaa7a835871df7f9b883ba573d8a2534
2017-11-13 01:25:47 +09:00
Neels Hofmeyr 12715e8e99 add osmo_sccp_inst_addr_name(), a variant of osmo_sccp_addr_name()
It can be cumbersome to derive the ss7 instance needed to pass to
sccp_addr_name(), because struct osmo_sccp_instance is opaque and only
available in sccp_internal.h, within libosmo-sccp.

Add osmo_sccp_inst_addr_name() which derives the ss7 instance from the internal
knowledge of the osmo_sccp_instance struct. This can save calls to
osmo_ss7_instance_find() just to do some logging of an sccp address.

Naming: first I thought to pick osmo_sccp_addr_name2(), but for some of the
string composing functions, adding a 2 already means that it is identical but
using a second static buffer (to be used twice within the same printf).

Change-Id: I70ec5c8b42682a23f11a5820431c7e34e225709b
2017-11-08 02:33:14 +01:00
Neels Hofmeyr ba12716882 safer osmo_sccp_make_addr_pc_ssn(): clear all values
Make sure that all values of the resulting sccp_addr are cleared to obtain a
clean PC+SSN address. Before this, gt and ip remained unset/random, e.g. in
osmo_sccp_tx_unitdata_ranap()

Change-Id: I37395169d364050e45e99793c495a9848a4f8601
2017-08-09 20:41:57 +00:00
Neels Hofmeyr 2373f2778a sccp_helpers: check buf len in append_to_buf()
Change-Id: I2e6d656871f952be8e719573fedf2154832841d7
2017-08-09 13:54:44 +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 603e065f43 add osmo_sccp_addr_name() and three value_string[]s
osmo_sccp_addr_dump() just prints the raw values. In osmo_sccp_addr_name(), use
osmo_ss7_pointcode_print() and newly added RI, SSN and GT value_string[] to
print more human readable log output.

Change-Id: Ie1aedd7894acd69ddc887cd65a8a0df4b888838c
2017-08-09 13:54:44 +02:00
Neels Hofmeyr 473048d0d2 add osmo_sccp_addr_set_ssn()
Will be used by e.g. osmo-hnbgw to add an SSN to addresses obtained from the
sccp address book.

Change-Id: I85b46269dbe7909e52873ace3f720f6292a4516c
2017-08-07 16:04:39 +02:00
Harald Welte dde5fda513 osmo_sccp_make_addr_pc_ssn(): Set routing indicator
When we crate a sccp address with PC+SSN, we should also set the routing
indicator accordingly (OSMO_SCCP_RI_SSN_PC).

Change-Id: Ie179df7158624520e90093da063c57f1e3efa0bd
2017-04-10 11:48:35 +02:00
Harald Welte d40b9f842b SUA: Port to new osmo_ss7 and SCCP code
If we use the infrastructure provided by osmo_ss7 on the lower layer and
the SCCP SCRC, SCLC and SCOC code on the upper side, not much of the
original sua.c code remains.  It looks much like the M3UA code now.

Change-Id: I193b74f58aa70c443ae17e78b5604246d6bc3f71
2017-04-10 11:48:34 +02:00
Harald Welte d75e8967ef License headers: Should always have been GPLv2-or-later
libosmo-sigtran is GPLv2-or-later, there were some files that
accidentially had an AGPLv3 license header, which was a copy+paste
mistake at that time.

Change-Id: I67dfd0ae6157afafd3873a3baaa4c6107c04ddfd
2017-04-10 10:41:16 +02:00
Harald Welte 0ebde0c42d sccp_helpers: Add osmo_sccp_{addr,gt}_dump() functions
They stringify a global title or SCCP address for human consumption

Change-Id: I630308aa4519c6e9a260419d37a376aac6a1ce28
2017-02-13 15:09:17 +01:00
Neels Hofmeyr e734655afb sccp_helpers: add convenience function for RANAP unitdata
Change-Id: Ie96d78512b8e3907753272d75471b882365968c4
2017-02-13 13:58:09 +00:00
Neels Hofmeyr 199b97652b sccp_helpers: add osmo_ prefix to all functions
Change-Id: I839c976f3ac722b955da18216de3df2eaa4c5af3
2017-02-13 13:58:01 +00:00
Neels Hofmeyr 81f63035ee sccp_helpers: adjust .h include and copyright
Change-Id: Id2d9a6c3e9b0928d245580895c78aa7355627adc
2017-02-13 13:57:53 +00:00
Neels Hofmeyr c07796dc3b sccp_helpers.h/.c: fix: apply rename of osmo_sua_link to osmo_sccp_link
Change-Id: If8b09bb05297ebf663b4a04d3cc094a6a8087f53
2017-02-13 13:57:44 +00:00
Neels Hofmeyr 86cfe9b3b4 Add sccp_helpers.[hc] moved from osmo-iuh, 1:1 at first
Move here unchanged first, so we're able to see the modifications in diffs.
Pending changes will follow in subsequent patches.

Moved from osmo-iuh 3da8608b6ad014fc74536dbb49019704fd425b8c, which was before
the rename of osmo_sua_link and osmo_sua_user to osmo_sccp_link and
osmo_sccp_user, so this will not compile.

Change-Id: Iae0c58c5f1eb00a685de70add0d5257e4316c6d5
2017-02-13 13:57:29 +00:00