Compare commits

...

13 Commits

Author SHA1 Message Date
Neels Hofmeyr
472bb0733d put SQL only used in hlr-db-tool in hlr_db_tool.c
Change-Id: I3ac327dbcef37472fb13b8689d008e74b83b3bb1
2020-09-21 14:42:29 +02:00
Keith
d118efb789 osmo-hlr-db-tool: Make import from osmo-nitb less "lossy"
Include the IMEI and the last seen time in an import from
an osmo-nitb database.

Change-Id: Ic47e549be3551ae43ab6a84228d47ae03e9652a6
2020-08-31 16:42:27 +02:00
Pau Espin Pedrol
ed18fa908c Support setting rt-prio and cpu-affinity mask through VTY
Change-Id: I33101aae3e2851febc335f6fbf96228eab7cf6df
Depends: libosmocore.git Change-Id If76a4bd2cc7b3c7adf5d84790a944d78be70e10a
Depends: osmo-gsm-masnuals.git Change-Id Icd75769ef630c3fa985fc5e2154d5521689cdd3c
Related: SYS#4986
2020-08-18 13:25:34 +02:00
Pau Espin Pedrol
f464fff173 doc: Update VTY reference xml file
Change-Id: Ifdefba331ae2542b1cdc5860d0f9e53ef9f703c4
2020-08-18 12:50:21 +02:00
Pau Espin Pedrol
e893eeb1b3 configure.ac: Fix trailing whitespace
Change-Id: If0569167922695bb88c8f168f89fa300dd181c72
2020-08-18 12:49:05 +02:00
Vadim Yanitskiy
b77d568196 debian/control: change maintainer to the Osmocom team / mailing list
Change-Id: I6b38640b57480c6950be491eeb3c5167be1c6aab
2020-08-13 16:09:02 +07:00
Neels Hofmeyr
80cb6c93b9 manual: describe subscriber import by SQL
It seems a bad idea to cement the internal SQL structure in the user manual,
but since we currently lack a safe and portable import mechanism (like CSV
import in osmo-hlr-db-tool), this is currently valuable info to users.

Change-Id: I3246e6d5364215a71c33b5aca876deab7b6cfd70
2020-06-29 17:12:06 +02:00
Neels Hofmeyr
565cf83a42 osmo-mslookup-client: fix segfault for respond_error() caller
respond_error() passes r == 0. On error, consider it the last response for that
request.

Change-Id: I1acb0b8aa00c098d1f1f1cc17035daa38ce29fd3
2020-06-03 18:38:56 +02:00
Vadim Yanitskiy
fa20702e67 gsup_server: fix typo: s/omso_gsup_message/osmo_gsup_message/
Change-Id: I77eac6df9836f2361d87df7ba5ab6fc14ba06b1d
2020-05-31 18:52:38 +00:00
Oliver Smith
949a53cdf0 Makefile.am: EXTRA_DIST: debian, contrib/*.spec.in
Change-Id: I401a4849ae186bddd667446ff7247976090e1db7
2020-05-22 13:40:09 +02:00
Oliver Smith
102e362943 contrib: integrate RPM spec
Remove OpenSUSE bug report link, set version to @VERSION@, make it build
with CentOS 8 etc.

Related: OS#4550
Change-Id: I38f80d0f867a2bbaa09b5a42cad5028f23a8effa
2020-05-19 17:08:28 +02:00
Oliver Smith
2f7fb2e36b 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: Icb6f4335d5157f058b39701e9fcb332264911ba3
2020-05-19 17:08:28 +02:00
Philipp Maier
377fe5a645 doc: do not use loglevel info for log category ss
The log category ss uses info as loglevel vor ss, this is to verbose,
lets use notice instead.

Change-Id: I192a5f07cb7f45adb6f3af1c511b706738bdadf4
2020-05-12 13:34:13 +02:00
17 changed files with 752 additions and 28 deletions

2
.gitignore vendored
View File

@@ -67,3 +67,5 @@ doc/manuals/generated/
doc/manuals/osmomsc-usermanual.xml
doc/manuals/common
doc/manuals/build
contrib/osmo-hlr.spec

View File

@@ -11,6 +11,8 @@ SUBDIRS = \
EXTRA_DIST = \
.version \
contrib/osmo-hlr.spec.in \
debian \
$(NULL)
AM_DISTCHECK_CONFIGURE_FLAGS = \

10
TODO-RELEASE Normal file
View File

@@ -0,0 +1,10 @@
# When cleaning up this file: bump API version in corresponding Makefile.am and rename corresponding debian/lib*.install
# according to https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info
# In short:
# LIBVERSION=c:r:a
# If the library source code has changed at all since the last update, then increment revision: c:r + 1:a.
# If any interfaces have been added, removed, or changed since the last update: c + 1:0:0.
# If any interfaces have been added since the last public release: c:r:a + 1.
# If any interfaces have been removed or changed since the last public release: c:r:0.
#library what description / commit summary line
osmo-hlr update osmo-gsm-manuals dependency to > 0.3.0 for vty_cpu_sched.adoc include

View File

@@ -25,7 +25,7 @@ AC_PROG_MKDIR_P
AC_PROG_CC
AC_PROG_INSTALL
dnl patching ${archive_cmds} to affect generation of file "libtool" to fix linking with clang
dnl patching ${archive_cmds} to affect generation of file "libtool" to fix linking with clang
AS_CASE(["$LD"],[*clang*],
[AS_CASE(["${host_os}"],
[*linux*],[archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'])])
@@ -39,10 +39,10 @@ PKG_PROG_PKG_CONFIG([0.20])
PKG_CHECK_MODULES(TALLOC, [talloc >= 2.0.1])
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.3.0)
PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.3.0)
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.3.0)
PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.3.0)
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.4.0)
PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.4.0)
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.4.0)
PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.4.0)
PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.6.0)
PKG_CHECK_MODULES(SQLITE3, sqlite3)
@@ -200,6 +200,7 @@ AC_OUTPUT(
contrib/Makefile
contrib/systemd/Makefile
contrib/dgsm/Makefile
contrib/osmo-hlr.spec
tests/Makefile
tests/auc/Makefile
tests/auc/gen_ts_55_205_test_sets/Makefile

190
contrib/osmo-hlr.spec.in Normal file
View File

@@ -0,0 +1,190 @@
#
# spec file for package osmo-hlr
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2016, Martin Hauke <mardnh@gmx.de>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
Name: osmo-hlr
Version: @VERSION@
Release: 0
Summary: Osmocom Home Location Register for GSUP protocol towards OsmoSGSN and OsmoCSCN
License: AGPL-3.0-or-later AND GPL-2.0-or-later
Group: Productivity/Telephony/Servers
URL: https://osmocom.org/projects/osmo-hlr
Source: %{name}-%{version}.tar.xz
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
BuildRequires: pkgconfig >= 0.20
BuildRequires: python3
%if 0%{?suse_version}
BuildRequires: systemd-rpm-macros
%endif
BuildRequires: pkgconfig(libosmoabis) >= 0.6.0
BuildRequires: pkgconfig(libosmocore) >= 1.2.0
BuildRequires: pkgconfig(libosmoctrl) >= 1.2.0
BuildRequires: pkgconfig(libosmogsm) >= 1.2.0
BuildRequires: pkgconfig(libosmovty) >= 1.2.0
BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(talloc) >= 2.0.1
# only needed for populate_hlr_db.pl
Requires: libdbi-drivers-dbd-sqlite3
%{?systemd_requires}
%description
The GSUP HLR is a stand-alone HLR (Home Location Register) for SIM
and USIM based subscribers which exposes the GSUP protocol towards
its users. OsmoSGSN supports this protocol.
osmo-gsup-hlr is still very simplistic. It is a single-threaded
architecture and uses only sqlite3 tables as back-end. It is suitable
for installations of the scale that OsmoNITB was able to handle. It
also lacks various features like fine-grained control of subscribed
services (like supplementary services).
%package -n libosmo-gsup-client0
Summary: Osmocom GSUP (General Subscriber Update Protocol) client library
License: GPL-2.0-or-later
Group: System/Libraries
%description -n libosmo-gsup-client0
This is a shared library that can be used to implement client programs for
the GSUP protocol. The typical GSUP server is OsmoHLR, with OsmoMSC, OsmoSGSN
and External USSD Entities (EUSEs) using this library to implement clients.
%package -n libosmo-gsup-client-devel
Summary: Development files for the Osmocom GSUP client library
License: GPL-2.0-or-later
Group: Development/Libraries/C and C++
Requires: libosmo-gsup-client0 = %{version}
%description -n libosmo-gsup-client-devel
This is a shared library that can be used to implement client programs for
the GSUP protocol. The typical GSUP server is OsmoHLR, with OsmoMSC, OsmoSGSN
and External USSD Entities (EUSEs) using this library to implement clients.
This subpackage contains libraries and header files for developing
applications that want to make use of libosmo-gsup-client.
%package -n libosmo-mslookup0
Summary: Osmocom MS lookup library
License: GPL-2.0-or-later
Group: System/Libraries
%description -n libosmo-mslookup0
This shared library contains routines for looking up mobile subscribers.
%package -n libosmo-mslookup-devel
Summary: Development files for the Osmocom MS lookup library
License: GPL-2.0-or-later
Group: Development/Libraries/C and C++
Requires: libosmo-mslookup0 = %{version}
%description -n libosmo-mslookup-devel
This shared library contains routines for looking up mobile subscribers.
This subpackage contains libraries and header files for developing
applications that want to make use of libosmo-mslookup.
%package -n osmo-mslookup-client
Summary: Standalone program using libosmo-mslookup
License: GPL-2.0-or-later
Group: Development/Libraries/C and C++
%description -n osmo-mslookup-client
Standalone program using libosmo-mslookup to easily integrate with programs
that want to connect services (SIP, SMS,...) to the current location of a
subscriber.
%prep
%setup -q
%build
echo "%{version}" >.tarball-version
autoreconf -fi
%configure \
--docdir="%{_docdir}/%{name}" \
--with-systemdsystemunitdir=%{_unitdir} \
--enable-shared \
--disable-static
make V=1 %{?_smp_mflags}
%install
%make_install
install -d "%{buildroot}/%{_localstatedir}/lib/osmocom"
find %{buildroot} -type f -name "*.la" -delete -print
%check
make %{?_smp_mflags} check || (find . -name testsuite.log -exec cat {} +)
%if 0%{?suse_version}
%preun
%service_del_preun %{name}.service
%postun
%service_del_postun %{name}.service
%pre
%service_add_pre %{name}.service
%post
%service_add_post %{name}.service
%endif
%post -n libosmo-gsup-client0 -p /sbin/ldconfig
%postun -n libosmo-gsup-client0 -p /sbin/ldconfig
%post -n libosmo-mslookup0 -p /sbin/ldconfig
%postun -n libosmo-mslookup0 -p /sbin/ldconfig
%files
%license COPYING
%dir %{_docdir}/%{name}
%dir %{_docdir}/%{name}/examples
%{_docdir}/%{name}/examples/osmo-hlr.cfg
%{_docdir}/%{name}/examples/osmo-hlr-dgsm.cfg
%dir %{_docdir}/%{name}/sql
%{_docdir}/%{name}/sql/hlr.sql
%{_docdir}/%{name}/sql//hlr_data.sql
%dir %{_sysconfdir}/osmocom
%dir %{_localstatedir}/lib/osmocom
%{_bindir}/osmo-hlr
%{_bindir}/osmo-hlr-db-tool
%dir %{_sysconfdir}/osmocom
%config %{_sysconfdir}/osmocom/osmo-hlr.cfg
%{_unitdir}/osmo-hlr.service
%files -n libosmo-gsup-client0
%{_libdir}/libosmo-gsup-client.so.0*
%files -n libosmo-gsup-client-devel
%{_bindir}/osmo-euse-demo
%dir %{_includedir}/osmocom
%dir %{_includedir}/osmocom/gsupclient
%{_includedir}/osmocom/gsupclient/*.h
%{_libdir}/libosmo-gsup-client.so
%{_libdir}/pkgconfig/libosmo-gsup-client.pc
%files -n libosmo-mslookup0
%{_libdir}/libosmo-mslookup.so.0*
%files -n libosmo-mslookup-devel
%dir %{_includedir}/osmocom
%dir %{_includedir}/osmocom/mslookup
%{_includedir}/osmocom/mslookup/*.h
%{_libdir}/libosmo-mslookup.so
%{_libdir}/pkgconfig/libosmo-mslookup.pc
%files -n osmo-mslookup-client
%{_bindir}/osmo-mslookup-client
%changelog

4
debian/control vendored
View File

@@ -1,14 +1,14 @@
Source: osmo-hlr
Section: net
Priority: optional
Maintainer: Max Suraev <msuraev@sysmocom.de>
Maintainer: Osmocom team <openbsc@lists.osmocom.org>
Build-Depends: debhelper (>= 9),
pkg-config,
dh-autoreconf,
dh-systemd (>= 1.5),
autotools-dev,
python3-minimal,
libosmocore-dev,
libosmocore-dev (>= 1.4.0),
libosmo-abis-dev,
libosmo-netif-dev,
libsqlite3-dev,

View File

@@ -12,7 +12,7 @@ log stderr
logging level main notice
logging level db notice
logging level auc notice
logging level ss info
logging level ss notice
logging level linp error
!
line vty

View File

@@ -54,7 +54,7 @@ this database file will be created in the current working directory.
Alternatively, you may use the `osmo-hlr-db-tool`, which is installed along
with `osmo-hlr`, to bootstrap an empty database, or to migrate subscriber data
from an old 'OsmoNITB' database. See `osmo-hlr-db-tool --help`.
from an old 'OsmoNITB' database. See <<db_import_nitb>>.
=== Multiple instances

View File

@@ -127,3 +127,83 @@ OsmoHLR# subscriber imei 35761300444848 show
----
<1> Randomly generated 5 digit MSISDN
<2> Disabled CS and PS NAM prevent the subscriber from accessing the network
=== Import Subscriber Data
==== Scripted Import
WARNING: It is not generally a good idea to depend on the HLR database's internal table structure, but in the lack of an
automated import procedure, this example is provided as an ad-hoc method to aid automated subscriber import. This is not
guaranteed to remain valid.
NOTE: We may add CSV and other import methods to the `osmo-hlr-db-tool`, but so far that is not implemented. Contact the
community if you are interested in such a feature being implemented.
NOTE: `sqlite3` is available from your distribution packages or `sqlite.org`.
Currently, probably the easiest way to automatically import subscribers to OsmoHLR is to write out a text file with SQL
commands per subscriber, and feed that to `sqlite3`, as described below.
A difficulty is to always choose subscriber IDs that are not yet in use. For an initial import, the subscriber ID may be
incremented per subscriber record. If adding more subscribers to an existing database, it is necessary to choose
subscriber IDs that are not yet in use. Get the highest ID in use with:
----
sqlite3 hlr.db 'select max(id) from subscriber'
----
A full SQL example of adding a single subscriber with id 23, IMSI 001010123456789, MSISDN 1234, Ki for COMP128v1, and K
and OPC for Milenage:
----
INSERT subscriber (id, imsi, msisdn) VALUES (23, '001010123456789', '1234');
INSERT INTO auc_2g (subscriber_id, algo_id_2g, ki)
VALUES(23, 1, '0123456789abcdef0123456789abcdef');
INSERT INTO auc_3g (subscriber_id, algo_id_3g, k, op, opc)
VALUES(23, 5, '0123456789abcdef0123456789abcdef',NULL,'0123456789abcdef0123456789abcdef');
----
Table entries to `auc_2g` and/or `auc_3g` may be omitted if no such key material is required.
UMTS Milenage auth (on both 2G and 3G RAN) is configured by the `auc_3g` table. `algo_id_3g` must currently always be 5
(MILENAGE).
The algorithm IDs for `algo_id_2g` and `algo_id_3g` are:
.Algorithm IDs in OsmoHLR's database
[options="header",width="50%",cols="40%,60%"]
|===
|`algo_id_2g` / `algo_id_3g` | Authentication Algorithm
| 1 | COMP128v1
| 2 | COMP128v2
| 3 | COMP128v3
| 4 | XOR
| 5 | MILENAGE
|===
Create an empty HLR database with
----
osmo-hlr-db-tool -l hlr.db create
----
Repeat above SQL commands per subscriber, incrementing the subscriber ID for each block, then feed the SQL commands for
the subscribers to be imported to the `sqlite3` command line tool:
----
sqlite3 hlr.db < subscribers.sql
----
[[db_import_nitb]]
==== Import OsmoNITB database
To upgrade from old OsmoNITB to OsmoHLR, use `osmo-hlr-db-tool`:
----
osmo-hlr-db-tool -l hlr.db import-nitb-db nitb.db
----
Be aware that the import is lossy, only the IMSI, MSISDN, nam_cs/ps and 2G auth data are set.

View File

@@ -28,6 +28,8 @@ include::{srcdir}/chapters/dgsm.adoc[]
include::./common/chapters/gsup.adoc[]
include::./common/chapters/vty_cpu_sched.adoc[]
include::./common/chapters/port_numbers.adoc[]
include::./common/chapters/bibliography.adoc[]
@@ -35,4 +37,3 @@ include::./common/chapters/bibliography.adoc[]
include::./common/chapters/glossary.adoc[]
include::./common/chapters/gfdl.adoc[]

View File

@@ -18,10 +18,11 @@
<param name='terminal' doc='Write to terminal' />
</params>
</command>
<command id='write file'>
<command id='write file [PATH]'>
<params>
<param name='write' doc='Write running configuration to memory, network, or terminal' />
<param name='file' doc='Write to configuration file' />
<param name='[PATH]' doc='Set file path to store the config, or replace if already exists' />
</params>
</command>
<command id='write memory'>
@@ -187,7 +188,7 @@
<param name='MASK' doc='List of logging categories to log, e.g. &apos;abc:mno:xyz&apos;. Available log categories depend on the specific application, refer to the &apos;logging level&apos; command. Optionally add individual log levels like &apos;abc,1:mno,3:xyz,5&apos;, where the level numbers are LOGL_DEBUG=1 LOGL_INFO=3 LOGL_NOTICE=5 LOGL_ERROR=7 LOGL_FATAL=8' />
</params>
</command>
<command id='logging level (main|db|auc|ss|lglobal|llapd|linp|lmux|lmi|lmib|lsms|lctrl|lgtp|lstats|lgsup|loap|lss7|lsccp|lsua|lm3ua|lmgcp|ljibuf|lrspro) (debug|info|notice|error|fatal)'>
<command id='logging level (main|db|auc|ss|mslookup|lu|dgsm|lglobal|llapd|linp|lmux|lmi|lmib|lsms|lctrl|lgtp|lstats|lgsup|loap|lss7|lsccp|lsua|lm3ua|lmgcp|ljibuf|lrspro) (debug|info|notice|error|fatal)'>
<params>
<param name='logging' doc='Configure logging' />
<param name='level' doc='Set the log level for a specified category' />
@@ -195,6 +196,9 @@
<param name='db' doc='Database Layer' />
<param name='auc' doc='Authentication Center' />
<param name='ss' doc='Supplementary Services' />
<param name='mslookup' doc='Mobile Subscriber Lookup' />
<param name='lu' doc='Location Updating' />
<param name='dgsm' doc='Distributed GSM: MS lookup and proxy' />
<param name='lglobal' doc='Library-internal global log family' />
<param name='llapd' doc='LAPD in libosmogsm' />
<param name='linp' doc='A-bis Intput Subsystem' />
@@ -253,6 +257,43 @@
<param name='force-all' doc='Release any globally forced log level set with &apos;logging level force-all &lt;level&gt;&apos;' />
</params>
</command>
<command id='logp (main|db|auc|ss|mslookup|lu|dgsm|lglobal|llapd|linp|lmux|lmi|lmib|lsms|lctrl|lgtp|lstats|lgsup|loap|lss7|lsccp|lsua|lm3ua|lmgcp|ljibuf|lrspro) (debug|info|notice|error|fatal) .LOGMESSAGE'>
<params>
<param name='logp' doc='Print a message on all log outputs; useful for placing markers in test logs' />
<param name='main' doc='Main Program' />
<param name='db' doc='Database Layer' />
<param name='auc' doc='Authentication Center' />
<param name='ss' doc='Supplementary Services' />
<param name='mslookup' doc='Mobile Subscriber Lookup' />
<param name='lu' doc='Location Updating' />
<param name='dgsm' doc='Distributed GSM: MS lookup and proxy' />
<param name='lglobal' doc='Library-internal global log family' />
<param name='llapd' doc='LAPD in libosmogsm' />
<param name='linp' doc='A-bis Intput Subsystem' />
<param name='lmux' doc='A-bis B-Subchannel TRAU Frame Multiplex' />
<param name='lmi' doc='A-bis Input Driver for Signalling' />
<param name='lmib' doc='A-bis Input Driver for B-Channels (voice)' />
<param name='lsms' doc='Layer3 Short Message Service (SMS)' />
<param name='lctrl' doc='Control Interface' />
<param name='lgtp' doc='GPRS GTP library' />
<param name='lstats' doc='Statistics messages and logging' />
<param name='lgsup' doc='Generic Subscriber Update Protocol' />
<param name='loap' doc='Osmocom Authentication Protocol' />
<param name='lss7' doc='libosmo-sigtran Signalling System 7' />
<param name='lsccp' doc='libosmo-sigtran SCCP Implementation' />
<param name='lsua' doc='libosmo-sigtran SCCP User Adaptation' />
<param name='lm3ua' doc='libosmo-sigtran MTP3 User Adaptation' />
<param name='lmgcp' doc='libosmo-mgcp Media Gateway Control Protocol' />
<param name='ljibuf' doc='libosmo-netif Jitter Buffer' />
<param name='lrspro' doc='Remote SIM protocol' />
<param name='debug' doc='Log debug messages and higher levels' />
<param name='info' doc='Log informational messages and higher levels' />
<param name='notice' doc='Log noticeable messages and higher levels' />
<param name='error' doc='Log error messages and higher levels' />
<param name='fatal' doc='Log only fatal messages' />
<param name='.LOGMESSAGE' doc='Arbitrary message to log on given category and log level' />
</params>
</command>
<command id='show logging vty'>
<params>
<param name='show' doc='Show running system information' />
@@ -360,6 +401,20 @@
<param name='IDENT' doc='IMSI/MSISDN/ID/IMEI of the subscriber' />
</params>
</command>
<command id='show mslookup services'>
<params>
<param name='show' doc='Show running system information' />
<param name='mslookup' doc='Distributed GSM / mslookup related information' />
<param name='services' doc='List configured service addresses as sent to remote mslookup requests' />
</params>
</command>
<command id='show cpu-sched threads'>
<params>
<param name='show' doc='Show running system information' />
<param name='cpu-sched' doc='Show Sched section information' />
<param name='threads' doc='Show information about running threads)' />
</params>
</command>
</node>
<node id='enable'>
<name>enable</name>
@@ -528,7 +583,7 @@
<param name='MASK' doc='List of logging categories to log, e.g. &apos;abc:mno:xyz&apos;. Available log categories depend on the specific application, refer to the &apos;logging level&apos; command. Optionally add individual log levels like &apos;abc,1:mno,3:xyz,5&apos;, where the level numbers are LOGL_DEBUG=1 LOGL_INFO=3 LOGL_NOTICE=5 LOGL_ERROR=7 LOGL_FATAL=8' />
</params>
</command>
<command id='logging level (main|db|auc|ss|lglobal|llapd|linp|lmux|lmi|lmib|lsms|lctrl|lgtp|lstats|lgsup|loap|lss7|lsccp|lsua|lm3ua|lmgcp|ljibuf|lrspro) (debug|info|notice|error|fatal)'>
<command id='logging level (main|db|auc|ss|mslookup|lu|dgsm|lglobal|llapd|linp|lmux|lmi|lmib|lsms|lctrl|lgtp|lstats|lgsup|loap|lss7|lsccp|lsua|lm3ua|lmgcp|ljibuf|lrspro) (debug|info|notice|error|fatal)'>
<params>
<param name='logging' doc='Configure logging' />
<param name='level' doc='Set the log level for a specified category' />
@@ -536,6 +591,9 @@
<param name='db' doc='Database Layer' />
<param name='auc' doc='Authentication Center' />
<param name='ss' doc='Supplementary Services' />
<param name='mslookup' doc='Mobile Subscriber Lookup' />
<param name='lu' doc='Location Updating' />
<param name='dgsm' doc='Distributed GSM: MS lookup and proxy' />
<param name='lglobal' doc='Library-internal global log family' />
<param name='llapd' doc='LAPD in libosmogsm' />
<param name='linp' doc='A-bis Intput Subsystem' />
@@ -564,7 +622,8 @@
</command>
<command id='logging level set-all (debug|info|notice|error|fatal)'>
<params>
<param name='logging' doc='Configure logging' /> <param name='level' doc='Set the log level for a specified category' />
<param name='logging' doc='Configure logging' />
<param name='level' doc='Set the log level for a specified category' />
<param name='set-all' doc='Once-off set all categories to the given log level. There is no single command to take back these changes -- each category is set to the given level, period.' />
<param name='debug' doc='Log debug messages and higher levels' />
<param name='info' doc='Log informational messages and higher levels' />
@@ -593,6 +652,43 @@
<param name='force-all' doc='Release any globally forced log level set with &apos;logging level force-all &lt;level&gt;&apos;' />
</params>
</command>
<command id='logp (main|db|auc|ss|mslookup|lu|dgsm|lglobal|llapd|linp|lmux|lmi|lmib|lsms|lctrl|lgtp|lstats|lgsup|loap|lss7|lsccp|lsua|lm3ua|lmgcp|ljibuf|lrspro) (debug|info|notice|error|fatal) .LOGMESSAGE'>
<params>
<param name='logp' doc='Print a message on all log outputs; useful for placing markers in test logs' />
<param name='main' doc='Main Program' />
<param name='db' doc='Database Layer' />
<param name='auc' doc='Authentication Center' />
<param name='ss' doc='Supplementary Services' />
<param name='mslookup' doc='Mobile Subscriber Lookup' />
<param name='lu' doc='Location Updating' />
<param name='dgsm' doc='Distributed GSM: MS lookup and proxy' />
<param name='lglobal' doc='Library-internal global log family' />
<param name='llapd' doc='LAPD in libosmogsm' />
<param name='linp' doc='A-bis Intput Subsystem' />
<param name='lmux' doc='A-bis B-Subchannel TRAU Frame Multiplex' />
<param name='lmi' doc='A-bis Input Driver for Signalling' />
<param name='lmib' doc='A-bis Input Driver for B-Channels (voice)' />
<param name='lsms' doc='Layer3 Short Message Service (SMS)' />
<param name='lctrl' doc='Control Interface' />
<param name='lgtp' doc='GPRS GTP library' />
<param name='lstats' doc='Statistics messages and logging' />
<param name='lgsup' doc='Generic Subscriber Update Protocol' />
<param name='loap' doc='Osmocom Authentication Protocol' />
<param name='lss7' doc='libosmo-sigtran Signalling System 7' />
<param name='lsccp' doc='libosmo-sigtran SCCP Implementation' />
<param name='lsua' doc='libosmo-sigtran SCCP User Adaptation' />
<param name='lm3ua' doc='libosmo-sigtran MTP3 User Adaptation' />
<param name='lmgcp' doc='libosmo-mgcp Media Gateway Control Protocol' />
<param name='ljibuf' doc='libosmo-netif Jitter Buffer' />
<param name='lrspro' doc='Remote SIM protocol' />
<param name='debug' doc='Log debug messages and higher levels' />
<param name='info' doc='Log informational messages and higher levels' />
<param name='notice' doc='Log noticeable messages and higher levels' />
<param name='error' doc='Log error messages and higher levels' />
<param name='fatal' doc='Log only fatal messages' />
<param name='.LOGMESSAGE' doc='Arbitrary message to log on given category and log level' />
</params>
</command>
<command id='show logging vty'>
<params>
<param name='show' doc='Show running system information' />
@@ -672,6 +768,18 @@
<param name='rate-counters' doc='Show all rate counters' />
</params>
</command>
<command id='stats report'>
<params>
<param name='stats' doc='Stats related commands' />
<param name='report' doc='Manurally trigger reporting of stats' />
</params>
</command>
<command id='stats reset'>
<params>
<param name='stats' doc='Stats related commands' />
<param name='reset' doc='Reset all stats' />
</params>
</command>
<command id='show gsup-connections'>
<params>
<param name='show' doc='Show running system information' />
@@ -827,6 +935,20 @@
<param name='cs+ps' doc='Allow access to both circuit and packet switched services' />
</params>
</command>
<command id='show mslookup services'>
<params>
<param name='show' doc='Show running system information' />
<param name='mslookup' doc='Distributed GSM / mslookup related information' />
<param name='services' doc='List configured service addresses as sent to remote mslookup requests' />
</params>
</command>
<command id='show cpu-sched threads'>
<params>
<param name='show' doc='Show running system information' />
<param name='cpu-sched' doc='Show Sched section information' />
<param name='threads' doc='Show information about running threads)' />
</params>
</command>
</node>
<node id='config'>
<name>config</name>
@@ -1056,11 +1178,11 @@
<param name='log' doc='Report to the logger' />
</params>
</command>
<command id='stats interval &lt;1-65535&gt;'>
<command id='stats interval &lt;0-65535&gt;'>
<params>
<param name='stats' doc='Configure stats sub-system' />
<param name='interval' doc='Set the reporting interval' />
<param name='&lt;1-65535&gt;' doc='Interval in seconds' />
<param name='&lt;0-65535&gt;' doc='Interval in seconds (0 disables the reporting interval)' />
</params>
</command>
<command id='hlr'>
@@ -1068,6 +1190,16 @@
<param name='hlr' doc='Configure the HLR' />
</params>
</command>
<command id='mslookup'>
<params>
<param name='mslookup' doc='Configure Distributed GSM mslookup' />
</params>
</command>
<command id='cpu-sched'>
<params>
<param name='cpu-sched' doc='Configure CPU Scheduler related settings' />
</params>
</command>
</node>
<node id='config-log'>
<name>config-log</name>
@@ -1143,7 +1275,7 @@
<param name='[last]' doc='Log source file info at the end of a log line. If omitted, log source file info just before the log text.' />
</params>
</command>
<command id='logging level (main|db|auc|ss|lglobal|llapd|linp|lmux|lmi|lmib|lsms|lctrl|lgtp|lstats|lgsup|loap|lss7|lsccp|lsua|lm3ua|lmgcp|ljibuf|lrspro) (debug|info|notice|error|fatal)'>
<command id='logging level (main|db|auc|ss|mslookup|lu|dgsm|lglobal|llapd|linp|lmux|lmi|lmib|lsms|lctrl|lgtp|lstats|lgsup|loap|lss7|lsccp|lsua|lm3ua|lmgcp|ljibuf|lrspro) (debug|info|notice|error|fatal)'>
<params>
<param name='logging' doc='Configure logging' />
<param name='level' doc='Set the log level for a specified category' />
@@ -1151,6 +1283,9 @@
<param name='db' doc='Database Layer' />
<param name='auc' doc='Authentication Center' />
<param name='ss' doc='Supplementary Services' />
<param name='mslookup' doc='Mobile Subscriber Lookup' />
<param name='lu' doc='Location Updating' />
<param name='dgsm' doc='Distributed GSM: MS lookup and proxy' />
<param name='lglobal' doc='Library-internal global log family' />
<param name='llapd' doc='LAPD in libosmogsm' />
<param name='linp' doc='A-bis Intput Subsystem' />
@@ -1278,6 +1413,12 @@
<param name='disable' doc='Disable the reporter' />
</params>
</command>
<command id='flush-period &lt;0-65535&gt;'>
<params>
<param name='flush-period' doc='Configure stats sub-system' />
<param name='&lt;0-65535&gt;' doc='Send all stats even if they have not changed (i.e. force the flush)every N-th reporting interval. Set to 0 to disable regular flush (default).' />
</params>
</command>
</node>
<node id='config-line'>
<name>config-line</name>
@@ -1309,6 +1450,27 @@
</params>
</command>
</node>
<node id='config-cpu-sched'>
<name>config-cpu-sched</name>
<command id='policy rr &lt;1-32&gt;'>
<params>
<param name='policy' doc='Set the scheduling policy to use for the process' />
<param name='rr' doc='Use the SCHED_RR real-time scheduling algorithm' />
<param name='&lt;1-32&gt;' doc='Set the SCHED_RR real-time priority' />
</params>
</command>
<command id='cpu-affinity (self|all|&lt;0-4294967295&gt;|THREADNAME) CPUHEXMASK [delay]'>
<params>
<param name='cpu-affinity' doc='Set CPU affinity mask on a (group of) thread(s)' />
<param name='self' doc='Set CPU affinity mask on thread running the VTY' />
<param name='all' doc='Set CPU affinity mask on all process&apos; threads' />
<param name='&lt;0-4294967295&gt;' doc='Set CPU affinity mask on a thread with specified PID' />
<param name='THREADNAME' doc='Set CPU affinity mask on a thread with specified thread name' />
<param name='CPUHEXMASK' doc='CPU affinity mask' />
<param name='[delay]' doc='If set, delay applying the affinity mask now and let the app handle it at a later point' />
</params>
</command>
</node>
<node id='config-hlr'>
<name>config-hlr</name>
<command id='gsup'>
@@ -1424,8 +1586,192 @@
<param name='A.B.C.D' doc='IPv4 Address to bind the GSUP interface to' />
</params>
</command>
<command id='ipa-name NAME'>
<params>
<param name='ipa-name' doc='Set the IPA name of this HLR, for proxying to remote HLRs' />
<param name='NAME' doc='A globally unique name for this HLR. For example: PLMN + redundancy server number: HLR-901-70-0. This name is used for GSUP routing and must be set if multiple HLRs interconnect (e.g. mslookup for Distributed GSM).' />
</params>
</command>
</node>
<node id='config-hlr-euse'>
<name>config-hlr-euse</name>
</node>
<node id='config-mslookup'>
<name>config-mslookup</name>
<command id='mdns bind [IP] [&lt;1-65535&gt;]'>
<params>
<param name='mdns' doc='Multicast DNS related configuration' />
<param name='bind' doc='Convenience shortcut: enable and configure both server and client for mDNS mslookup' />
<param name='[IP]' doc='multicast IPv4 address like 239.192.23.42 or IPv6 address like ff08::23:42' />
<param name='[&lt;1-65535&gt;]' doc='mDNS UDP Port number' />
</params>
</command>
<command id='mdns domain-suffix DOMAIN_SUFFIX'>
<params>
<param name='mdns' doc='Multicast DNS related configuration' />
<param name='domain-suffix' doc='mDNS domain suffix (default: mdns.osmocom.org). This is appended and stripped from mDNS packets during encoding/decoding, so we don&apos;t collide with top-level domains administrated by IANA' />
<param name='DOMAIN_SUFFIX' doc='mDNS domain suffix (default: mdns.osmocom.org). This is appended and stripped from mDNS packets during encoding/decoding, so we don&apos;t collide with top-level domains administrated by IANA' />
</params>
</command>
<command id='no mdns bind'>
<params>
<param name='no' doc='Negate a command or set its defaults' />
<param name='mdns' doc='Disable both server and client for mDNS mslookup' />
<param name='bind' doc='(null)' />
</params>
</command>
<command id='server'>
<params>
<param name='server' doc='Enable and configure Distributed GSM mslookup server' />
</params>
</command>
<command id='no server'>
<params>
<param name='no' doc='Negate a command or set its defaults' />
<param name='server' doc='Disable Distributed GSM mslookup server' />
</params>
</command>
<command id='client'>
<params>
<param name='client' doc='Enable and configure Distributed GSM mslookup client' />
</params>
</command>
<command id='no client'>
<params>
<param name='no' doc='Negate a command or set its defaults' />
<param name='client' doc='Disable Distributed GSM mslookup client' />
</params>
</command>
</node>
<node id='config-mslookup-server'>
<name>config-mslookup-server</name>
<command id='mdns bind [IP] [&lt;1-65535&gt;]'>
<params>
<param name='mdns' doc='Multicast DNS related configuration' />
<param name='bind' doc='Configure where the mDNS server listens for mslookup requests' />
<param name='[IP]' doc='multicast IPv4 address like 239.192.23.42 or IPv6 address like ff08::23:42' />
<param name='[&lt;1-65535&gt;]' doc='mDNS UDP Port number' />
</params>
</command>
<command id='mdns domain-suffix DOMAIN_SUFFIX'>
<params>
<param name='mdns' doc='Multicast DNS related configuration' />
<param name='domain-suffix' doc='mDNS domain suffix (default: mdns.osmocom.org). This is appended and stripped from mDNS packets during encoding/decoding, so we don&apos;t collide with top-level domains administrated by IANA' />
<param name='DOMAIN_SUFFIX' doc='mDNS domain suffix (default: mdns.osmocom.org). This is appended and stripped from mDNS packets during encoding/decoding, so we don&apos;t collide with top-level domains administrated by IANA' />
</params>
</command>
<command id='no mdns bind'>
<params>
<param name='no' doc='Negate a command or set its defaults' />
<param name='mdns' doc='Disable server for mDNS mslookup (do not answer remote requests)' />
<param name='bind' doc='(null)' />
</params>
</command>
<command id='service NAME at IP &lt;1-65535&gt;'>
<params>
<param name='service' doc='Configure addresses of local services, as sent in replies to remote mslookup requests.' />
<param name='NAME' doc='mslookup service name, e.g. sip.voice or smpp.sms' />
<param name='at' doc='at' />
<param name='IP' doc='IPv4 address like 1.2.3.4 or IPv6 address like a:b:c:d::1' />
<param name='&lt;1-65535&gt;' doc='Service-specific port number' />
</params>
</command>
<command id='no service NAME'>
<params>
<param name='no' doc='Negate a command or set its defaults' />
<param name='service' doc='Remove one or more service address entries' />
<param name='NAME' doc='mslookup service name, e.g. sip.voice or smpp.sms' />
</params>
</command>
<command id='no service NAME at IP &lt;1-65535&gt;'>
<params>
<param name='no' doc='Negate a command or set its defaults' />
<param name='service' doc='Remove one or more service address entries' />
<param name='NAME' doc='mslookup service name, e.g. sip.voice or smpp.sms' />
<param name='at' doc='at' />
<param name='IP' doc='IPv4 address like 1.2.3.4 or IPv6 address like a:b:c:d::1' />
<param name='&lt;1-65535&gt;' doc='Service-specific port number' />
</params>
</command>
<command id='msc ipa-name .IPA_NAME'>
<params>
<param name='msc' doc='Configure services for individual local MSCs' />
<param name='ipa-name' doc='Identify locally connected MSC by IPA Unit Name' />
<param name='.IPA_NAME' doc='IPA Unit Name of the local MSC to configure' />
</params>
</command>
</node>
<node id='config-mslookup-server-msc'>
<name>config-mslookup-server-msc</name>
<command id='service NAME at IP &lt;1-65535&gt;'>
<params>
<param name='service' doc='Configure addresses of local services, as sent in replies to remote mslookup requests.' />
<param name='NAME' doc='mslookup service name, e.g. sip.voice or smpp.sms' />
<param name='at' doc='at' />
<param name='IP' doc='IPv4 address like 1.2.3.4 or IPv6 address like a:b:c:d::1' />
<param name='&lt;1-65535&gt;' doc='Service-specific port number' />
</params>
</command>
<command id='no service NAME'>
<params>
<param name='no' doc='Negate a command or set its defaults' />
<param name='service' doc='Remove one or more service address entries' />
<param name='NAME' doc='mslookup service name, e.g. sip.voice or smpp.sms' />
</params>
</command>
<command id='no service NAME at IP &lt;1-65535&gt;'>
<params>
<param name='no' doc='Negate a command or set its defaults' />
<param name='service' doc='Remove one or more service address entries' />
<param name='NAME' doc='mslookup service name, e.g. sip.voice or smpp.sms' />
<param name='at' doc='at' />
<param name='IP' doc='IPv4 address like 1.2.3.4 or IPv6 address like a:b:c:d::1' />
<param name='&lt;1-65535&gt;' doc='Service-specific port number' />
</params>
</command>
</node>
<node id='config-mslookup-client'>
<name>config-mslookup-client</name>
<command id='timeout &lt;1-100000&gt;'>
<params>
<param name='timeout' doc='How long should the mslookup client wait for remote responses before evaluating received results' />
<param name='&lt;1-100000&gt;' doc='timeout in milliseconds' />
</params>
</command>
<command id='mdns bind [IP] [&lt;1-65535&gt;]'>
<params>
<param name='mdns' doc='Multicast DNS related configuration' />
<param name='bind' doc='Enable mDNS client, and configure multicast address to send mDNS mslookup requests to' />
<param name='[IP]' doc='multicast IPv4 address like 239.192.23.42 or IPv6 address like ff08::23:42' />
<param name='[&lt;1-65535&gt;]' doc='mDNS UDP Port number' />
</params>
</command>
<command id='mdns domain-suffix DOMAIN_SUFFIX'>
<params>
<param name='mdns' doc='Multicast DNS related configuration' />
<param name='domain-suffix' doc='mDNS domain suffix (default: mdns.osmocom.org). This is appended and stripped from mDNS packets during encoding/decoding, so we don&apos;t collide with top-level domains administrated by IANA' />
<param name='DOMAIN_SUFFIX' doc='mDNS domain suffix (default: mdns.osmocom.org). This is appended and stripped from mDNS packets during encoding/decoding, so we don&apos;t collide with top-level domains administrated by IANA' />
</params>
</command>
<command id='no mdns bind'>
<params>
<param name='no' doc='Negate a command or set its defaults' />
<param name='mdns' doc='Disable mDNS client, do not query remote services by mDNS' />
<param name='bind' doc='(null)' />
</params>
</command>
<command id='gateway-proxy IP [&lt;1-65535&gt;]'>
<params>
<param name='gateway-proxy' doc='Configure a fixed IP address to send all GSUP requests for unknown IMSIs to, without invoking a lookup for IMSI' />
<param name='IP' doc='IP address of the remote HLR' />
<param name='[&lt;1-65535&gt;]' doc='GSUP port number (omit for default 4222)' />
</params>
</command>
<command id='no gateway-proxy'>
<params>
<param name='no' doc='Negate a command or set its defaults' />
<param name='gateway-proxy' doc='Disable gateway proxy for GSUP with unknown IMSIs' />
</params>
</command>
</node>
</vtydoc>

View File

@@ -461,7 +461,7 @@ int osmo_gsup_configure_wildcard_apn(struct osmo_gsup_message *gsup,
/**
* Populate a gsup message structure with an Insert Subscriber Data Message.
* All required memory buffers for data pointed to by pointers in struct omso_gsup_message
* All required memory buffers for data pointed to by pointers in struct osmo_gsup_message
* must be allocated by the caller and should have the same lifetime as the gsup parameter.
*
* \param[out] gsup The gsup message to populate.

View File

@@ -31,6 +31,7 @@
#include <osmocom/vty/command.h>
#include <osmocom/vty/telnet_interface.h>
#include <osmocom/vty/ports.h>
#include <osmocom/vty/cpu_sched_vty.h>
#include <osmocom/ctrl/control_vty.h>
#include <osmocom/gsm/apn.h>
#include <osmocom/gsm/gsm48_ie.h>
@@ -732,6 +733,7 @@ int main(int argc, char **argv)
handle_options(argc, argv);
hlr_vty_init();
dgsm_vty_init();
osmo_cpu_sched_vty_init(hlr_ctx);
rc = vty_read_config_file(cmdline_opts.config_file, NULL);
if (rc < 0) {

View File

@@ -25,6 +25,7 @@
#include <getopt.h>
#include <inttypes.h>
#include <string.h>
#include <errno.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/application.h>
@@ -70,8 +71,9 @@ static void print_help()
printf(" (All commands imply this if none exists yet.)\n");
printf("\n");
printf(" import-nitb-db <nitb.db> Add OsmoNITB db's subscribers to OsmoHLR db.\n");
printf(" Be aware that the import is lossy, only the\n");
printf(" IMSI, MSISDN, nam_cs/ps and 2G auth data are set.\n");
printf(" Be aware that the import is somewhat lossy, only the IMSI,\n");
printf(" MSISDN, IMEI, nam_cs/ps, 2G auth data and last seen LU are set.\n");
printf(" The most recently associated IMEI from the Equipment table is used.\n");
}
static void print_version(int print_copyright)
@@ -212,9 +214,15 @@ enum nitb_stmt {
static const char *nitb_stmt_sql[] = {
[NITB_SELECT_SUBSCR] =
"SELECT imsi, id, extension, authorized"
" FROM Subscriber"
" ORDER BY id",
"SELECT s.imsi, s.id, s.extension, s.authorized,"
" SUBSTR(e.imei,0,15), STRFTIME('%s', s.expire_lu)"
" FROM Subscriber s INNER JOIN"
" (SELECT imei, subscriber_id, MAX(Equipment.updated) AS updated"
" FROM Equipment,EquipmentWatch"
" WHERE Equipment.id = EquipmentWatch.equipment_id"
" GROUP BY EquipmentWatch.subscriber_id) e"
" ON e.subscriber_id = s.id"
" ORDER by s.id",
[NITB_SELECT_AUTH_KEYS] =
"SELECT algorithm_id, a3a8_ki from authkeys"
" WHERE subscriber_id = $subscr_id",
@@ -222,8 +230,65 @@ static const char *nitb_stmt_sql[] = {
sqlite3_stmt *nitb_stmt[ARRAY_SIZE(nitb_stmt_sql)] = {};
enum hlr_db_stmt {
HLR_DB_STMT_SET_IMPLICIT_LU_BY_IMSI,
};
static const char *hlr_db_stmt_sql[] = {
[HLR_DB_STMT_SET_IMPLICIT_LU_BY_IMSI] =
"UPDATE subscriber SET last_lu_seen = datetime($last_lu, 'unixepoch') WHERE imsi = $imsi",
};
sqlite3_stmt *hlr_db_stmt[ARRAY_SIZE(hlr_db_stmt_sql)] = {};
size_t _dbd_decode_binary(const unsigned char *in, unsigned char *out);
/*! Set a subscriber's LU timestamp in the HLR database.
* In normal operations there is never any need to explicitly
* update the value of last_lu_seen, so this function can live here.
*
* \param[in,out] dbc database context.
* \param[in] imsi ASCII string of IMSI digits
* \param[in] imei ASCII string of identifier digits, or NULL to remove the IMEI.
* \returns 0 on success, -ENOENT when the given subscriber does not exist,
* -EIO on database errors.
*/
int db_subscr_update_lu_by_imsi(struct db_context *dbc, const char* imsi, const int last_lu)
{
int rc, ret = 0;
sqlite3_stmt *stmt = hlr_db_stmt[HLR_DB_STMT_SET_IMPLICIT_LU_BY_IMSI];
if (!db_bind_text(stmt, "$imsi", imsi))
return -EIO;
if (last_lu && !db_bind_int(stmt, "$last_lu", last_lu))
return -EIO;
/* execute the statement */
rc = sqlite3_step(stmt);
if (rc != SQLITE_DONE) {
LOGP(DAUC, LOGL_ERROR, "Update last_lu_seen for subscriber IMSI='%s': SQL Error: %s\n", imsi,
sqlite3_errmsg(dbc->db));
ret = -EIO;
goto out;
}
/* verify execution result */
rc = sqlite3_changes(dbc->db);
if (!rc) {
LOGP(DAUC, LOGL_ERROR, "Cannot update last_lu_seen for subscriber IMSI='%s': no such subscriber\n", imsi);
ret = -ENOENT;
} else if (rc != 1) {
LOGP(DAUC, LOGL_ERROR, "Update last_lu_seen for subscriber IMSI='%s': SQL modified %d rows (expected 1)\n",
imsi, rc);
ret = -EIO;
}
out:
db_remove_reset(stmt);
return ret;
}
void import_nitb_subscr_aud(sqlite3 *nitb_db, const char *imsi, int64_t nitb_id, int64_t hlr_id)
{
int rc;
@@ -297,6 +362,7 @@ void import_nitb_subscr(sqlite3 *nitb_db, sqlite3_stmt *stmt)
int64_t imsi;
char imsi_str[32];
bool authorized;
int last_lu_int;
imsi = sqlite3_column_int64(stmt, 0);
@@ -315,8 +381,16 @@ void import_nitb_subscr(sqlite3 *nitb_db, sqlite3_stmt *stmt)
nitb_id = sqlite3_column_int64(stmt, 1);
copy_sqlite3_text_to_buf(subscr.msisdn, stmt, 2);
authorized = sqlite3_column_int(stmt, 3) ? true : false;
copy_sqlite3_text_to_buf(subscr.imei, stmt, 4);
/* Default periodic LU was 30 mins and the expire_lu
* was twice that + 1 min
*/
last_lu_int = sqlite3_column_int(stmt, 5) - 3660;
db_subscr_update_msisdn_by_imsi(dbc, imsi_str, subscr.msisdn);
db_subscr_update_imei_by_imsi(dbc, imsi_str, subscr.imei);
db_subscr_update_lu_by_imsi(dbc, imsi_str, last_lu_int);
db_subscr_nam(dbc, imsi_str, authorized, true);
db_subscr_nam(dbc, imsi_str, authorized, false);
@@ -361,6 +435,17 @@ int import_nitb_db(void)
}
}
for (i = 0; i < ARRAY_SIZE(hlr_db_stmt_sql); i++) {
sql = hlr_db_stmt_sql[i];
rc = sqlite3_prepare_v2(g_hlr_db_tool_ctx->dbc->db, hlr_db_stmt_sql[i], -1,
&hlr_db_stmt[i], NULL);
if (rc != SQLITE_OK) {
LOGP(DDB, LOGL_ERROR, "OsmoHLR DB: Unable to prepare SQL statement '%s'\n", sql);
ret = -1;
goto out_free;
}
}
stmt = nitb_stmt[NITB_SELECT_SUBSCR];
while ((rc = sqlite3_step(stmt)) == SQLITE_ROW) {

View File

@@ -584,11 +584,11 @@ void respond_result(const char *query_str, const struct osmo_mslookup_result *r)
llist_for_each_entry_safe(c, n, &globals.socket_clients, entry) {
if (!strcmp(query_str, c->query_str)) {
socket_client_respond_result(c, g_buf);
if (r->last)
if (!r || r->last)
socket_client_close(c);
}
}
if (r->last)
if (!r || r->last)
globals.requests_handled++;
}

View File

@@ -16,6 +16,7 @@ OsmoHLR> list
subscriber (imsi|msisdn|id|imei) IDENT show
show subscriber (imsi|msisdn|id|imei) IDENT
show mslookup services
...
OsmoHLR> enable
OsmoHLR# ?
@@ -25,12 +26,15 @@ OsmoHLR# ?
OsmoHLR# configure terminal
OsmoHLR(config)# ?
...
hlr Configure the HLR
mslookup Configure Distributed GSM mslookup
hlr Configure the HLR
mslookup Configure Distributed GSM mslookup
...
OsmoHLR(config)# list
...
hlr
mslookup
...
OsmoHLR(config)# hlr
OsmoHLR(config-hlr)# ?
@@ -89,7 +93,7 @@ log stderr
logging level main notice
logging level db notice
logging level auc notice
logging level ss info
logging level ss notice
logging level mslookup notice
logging level lu notice
logging level dgsm notice

View File

@@ -14,6 +14,7 @@ OsmoHLR# list
subscriber (imsi|msisdn|id|imei) IDENT update imei (none|IMEI)
subscriber (imsi|msisdn|id|imei) IDENT update network-access-mode (none|cs|ps|cs+ps)
show mslookup services
...
OsmoHLR# subscriber?
subscriber Subscriber management commands