I would like to tweak the names for the recently added functions, so
that they are more clear -- quickly before we release it or anyone uses
these.
Depends: libosmocore I9f43428af654a5674ac3035fe4db1394aac7a7af
Related: I4c1998fd7fee7282d107846dae2cff4b5ceb3a7b
Change-Id: If381f537ab91af1feef7f0e51921217f27e18e6a
Add non-legacy string functions for osmo_scu_prim_name in the form of
_buf() and _c() signatures.
So far there is only osmo_scu_prim_name() using a static buffer.
Implement that using osmo_scu_prim_name_buf().
Change-Id: I4c1998fd7fee7282d107846dae2cff4b5ceb3a7b
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
* 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
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
To allow osmo-bsc to add more than one MSC peer on a single SCCP instance, it
must add a local SCCP user only once per SCCP instance. The first configured
MSC adds a local user, all subsequent MSC should use the same local SCCP user.
So, it is most convenient to provide a public function to return such user if
it exists.
Add as thin wrapper instead of renaming and moving the internal
sccp_user_find(): to keep the patch smaller, and to match the way
osmo_sccp_user_bind_pc() is a 1:1 wrapper for sccp_user_bind_pc().
Related: OS#3682
Change-Id: I9ecbab16b45268f626950303d6ff8296dd6acda0
osmo-msc identifies its BSC and RNC peers by SCCP address, and compares those
by memcmp(), which is not really accurate. Rather provide a meaningful
osmo_sccp_addr_cmp() API to determine whether SCCP addresses are identical.
Go for a full cmp that would also allow sorting.
Change-Id: Ie9e2add7bbfae651c04e230d62e37cebeb91b0f5
Add osmo_sccp_user_sap_down_nofree(), which is identical to
osmo_sccp_user_sap_down(), but doesn't imply a msgb_free().
To implement that, sccp_sclc_user_sap_down_nofree() with the same msgb
semantics is required.
Rationale:
Avoiding msgb leaks is easiest if the caller retains ownership of the msgb.
Take this hypothetical chain where leaks are obviously avoided:
void send()
{
msg = msgb_alloc();
dispatch(msg);
msgb_free(msg);
}
void dispatch(msg)
{
osmo_fsm_inst_dispatch(fi, msg);
}
void fi_on_event(fi, data)
{
if (socket_is_ok)
socket_write((struct msgb*)data);
}
void socket_write(msgb)
{
if (!ok1)
return;
if (ok2) {
if (!ok3)
return;
write(sock, msg->data);
}
}
However, if the caller passes ownership down to the msgb consumer, things
become nightmarishly complex:
void send()
{
msg = msgb_alloc();
rc = dispatch(msg);
/* dispatching event failed? */
if (rc)
msgb_free(msg);
}
int dispatch(msg)
{
if (osmo_fsm_inst_dispatch(fi, msg))
return -1;
if (something_else())
return -1; // <-- double free!
}
void fi_on_event(fi, data)
{
if (socket_is_ok) {
socket_write((struct msgb*)data);
else
/* socket didn't consume? */
msgb_free(data);
}
int socket_write(msgb)
{
if (!ok1)
return -1; // <-- leak!
if (ok2) {
if (!ok3)
goto out;
write(sock, msg->data);
}
out:
msgb_free(msg);
return -2;
}
If any link in this call chain fails to be aware of the importance to return a
failed RC or to free a msgb if the chain is broken, or to not return a failed
RC if the msgb is consumed, we have a hidden msgb leak or double free.
This is the case with osmo_sccp_user_sap_down(). In new osmo-msc, passing data
through various FSM instances, there is high potential for leak/double-free
bugs. A very large brain is required to track down every msgb path.
osmo_sccp_user_sap_down_nofree() makes this problem trivial to solve even for
humans.
Change-Id: Ic818efa78b90f727e1a94c18b60d9a306644f340
There is a naming dilemma: though the osmo_ prefix is now reserved for
libosmocore, all surrounding API already has the osmo_ prefix.
This will be used by osmo-hnbgw's VTY 'show cnlink' command.
Change-Id: Ib7abf69cfcf4c56273223054b280458451e6c2f6
* BSSAP is 254 on both MSC and BSC side: Add missing define
* BSSAP-LE (LCS Extension) has 250/251, adjust name to add -LE suffix
Change-Id: Iccec75cfc0cf16bd717a9bd4606d1e772c332ccc
osmo_sccp_get_ss7() has the risk of a nullpointer dereference, when
sccp is NULL.
Return NULL when the sccp instance is NULL.
Add doxygen comment
Change-Id: I84d484e4441fd37443fff8c67e17df8fb15d5b2e
It is currently impossible to find out which SCCP instance handles
a particular user.
Introduce function to lookup the SCCP instance from a given SCCP
user.
Change-Id: I9562c4f1d00e2ebb3252c5dea598b643aa393719
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
Allows to automatically set an RI in future change
I75c67d289693f1c2a049ac61cf2b2097d6e5687d
"sccp-addr vty: set RI to SSN_PC when setting a point-code"
Change-Id: I6e2f31b023b08cba2f2ee8234e6108efcaca41c0
In order to catch invalid CS7 configurations, It is necessary
to check if sccp addresses contain plausible address data.
Change-Id: Ic6245288b0171eae10aa708403c1ddb584c92f38
The most important parts of an SCCP address are the routing
indicator and the pointcode. The latter one is always available
via the SS7 instance, so a basic local address can be derived
from there.
Add function osmo_sccp_local_addr_by_instance() to derive a basic
local SCCP address from a given SCCP instance
Change-Id: I371dc9132871aad3d8321ea13cf9fd69d76eff8f
The sccp-addressbook only allows defining addresses for a specific
ss7 instance. It is not possible to use an sscp-address, that is
defined in the one ss7 instance in another ss7 instance.
Add a second global list where all sscp-addresses are added,
regardless on which instance they are defined.
Fixup the search functions so that they always search the global
list.
Change the API, so that the address data is written to a
destination pointer. This protects the stored address from
unintentional changes. Also return the ss7 instance, where the
address is associated with.
Change-Id: I5acc1e5abc3b3081149a9f476038e4e53d23b763
SCCP addresses are defined through a number of compoinents, not
just an IP-Address, there is also point code, ssn and more. To
simplify and unify the handling of such objects, this patch
introduces an addressbook functionality. The user can set up
multiple addresses per ss7 instance and give them names. Later
that name can be used to reference the address at a later point
in the config. This means that the usage of sccp-addresses from
the programmers point of view boils down to a VTY function that
reads the string name of a previously defined address. The
programmer can then use the API to get a pointer to the SCCP
address struct and use it normally.
For this feature, two additional VTY nodes are necessary,
this commit depends libosmocore change:
Change-Id I42aa29c0cccc97f284b85801c5329b015b189640
Change-Id: I068ed7f7d113dab88424a9d47bab7fc703bb7942
as 'struct osmo_sccp_instance' is opaque to the user application, it is
useful to have an accessor function that resolves the ss7 instance used
by the SCCP instance.
Change-Id: I8057a6d69584239b9781c5cece42066293ea1dd6
As 'struct osmo_sccp_user' is private, we need this accessor functions
for the SCCP User so it can set and get the 'priv' data.
Change-Id: Ia68a36dc18a7d754d63ae29c86d68e495b5c4134
This is an implementation of SCCP as specified in ITO-T Q.71x,
particularly the SCRC (routing), SCLC (Connectionless) and SCOC
(Connection Oriented) portions. the elaborate state machines of
SCOC are implemented using osmo_fsm, with one state machine for each
connection.
Interfaces to the top (user application) are the SCCP-USER-SAP and on
the bottom (network) side the MTP-USER-SAP as provided by osmo_ss7.
Contrary to a straight-forward implementation, the code internally
always uses a SUA representation of all messages (in struct xua_msg).
This enables us to have one common implementation of all related state
machines and use them for both SUA and SCCP. If used with real SCCP
wire format, all messages are translated from SCCP to SUA on ingress and
translated from SUA to SCCP on egress. As SUA is a super-set of SCCP,
this can be done "lossless".
Change-Id: I916e895d9a4914b05483fe12ab5251f206d10dee
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
This is more natural to most application code, so simply go for ASCII
string with NUL-termination rather than an array with explicit length.
Change-Id: I6312208cdfa83184be41157a473c96e9120c63db
By accident, I already fixed this typo in osmo-iuh, breaking the build. Instead
of reverting there, fix it here.
Change-Id: I4076fb37c0d94be7adff46e76465884a61c54c9a
143 is actually the SSN for RNSAP. Wireshark displayed a RNSAP message type
and malformed packet warning until I fixed this to 142. Now I get the proper
RANAP and id-Paging reported.
There has been a reallocation for RANAP and RNSAP SSNs, though the old SSN for
RANAP is apparently 32 (seen in a pcap from a real 3G network). When I send 32
instead of 142, wireshark also decodes the message as valid RANAP.