Commit Graph

12 Commits

Author SHA1 Message Date
Neels Hofmeyr 81c0bcab06 Revert "SCOC: When sending a CORE/CR, SUA SRC_ADDR == CallingPartyAddress"
This reverts commit 5527df78ad.

I tried some time to figure out what other changes are needed to make this
commit work and fix a confusion, until I noticed:

The commit's *log message* is correct that SRC == calling, but the *patch*
modifies callED addr to be the SRC, which is wrong. So reverting this commit is
indeed the correct way to fix our addresses.

Change-Id: Ic76aacc81f87f8885fe04121aead5c79a761ef07
2017-06-27 21:25:03 +00: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 5527df78ad SCOC: When sending a CORE/CR, SUA SRC_ADDR == CallingPartyAddress
SUA uses different semantics (source / destination) address, while SCCP
uses Calling/CalledParty. This leads to some confusion.  At least in the
CR/CORE case, the CallingParty equals the SRC_ADDR.

Change-Id: I5a3c27b112148dd539f092cce7618b4f62fde73c
2017-05-04 09:07:21 +02:00
Harald Welte 982c0ce337 sccp_scoc: don't pass variable as argument if we know it's NULL
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
2017-04-27 12:17:20 +02:00
Harald Welte 8a1f5a72db scu_gen_encode_and_send(): Fix NULL pointer deref
We were using the 'xua' pointer before checkin if it actually is valid

Change-Id: I5cd3250afc0b787b78683cd8ab6b2512e0d5c69e
Fixes: coverity CID#166945
2017-04-27 11:52:43 +02:00
Harald Welte 4c880a02f4 osmo_sccp_user_sap_down(): Avoid uninitialized pointer deref
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
2017-04-27 11:48:15 +02:00
Harald Welte c031536808 SCCP: Add VTY interface for SCCP
Change-Id: I100daaa947dbab6a4528c4e9fbd0d30790288f63
2017-04-14 20:25:50 +02:00
Harald Welte f5a030fac8 sccp_scoc: Memorize if a connection is incoming or outbound
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
2017-04-14 20:25:50 +02:00
Harald Welte dff8f995ef SCCP SCOC: Ensure user primitive msgb->l2h always poinst to tail
In case there is no user data in a CONNECT.conf primitive (or other CO
primitives), we must make sure that msgb->l2h = msgb->tail so that the
SCCP User can use msgb_l2len(msg) == 0 as indicator to verify if user
data is present or not.

Change-Id: Ie512fe063391e3a634097f555b9b0089d2981de9
2017-04-11 21:45:25 +02:00
Harald Welte 996dcf3ba6 Fix for SCCP CC without user data
When sending messages like CC (or SUA COAK) without user data, we must
make sure to not include the optional data part - as opposed to
including one with zero length.

Change-Id: If91edb526cbcd792ec5ebcb4518cf848feb69391
2017-04-11 09:42:09 +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 ee350893cf Add new SCCP implementation
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
2017-04-10 11:48:34 +02:00