Commit Graph

28 Commits

Author SHA1 Message Date
Mychaela N. Falconia ff7c7ea085 SMS over GSUP: implement vty config of SMSC routing
At the user-visible level (advanced settings menus on phones,
GSM 07.05 AT commands, SIM programming) each SMSC is identified
by a numeric address that looks like a phone number, originally
meant to be a Global Title.  OsmoMSC passes these SMSC addresses
through as-is to MO-forwardSM.req GSUP message - however, SMSCs
that connect to OsmoHLR via GSUP identify themselves by their
IPA names instead.  Hence we need a mapping mechanism in OsmoHLR
config.

To accommodate different styles of network design ranging from
strict recreation of classic GSM architecture to guest roaming
arrangements, a two-level configuration is implemented, modeled
after EUSE/USSD configuration: first one defines which SMSCs exist
as entities, identified only by their IPA names, and then one
defines which numeric SMSC address (in SM-RP-DA) should go to which
configured SMSC, with the additional possibility of a default route.

Related: OS#6135
Change-Id: I1624dcd9d22b4efca965ccdd1c74f0063a94a33c
2023-09-21 01:56:21 +00:00
Vadim Yanitskiy fa6af8872f hlr_vty.c: drop redundant include of hlr_ussd.h
Change-Id: Ia873c3ea7fb76cb83628811f159e9d5f2de8dcbd
2023-09-17 02:04:05 +00:00
Alexander Couzens 37f0b3a8f3 Add support for multiple APN profiles for subscriber data
Previously the HLR sent in the Insert Subscriber Data call only the
wildcard APN as a single entry.
This violates the spec because the first entry (with the lowest context_id) is
always the default APN, but it is forbidden to have a wildcard APN as default apn.

Introduce a default template/profile which can contain multiple APNs.
This profile is always sent out to the SGSN/MME as part of Insert-Subscriber-Data.
In the future a subscriber might have a profile template name written into the
database which will resolve to a "pdp-profile premium" in the configuration.

To be backward compatible, if the pdp-profile default section is missing,
the HLR will send out only a wildcard APN.

Config example:

hlr
 ps
  pdp-profile default
   profile 1
    apn internet
   profile 2
    apn *

Changes to the apn list will be only handed out to subscribers
when the subscriber do a location update.

Related: SYS#6391
Change-Id: I540132ee5dcfd09f4816e02e702927e1074ca50f
2023-09-12 09:48:02 +00:00
Alexander Couzens 268a33e58b Add vty `reject-cause` to set the reject cause
Allow to set the LU reject cause independently for both of the
following cases; either when an IMSI is unknown to the HLR or
when the mslookup client does not a receive a timely response
to a GSUP request for the remote home HLR.

Original patchset modified by <keith@rhizomatica.org>

Change-Id: Icea39020c23fbbea9e92847df76af8986fdbf48a
2023-01-20 14:03:01 +00:00
Max 53f6067e97 hlr_vty.c: fix typo
Change-Id: If79ebd9a8998e64be55e52af43e426f37e3972af
2022-09-24 01:55:46 +00:00
Neels Hofmeyr 3f9d1977df db v6: determine 3G AUC IND from VLR name
Each VLR requesting auth tuples should use a distinct IND pool for 3G
auth.  So far we tied the IND to the GSUP peer connection; MSC and SGSN
were always distinct GSUP peers, they ended up using distinct INDs.

However, we have implemented a GSUP proxy, so that, in a distributed
setup, a remotely roaming subscriber has only one direct GSUP peer
proxying for both remote MSC and SGSN. That means as soon as a
subscriber roams to a different site, we would use the GSUP proxy name
to determine the IND instead of the separate MSC and SGSN. The site's
MSC and SGSN appear as the same client, get the same IND bucket, waste
SQNs rapidly and cause auth tuple generation load.

So instead of using the local client as IND, persistently keep a list of
VLR names and assign a different IND to each. Use the
gsup_req->source_name as indicator, which reflects the actual remote
VLR's name (remote MSC or SGSN).

Persist the site <-> IND assignments in the database.

Add an IND test to db_test.c

There was an earlier patch version that separated the IND pools by
cn_domain, but it turned out to add complex semantics, while only
solving one aspect of the "adjacent VLR" problem. We need a solution not
only for CS vs PS, but also for 2,3G vs 4G, and for sites that are
physically adjacent to each other. This patch version does not offer any
automatic solution for that -- as soon as more than 2^IND_bitlen
(usually 32) VLRs show up, it is the responsibility of the admin to
ensure the 'ind' table in the hlr.db does not have unfortunate IND
assignments. So far no VTY commands exist for that, they may be added in
the future.

Related: OS#4319
Change-Id: I6f0a6bbef3a27507605c3b4a0e1a89bdfd468374
2021-07-19 09:01:06 +00:00
Keith Whyte 649c335602 Correct configuration written from vty
osmo-hlr would not read back written configuration due to
bad indentation in the mslookup->server->service section.

Also ipa-name was missing.

Change-Id: Ied4b9504f06a51c3895054a8b9d07a67eda3aeeb
2021-02-26 01:21:41 +01:00
Vadim Yanitskiy dac855e5c8 USSD: add special 'idle' handler to IUSE for testing
Change-Id: I0d566a60e95ce2da951f22ad47c6155c5b6a338c
2020-11-17 18:50:27 +07:00
Vadim Yanitskiy c47d5c0d77 cosmetic: fix spelling in logging message: existAnt -> existEnt
Change-Id: Id803d0c71f3762b8353289853918ea78859780b4
2020-10-29 18:05:22 +07:00
Neels Hofmeyr 76328bdc91 D-GSM 3/n: implement roaming by mslookup in osmo-hlr
Add mslookup client to find remote home HLRs of unknown IMSIs, and
proxy/forward GSUP for those to the right remote HLR instances.

Add remote_hlr.c to manage one GSUP client per remote HLR GSUP address.

Add proxy.c to keep state about remotely handled IMSIs (remote GSUP address,
MSISDN, and probably more in future patches).  The mslookup_server that
determines whether a given MSISDN is attached locally now also needs to look in
the proxy record: it is always the osmo-hlr immediately peering for the MSC
that should respond to mslookup service address queries like SIP and SMPP.
(Only gsup.hlr service is always answered by the home HLR.)

Add dgsm.c to set up an mdns mslookup client, ask for IMSI homes, and to decide
which GSUP is handled locally and which needs to go to a remote HLR.

Add full VTY config and VTY tests.

For a detailed overview of the D-GSM and mslookup related files, please see the
elaborate comment at the top of mslookup.c (already added in an earlier patch).

Change-Id: I2fe453553c90e6ee527ed13a13089900efd488aa
2020-04-30 19:22:24 +02:00
Neels Hofmeyr 2f75803e5d move headers to include/osmocom/hlr
Apply the same headers structure that we keep in most Osmocom source trees:
Keep noinst_HEADERS in include/osmocom/hlr and include them using
  #include <osmocom/hlr/*.h>

The only header kept in src/ is db_bootstrap.h, because it is generated during
build time. If it was built in include/osmocom/hlr, we would need db.o to
depend on db_bootstrap.h in a different subdir, which automake can't do well.

Change-Id: Ic912fe27f545b85443c5fb713d8c3c8aac23c9ad
2019-11-20 01:25:39 +01:00
Pau Espin e49391bfc4 Remove undefined param passed to logging_vty_add_cmds
Since March 15th 2017, libosmocore API logging_vty_add_cmds() had its
parameter removed (c65c5b4ea075ef6cef11fff9442ae0b15c1d6af7). However,
definition in C file doesn't contain "(void)", which means number of
parameters is undefined and thus compiler doesn't complain. Let's remove
parameters from all callers before enforcing "(void)" on it.

Related: OS#4138
Change-Id: I6d0dbbd83ce17ee798bfb6e30378ed1dbae19134
2019-08-05 15:57:13 +02:00
Oliver Smith c7f1787c18 Create subscribers on demand
Add a new vty option and allow to optionally generate a random msisdn,
as well as setting the default NAM:

subscriber-create-on-demand (no-msisdn|<3-15>) (none|cs|ps|both)

Thanks to Vadim for the random MSISDN patch [1], which was squashed into
this one.

[1] Change-Id: I475c71f9902950fa7498855a616e1ec231fad6ac

Depends on: Idc74f4d94ad44b9fc1b6d43178f5f33d551ebfb1 (libosmocore)
Change-Id: I0c9fe93f5c24b5e9fefb513c4d049fb7ebd47ecd
Related: OS#2542
2019-05-19 14:42:46 +07:00
Neels Hofmeyr 5857c595b3 osmo-hlr: allow configuring db path from cfg file
So far, the cmdline argument was the only way to set a database config file.
Add a similar config to VTY as 'hlr' / 'database'. The cmdline arg is stronger
than the 'database' cfg item. DB is not reloaded from VTY command.

Change-Id: I87b8673324e1e6225afb758fb4963ff3279ea3d8
2019-05-08 04:12:38 +00:00
Max 20ddfdbc53 Enable statsd support
Change-Id: I00b8aa4e59028a4c1098a3bae034e8d8ddfbe681
2019-02-18 19:57:58 +00:00
Oliver Smith 851814aa7c Optionally store IMEI in subscriber table
Add VTY config option "store-imei". When it is set, store the IMEI
sent from the VLR with CHECK-IMEI in the database.

Related: OS#2541
Change-Id: I09274ecbed64224f7ae305e09ede773931da2a57
2019-01-24 15:29:08 +00:00
Vadim Yanitskiy d157a56361 SS/USSD: make NCSS session timeout configurable
It may happen that either the MS or an ESME would become
unresponsive, e.g. due to a bug, or a dropped message.
This is why we have SS session timeout, that prevents
keeping 'stalled' sessions forever.

Let's introduce a VTY option, which can be used to configure
this timer (by default it's set to 30 seconds):

hlr
  ...
  ! Use 0 to disable this timer
  ncss-guard-timeout 30

Change-Id: I971fc2cee6fd46d4d5d6dac6c634e0b22fff183d
Related: OS#3717
2018-12-05 19:45:34 +00: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
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 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 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 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 7ee6e554af osmo-hlr: Add talloc context introspection via VTY
This requires libosmocore with Change-Id
I43fc42880b22294d83c565ae600ac65e4f38b30d or later.

Change-Id: Ibc2c333b83f85fa69a364e3e342f12f50dbc2f70
2018-02-14 08:25:52 +01:00
Neels Hofmeyr 85e8a64bb4 vty: skip installing cmds now always installed by default
vty_install_default() and install_default() will soon be deprecated.

Depends: I5021c64a787b63314e0f2f1cba0b8fc7bff4f09b
Change-Id: I09762f110c7bcaf85c0ef2f472eb43ac543c74e9
2017-11-01 00:50:13 +01:00
Neels Hofmeyr 183e7009af implement subscriber vty interface, tests
Implement VTY commands for subscriber manipulation:
- create / delete subscriber
- modify MSISDN
- add/edit/remove 2G and 3G authentication data
- show by IMSI, MSISDN or DB ID.
(enable/disable CS/PS and purge/unpurge to follow later.)

Implement VTY unit tests for the new commands using new
osmo_verify_transcript_vty.py from osmo-python-tests.

Depends: libosmocore I1e94f5b0717b947d2a7a7d36bacdf04a75cb3522
         osmo-python-tests Id47331009910e651372b9c9c76e12f2e8964cc2c
Change-Id: I42b3b70a0439a8f2e4964d7cc31e593c1f0d7537
2017-10-17 00:59:00 +02:00
Pau Espin ce9bc40846 VTY: Add hlr node and bind ip field
With this patch the address osmo-hlr binds to can be changed to
something else than 0.0.0.0

Change-Id: I79f7a300480f308b21116dd14d1698be38725afd
2017-06-01 11:31:39 +02:00
Neels Hofmeyr 7685a78757 main: add VTY and '-c config-file' option
Add config file, mainly for logging control.

Open VTY on the OMSO_VTY_PORT_HLR added to libosmocore in
commit 92fa18e6b800a27aa064a5fb8321cddd7383ae20
aka change-id I08cb52d9399a27e6876e45da36f434708c4fddef.

Add hlr_vty.h/c for standard VTY setup.
Add -c option to pass config file.
Add --version option.

Change-Id: Iedb884345a597371a337b0c67eb6013b7d5d1ce1
2017-02-01 13:58:50 +01:00