Commit Graph

688 Commits

Author SHA1 Message Date
Pau Espin 1ba800e36c tests: xua_test: Fix array len computation
As warned by gcc 8.1.0:
In file included from libosmo-sccp/include/osmocom/sigtran/osmo_ss7.h:7,
                 from libosmo-sccp/include/../src/xua_internal.h:3,
                 from libosmo-sccp/tests/xua/xua_test.c:21:
/include/osmocom/core/utils.h:13:34: error: division ‘sizeof (const uint8_t (*)[12] {aka const unsigned char (*)[12]}) / sizeof (const uint8_t[12] {aka const unsigned char[12]})’ does not compute the number of array elements [-Werror=sizeof-pointer-div]
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
                                  ^
libosmo-sccp/tests/xua/xua_test.c:371:45: note: in expansion of macro ‘ARRAY_SIZE’
 #define PARTARR(x, data) { .tag = x, .len = ARRAY_SIZE(data), .dat = (uint8_t *) data }

Change-Id: Iad5703d68fee26fc83958741512820d2539e604e
2018-05-16 14:47:42 +02:00
Pau Espin 920b22c473 tests: xua_test: Fix use of wrong buffer for dest addr
All the others parts use that buffer as its name indicates.

Change-Id: Ide7fe148cc762153330b08f66737816ceed96cb2
2018-05-16 14:47:42 +02:00
Stefan Sperling 3b8ff68a0a free msgb for primitive allocated in lm_timer_cb() of lm_fsm
A primitive allocated in lm_timer_cb() with xua_xlm_prim_alloc()
was never freed. Don't forget to free the msgb in osmo_xlm_sap_down().

Found by code inspection.

Also, assert that allocation suceeded like we do elsewhere.

Change-Id: Ie667b1b8beeda2aa4520a1413f51101435215cc0
Related: OS#2449
2018-05-15 13:47:02 +02:00
Harald Welte b7d9255f1b debian/control: match build dependency versions with configure.ac
So far, 'debian/control' didn't express the minimum version numbers
of the libosmocore + libosmo-netif build dependencies.  This resulted
in build failures against older libosmocore/libosmo-netif versions,
so let's make sure the minimum veresion requirements are expressed
also in debian/control.

Change-Id: I1c874880d8b2569df7acc1af554f7a4dd30e649e
2018-05-08 17:40:04 +02:00
Pau Espin c88605c41c Bump version: 0.8.1.43-7e34-dirty → 0.9.0
Change-Id: Ie3d11408f35509138475e7edde285e1bf5bef8e0
2018-05-03 17:08:07 +02:00
Pau Espin 7e3476dc76 use osmo_init_logging2
Change-Id: I0d45b9381125c496a691ac5da68190b7b3479fc3
2018-04-17 14:22:36 +02:00
Harald Welte f1fa4a7a9c ipa_asp_fsm: Prevent against integer underflow
Ensure we don't pass a negative integer as "unsigned int len" to
ipa_asp_fsm_wait_id_get().  This could result in a remotely-triggered
integer underflow.

Change-Id: Idf9a5c0938e6ae6d47bf85ddfec3306fa3ddb3ce
2018-04-16 22:55:15 +02:00
Neels Hofmeyr 58fcc5344e jenkins.sh: use --enable-werror configure flag, not CFLAGS
Change-Id: I5c3f11586d48a076479eb19ed80a11caad4251d8
2018-03-05 20:51:22 +01:00
Neels Hofmeyr 2d5026b92b configure: add --enable-werror
Provide a sane means of adding the -Werror compiler flag.

Currently, some of our jenkins.sh add -Werror by passing 'CFLAGS="-Werror"',
but that actually *overwrites* all the other CFLAGS we might want to have set.

Maintain these exceptions from -Werror:
a) deprecation (allow upstream to mark deprecation without breaking builds);
b) "#warning" pragmas (allow to remind ourselves of errors without breaking
   builds)

As a last configure step before generating the output files, print the complete
CFLAGS and CPPFLAGS by means of AC_MSG_RESULT.

Change-Id: Idb579d546d6f228e86bd49ca15aa87b86978205a
2018-03-05 20:39:36 +01:00
Pau Espin 3137be99ef contrib: jenkins.sh: Disable doxygen in libosmocore build
Change-Id: I7abc8862a63d448408ae43802da689fe436a0ff0
2018-02-20 20:20:14 +01:00
Max 7f0b908480 SS7: clarify handling of stream opening error
Add comment clarifying why we've just logged error but continued anyway.

Change-Id: I2ce55983b255b0b50fd5142d6ddf188dc8ee20b9
2018-02-15 12:31:35 +00:00
Martin Hauke 60d4be5427 build: AC_PROG_LIBTOOL is the same as LT_INIT
Change-Id: I30f8d289d9dca892e40cd7ed787029fbcafa2dff
2018-02-10 18:08:21 +01:00
Harald Welte d4c9dc4b91 debian/control: Fix Vcs-Browser
Change-Id: I9bc4ee167a141b91f573d038ad524a9cf097ab34
2018-02-09 12:11:05 +01:00
Harald Welte b956b606d8 sccp_types.h: Fix value for SCCP_REFUSAL_UNEQUIPPED_USER
It seems we have been sending the wrong numeric value in SCCP connection
refusal due to an unqeuipped user.  It turns out our list of refusal
causes was missing one entry, causing an off-by-one for this refusal
cause.  While at it, add a comment which section of which spec is
relevant for this enum.

Change-Id: I113645bd6df1ec9ae5137977028df38560fc4789
2018-01-17 19:17:34 +01:00
Neels Hofmeyr 8254cf4f2a error log: sccp_scoc.c: log failure to create/resolve conn_id
Tweak the FIXMEs to clarify that we're lacking a reply to the SCCP user besides
log output.

Change-Id: Ib235ff8e264aaf0c2e9794f464a3ba7b54816f3d
2018-01-07 22:40:23 +01:00
Neels Hofmeyr 16676cf05a cosmetic: hmrt_message_for_routing(): use osmo_ss7_route_name()
Change-Id: Iae524c38cd91383a59c64bf7919d94ba7ff350bd
2017-12-24 21:21:55 +01:00
Neels Hofmeyr 8800b7cf9f add osmo_ss7_route_name()
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: Ia0d15a2814b08bc3f052a1ed12dbb68bade55309
2017-12-24 20:32:03 +01:00
Neels Hofmeyr e4a77d4673 add osmo_sccp_user_name()
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
2017-12-24 20:32:03 +01:00
Neels Hofmeyr d23e38020f typo: osmo-stp main: 'Erro'
Change-Id: Ibb28f48b46a4b86c62770b4d22dcf735717aeadb
2017-12-24 20:32:03 +01: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
Max 1aa2a42eae Enable sanitize for CI tests
Change-Id: Ida8cfcd9a9f86e65273452afa051381bc0c16421
2017-12-21 17:05:35 +01:00
Pau Espin 10d4815bb1 ss7: Re-bind xUA server socket after setting new IP
In osmo-stp, cmd "local-ip" inside node "listen m3ua 2905" was actually
not being applied, because the server was created + bound at "listen" command
time using NULL as IP, and at "local-ip" time the IP was changed but the
server was not re-bound using the new IP, so it kept listening at
0.0.0.0.

With this patch, we defer binding the socket to "local-ip" cmd time,
after the IP has been applied.

As a result, if no "local-ip" command is provided, then the bind never
happens, which means it is now mandatory that users of osmo_ss7_xua_server_create
API not using osmo_ss7_xua_server_set_local_host call new provided API
osmo_ss7_xua_server_bind. Another new API osmo_ss7_bind_all_instances is
provided to easily make sure all servers are bound after configuration
process. This is specially important for servers which doesn't contain
the "local-ip" parameter.

Users of osmo_sccp_simple_server API are not affected by this change,
and they not requrie to call any new API.

Furthermore, using osmo_ss7_xua_server_bind in VTY code ensures the xUA
server is automatically bound to the new address if the operator changes
the "local-ip" cmd at runtime.

Related: OS#2647

Change-Id: I79738963d633bec70705ff159c5b2127cd498aa2
2017-12-20 16:04:08 +00: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 081ac9c029 xua_as[p]_fsm: Use osmo_timer_del() on FSM cleanup
When we destroy a FSM, we (logically) must osmo_timer_del() any running
timers that the FSM might have been using.  This was not implemented
for xua_as_fsm, xua_asp_fsm and also missing from ipa_asp_fsm.

Change-Id: I670df831d7bc30de48ed4277648a461e1e1968fa
Related: OS#2668
2017-11-20 20:48:39 +00:00
Harald Welte 646f47d5a3 Add "show cs7 (m3ua}sua}ipa)" command to show xUA servers
Change-Id: If072e009f4a95a66e0da1576958ab4d3e227d87e
2017-11-20 20:48:39 +00:00
Pau Espin 116dfb6621 contrib/test: Fix config of local/remote ports
The first port is the remote one, and the second port is the local one,
according to cs7_asp_cmd doc and code. In the same config, the ports for
the servers are used and for the local port in the client we don't care,
that's why we use 0 there.

Change-Id: I0fafd07614068a27c19bc2dfa6491b4b0c6737fb
2017-11-20 10:27:31 +00:00
Neels Hofmeyr 73a7435d28 xua_test: sanitize: fix msgb leak
Change-Id: Ie57e803bb6361f39042084a21cada754a6506606
2017-11-18 10:19:04 +00:00
Neels Hofmeyr a17ecfa7b1 sccp_test: sanitize: don't memcmp NULL pointers
Change-Id: I0159a875c1e11f4f9728d9e09f5c365b8174673a
2017-11-18 10:19:04 +00:00
Neels Hofmeyr 3867a7422a sccp_test: sanitize: fix msgb mem leaks
Change-Id: I6d5ff3e4c053db5a2af9d548250f0307e00317bb
2017-11-18 10:19:04 +00:00
Neels Hofmeyr 0a30a8522d add --enable-sanitize config option
Change-Id: Ie9bf734cb6cdee24e776cd64f9f1b800a7a9277c
2017-11-18 10:19:04 +00:00
Pau Espin 7d9a197390 ss7_vty: Fix out-of-bounds access in 'as' cmd
Change-Id: I180d2ecbb266d9baf2a96017bab20760bb42812e
2017-11-17 14:37:14 +01:00
Harald Welte b393b3f4cc Add SPDX-License-Identifier + missing copyright statements
Change-Id: I113232bbeaa7a835871df7f9b883ba573d8a2534
2017-11-13 01:25:47 +09:00
Harald Welte 658cb0ff2e debian/copyright: Fix upstream-name
Change-Id: I0ee80d9d6ffe7936849c23942498fe9b7058a88a
2017-11-13 01:25:16 +09:00
Harald Welte ed1daa2c8f STP: Add osmoappdesc.py
Change-Id: I60362d78b5db3ed5bc96c84a8523c391ff7f8125
2017-11-12 08:22:03 +09:00
Harald Welte 3c1e65023a osmo-stp: Align prompt formatting with other Osmocom programs
In all other Programs we have the VTY like OsmoBSC, OsmoMSC, etc.
so let's make sure osmo-stp also uses OsmoSTP and not osmo-stp.

Change-Id: Ic91010779ad22c41e28ed4cf43c2e3ab679214b5
2017-11-12 08:21:54 +09:00
Harald Welte 510375efd3 ipa: Automatically create / destroy route on IPA connect/disconnect
From the STP point of view: In order to be able to route messages back
to an IPA client, we need to create a route at the time we have
successfully identified the AS for this client based on the name
presented in the IPA CCM ACK "name" field.  Once the IPA client is
destroyed, the route must be deleted again.

With this commit present, we can have an IPA client (such as
osmo-bsc-sccplite) connect to OsmoSTP and exchange BSS[M]AP
with an M3UA-speaking osmo-msc.  Basically, the STP reaches
the point where it can translate between IPA-style SCCPlite
and proper M3UA/SUA on the other side.

Change-Id: I901f06c5d0f2eae60f8d931215ed65190330ce66
2017-11-12 04:41:34 +09:00
Harald Welte bc44437a43 ipa: Patch DPC/OPC information into SCCP Calling/Called Party Address
When we receive a SCCPlite message from an IPA peer, it may simply
contain a SSN number but no point codes.  Similarly to creating a fake
MTP routing label from override DPC and routing key OPC, we can also
add that point code information to the SCCP header.  This way the rest
of the SS7 network can handle the message and route it accordingly.

Change-Id: I4a2ff063e3c060641b3fd181a1cd600da3ec568b
2017-11-12 04:41:34 +09:00
Harald Welte f4a127ef99 initialize msg->l2h in sccp_msgb_alloc()
Change-Id: I5fb11075593696b110bfd3e0541e3aa790029903
2017-11-12 04:41:29 +09:00
Harald Welte 450cdd8b18 ipa: Fix endianness of pseud-M3UA header
Change-Id: I70b420fc2105bb6e486adecf9285fed2fb471f73
2017-11-10 13:25:58 +09:00
Harald Welte 0bd848c112 ipa: Fix setting of OPC/DPC based on routing-context + override
As IPA is a transport layer underneath SCCP, and we don't have MTP-level
OPC and DPC fields in it, we are using the "point-code override dpc"
feature for setting the pseudo-M3UA DPC on incoming Rx packets,
and we use the PC from the routing context as pseudo-M3UA OPC.

However, we were so far only storing this in the M3UA data header,
and not in the xua->mtp.{opc,dpc} members, which are consulted
during the routing decisions.

Change-Id: I5e2244620cd48f848382eb595ce59c6212069788
2017-11-09 17:14:48 +09:00
Harald Welte 9f7a517eb6 vty: Make sure 'point-code override dpc' is saved with correct indent
Change-Id: I4c42ee71eff4ee6aad8dce4156809adb041811a6
2017-11-09 16:06:22 +09:00
Harald Welte b7552385b7 xua: Write 'local-ip' only if non-NULL
Avoid writing 'local-ip (null)' to the config file

Change-Id: Ie49f21afd6b29b8e4a3b16f3f18764fea856d196
2017-11-09 16:05:19 +09:00
Neels Hofmeyr 67ca594140 sccp vty: be fatal for addressbook entry errors
So far, the config would log an error upon config parsing, and then continue to
use defaults, which is super easy to miss. On errors, return CMD_ERR_INCOMPLETE
to abort the program in a config parsing error.

Be fatal for re-using an already defined addressbook entry in another cs7
instance, and for having a too long addressbook entry name.

Though it is mixing in cosmetic changes, add "Error:" to the output and arrange
the erratic name to the end of the message, as is customary for error messages.

Related: osmo-bsc Ia4e58902a2d3757b266cf35ac89f256cfb8f0eec
Change-Id: I2f71b9c4dd30f919d2054da81283dd7035f44f60
2017-11-08 03:10:25 +01: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
Max 8914a2f0fa Fix typo in .deb dependency
Change-Id: Ie6b8770febebcd280e86725dffb5cb86046baeb5
2017-11-02 14:51:53 +01:00
Neels Hofmeyr 87fe4d66ea vty: skip installing cmds now always installed by default
vty_install_default() and install_default() will soon be deprecated.

Depends: I5021c64a787b63314e0f2f1cba0b8fc7bff4f09b
Change-Id: I185aa3a11cb63c893ed80f326f852bde95217321
2017-11-01 00:47:19 +01:00
Neels Hofmeyr ac9d0f53ab jenkins: use osmo-clean-workspace.sh before and after build
See osmo-ci change I2409b2928b4d7ebbd6c005097d4ad7337307dd93 for rationale.

Depends: I2409b2928b4d7ebbd6c005097d4ad7337307dd93
Change-Id: I6e3a24a32b8e06d89ac11b59bca052d56f00c78c
2017-10-28 15:08:21 +00:00
Harald Welte 44b92d2c0e Bump version: 0.8.0 → 0.8.1
Change-Id: I5c9068859c340ac21a5c6975afb3e9bd361ecdb5
2017-10-28 12:40:00 +02:00
Harald Welte b2b727d058 Debian: fix typo resulting in osmo-stp missing automatic shlib dependencies
Change-Id: I0dbb57e1cc9f2b661428d0ba71ef6afc19058669
dpkg-gencontrol: warning: Depends field of package osmo-stp: unknown substitution variable ${shlib:Depends}
dpkg-gencontrol: warning: package osmo-stp: unused substitution variable ${shlibs:Depends}
2017-10-28 10:26:22 +00:00