Commit Graph

437 Commits

Author SHA1 Message Date
Harald Welte 0da9f2f19c libosmo-gsup-client: License is GPLv2-or-later
Fix the unintentional AGPLv3-or-later license header in gsup_client.c

Change-Id: I6378bd59fdbe8d95cd6132a1cbc40ae29b558c42
2018-09-03 15:19:24 +02:00
Harald Welte 1eb9869d81 USSD: Fix "ussd default-route"
Before this patch, the default route logic was not implemented.  The
user could specify a default-route, but it wouldn't be used by the
actual routing logic.  Let's fix that.

Change-Id: I0b04a75dc297f088f13da413d08c52e0747e46e6
2018-08-08 08:58:54 +02:00
Vadim Yanitskiy 3adb33de93 hlr_ussd.c: avoid using CR and NL in IUSE responses
According to GSM TS 03.38, section 6.1.2.1, CR symbol at the end
is optional, and moreover libosmogsm encoding API will carry
about the bit padding itself.

Change-Id: I09e8a67758698f3b7a578eab956311e269d091ee
2018-08-08 06:21:26 +00:00
Harald Welte 791ea72ee4 debian: Make libosmo-gsup-client-dev depend on libosmo-gsup-client0
The -dev package should depend on the binary package.

Change-Id: I01e58788e8485cadecad8b8788887743b41b9f1f
2018-08-06 18:38:20 +02:00
Harald Welte 9f7b69a618 gitignore: Add .tarball-version
Change-Id: I2ed792ef248e2b62f63acc7d83add240df03336f
2018-08-06 14:23:33 +02:00
Vadim Yanitskiy e6c839ed2d hlr_ussd.c: fix: properly print a EUSE / IUSE name
We need to distinguish between both EUSE and IUSE, and properly
print their names. Otherwise, garbage is printed in case of IUSE.

Change-Id: I497e7c1fe41279afdb1256ee69e166066a6462bb
2018-08-03 00:00:28 +07:00
Vadim Yanitskiy b93c44f32e USSD/hlr_vty.c: print error if EUSE is not found
Change-Id: I18045c5e544a99b2414a6f0268f1343df119b9f3
2018-08-02 23:58:32 +07:00
Vadim Yanitskiy a05efe8803 hlr_ussd.h: drop meaningless forward declaration
Change-Id: I70a5c7c83c2356b779fb1ea7ffe07ccc1e279c22
2018-08-01 10:24:06 +00:00
Martin Hauke 764514198b debian: Fix typo in package description
Change-Id: Iaa5a3b9e249ce493221569cf9411cc04c4044a0c
2018-07-31 20:13:09 +02:00
Harald Welte 5198609a5e pkg-config: Fix libosmo-gsup-client pkg-config file
Both description and actual "Libs" line were broken.

Change-Id: I92e625418d53a2f17feca87c72624b84183f8cdb
2018-07-31 19:37:45 +02:00
Harald Welte 7c2f430fc5 debian: Add sub-package for libosmo-gsup-client
Change-Id: Iad227bb477d64da30dd6bfbbe1bd0c0a55be9474
2018-07-31 19:19:43 +02:00
Vadim Yanitskiy 633fddebcd Update .gitignore: ignore osmo-euse-demo
Change-Id: I1e2fb003d507a00f9255e021dd8956269f0657ee
2018-07-31 06:52:16 +00:00
Vadim Yanitskiy 7c5e930aa8 hlr_ussd.h: use proper libc headers
Change-Id: I2b9485be08c6cbf188ed1f4059ff28ab65c61dbf
2018-07-31 01:38:40 +07:00
Vadim Yanitskiy 83df349045 hlr_ussd.h: add #pragma once include guard
Change-Id: Iba9470e11af2f2609486b9b0b6bfa3207b883a3a
2018-07-31 01:17:25 +07:00
Vadim Yanitskiy 05fe0233d2 tests/Makefile.am: also remove temporary sqlite files
The osmo_verify_transcript_*.py do terminate the osmo-hlr process
in some unusual way, so the database file is not closed properly.

Let's remove temporary files after the tests execution.

Change-Id: I9e4c98e86c1d6b627bfee1acb4fa116460687483
2018-07-30 16:37:27 +00:00
Vadim Yanitskiy 2781bb767e Update .gitignore: add missing build products
Change-Id: I71809105c631703477d8226ba28a57121807b5ed
2018-07-30 16:37:27 +00:00
Vadim Yanitskiy f473c7b23c hlr_vty_subscr.c: fix subscriber creation command help
Change-Id: Id8dda53cdd10aeedf5451109f9e61d6438c3e09b
2018-07-30 16:37:27 +00:00
Harald Welte dab544e14b USSD: Add support for internal USSD handlers
There are some requests that are best served inside the HLR, as it
has access to subscriber information such as MSISDN and IMSI.

This unfortunately required quite some restructuring of the USSD
related structures including the VTY syntax for adding routes.

The default config file has been updated to replicate the *#100#
built-in behavior of old OsmoNITB.

Closes: OS#2566
Change-Id: I1d09fab810a6bb9ab02904de72dbc9e8a414f9f9
2018-07-30 17:43:10 +02:00
Harald Welte 7d29d59292 Add osmo-euse-demo as minimalistic test of a External USSD (EUSE) handler
This is a small program which simply echo's the USSD request message it
gets in a quote back to the sender.  Its purpose is to illustrate how
EUSEs can be implemented using libosmo-gsup-client.

Change-Id: I3fb8554ca329cb609c591058254117006f665e73
2018-07-30 17:32:15 +02:00
Harald Welte 55d32a1e3c USSD: fix null-pointer deref in "default-route" vty/config cmd
Change-Id: I5ebaea77be6beaf88771fb584477358a4d80a47f
2018-07-30 17:26:35 +02:00
Harald Welte 95b96d4245 USSD: Add new "DSS" logging category and use it appropriately
Change-Id: I0ac198a49ba70ea40fea18464325f1925797a6e8
2018-07-30 17:14:53 +02:00
Harald Welte 9b6bc9e479 osmo-hlr.cfg: Don't enable DEBUG logging by default
This is not a setting that normal users should use in production.

Change-Id: I6594fb083cad70ec596af872d85f805897b29644
2018-07-30 17:14:11 +02:00
Harald Welte 7f32f5f3e6 USSD: Further unification of log output; Use LOGPSS when possible
Change-Id: I2c508fe70337d24c4a8b48e0393ad3c979eea0e7
2018-07-30 16:59:20 +02:00
Harald Welte 7266731eca USSD: Send ReturnError component if USSD Code unknown / EUSE disconnected
Change-Id: Ieef06cec05dd81f600594465d18804362e0fafd6
2018-07-30 14:53:13 +00:00
Harald Welte 97bfb65eeb hlr_ussd: Introduce LOGPSS() macro
Change-Id: I1058ef9fd67af2224c991e43bab02bcf21c9f174
2018-07-30 14:53:13 +00:00
Harald Welte bb77939a86 USSD: Add basic dispatch + decode of GSUP-encapsulated SS/USSD
We don't want any SS session to run for more than 30s.  The timeout
is currently not refreshed.

If we need more comprehensive timeout handling, using osmo_fsm for SS
sessions might make sense.

Change-Id: I5c9fb6b619402d2a23fea9db99590143d85ac11a
2018-07-30 14:53:13 +00:00
Harald Welte 4956ae1f70 USSD: Add Core USSD handling + VTY routing config to HLR
Change-Id: I3cfd7cd401ea32b7e92f1124d129099d9f7dc6e6
2018-07-30 14:53:13 +00:00
Harald Welte d5807b8c87 hlr: Export + Declare global g_hlr symbol
It is a global variable, and it's sort of bogus if every C file
re-declares it as a static global variable that is assigned to the
same value as the "real" global one during start-up.

Change-Id: I6f3e50f071fb2fbbe58413b4760dc2215055a444
2018-07-30 14:53:13 +00:00
Harald Welte 21c14fc7f4 GSUP: Log GSUP route add/remove
Change-Id: I1768d0b8ee7e2821e40a799c9a1c1d900a7ddc48
2018-07-30 14:53:13 +00:00
Vadim Yanitskiy 050eb1d803 src/db.c: don't ignore the result of db_bootstrap()
Change-Id: I0de3d4c4355c4dee8b832faae347586d1e1b3516
2018-07-30 20:48:19 +07:00
Vadim Yanitskiy dc17e05e28 src/db.c: fix: make sure the database is properly closed
Thanks to ASAN, it was discovered that some part of heap
is not released on exit:

  ==19736==ERROR: LeakSanitizer: detected memory leaks

  Indirect leak of 94616 byte(s) in 214 object(s) allocated from:
    #0 0x4e05c6  (/home/wmn/osmocom/osmo-hlr/src/osmo-hlr+0x4e05c6)
    #1 0x7f9b01061dc6  (/usr/lib/x86_64-linux-gnu/libsqlite3.so.0+0x33dc6)

  Indirect leak of 1160 byte(s) in 1 object(s) allocated from:
    #0 0x4e097d  (/home/wmn/osmocom/osmo-hlr/src/osmo-hlr+0x4e097d)
    #1 0x7f9b01061d58  (/usr/lib/x86_64-linux-gnu/libsqlite3.so.0+0x33d58)

  SUMMARY: AddressSanitizer: 95776 byte(s) leaked in 215 allocation(s).

After a long investigation, it was figured out that *sqlite never
closes the database* due to 'unfinalized statements or unfinished
backups'.

The problem was in db_bootstrap(), where several statements were
prepared, but not finalized in loop. This was also the reason of
*.db-shm / *.db-wal files remaining after the program is closed,
and the reason of the following message

  db.c:77 (283) recovered 18 frames from WAL file *.db-wal

Let's fix this and stop ignoring the result of sqlite3_close().

Change-Id: Ibe620d7723b1947d4f60f820bd18435ad0193112
Related: OS#3434
2018-07-30 13:35:32 +00:00
Harald Welte 953d27ce8f gsup_client: rename gsup_client_* to osmo_gsup_client_*
As we're moving this to a common/shared library now, we need to use
the osmo_ namespace prefix for symbol names, struct/type names and
constants.

Change-Id: I294f8f96af4c5daa2b128962534426e04909290e
2018-07-30 13:07:08 +00:00
Harald Welte ec6915a771 import gsup_client.c as new libosmo-gsup-client
This imports the code from osmo-msc 6afef893e17bce67e4d4119acd34d480ed03ba77
with minimal changes to make it compile.  Symbol renaming ot osmo_
prefix is done separately in a follow-up patch to have a as-clean-as-possible
import first.

Requires: libosmocore.git Change-Id Ie36729996abd30b84d1c30a09f62ebc6a9794950
Change-Id: Ief50054ad135551625b684ed8a0486f7af0b2940
2018-07-30 13:07:08 +00:00
Vadim Yanitskiy 9fdb854174 hlr.c: track the use of talloc NULL memory contexts
Tracking NULL memory contexts allows one to detect memory chunks
allocated outside the application's root context, which in most
cases are the result of some mistake.

For example, the VTY implementation still uses the NULL context,
so we have to clean up it manually until this is fixed.

At the moment we have at least one chunk allocated outside the
application's root context (excluding the VTY context):

  full talloc report on 'null_context' (total 24 bytes in 2 blocks)
    struct lookup_helper  contains  24 bytes in  1 blocks

Change-Id: I7ea86730e090c06b2a5966ae4d04b8144b1cd20a
2018-07-30 04:11:20 +07:00
Vadim Yanitskiy 4793a7efc3 hlr.c: free root talloc context on exit
This makes both ASAN and Valgrind happy, because they do expect
all allocated heap chunks to be released on exit.

Change-Id: I7345dec8d06b0b71a859c16132dc0008cfe17cba
2018-07-30 03:57:03 +07:00
Vadim Yanitskiy 527d934807 hlr.c: move deinitialization code from SIGINT handler
There were a few lines of dead code below the osmo_select_main()
loop, while the actual deinitialization code was a part of SIGINT
handler. Let's reanimate this dead zone by moving the code there
and introducing a global 'loop-breaker' variable.

Change-Id: I0e2d673b420193e2bdc1a92377aca542f3a19229
2018-07-30 02:42:25 +07:00
Pau Espin 6b274b95fc sql/Makefile: Create empty /var/lib/osmocom directory at install time
Otherwise osmo-hlr is unable to start correctly.

Change-Id: I1233fc9b3dc685561f79a34e1c32c459dc1aa685
2018-07-02 17:47:24 +02:00
Pau Espin edca4f88a6 sql/Makefile: Install sql files under doc/.../sql subdir
Change-Id: I1c9008d4692412a0cfe39d05216fc9c857cf1e8a
2018-07-02 17:44:35 +02:00
Pau Espin b9c1028cb0 sql/Makefile: Install hlr_data.sql as example together with hlr.sql
Change-Id: Id4a12252b309f03bb393fa26612c305744e14403
2018-07-02 17:27:44 +02:00
Pau Espin 1442e3a3d3 debian: Avoid installing duplicate cfg file in /etc
Change-Id: Ieb25cc8195a2fe7f81b7a39955e0bca5d5c510eb
2018-07-02 17:15:13 +02:00
Martin Hauke 0b8f054b5f sql/Makefile.am: Make docsdir completely configurable
$(docdir) defaults to $(datadir)/doc/osmo-hlr

Change-Id: I77fa16d0edcf88a8e120921504cd088328077836
2018-06-24 17:14:04 +00:00
Harald Welte fa7ee333f7 Add "show gsup-connections" VTY command
This can help with debugging and give operational insight.

Change-Id: I977b4b8cdb36dab42b3d736a28d8b5f17cff04cd
2018-06-24 14:06:56 +02:00
Harald Welte 8fbf82b83f gsup_router: Use "#pragma once" and add missing #includes
Change-Id: I2cc43ea5846e5b98281efc897252c8dcc3ef5728
2018-06-24 11:49:16 +02:00
Harald Welte bd72f1331d move osmo_gsup_addr_send() declaration from luop.h to gsup_router.h
Change-Id: I33165b7b58bd8c863083ed50ce21e3c032c579f5
2018-06-24 11:49:13 +02:00
Harald Welte 32acace879 gsup_server: Add "priv" pointer and make it point to 'struct hlr'
Change-Id: Iada68996b7f4cbdcca92b254ddaf6b88b962e6f1
2018-06-16 20:21:45 +02:00
Harald Welte b85f60477f disable blind subscriber insertion into every VLR/SGSN
During the attempt to fix OS#2785 in Change-Id
I6a92ca34cdaadca9eacc774bb1ca386c325ba865, we introduced logic that
would blindly insert a subscriber *concurrently* in all VLRs/SGSNs of
the network on any update of the subscriber.

Before that patch, we didn't update the current serving SGSN/VLR,
and after the change we created subscribers in all SGSNs/VLRs, of which
all-1 are not serving the subscriber at that time.

We'll have to go back to the original behavior until a proper fix can
be introduced.

Change-Id: Ibf6f1b21b08560d4d8f41bbe7782d40abf4585f8
Related: OS#3091
Related: OS#2785
2018-06-15 18:01:14 +02:00
Harald Welte a1d3b048fb Return proper GSUP error in case of too short IMSI
This fixes HLR_Tests.TC_gsup_sai_err_invalid_imsi

Change-Id: I4f51abdf44dfc62d7e8792341aad6dafe58923da
Closes: OS#3028
2018-06-11 20:28:35 +02:00
Stefan Sperling f83432c25c move creation of insert subscriber data messages to a common function
Move code to create an Insert Subscriber Data message into a common
function which can be shared by hlr.c and luop.c.

As a consequence, we always encode gsup.cn_domain in the corresponding
msgb and must adjust expected output of the 'gsup' test accordingly.

Change-Id: I6a92ca34cdaadca9eacc774bb1ca386c325ba865
Requested-by: neels
Related: OS#2785
2018-05-18 12:18:32 +02:00
Pau Espin 78f4301025 Bump version: 0.2.0.3-1b8a → 0.2.1
Change-Id: I9c457e9baeb546bfefacacddddd48996902e587a
2018-05-04 18:41:35 +02:00
Neels Hofmeyr 1b8a1dc00a add error handling to osmo_gsup_configure_wildcard_apn()
Follow-up to I83d9ef2868bbb01e3f1ddb7920fe735aca172b15 as requested in code review.

Change-Id: Ifcee1e0d275741c1172b208600851861adb13238
2018-05-04 16:48:26 +02:00