AgeCommit message (Collapse)AuthorFilesLines
2017-10-27Tag/Release Version Welte1-0/+6
This marks the first version of this source package that includes libosmo-sigtran and osmo-stp. Misc Changelog: * Add Doxygen API documentation * Add examples for libosmo-sigtran client and server side API * Add 'struct sccp_data_unitdata_service' for UDTS * Big endian support for sccp_src_ref_to_int() and sccp_src_ref_from_int() * Fix any unintended references to AGPL in the soruce Change-Id: I390f32f289a6b7464672e6081bc189503addb92b
2017-10-27Proper Debian packaging with split packages, -dbg, -doc, ...Harald Welte8-4/+123
Change-Id: I58ce90a9b8e4fc41ceb6a112df1f4503008743a7
2017-10-27Doxugen: s/libosmo-sccp/libosmo-sigtran/gHarald Welte2-9/+9
The Doxygen annotation we have in this library, and which the Doxyfile generates is actually for the shared libosmo-sigtran, and not for the legacy libosmo-sccp. Let's correct that mistake. Change-Id: Id591695f9ac9eba53259558c657df834c331e5fa
2017-10-27update libosmocore/libosmo-netif dependency to current versionsHarald Welte1-4/+4
Change-Id: I084b5968dec97b0bba0344425f880077ddada440
2017-10-27implement unit tests for osmo_sccp_addr_{parse,encode}()Harald Welte6-2/+260
The recent bug with chopped-off point codes in SCCP Address handling has shown that this code could need proper test cases. This patch adds a testsuite for SCCP address encoding and decoding. Related: OS#2441 Change-Id: I612352736ab33462ca0dd97798a2c437eadccb86
2017-10-27osmo_sccp_addr_encode(): Catch some more errors and log themHarald Welte1-0/+10
Log errors in case the user provides global title indicators or nature-of-address indicators that exceed the permitted value range Change-Id: I493b7810bdc58e448f496565ded36f9dce2c1226
2017-10-27osmo_sccp_addr_encode(): Fix truncation of point codesHarald Welte1-1/+1
In osmo_sccp_addr_encode(), we accidentially truncated all point codes to 10 bits, where in reality we should have truncated them to 14 bits: One 'f' was missing in the bit-mask. Closes: OS#2441 Change-Id: Iad67b674b5b5fd41996aa898a131e98900842dd8
2017-10-27osmo_sccp_addr_encode(): Check for more erroneous situationsHarald Welte1-1/+16
... and bail out + log an error. Change-Id: I2a419343e55edad39c59e763d11046c5a439444d
2017-10-26sccp_scrc: fix Network Indicator in SIO compositionNeels Hofmeyr1-1/+1
Since the NI is in bits DC, not BA, it needs to be shifted by 6, not 4, to end up in the two most significant bits. Also, NI is two bits wide, hence & 0x3. (The m3ua.c side of this is already correct.) See ITU-T Recommendation Q.704 (07/96), 14.2 "Service information octet". Before this patch, NI was always sent as 00 == International regardless of the VTY configuration. This patch was verified to work by a wireshark trace of osmo-bsc connecting to osmo-msc, showing the NI decoded as configured by an osmo-bsc.cfg file in the BSSMAP Reset message MTP 3 / Protocol data. Change-Id: I7bb4eb6518a1e0d74313bda776d2a6acd0b02e1b
2017-10-18Add doxygen docsMax5-0/+1755
Make sure doxygen generates library documentation by default (can be disabled at compile time). Change-Id: I2bf7438bcdde19dc88b9bc14c8ad9c8f49099f8a Related: OS#2572
2017-10-04Makefile.am: Link libosmo-sigtran against libvtyHarald Welte1-2/+4
libosmo-sigtran is using symbols from libosmo-vty, so make sure that we explicitly link against libosmo-vty to ensure the dependency shows up in `ldd` of the library. Change-Id: I4d96612a0df5a1232ed8fe280c5d592f462ef7b1
2017-09-27contrib: Add osmo-stp systemd service filePau Espin Pedrol1-0/+11
Change-Id: If6423222b5f1574701c48b5e93eb6c4918879d6c
2017-09-14simple client: prevent overwriting asp settingsPhilipp Maier1-13/+28
If the user does not create an AS, but creates an ASP with a name that is equal to the default name, then the simple client detects that and trys to use this ASP. However, unfortunately it then overwrites the settings of the ASP with the default settings. If the detected ASP is not created by the simple client, use it, but preseve the settings of that ASP. Change-Id: I53d73059f804c3bbea6cb43dc73ad49a753b3b15
2017-09-11vty: add 'asp' / 'local-ip' commandNeels Hofmeyr1-0/+13
We can set the ASP's remote IP (i.e. where to reach osmo-stp), but so far the only way to specify the local IP address to bind to can only be set from C code (e.g. the simple client). Allow setting the local address via VTY. For example, this is desired for the osmo-gsm-tester, to not use arbitrary IP addresses. Change-Id: I3f71897dfacafcf3126e51894d6ca756b02dcd7d
2017-09-03sccp_sap.h: Fix SSN for BSSAP and BSSAP-LEHarald Welte3-5/+7
* 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
2017-08-31osmo-stp: Fix process termination on SIGINT+SIGTERMHarald Welte1-1/+4
In commit eed8c1bfae1d151e135b574d83ed295d36ad8b44 we introduced some singal handling code for (among others) SIGINT and SIGTERM. This code causes the process to hang rather than terminate, as it only dispatches a signal that nobody handles yet in libosmo-sccp. Until a proper implementation is made, let's terminate the process as expected. Change-Id: Iff79c8ac0b347660333912c9258073a013ea799b
2017-08-29Use release helper from libosmocoreMax3-0/+15
See https://osmocom.org/projects/cellular-infrastructure/wiki/Make_a_new_release for details. Change-Id: I39b3bfa8a1ccf376215a3ce220cb3cf7a85471cb Related: OS#1861
2017-08-28cosmetic: aggressively set vty->index to NULL in osmo_ss7_vty_go_parent()Neels Hofmeyr1-0/+2
Change-Id: I579482f679cd43edfbe796a5806ef360335f1c55
2017-08-26Use value string check from osmo-ciMax1-4/+3
Change-Id: I1a2223b1a059fbb832948decf11f9237fad389f2
2017-08-24sccp: again fix handling of default IP addresses in osmo_sccp_simple_client()Philipp Maier1-4/+2
The previous fix (I312caf9d54cedb02034e4ef88fdd2e6ad9ca1c34) caused the default addresses to be discarded. Actually talloc_strdup() the default addresses to use them if not NULL. Change-Id: Ic8563ab272d5256a1b8ceefd5fee37da61e1bd26
2017-08-23osmo_ss7_vty: fix 'as' / 'routing-key' commandNeels Hofmeyr1-31/+58
The VTY definition for this command is flawed and breaks osmo-msc VTY tests. The small problem is a stray '}' in the definition, the bigger problem is that square brackets indicating optional arguments must not enclose more than one argument. Split up the command in several separate definitions with si arg, with ssn arg, with both, and with neither. If si and/or ssn are not passed, set them to zero. See https://lists.osmocom.org/pipermail/openbsc/2017-August/011026.html "optional vty items are stricter than expected" Change-Id: Idc68bfae5457960a9eae5d9648586d6ce719ad68
2017-08-22vty: fix doc for 'xua rkm routing-key-allocation'Neels Hofmeyr1-1/+2
A doc element is missing, which fails the VTY tests in osmo-msc at Change-Id I5ae4e05ee7c57cad341ea5e86af37c1f6b0ffa77. Change-Id: I16aa74244ed5332bdc1fddd538e17b86f62ec3b2
2017-08-20OsmoSTP: Install our default set of signal handlersHarald Welte1-1/+41
Change-Id: Id5e37dc35923fd689e2cecd9923154774efd7f51
2017-08-15Fix SCCP client crash on xUA server (STP) disconnectHarald Welte1-1/+0
When the server (STP) disappears from a live SCCP client, then the xUA default layer manager receives LM_E_SCTP_DISC_IND, which is traversing retart_asp(). In there, we first terminate the current instance of the layer manager FSM, and then re-initialize the ASP to use the default layer manager using osmo_ss7_asp_use_default_lm(). However, osmo_ss7_asp_use_default_lm() uses the presence of an asp->lm_priv pointer as a sign that the old layer manager is still running and attempts to terminate it - despite being terminated just before in restart_as(). So let's simply remove the termination from restart_asp(), and leave it to osmo_ss7_asp_use_default_lm(). Fixes: OS#2402 Change-Id: I062d3af17539de864b56d079fe9b8d76ad99cf1e
2017-08-15vty: fix (null) string in vty configPhilipp Maier1-1/+2
The asp->cfg.remote.host is allowed to be NULL in cases where the localhost is used. Check if asp->cfg.remote.host is NULL when writing the config file and omit it when it is set to NULL. Change-Id: I18f79cc4d4f1db8f2858e8e95098c5821d50594f
2017-08-11sccp: fixup for osmo_sccp_get_ss7()Philipp Maier2-2/+7
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
2017-08-11sccp: function to get sccp instance from sccp userPhilipp Maier2-0/+11
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
2017-08-11sccp: make osmo_sccp_addr_name() availablePhilipp Maier1-0/+1
osmo_sccp_addr_name() is not listed in any header file. Add osmo_sccp_addr_name() to sccp_helpers.h in order to make it available. Change-Id: I092dd55948faeeff78f28f7d50c5b84b9e69ef24
2017-08-11sccp: add doxgen comments for osmo_sccp_simple_client()Philipp Maier1-0/+32
Some of the functons in sccp_user.c have already doygen comments on them. Add doxygen comments for the simple client functions as well Change-Id: I9143bdc54d729f9f50e69fe38cd1798e065f2497
2017-08-11sccp: check for valid point code in osmo_sccp_simple_client()Philipp Maier1-6/+10
The point-code is not checked in the beginning, only the ASP checks the point code at a very late stage and fails in case an invalid point-code is detected. Remove the check in the ASP creation. Add a new check after the SS7 initalization that checks the point-code. If none is set, the default point-code will be used. Change-Id: I334d90e769bd9952f67c51b12a945f22bd268fa8
2017-08-11sccp: fix handling of default IP addresses in osmo_sccp_simple_client()Philipp Maier1-4/+4
When the default IP addresses (remote or local) the respective struct value should be set to NULL. Fix wrong ?:-notation. Change-Id: I312caf9d54cedb02034e4ef88fdd2e6ad9ca1c34
2017-08-10sccp: prefix default parameters of osmo_sccp_simple_client()Philipp Maier2-27/+37
The simple client takes certain parameters (pc, ip and port numbers) which serve as a fallback default in case the user did not configure any suitable parameters via the VTY. Prefix all default variables with default_ to make the purpose clear to the API user Change-Id: Id9e697e8b198e4f58a79e59aaf2e649e84a3eb63
2017-08-09safer osmo_sccp_make_addr_pc_ssn(): clear all valuesNeels Hofmeyr1-4/+6
Make sure that all values of the resulting sccp_addr are cleared to obtain a clean PC+SSN address. Before this, gt and ip remained unset/random, e.g. in osmo_sccp_tx_unitdata_ranap() Change-Id: I37395169d364050e45e99793c495a9848a4f8601
2017-08-09vty: hide SG commands when running as ASPPhilipp Maier1-5/+13
The SG (signal gateway) requires an extra set of VTY commands in order to be fully configurable. These VTY commands do not make sense in a situation where libosmo-sccp is used to implement an ASP (application server process). Detect in which role libosmo-sccp is used by which of the VTY initalization functions are called: osmo_ss7_vty_init_asp() ==> ASP osmo_ss7_vty_init_sg() ==> SG Prevent writing back of SG specific configuration when in running as ASP. Only write back the full parameter set when running as SG. Change-Id: I707bcd790f4c6d0f618e41163b51d2179ea3aeaf
2017-08-09sccp: fix creating of the default route in simple clientPhilipp Maier1-3/+7
The simple client (osmo_sccp_simple_client_on_ss7_id() and osmo_sccp_simple_client) does not create a default route if the user has already created an AS via VTY. Check the presence of a default route independently of the AS. If no default route exists, create one. Change-Id: I7516fa5509bade4ba10e9d8eaa3e46cfe3696b3a
2017-08-09cosmetic: ws in logNeels Hofmeyr1-1/+1
Change-Id: If5a56ec170d4e91ce070f6fa9c9cfe5bbc121186
2017-08-09sccp_helpers: check buf len in append_to_buf()Neels Hofmeyr1-18/+21
Change-Id: I2e6d656871f952be8e719573fedf2154832841d7
2017-08-09sccp-addr vty: set RI to SSN_PC when setting a point-codeNeels Hofmeyr1-0/+2
Change-Id: I75c67d289693f1c2a049ac61cf2b2097d6e5687d
2017-08-09fix osmo_sccp_addr_dump(): actually print RINeels Hofmeyr2-7/+7
Adjust xua_test accordingly. Change-Id: I93e0aa706867e7b1de7f7a6071e3c8af89772af0
2017-08-09add osmo_sccp_addr_name() and three value_string[]sNeels Hofmeyr3-0/+84
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
2017-08-09introduce OSMO_SCCP_RI_NONE to indicate unset RINeels Hofmeyr2-0/+6
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
2017-08-09constify ss7_instance arg of osmo_ss7_pointcode_print()Neels Hofmeyr2-5/+5
Change-Id: I8c6b7188d004033e75e9c41f4a65c418d13a79c5
2017-08-09consistency: use OSMO_SS7_PC_INVALID for osmo_sccp_userNeels Hofmeyr4-21/+16
A previous patch added ss7_instance primary_pc validity checks by means of OSMO_SS7_PC_INVALID. To be consistent, also adjust sccp_user accordingly. (see I7f0f0c89b7335d9da24161bfac8234be214ca00c) Remove the osmo_sccp_user's pc_valid field, replaced by pc=OSMO_SS7_PC_INVALID. Adjust all code paths. Simplify some log printing, using the fact that osmo_ss7_pointcode_print() now outputs "(no PC)" for unset point codes. Change-Id: I8684c9b559712072c772012890bbf7efa7c8eb35
2017-08-09ensure valid primary_pc in osmo_ss7_instanceNeels Hofmeyr5-6/+19
Initialize osmo_ss7_instance.cfg.primary_pc = OSMO_SS7_PC_INVALID. Adjust all code paths using primary_pc to ensure it is indeed valid. Rationale: It looks like we are going to use the primary point-code of an SS7 instance to derive a local SCCP address, e.g. for osmo-bsc and osmo-hnbgw. cs7-instance 1 point-code 1.2.3 ! sets osmo_ss7_instance.primary_pc = 1.2.3 sccp-address msc point-code 0.0.1 routing-indicator PC hnb iucs remote-addr msc ! derives cs7 instance 1 and local pc 1.2.3 If 'point-code 1.2.3' is omitted, this becomes '0.0.0' without the user noticing, and this happens for each client that omits it. I would like to barf when no local PC is set. Change-Id: I7f0f0c89b7335d9da24161bfac8234be214ca00c
2017-08-09add OSMO_SS7_PC_INVALID, add osmo_ss7_pc_is_valid()Neels Hofmeyr2-3/+17
Introduce OSMO_SS7_PC_INVALID to mark an unset point code. Add static osmo_ss7_pc_is_valid() (name matches schema of osmo_ss7_pc_is_local()). In osmo_ss7_pointcode_print(), return "(no PC)" if !osmo_ss7_pc_is_valid(), for convenient printing of any PC state. Subsequent patches will use this for osmo_ss7_instance (I7f0f0c89b7335d9da24161bfac8234be214ca00c) as well as osmo_sccp_user (I8684c9b559712072c772012890bbf7efa7c8eb35). Rationale: Currently, in osmo_ss7_vty.c we had "if (inst->cfg.primary_pc)" suggesting 0 is invalid, but in struct osmo_sccp_user we have flag pc_valid suggesting 0 is indeed valid. All known point code formats are <= 24bit, so we can easily use 0xffffffff as indicator for an unset PC, which removes the need to remember to set a second field for validity and keeps the structs nice and lean. Change-Id: Ib5715bf03a4de7713a7a809dfd821c700255ba8c
2017-08-09sccp: add function to check sccp addressesPhilipp Maier2-0/+44
In order to catch invalid CS7 configurations, It is necessary to check if sccp addresses contain plausible address data. Change-Id: Ic6245288b0171eae10aa708403c1ddb584c92f38
2017-08-07osmo_ss7_vty_init: ensure a talloc ctx is set by userNeels Hofmeyr4-15/+11
Drop the separate osmo_ss7_set_vty_alloc_ctx() because we are likely to forget calling it. Instead, incorporate into osmo_ss7_vty_init_*() with a new ctx arg, and set the static context var in vty_init_shared(). Change-Id: Id4e7f47979001f7856b0b3665c9e94982e75e490
2017-08-07add osmo_sccp_addr_set_ssn()Neels Hofmeyr2-0/+8
Will be used by e.g. osmo-hnbgw to add an SSN to addresses obtained from the sccp address book. Change-Id: I85b46269dbe7909e52873ace3f720f6292a4516c
2017-08-01sccp: derive local address from given sccp instancePhilipp Maier2-0/+26
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
2017-07-31sccp: fix possible nullpointer derefInstallation Owner1-2/+4
check input parameters local_ip and remote_ip of the function osmo_sccp_simple_client_on_ss7_id() before using them with talloc_strdup() Change-Id: I1a5dd1ea3167513bf9e7ae153f83e1ae3136c905