Commit Graph

688 Commits

Author SHA1 Message Date
Oliver Smith ad695405d9 contrib: integrate RPM spec
Remove OpenSUSE bug report link, set version to 0.0.0, make it build with
CentOS 8 etc.

Do not try to build libsscp, libmtp and libxua as shared libraries. The
imported spec file patched the source with "0001-build-fixes.patch" (not
imported) and packaged resulting so files. However, these libraries are
legacy and built statically on purpose, as it's stated on the wiki page:
https://osmocom.org/projects/libosmo-sccp/wiki

Related: OS#4550
Change-Id: Id1d77a79b43a9cb967fe3fe10394cca24757af85
2020-05-15 11:56:48 +02:00
Oliver Smith 2686a74548 contrib: import RPM spec
Copy the RPM spec file from:
https://build.opensuse.org/project/show/home:mnhauke:osmocom:nightly

Related: OS#4550
Change-Id: Ic5bee5cbb5752afa598d805166061b1f10af41ea
2020-05-14 11:32:25 +02:00
Philipp Maier ed01782610 doc: make sure all log categories are set to level notice
Lets make sure all logging levels are set to notice

Change-Id: I3b17aa4354f30b55da8fc77f4fe6af0373de7983
2020-05-12 11:29:18 +00:00
Harald Welte f7129b44ae sccp_internal.h: fix compilation with gcc-10
/usr/bin/ld: .libs/sccp_helpers.o:/home/laforge/projects/git/libosmo-sccp/src/sccp_internal.h:123: multiple definition of `sccp_scoc_fsm'; .libs/sua.o:/home/laforge/projects/git/libosmo-sccp/src/sccp_internal.h:123: first defined here

See also https://alioth-lists.debian.net/pipermail/debian-mobcom-maintainers/Week-of-Mon-20200413/000646.html

Change-Id: Icbc06ed2c8d2bd5c63716945c3df923ea4de7886
2020-04-20 19:35:43 +02:00
Eric Wild 858b81a252 configure.ac: fix libtool issue with clang and sanitizer
As pointed out at https://github.com/libexpat/libexpat/issues/312
libtool does not play nice with clang sanitizer builds at all.
For those builds LD shoud be set to clang too (and LDFLAGS needs the
sanitizer flags as well), because the clang compiler driver knows how
linking to the sanitizer libs works, but then at a later stage libtool
fails to actually produce the shared libraries and the build fails. This
is fixed by this patch.

Addtionally LD_LIBRARY_PATH has no effect on conftest runs during
configure time, so the rpath needs to be set to the asan library path to
ensure the configure run does not fail due to a missing asan library,
i.e.:

SANS='-fsanitize=memory -fsanitize-recover=all -shared-libsan'
export CC=clang-10
ASANPATH=$(dirname `$CC -print-file-name=libclang_rt.asan-x86_64.so`)
export LDFLAGS="-Wl,-rpath,$ASANPATH $SANS $LDFLAGS"

Change-Id: I292c303840a76c5042dc077829c5df46158ca8ba
2020-04-11 01:16:19 +02:00
Neels Hofmeyr ed2d50d4e9 cs7 vty: add 'show cs7 config'
When 'cs7' was added, it was generally possible to get the full automatic
configuration spelled out by using 'show running-config'. Later, the vty was
modified so that automatically configured parts were omitted.

Since figuring out the 'cs7' configuration is far from trivial, it is very
convenient to get the program's current configuration spelled out in detail,
whether it is automatic or not. For this purpose, add a new 'show' command
which simply calls the ss7 VTY's write function with a new switch to disable
all omissions.

Change-Id: I84707561a6f54851c5599c39ea9bf1d971a2a1d7
2020-03-19 18:01:49 +00:00
Harald Welte a9ff416745 don't use 'debug' log level in example configs
Related: OS#2577
Change-Id: I16807f827f958d48519871355115715b753edfcb
2020-03-19 14:15:30 +00:00
Pau Espin 7f171d2a2b xua_asp_fsm.c: Drop unused defines
Those values (except for XUA_T_ACK_SEC) are not used at all, and anyway
they already exist as timers in osmo_sccp_timer_defaults (sccp_scoc.c).

Change-Id: Id5902e809e02b2651e381cd58ef97b77c1143dc2
2020-01-21 15:25:27 +01:00
Pau Espin 674f677146 cosmetic: fix typo in comment
Change-Id: Ia39d4961a2690ea4c56276db8f1503a75e97d154
2020-01-21 15:24:58 +01:00
Pau Espin 14fea23527 sccp: Disarm inactivity timer upon T(iar) active->disconn_pend
All other code paths moving to state DISCONN_PEND seem to stop them, and
anyway that state doesn't permit event SCOC_E_T_IAS_EXP:

DLSCCP DEBUG SCCP-SCOC(0){ACTIVE}: Received Event T(iar)_expired (sccp_scoc.c:346)
...
DLSCCP DEBUG SCCP-SCOC(0){ACTIVE}: state_chg to DISCONN_PEND (sccp_scoc.c:1095)
...
DLSCCP DEBUG SCCP-SCOC(0){DISCONN_PEND}: Received Event T(ias)_expired (sccp_scoc.c:339)
DLSCCP ERROR SCCP-SCOC(0){DISCONN_PEND}: Event T(ias)_expired not permitted (sccp_scoc.c:339)

Change-Id: Ieb02dedba312ab76890e943934ce6a1e2fe61f74
2020-01-21 10:53:34 +01:00
Pau Espin 82c7a3c36c sccp_scoc: Deliver correct disconnect cause and importance to user on timer expiration
Change-Id: I87b84e9c3c4cb35135efdb4ba155c684917fbab7
2020-01-21 10:53:34 +01:00
Pau Espin c6a04b17a2 examples/sccp_test_server: Log disconnect indication in echo service
Change-Id: I221519e75800c8bfbe68e24d04913b0c385c521d
2020-01-21 10:53:34 +01:00
Pau Espin 7c441e2067 examples/sccp_test_server: Log primitive name instead of value
Change-Id: I956fa5989ca2dea46b2eaaf4e562c7962aa8be9d
2020-01-21 10:53:32 +01:00
Pau Espin 9ed01722c2 osmo_sccp_simple_server(): use sccp instance index 0 instead of 1
When using osmo_sccp_simple_client(), it will create an sccp instance if
none exists. The sccp instance identifier starts with 0.
The implicit created instance should use sccp instance 0 (the
first connection).

This is basically a counterpart of much older commit
3884eb68d9, were same logic was applied to
osmo_sccp_simple_client().

Change-Id: I85d2680ac65a552d7b2824ec41cd8fc669782079
2020-01-21 10:52:47 +01:00
Pau Espin 5663db37a3 examples/sccp_demo_user: Support reading log/vty config from file
Passing a config file is still optional, and both client and server work
out of the box with providing any. It's still goot allowing to pass a
config file to be able to configure easily stuff like logging, VTY ip
address binding, etc.

Change-Id: Ie75d004a0e9f24309060f241f22209df1bbe358e
2020-01-21 10:52:47 +01:00
Pau Espin ed1a2b3680 example/sccp_demo_user: Use osmocom logging system instead of printf
Change-Id: I211eee8abdb332161be7a31e2864f254d1f51c66
2020-01-21 10:52:39 +01:00
Pau Espin 253e6fecb6 sccp: Fix wrong param type in osmo_sccp_pnc_name()
Wrong type was used when the function was introduced a few commits ago.

Fixes: 5a7eb34f735e0ae93a74da3bc8361454457e49cdi
Closes: CID#207712
Change-Id: Ie9b89483158dd6b988e4c34b497bf3b231c15cd3
2020-01-18 13:25:30 +01:00
Pau Espin c18befb0e3 sccp: Log missing user and router failure paths
Change-Id: I36374e4419474c5ab43c9cca1b59f3054f93180b
2020-01-17 15:52:24 +01:00
Pau Espin a84fa351d3 sccp2sua.c: Log malformed SUA message
Change-Id: Ie04371d27426011e1a1a4f9136e0b28bf33df03b
2020-01-17 15:20:13 +01:00
Pau Espin 2734e1c38c sccp: Support receiving messages with no optional params
Change-Id: I745bd32c62763ba2d88e74de8644c171ef506b37
2020-01-17 14:41:58 +01:00
Pau Espin 5a7eb34f73 sccp: Improve logging in sccp_to_xua_opt()
Change-Id: Icb3f18f34ecfe0602c6e491b61107a30287dcafb
2020-01-17 14:41:53 +01:00
Pau Espin 060b39223e sccp: Convert ifelse to switch statement
Change-Id: I1f3129f5b949fc70913e8103ef17c696002b8ed2
2020-01-17 14:38:26 +01:00
Pau Espin 4b3cbccae7 examples/sccp_demo_user: log category name instead of its hex value
Change-Id: I57afb4cacdb3c118c7570d924caa23144d192aa8
2020-01-17 14:38:26 +01:00
Pau Espin 4706c40ef6 examples/sccp_test_server.c: Fix typo in log message
Change-Id: I8456893b77624402645728ce9403847065a662eb
2020-01-17 14:38:26 +01:00
Pau Espin 08b51ee75a sccp: Avoid memleak of xua_msg receiving malformed sccp message
first, xua_msg is allocated internally in the function. Then depending
on msg type different functions are called. All of those functions
either return the same input xua msg pointer or NULL. If they return
NULL due to parsing failure, we need to free the internally allocated
xua pointer.

Change-Id: I4189fbd66e7e05ce466b3e716a357c56d788b64c
2020-01-17 14:38:26 +01:00
Pau Espin d3e28faa35 sccp: Add value_string for SCCP message types
Change-Id: Ibf3ee4be88a4ca633a01fad08d4c714bfa9008bc
2020-01-17 14:38:22 +01:00
Pau Espin 61d890f88f sccp: Fix null ptr access on malformed or unsupported msg received
Detected while running a TTCN3 sending malformed SCCP message in
SCCP_Tests_RAW.ttcn:

sccp_user.c:174:12: runtime error: member access within null pointer of type 'struct xua_msg'
ASAN:DEADLYSIGNAL
=================================================================
==6==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000008 (pc 0x7f2a11f93c5c bp 0x7ffefcf05c50 sp 0x7ffefcf05c10 T0)
    #0 0x7f2a11f93c5b in mtp_user_prim_cb /tmp/libosmo-sccp/src/sccp_user.c:174
    #1 0x7f2a11fb48f9 in deliver_to_mtp_user /tmp/libosmo-sccp/src/osmo_ss7_hmrt.c:94
    #2 0x7f2a11fb4c8a in hmdt_message_for_distribution /tmp/libosmo-sccp/src/osmo_ss7_hmrt.c:133
    #3 0x7f2a11fb5c90 in m3ua_hmdc_rx_from_l2 /tmp/libosmo-sccp/src/osmo_ss7_hmrt.c:275
    #4 0x7f2a11f6f5c2 in m3ua_rx_xfer /tmp/libosmo-sccp/src/m3ua.c:586
    #5 0x7f2a11f70480 in m3ua_rx_msg /tmp/libosmo-sccp/src/m3ua.c:739
    #6 0x7f2a11faee35 in xua_srv_conn_cb /tmp/libosmo-sccp/src/osmo_ss7.c:1623
    #7 0x7f2a0f46d082  (/usr/lib/x86_64-linux-gnu/libosmonetif.so.8+0xb082)
    #8 0x7f2a1186c0be  (/usr/lib/x86_64-linux-gnu/libosmocore.so.12+0xc0be)
    #9 0x7f2a1186c735 in osmo_select_main (/usr/lib/x86_64-linux-gnu/libosmocore.so.12+0xc735)
    #10 0x557378718219 in main /tmp/libosmo-sccp/examples/sccp_demo_user.c:264
    #11 0x7f2a105ad2e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
    #12 0x557378717059 in _start (/usr/local/bin/sccp_demo_user+0x6059)

Change-Id: Idafa8c9693d98ecd214b62155372e4db69e2a4a4
2020-01-16 18:14:30 +01:00
Pau Espin 07b79bd91e sccp_demo_user: Bind VTY to -l local address cmdline arg
Change-Id: Id93db4ea2865f3f2dbfc89890389ebd02fa8172b
2020-01-16 15:33:09 +01:00
Pau Espin 4c273d6437 ss7: Improve checks in osmo_ss7_asp_peer_add_host()
* Introduce check to make sure we don't write out of peer->host bounds.
* Clean up any/specific address checks, it should be more clear now.

Change-Id: I3ecb94267acbec6ecf2134b08110f24f131cd8cf
2020-01-13 12:58:35 +01:00
Pau Espin bc84ef264e ss7: Fix sccp_simple_server rejecting connections
Server addresses (and remote added ones) were not being copied to the
ASP and hence connections were not matches against the ASP when
connecting:

osmo_ss7.c:1820 (r=127.0.0.2:2905<->l=127.0.0.1:2905): m3ua connection
without matching ASP definition and no dynamic registration enabled, terminating

Related: OS#4355
Change-Id: I77d4f4d733cb46eaaacc7dc32259c9851c79d78e
2020-01-13 12:43:59 +01:00
Pau Espin 191a305cb5 ss7: Set ASP addresses using asp_peer APIs
Change-Id: I4736cb107a1987dab123744b98fb2b06a5e1167a
2020-01-13 12:43:59 +01:00
Pau Espin 7b56b75f36 ss7: Introduce APIs to manage asp_peer hosts
The code managing addresses is decoupled from xua_server since they will
also be used to manage addresses for ASPs.

Change-Id: I4af2a6915ac57c7baa67343bd9414c65154d67f7
2020-01-13 12:41:51 +01:00
Pau Espin 3862b32fd1 ss7: Return value from child function in osmo_ss7_xua_server_set_local_host
It doesn't really change old behavior since it's impossible the child
function returned an error with current implementation, but let's better
return the return code in case new error paths are added.

Change-Id: I24747578b3412b385c1ea1a14922f543f9023a27
2020-01-13 12:27:13 +01:00
Harald Welte ebf7fba8dd sccp_demo_user: Change prompt to not include any '-' symbols
It seems that our TTCN3 VTY/Telnet module no longer supports '-'
inside prompts. Let's make sure the SCCP_Tests can again be executed
by removing them from our promt name here.

Change-Id: I4b6d7dd6fdf7521a4a9071e50ac1dcb2993c74bb
2020-01-10 12:53:52 +01:00
Pau Espin 55c3b37dcd configure.ac: Check for sctp_recvmsg instead of sctp_send
sctp_send is not used at all in libosmo-sccp. sctp_recvmsg is used
though.

Change-Id: Iac90c5f531a136fb3535404a6fdfd4c2d7a594aa
2020-01-09 14:01:24 +01:00
Pau Espin 7ec4c1f0ee sua.c: Avoid double free in sua_rx_msg()->...->mtp_user_prim_cb()
Old commit of mine successfully fixed a memory leak, but apparently
after some more investigation it seems to have introduced a double free
of xua object in other code paths.

Nowadays, it seems scrc_rx_mtp_xfer_ind_xua() is called from 3 different places:
mtp_user_prim_cb()
sua_rx_cl()
sua_rx_co()

Before present patch, first caller is not freeing the xua message and my
old commit made scrc_rx_mtp_xfer_ind_xua() free it (by passing
ownsership of the object). But the other 2 callers do free the xua
object afterwards (actually the grandparent caller sua_rx_msg() does
it), which means it would double-free the xua object.

Let's move ownership out of scrc_rx_mtp_xfer_ind_xua() and let the
caller free the xua object (only changes need on the first caller). This
way everybody is happy and we keep the free() closer to the alloc().

Change-Id: Ia550b781b97adbdc0a0ad58a1075e5467e056f1e
Related: OS#4348
Fixes: 9c3baa89fb
2020-01-08 21:10:08 +01:00
Neels Hofmeyr a468af2c64 Revert "fix memleaks in mtp_user_prim_cb()"
This reverts commit ffb248dd78.

Reason for revert: ttcn-msc-tests fail, apparently there are lots more
xua_msg_free() in scrc_rx_mtp_xfer_ind_xua() that need to be dropped

Change-Id: I008bcb6d5bad9e6347e7cd670159816f51331189
2020-01-08 19:20:21 +00:00
Neels Hofmeyr ffb248dd78 fix memleaks in mtp_user_prim_cb()
After dispatching to scrc_rx_mtp_xfer_ind_xua(), free the xua_msg.

Do not free the xua_msg in any of the code paths triggered within
scrc_rx_mtp_xfer_ind_xua(), i.e. remove xua_msg_free() from:
sccp_scoc_rx_from_scrc()
 +->sccp_scoc_rx_unass_local_ref()
     +->tx_coerr_from_xua()
     +->tx_relco_from_xua()

Before this, some code paths would free the xua_msg, while most code paths
would not, causing mem leaks.

Change-Id: I72b3c6a6f57ba32d9ba191af33b4b236492174e0
2020-01-07 18:18:46 +01:00
Pau Espin 5e4643f4bc Bump version: 1.1.0.71-bb75-dirty → 1.2.0
Change-Id: Ibab643b971f80e3774c393ff3988a765dc081196
2020-01-02 21:24:11 +01:00
Pau Espin 7cc11dafa4 debian: Drop patches directory containing old patch not longer required
Change-Id: I8e518a28cc54f42ff3e7e9205eefbce3a1d67d9d
2020-01-02 21:22:48 +01:00
Harald Welte bb752a32ea ASP: Stop re-transmitting un-acknowledged messages on SCTP down event
We don't want to attempt to re-transmit if we lost the connection:

DLSS7 <000c> xua_asp_fsm.c:251 XUA_ASP(asp-client0){ASP_DOWN}: T(ack) callback: re-transmitting event ASPSM-ASP_UP
DLSS7 <000c> osmo_ss7.c:1833 0: asp-asp-client0: Cannot transmit, asp->client not connected
DLSS7 <000c> xua_asp_fsm.c:251 XUA_ASP(asp-client0){ASP_DOWN}: T(ack) callback: re-transmitting event ASPSM-ASP_UP
DLSS7 <000c> osmo_ss7.c:1833 0: asp-asp-client0: Cannot transmit, asp->client not connected
DLSS7 <000c> xua_asp_fsm.c:251 XUA_ASP(asp-client0){ASP_DOWN}: T(ack) callback: re-transmitting event ASPSM-ASP_UP
DLSS7 <000c> osmo_ss7.c:1833 0: asp-asp-client0: Cannot transmit, asp->client not connected
DLSS7 <000c> xua_asp_fsm.c:251 XUA_ASP(asp-client0){ASP_DOWN}: T(ack) callback: re-transmitting event ASPSM-ASP_UP
DLSS7 <000c> osmo_ss7.c:1833 0: asp-asp-client0: Cannot transmit, asp->client not connected
DLSS7 <000c> xua_asp_fsm.c:251 XUA_ASP(asp-client0){ASP_DOWN}: T(ack) callback: re-transmitting event ASPSM-ASP_UP

Change-Id: Ic8da646d22d3120121d9af43a890762a879f9d74
2019-12-17 15:02:28 +01:00
Harald Welte 9b9cb25f8e ASP FSM: Permit DOWN -> DOWN "transition"
let's avoid messages like
DLSS7 <000c> xua_asp_fsm.c:600 XUA_ASP(asp-client0){ASP_DOWN}: transition to state ASP_DOWN not permitted!

Change-Id: Iabbcf92e3022a4c3f165ce19be929915f92b455c
2019-12-17 15:02:28 +01:00
Harald Welte 6e054bf661 stp: exit(2) on unsupported positional arguments on command line
Change-Id: I70390948943fe42469b8c6d63babc232e857e60c
2019-12-17 15:02:28 +01:00
Oliver Smith a8a646af16 osmoappdesc.py, tests: switch to python 3
Make build and external tests work with python3, so we can drop
the python2 dependency.

This should be merged shortly after osmo-python-tests was migrated to
python3, and the jenkins build slaves were (automatically) updated to
have the new osmo-python-tests installed.

Related: OS#2819
Depends: osmo-python-tests I3ffc3519bf6c22536a49dad7a966188ddad351a7
Change-Id: I344c49001fba23bdcfdef06ab174c52b60edd01c
2019-12-12 09:18:58 +00:00
Oliver Smith feb6777c64 gitignore: add various generated doc files
Change-Id: I14eac5a1e7bc5ff202fc57d76c1b84d4e0050ca8
2019-12-11 12:34:04 +00:00
Harald Welte ee6e43a6e2 xua_asp_fsm: Ensure xUA client includes routing contexts in ASPAC/ASPIA
If we are running in ASP (client) role, and we are about to transmit an
ASPAC or ASPIA to the SG, we must make sure to include any applicable
routing contexts.

Change-Id: Iee4f0d553d6845a9ae08cb5e4f57fdec443e4ef9
Related: OS#4285
2019-12-02 12:03:43 +00:00
Harald Welte ac2e715fbd xua_asp_fsm: Ensure xUA client includes traffic-mode if configured
When a client (ASP) sends an ASPAC to the server (SG), it should include
the traffic-mode configured for it's ASs, if any.

Change-Id: Ia850df22df529dab74959e8666f85976002c482c
Related: OS#4285
2019-12-02 10:19:31 +00:00
Harald Welte a4555c3430 check for osmo_fsm_register() failures and propagate error
Change-Id: Id8861144e4880383a173b7e6ae7860beebac09d9
2019-12-01 17:36:50 +01:00
Harald Welte 362141cc58 Skip dynamic ASPs when writing the list of ASPs in an AS
we handle this correctly in not writing the actual "asp" configuration,
but we have a bug when writing the list of asps within one "as". Let's
make sure to skip the dynamically-created ASPs there, too.

Change-Id: I1a184f3ddec2e91ced8c95ada224da8b490407a8
Closes: OS#4284
2019-11-28 14:12:53 +01:00
Pau Espin af55d4a4a4 xua: Implement traffic mode broadcast
Change-Id: I4358965f0ff0aa05c5082a2745159da766e9a4e7
2019-11-20 16:17:39 +01:00