xua will always be NULL in one particular switch case of
scoc_fsm_conn_pend_out(), so let's use NULL directly rather than obscure
it though a variable that might be understood as this being non-NULL in
some cases.
Change-Id: Id6dc56442441489aefc706bcebc49197ca3dae1e
Fixes: coverity CID#166934
While the SUA / SCCP2SUA code is ensuring that mandatory information
elements such as the user data IE in a CLD$ message, we might still have
current or future callers of sclc_rx_cldr() that don't comply with that.
So let's make sure data_ie is valid before dereferencing it.
Change-Id: I7c1010b0ac82ee0b7bd5e2c7413899695eae0070
Fixes: coverity CID#166940
While the SUA / SCCP2SUA code is ensuring that mandatory information
elements such as the user data IE in a CLDT message, we might still have
current or future callers of sclc_rx_cldt() that don't comply with that.
So let's make sure data_ie is valid before dereferencing it.
Change-Id: Ia102f6c4cd5c6c3f823cb219635c42b9a87765f8
Fixes: coverity CID#166942
We had used + derefernced the 'prim' pointer before checking its
validity.
Change-Id: I0ca5026091e91926924b297f9342bda5f9fd38c9
Fixes: coverity CID#166946
When receiving an unknown primitive, we end up de-referencing an
unassigned/uninitialized pointer for 'conn'. Let's properly catch that
case and print an error message.
Change-Id: Id1f5f293ea9bce8601d45164be670a7062d91802
Fixes: coverity CID#166947
The missing break statement leads to an unintended fall-through which in
turn prints a wrong ERROR message.
Change-Id: I6618fa247b889d4162118278cd05dee85cf21899
Fixes: coverity CID#166948
RKM permits multiple routing key IEs to be inside a single Routing Key
Registration message. We were trying to handle this, but the counter we
used as array index into the 'newly_assigned_as' array was actually
always kept at zero.
Change-Id: I08a962d2f242cefb67fb2dc93818c1ed532e8990
Fixes: coverity CID#166991
If for some reason we cannot resolve the file descriptor for a given
FSM, we shouldn't attempt to send data through it.
Fixes: coverity CID#167155, CID#167154, CID#167153, CID#167152, CID#167151, CID#167151
Change-Id: I8b1a676b653bcdad21cb7927d549f499950a2b73
As an IPA SCCPlite message arrives without any MTP routing label, we
simply construct one artificially for all inbound IPA/SCCPlite packets:
* we set the SPC to the point-code of the routing key of the AS
(as this is the PC we route to this IPA/SCCPlite client anyway)
* we set the DPC to a point-code from a new vty config command
"point-code override dpc"
Change-Id: Id556398e1ded3e613cfde7ea8b71aff7a414ff90
The use of m3ua_msgb_alloc() from generic code is a bit ugly, but I
really don't want to introduce yet another msgb_alloc wrapper.
Change-Id: Ic6dc9a1e7bbed2e1f73395bd18b727fa7892e25b
When we disconnect a client, make sure that we always go through
xua_cli_close_and_reconnect(), which will make sure to notify the ASP
FSM using XUA_ASP_E_SCTP_COMM_DOWN_IND.
Change-Id: I6859b8549c8cbbe2e8279da0ede562387a066d04
This tries as good as possible to fit the IPA/SCCPlite stacking into the
existing SIGTRAN/SS7 code architecture/model. To the user, the IPA
protocol looks like yet another protocol on the same level as the choice
between SUA and M3AU. On the inside, things are obviously quite
different.
We need to handle TCP with IPA framing instead of SCTP for both server
and client. We also implement an alternative "ASP FSM" for IPA, which
takes care of the CCM handshake (ID_REQ/ID_RESP/ID_ACK/ID_ACK2) for both
client and server mode.
In server mode, we use the 'unit name' as identifier to look up the AS,
similar to how we use a routing context to look up the AS in the xUA
case.
We also have to bypass activating the default layer manager in the
simple client to make sure we don't run into even more complexity.
What's missing right now is some way to manually override/set the point
codes. As IPA/SCCPlite is missing any routing label, we currently
simply generate one with SPC=0/DPC=0, which will obviously not work in
most configurations.
Change-Id: I9098574cddeba10fcf8f1b6c196a7069a6805c56
So when we create a xua_server for SUA, we must make sure to create that
associated SCCP instance, if it doesn't already exist. End-user
programs probably normally call this during their initialization anyway,
but in something like OsmoSTP, we need to auto-create it.
Change-Id: Ib575763dbd00f5bd7bfbf48f227a8f5ef9528e2a
I don't think the order of messages is that important (and specified in
the RFC), but let's do this to make the m3ua-testtool case happy.
Change-Id: I2e150e941a6fcfd203944f5b20bd07c07193f44a
Depending on whether or not any ASP is INACTIVE, we need to go to
AS_INACTIVE or AS_DOWN after T(r) expiry in the xua_as_fsm.
Found by m3ua-testtool testcase m3ua-sgp-aspsm-o-003
Change-Id: Iad6b176a5c95a28fbd5ba437696c2e6e160bdb00
Higher-layer code shouldn't have to worry between client and server
difference. It just wants to close the underlying connection for a
given ASP - which it now can by means of osmo_ss7_asp_disconnect().
Change-Id: I36b089abd281b8edac8830fda2d8e57cc06cd0a7
For classic xUA this is not needed, as the server doesn't have to react
to establishment of the SCTP connection. The client will start with an
ASP_UP_REQ. However, in upcoming IPA support, the FSM will need to
react on this event.
Change-Id: Ib10914b27f8761ea44a0fdba96c045821223722a
When dynamically allocating ASPs, we used the hardcoded M3UA protocol,
which is of course wrong in case of SUA or other protocols. Let's use
the xua_server's configured protocol for the created ASPs.
Change-Id: I07832cbaf1ca42f0c7df399e4f96599034b72816
When we destroy a xua_server, we would like to close and destroy any
ASPs that were established via that xua_server. In order to do so, we
need to add a list of ASPs to the xua_server, which we can iterate.
Change-Id: Iff3ed099b817e54e563b70d9ab40f63af63cc2fb
By moving this variable into the SS7 instance, we avoid one more global
variable, and we also fix a bug where the xua servers would be saved
multiple times (once per instance).
Change-Id: Icbab59d773f23cc8514cbeb6e21e25ca35dd337f
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
If we add more xUA variants/protocols, we want to avoid having to touch
too many parts of the code with copy+pasted strings.
Change-Id: I085b884d98fb4c45ac15910a8ebf82b91e861fd4
This is not really needed by the state machines internally, so we have
to artificially add it to the sccp_connection. We don't use it yet, but
upcoming code for VTY introspection of SCCP connections will be able to
use it.
Change-Id: Ic3c85152665abfb613e197b098c97392d16d16bf
If RKM has dynamically generated some AS definitions on the fly, or if
we accepted auto-creation of ASPs on SCTP connect time, then we don't
wnat to save such objects during vty config file store.
Change-Id: I9d0b0b61737a30b9d6e76cecbe42ec071bcddeeb
Using this command one can specify if ASP connections should be refused
if there's no matching configuration, or whether ASPs should simply be
create on-demand.
Change-Id: Ic93b99047fb566cdb25a2f4139ebef54849dece9
If we actually found an instance for the specified ID, return it fast
and don't (re)initialize all linked list heads, etc.
Change-Id: I91b6aabdb873ed8dd103918ee5e40b7ad3946735