mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-hlr.git
synced 2025-11-02 13:13:29 +00:00
Compare commits
27 Commits
fairwaves/
...
laforge/xo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f5506ae766 | ||
|
|
dac855e5c8 | ||
|
|
6a6c7f87ca | ||
|
|
6cfef3ac26 | ||
|
|
66f0b5fbea | ||
|
|
c47d5c0d77 | ||
|
|
dfbc2cbbc2 | ||
|
|
89649ea997 | ||
|
|
23ac586522 | ||
|
|
de50b20116 | ||
|
|
ed18fa908c | ||
|
|
f464fff173 | ||
|
|
e893eeb1b3 | ||
|
|
b77d568196 | ||
|
|
80cb6c93b9 | ||
|
|
565cf83a42 | ||
|
|
fa20702e67 | ||
|
|
949a53cdf0 | ||
|
|
102e362943 | ||
|
|
2f7fb2e36b | ||
|
|
377fe5a645 | ||
|
|
c7ea21357a | ||
|
|
9b8e7b4e39 | ||
|
|
010ceb8206 | ||
|
|
1bd3ec49b1 | ||
|
|
dfe6f41c81 | ||
|
|
3e79a38440 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -67,3 +67,5 @@ doc/manuals/generated/
|
||||
doc/manuals/osmomsc-usermanual.xml
|
||||
doc/manuals/common
|
||||
doc/manuals/build
|
||||
|
||||
contrib/osmo-hlr.spec
|
||||
|
||||
@@ -11,6 +11,8 @@ SUBDIRS = \
|
||||
|
||||
EXTRA_DIST = \
|
||||
.version \
|
||||
contrib/osmo-hlr.spec.in \
|
||||
debian \
|
||||
$(NULL)
|
||||
|
||||
AM_DISTCHECK_CONFIGURE_FLAGS = \
|
||||
|
||||
10
TODO-RELEASE
Normal file
10
TODO-RELEASE
Normal 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
|
||||
11
configure.ac
11
configure.ac
@@ -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
|
||||
|
||||
@@ -100,6 +100,9 @@ def rx_deliver_sm(pdu):
|
||||
time.sleep(args.sleep)
|
||||
logging.info("Sleep done")
|
||||
|
||||
if args.always_fail is not None:
|
||||
return args.always_fail
|
||||
|
||||
result = query_mslookup("smpp.sms", msisdn)
|
||||
if 'v4' not in result or not result['v4']:
|
||||
logging.info('No IPv4 result from mslookup! This example only'
|
||||
@@ -147,12 +150,35 @@ def main():
|
||||
parser.add_argument('--sleep', default=0, type=float,
|
||||
help='sleep time in seconds before forwarding an SMS,'
|
||||
' to test multithreading (default: 0)')
|
||||
parser.add_argument('--always-fail', default=None, metavar='SMPP_ESME_ERRCODE',
|
||||
help='test delivery failure: always return an error code on Deliver-SM,'
|
||||
' pass an smpplib error code name like RDELIVERYFAILURE (see smpplib/consts.py),'
|
||||
' or an SMPP error code in hex digits')
|
||||
args = parser.parse_args()
|
||||
|
||||
logging.basicConfig(level=logging.INFO, format='[%(asctime)s]'
|
||||
' (%(threadName)s) %(message)s', datefmt="%H:%M:%S")
|
||||
|
||||
if args.always_fail:
|
||||
resolved = None
|
||||
name = 'SMPP_ESME_' + args.always_fail
|
||||
if hasattr(smpplib.consts, name):
|
||||
resolved = getattr(smpplib.consts, name)
|
||||
if resolved is None:
|
||||
try:
|
||||
resolved = int(args.always_fail, 16)
|
||||
except ValueError:
|
||||
resolved = None
|
||||
if resolved is None:
|
||||
print('Invalid argument for --always-fail: %r' % args.always_fail)
|
||||
exit(1)
|
||||
args.always_fail = resolved
|
||||
logging.info('--always-fail: returning error code %s to all Deliver-SM' % hex(args.always_fail))
|
||||
|
||||
smpp_bind()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
# vim: expandtab tabstop=4 shiftwidth=4
|
||||
|
||||
@@ -57,11 +57,11 @@ autoreconf --install --force
|
||||
$CONFIG
|
||||
$MAKE $PARALLEL_MAKE
|
||||
$MAKE check || cat-testlogs.sh
|
||||
DISTCHECK_CONFIGURE_FLAGS="$CONFIG" $MAKE distcheck || cat-testlogs.sh
|
||||
DISTCHECK_CONFIGURE_FLAGS="$CONFIG" $MAKE $PARALLEL_MAKE distcheck || cat-testlogs.sh
|
||||
|
||||
if [ "$WITH_MANUALS" = "1" ] && [ "$PUBLISH" = "1" ]; then
|
||||
make -C "$base/doc/manuals" publish
|
||||
fi
|
||||
|
||||
$MAKE maintainer-clean
|
||||
$MAKE $PARALLEL_MAKE maintainer-clean
|
||||
osmo-clean-workspace.sh
|
||||
|
||||
190
contrib/osmo-hlr.spec.in
Normal file
190
contrib/osmo-hlr.spec.in
Normal 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
4
debian/control
vendored
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -50,15 +50,29 @@ prefix route to the named EUSE. All USSD short codes starting with *123 will be
|
||||
routed to the named EUSE.
|
||||
|
||||
`ussd route prefix *#100# internal own-msisdn` installs a prefix route
|
||||
to the named internal USSD handler. There above command will restore
|
||||
to the named internal USSD handler. The above command will restore
|
||||
the old behavior, in which *#100# will return a text message containing
|
||||
the subscribers own phone number. There is one other handler called
|
||||
`own-imsi` which will return the IMSI instead of the MSISDN.
|
||||
the subscribers own phone number. More information on internal USSD
|
||||
handlers can be found in <<iuse_handlers>>.
|
||||
|
||||
`ussd default-route external foobar-00-00-00-00-00-00` installs a
|
||||
default route to the named EUSE. This means that all USSD codes for
|
||||
which no more specific route exists will be routed to the named EUSE.
|
||||
|
||||
[[iuse_handlers]]
|
||||
=== Built-in USSD handlers
|
||||
|
||||
OsmoHLR has an Internal USSD Entity (IUSE) that allows to handle some
|
||||
USSD requests internally. It features a set of simple handlers, which
|
||||
can be assigned to one or more USSD request prefixes:
|
||||
|
||||
* `own-msisdn` returns subscriber's MSISDN (if assigned);
|
||||
* `own-imsi` returns subscriber's IMSI;
|
||||
* `test-idle` keeps the session idle until the MS terminates it, or
|
||||
the guard timer expires (may be useful for testing).
|
||||
|
||||
Additional handlers can be added on request.
|
||||
|
||||
=== Example EUSE program
|
||||
|
||||
We have provided an example EUSE developed in C language using existing
|
||||
|
||||
@@ -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[]
|
||||
|
||||
|
||||
@@ -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. 'abc:mno:xyz'. Available log categories depend on the specific application, refer to the 'logging level' command. Optionally add individual log levels like 'abc,1:mno,3:xyz,5', 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 'logging level force-all <level>'' />
|
||||
</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. 'abc:mno:xyz'. Available log categories depend on the specific application, refer to the 'logging level' command. Optionally add individual log levels like 'abc,1:mno,3:xyz,5', 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 'logging level force-all <level>'' />
|
||||
</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 <1-65535>'>
|
||||
<command id='stats interval <0-65535>'>
|
||||
<params>
|
||||
<param name='stats' doc='Configure stats sub-system' />
|
||||
<param name='interval' doc='Set the reporting interval' />
|
||||
<param name='<1-65535>' doc='Interval in seconds' />
|
||||
<param name='<0-65535>' 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 <0-65535>'>
|
||||
<params>
|
||||
<param name='flush-period' doc='Configure stats sub-system' />
|
||||
<param name='<0-65535>' 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 <1-32>'>
|
||||
<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='<1-32>' doc='Set the SCHED_RR real-time priority' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='cpu-affinity (self|all|<0-4294967295>|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' threads' />
|
||||
<param name='<0-4294967295>' 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] [<1-65535>]'>
|
||||
<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='[<1-65535>]' 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'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'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] [<1-65535>]'>
|
||||
<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='[<1-65535>]' 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'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'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 <1-65535>'>
|
||||
<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='<1-65535>' 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 <1-65535>'>
|
||||
<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='<1-65535>' 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 <1-65535>'>
|
||||
<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='<1-65535>' 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 <1-65535>'>
|
||||
<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='<1-65535>' doc='Service-specific port number' />
|
||||
</params>
|
||||
</command>
|
||||
</node>
|
||||
<node id='config-mslookup-client'>
|
||||
<name>config-mslookup-client</name>
|
||||
<command id='timeout <1-100000>'>
|
||||
<params>
|
||||
<param name='timeout' doc='How long should the mslookup client wait for remote responses before evaluating received results' />
|
||||
<param name='<1-100000>' doc='timeout in milliseconds' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='mdns bind [IP] [<1-65535>]'>
|
||||
<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='[<1-65535>]' 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'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'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 [<1-65535>]'>
|
||||
<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='[<1-65535>]' 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>
|
||||
|
||||
@@ -264,11 +264,11 @@ int db_subscr_update_aud_by_id(struct db_context *dbc, int64_t subscr_id,
|
||||
switch (aud->algo) {
|
||||
case OSMO_AUTH_ALG_NONE:
|
||||
case OSMO_AUTH_ALG_MILENAGE:
|
||||
case OSMO_AUTH_ALG_XOR:
|
||||
break;
|
||||
case OSMO_AUTH_ALG_COMP128v1:
|
||||
case OSMO_AUTH_ALG_COMP128v2:
|
||||
case OSMO_AUTH_ALG_COMP128v3:
|
||||
case OSMO_AUTH_ALG_XOR:
|
||||
LOGP(DAUC, LOGL_ERROR, "Cannot update auth tokens:"
|
||||
" auth algo not suited for 3G: %s\n",
|
||||
osmo_auth_alg_name(aud->algo));
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <osmocom/core/msgb.h>
|
||||
#include <osmocom/core/logging.h>
|
||||
@@ -274,7 +276,7 @@ static int osmo_gsup_server_ccm_cb(struct ipa_server_conn *conn,
|
||||
{
|
||||
struct osmo_gsup_conn *clnt = (struct osmo_gsup_conn *)conn->data;
|
||||
uint8_t *addr = NULL;
|
||||
size_t addr_len;
|
||||
int addr_len;
|
||||
|
||||
LOGP(DLGSUP, LOGL_INFO, "CCM Callback\n");
|
||||
|
||||
@@ -352,6 +354,19 @@ void osmo_gsup_server_add_conn(struct llist_head *clients,
|
||||
llist_add(&conn->list, &prev_conn->list);
|
||||
}
|
||||
|
||||
static void update_fd_settings(int fd)
|
||||
{
|
||||
int ret;
|
||||
int val;
|
||||
|
||||
/*TODO: Set keepalive settings here. See OS#4312 */
|
||||
|
||||
val = 1;
|
||||
ret = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val));
|
||||
if (ret < 0)
|
||||
LOGP(DLGSUP, LOGL_ERROR, "Failed to set TCP_NODELAY: %s\n", strerror(errno));
|
||||
}
|
||||
|
||||
/* a client has connected to the server socket and we have accept()ed it */
|
||||
static int osmo_gsup_server_accept_cb(struct ipa_server_link *link, int fd)
|
||||
{
|
||||
@@ -376,6 +391,8 @@ static int osmo_gsup_server_accept_cb(struct ipa_server_link *link, int fd)
|
||||
LOGP(DLGSUP, LOGL_INFO, "New GSUP client %s:%d (IND=%u)\n",
|
||||
conn->conn->addr, conn->conn->port, conn->auc_3g_ind);
|
||||
|
||||
update_fd_settings(fd);
|
||||
|
||||
/* request the identity of the client */
|
||||
rc = ipa_ccm_send_id_req(fd);
|
||||
if (rc < 0)
|
||||
@@ -461,7 +478,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.
|
||||
|
||||
@@ -154,6 +154,12 @@ int osmo_cni_peer_id_set_str(struct osmo_cni_peer_id *cni_peer_id, enum osmo_cni
|
||||
|
||||
int osmo_cni_peer_id_cmp(const struct osmo_cni_peer_id *a, const struct osmo_cni_peer_id *b)
|
||||
{
|
||||
if (a == b)
|
||||
return 0;
|
||||
if (!a)
|
||||
return -1;
|
||||
if (!b)
|
||||
return 1;
|
||||
if (a->type != b->type)
|
||||
return OSMO_CMP(a->type, b->type);
|
||||
switch (a->type) {
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
static void start_test_procedure(struct osmo_gsup_client *gsupc);
|
||||
|
||||
@@ -129,6 +131,19 @@ static void gsup_client_oap_register(struct osmo_gsup_client *gsupc)
|
||||
client_send(gsupc, IPAC_PROTO_EXT_OAP, msg_tx);
|
||||
}
|
||||
|
||||
static void update_fd_settings(int fd)
|
||||
{
|
||||
int ret;
|
||||
int val;
|
||||
|
||||
/*TODO: Set keepalive settings here. See OS#4312 */
|
||||
|
||||
val = 1;
|
||||
ret = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val));
|
||||
if (ret < 0)
|
||||
LOGP(DLGSUP, LOGL_ERROR, "Failed to set TCP_NODELAY: %s\n", strerror(errno));
|
||||
}
|
||||
|
||||
static void gsup_client_updown_cb(struct ipa_client_conn *link, int up)
|
||||
{
|
||||
struct osmo_gsup_client *gsupc = link->data;
|
||||
@@ -139,6 +154,7 @@ static void gsup_client_updown_cb(struct ipa_client_conn *link, int up)
|
||||
gsupc->is_connected = up;
|
||||
|
||||
if (up) {
|
||||
update_fd_settings(link->ofd->fd);
|
||||
start_test_procedure(gsupc);
|
||||
|
||||
if (gsupc->oap_state.state == OSMO_OAP_INITIALIZED)
|
||||
|
||||
@@ -107,6 +107,12 @@ struct osmo_gsup_req *osmo_gsup_req_new(void *ctx, const struct osmo_cni_peer_id
|
||||
struct osmo_gsup_req *req;
|
||||
int rc;
|
||||
|
||||
if (!from_peer) {
|
||||
LOGP(DLGSUP, LOGL_ERROR, "Rx GSUP from NULL peer is not allowed\n");
|
||||
msgb_free(msg);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!msgb_l2(msg) || !msgb_l2len(msg)) {
|
||||
LOGP(DLGSUP, LOGL_ERROR, "Rx GSUP from %s: missing or empty L2 data\n",
|
||||
osmo_cni_peer_id_to_str(from_peer));
|
||||
@@ -121,8 +127,7 @@ struct osmo_gsup_req *osmo_gsup_req_new(void *ctx, const struct osmo_cni_peer_id
|
||||
req->msg = msg;
|
||||
req->send_response_cb = send_response_cb;
|
||||
req->cb_data = cb_data;
|
||||
if (from_peer)
|
||||
req->source_name = *from_peer;
|
||||
req->source_name = *from_peer;
|
||||
rc = osmo_gsup_decode(msgb_l2(req->msg), msgb_l2len(req->msg), (struct osmo_gsup_message*)&req->gsup);
|
||||
if (rc < 0) {
|
||||
LOGP(DLGSUP, LOGL_ERROR, "Rx GSUP from %s: cannot decode (rc=%d)\n", osmo_cni_peer_id_to_str(from_peer), rc);
|
||||
|
||||
@@ -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>
|
||||
@@ -268,9 +269,9 @@ int hlr_subscr_nam(struct hlr *hlr, struct hlr_subscriber *subscr, bool nam_val,
|
||||
if (nam_val)
|
||||
return 0;
|
||||
|
||||
if (subscr->vlr_number && osmo_ipa_name_set_str(&vlr_name, subscr->vlr_number))
|
||||
if (subscr->vlr_number[0] && !osmo_ipa_name_set_str(&vlr_name, subscr->vlr_number))
|
||||
osmo_gsup_enc_send_to_ipa_name(g_hlr->gs, &vlr_name, &gsup_del_data);
|
||||
if (subscr->sgsn_number && osmo_ipa_name_set_str(&vlr_name, subscr->sgsn_number))
|
||||
if (subscr->sgsn_number[0] && !osmo_ipa_name_set_str(&vlr_name, subscr->sgsn_number))
|
||||
osmo_gsup_enc_send_to_ipa_name(g_hlr->gs, &vlr_name, &gsup_del_data);
|
||||
return 0;
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 LEFT 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,18 @@ 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);
|
||||
/* In case the subscriber was somehow never seen, invent an IMEI */
|
||||
if (strlen(subscr.imei) == 14)
|
||||
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 +437,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) {
|
||||
@@ -387,6 +474,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
int rc;
|
||||
int (*main_action)(void);
|
||||
int i;
|
||||
main_action = NULL;
|
||||
|
||||
g_hlr_db_tool_ctx = talloc_zero(NULL, struct hlr_db_tool_ctx);
|
||||
@@ -430,6 +518,11 @@ int main(int argc, char **argv)
|
||||
if (main_action)
|
||||
rc = (*main_action)();
|
||||
|
||||
/* db_close will only finalize statments in g_hlr_db_tool_ctx->dbc->stmt
|
||||
* it is ok to call finalize on NULL */
|
||||
for (i = 0; i < ARRAY_SIZE(hlr_db_stmt); i++) {
|
||||
sqlite3_finalize(hlr_db_stmt[i]);
|
||||
}
|
||||
db_close(g_hlr_db_tool_ctx->dbc);
|
||||
log_fini();
|
||||
exit(rc ? EXIT_FAILURE : EXIT_SUCCESS);
|
||||
|
||||
@@ -279,19 +279,20 @@ static int ss_gsup_send_to_ms(struct ss_session *ss, struct osmo_gsup_server *gs
|
||||
}
|
||||
|
||||
static int ss_tx_to_ms(struct ss_session *ss, enum osmo_gsup_message_type gsup_msg_type,
|
||||
bool final, struct msgb *ss_msg)
|
||||
struct msgb *ss_msg)
|
||||
|
||||
{
|
||||
struct osmo_gsup_message resp = {0};
|
||||
struct osmo_gsup_message resp;
|
||||
int rc;
|
||||
|
||||
resp.message_type = gsup_msg_type;
|
||||
resp = (struct osmo_gsup_message) {
|
||||
.message_type = gsup_msg_type,
|
||||
.session_id = ss->session_id,
|
||||
.session_state = ss->state,
|
||||
};
|
||||
|
||||
OSMO_STRLCPY_ARRAY(resp.imsi, ss->imsi);
|
||||
if (final)
|
||||
resp.session_state = OSMO_GSUP_SESSION_STATE_END;
|
||||
else
|
||||
resp.session_state = OSMO_GSUP_SESSION_STATE_CONTINUE;
|
||||
resp.session_id = ss->session_id;
|
||||
|
||||
if (ss_msg) {
|
||||
resp.ss_info = msgb_data(ss_msg);
|
||||
resp.ss_info_len = msgb_length(ss_msg);
|
||||
@@ -311,7 +312,8 @@ static int ss_tx_reject(struct ss_session *ss, int invoke_id, uint8_t problem_ta
|
||||
LOGPSS(ss, LOGL_NOTICE, "Tx Reject(%u, 0x%02x, 0x%02x)\n", invoke_id,
|
||||
problem_tag, problem_code);
|
||||
OSMO_ASSERT(msg);
|
||||
return ss_tx_to_ms(ss, OSMO_GSUP_MSGT_PROC_SS_RESULT, true, msg);
|
||||
ss->state = OSMO_GSUP_SESSION_STATE_END;
|
||||
return ss_tx_to_ms(ss, OSMO_GSUP_MSGT_PROC_SS_RESULT, msg);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -320,15 +322,16 @@ static int ss_tx_to_ms_error(struct ss_session *ss, uint8_t invoke_id, uint8_t e
|
||||
struct msgb *msg = gsm0480_gen_return_error(invoke_id, error_code);
|
||||
LOGPSS(ss, LOGL_NOTICE, "Tx ReturnError(%u, 0x%02x)\n", invoke_id, error_code);
|
||||
OSMO_ASSERT(msg);
|
||||
return ss_tx_to_ms(ss, OSMO_GSUP_MSGT_PROC_SS_RESULT, true, msg);
|
||||
ss->state = OSMO_GSUP_SESSION_STATE_END;
|
||||
return ss_tx_to_ms(ss, OSMO_GSUP_MSGT_PROC_SS_RESULT, msg);
|
||||
}
|
||||
|
||||
static int ss_tx_to_ms_ussd_7bit(struct ss_session *ss, bool final, uint8_t invoke_id, const char *text)
|
||||
static int ss_tx_to_ms_ussd_7bit(struct ss_session *ss, uint8_t invoke_id, const char *text)
|
||||
{
|
||||
struct msgb *msg = gsm0480_gen_ussd_resp_7bit(invoke_id, text);
|
||||
LOGPSS(ss, LOGL_INFO, "Tx USSD '%s'\n", text);
|
||||
OSMO_ASSERT(msg);
|
||||
return ss_tx_to_ms(ss, OSMO_GSUP_MSGT_PROC_SS_RESULT, final, msg);
|
||||
return ss_tx_to_ms(ss, OSMO_GSUP_MSGT_PROC_SS_RESULT, msg);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@@ -344,6 +347,8 @@ static int handle_ussd_own_msisdn(struct ss_session *ss,
|
||||
char buf[GSM0480_USSD_7BIT_STRING_LEN+1];
|
||||
int rc;
|
||||
|
||||
ss->state = OSMO_GSUP_SESSION_STATE_END;
|
||||
|
||||
rc = db_subscr_get_by_imsi(g_hlr->dbc, ss->imsi, &subscr);
|
||||
switch (rc) {
|
||||
case 0:
|
||||
@@ -351,7 +356,7 @@ static int handle_ussd_own_msisdn(struct ss_session *ss,
|
||||
snprintf(buf, sizeof(buf), "You have no MSISDN!");
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "Your extension is %s", subscr.msisdn);
|
||||
ss_tx_to_ms_ussd_7bit(ss, true, req->invoke_id, buf);
|
||||
ss_tx_to_ms_ussd_7bit(ss, req->invoke_id, buf);
|
||||
break;
|
||||
case -ENOENT:
|
||||
ss_tx_to_ms_error(ss, req->invoke_id, GSM0480_ERR_CODE_UNKNOWN_SUBSCRIBER);
|
||||
@@ -369,7 +374,21 @@ static int handle_ussd_own_imsi(struct ss_session *ss,
|
||||
{
|
||||
char buf[GSM0480_USSD_7BIT_STRING_LEN+1];
|
||||
snprintf(buf, sizeof(buf), "Your IMSI is %s", ss->imsi);
|
||||
ss_tx_to_ms_ussd_7bit(ss, true, req->invoke_id, buf);
|
||||
ss->state = OSMO_GSUP_SESSION_STATE_END;
|
||||
ss_tx_to_ms_ussd_7bit(ss, req->invoke_id, buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* This handler just keeps the session idle unless the guard timer expires. */
|
||||
static int handle_ussd_test_idle(struct ss_session *ss,
|
||||
const struct osmo_gsup_message *gsup,
|
||||
const struct ss_request *req)
|
||||
{
|
||||
char buf[GSM0480_USSD_7BIT_STRING_LEN + 1];
|
||||
snprintf(buf, sizeof(buf), "Keeping your session idle, it will expire "
|
||||
"at most in %u seconds.", g_hlr->ncss_guard_timeout);
|
||||
ss->state = OSMO_GSUP_SESSION_STATE_CONTINUE;
|
||||
ss_tx_to_ms_ussd_7bit(ss, req->invoke_id, buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -383,6 +402,10 @@ static const struct hlr_iuse hlr_iuses[] = {
|
||||
.name = "own-imsi",
|
||||
.handle_ussd = handle_ussd_own_imsi,
|
||||
},
|
||||
{
|
||||
.name = "test-idle",
|
||||
.handle_ussd = handle_ussd_test_idle,
|
||||
},
|
||||
};
|
||||
|
||||
const struct hlr_iuse *iuse_find(const char *name)
|
||||
@@ -496,8 +519,9 @@ static int handle_ussd(struct ss_session *ss, bool is_euse_originated, const str
|
||||
} else {
|
||||
/* Handle internally */
|
||||
ss->u.iuse->handle_ussd(ss, gsup, req);
|
||||
/* Release session immediately */
|
||||
ss_session_free(ss);
|
||||
/* Release session if the handler has changed its state to END */
|
||||
if (ss->state == OSMO_GSUP_SESSION_STATE_END)
|
||||
ss_session_free(ss);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -174,10 +174,11 @@ DEFUN(cfg_hlr_gsup_ipa_name,
|
||||
#define UROUTE_STR "Routing Configuration\n"
|
||||
#define PREFIX_STR "Prefix-Matching Route\n" "USSD Prefix\n"
|
||||
|
||||
#define INT_CHOICE "(own-msisdn|own-imsi)"
|
||||
#define INT_CHOICE "(own-msisdn|own-imsi|test-idle)"
|
||||
#define INT_STR "Internal USSD Handler\n" \
|
||||
"Respond with subscribers' own MSISDN\n" \
|
||||
"Respond with subscribers' own IMSI\n"
|
||||
"Respond with subscribers' own IMSI\n" \
|
||||
"Keep the session idle (useful for testing)\n"
|
||||
|
||||
#define EXT_STR "External USSD Handler\n" \
|
||||
"Name of External USSD Handler (IPA CCM ID)\n"
|
||||
@@ -305,7 +306,7 @@ DEFUN(cfg_no_euse, cfg_no_euse_cmd,
|
||||
{
|
||||
struct hlr_euse *euse = euse_find(g_hlr, argv[0]);
|
||||
if (!euse) {
|
||||
vty_out(vty, "%% Cannot remove non-existant EUSE %s%s", argv[0], VTY_NEWLINE);
|
||||
vty_out(vty, "%% Cannot remove non-existent EUSE %s%s", argv[0], VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
if (g_hlr->euse_default == euse) {
|
||||
|
||||
@@ -355,9 +355,10 @@ static bool is_hexkey_valid(struct vty *vty, const char *label,
|
||||
"Use COMP128v3 algorithm\n" \
|
||||
"Use XOR algorithm\n"
|
||||
|
||||
#define AUTH_ALG_TYPES_3G "milenage"
|
||||
#define AUTH_ALG_TYPES_3G "(milenage|xor)"
|
||||
#define AUTH_ALG_TYPES_3G_HELP \
|
||||
"Use Milenage algorithm\n"
|
||||
"Use Milenage algorithm\n" \
|
||||
"Use XOR algorithm\n"
|
||||
|
||||
#define A38_XOR_MIN_KEY_LEN 12
|
||||
#define A38_XOR_MAX_KEY_LEN 16
|
||||
@@ -511,11 +512,11 @@ DEFUN(subscriber_aud3g,
|
||||
int rc;
|
||||
const char *id_type = argv[0];
|
||||
const char *id = argv[1];
|
||||
const char *alg_type = AUTH_ALG_TYPES_3G;
|
||||
const char *k = argv[2];
|
||||
bool opc_is_op = (strcasecmp("op", argv[3]) == 0);
|
||||
const char *op_opc = argv[4];
|
||||
int ind_bitlen = argc > 6? atoi(argv[6]) : 5;
|
||||
const char *alg_type = argv[2];
|
||||
const char *k = argv[3];
|
||||
bool opc_is_op = (strcasecmp("op", argv[4]) == 0);
|
||||
const char *op_opc = argv[5];
|
||||
int ind_bitlen = argc > 7? atoi(argv[7]) : 5;
|
||||
struct sub_auth_data_str aud3g = {
|
||||
.type = OSMO_AUTH_TYPE_UMTS,
|
||||
.u.umts = {
|
||||
|
||||
@@ -487,7 +487,7 @@ static int socket_cb(struct osmo_fd *ofd, unsigned int flags)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if (flags & BSC_FD_READ)
|
||||
if (flags & OSMO_FD_READ)
|
||||
rc = socket_read_cb(ofd);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
@@ -512,7 +512,7 @@ int socket_accept(struct osmo_fd *ofd, unsigned int flags)
|
||||
c = talloc_zero(globals.ctx, struct socket_client);
|
||||
OSMO_ASSERT(c);
|
||||
c->ofd.fd = rc;
|
||||
c->ofd.when = BSC_FD_READ;
|
||||
c->ofd.when = OSMO_FD_READ;
|
||||
c->ofd.cb = socket_cb;
|
||||
c->ofd.data = c;
|
||||
|
||||
@@ -543,7 +543,7 @@ int socket_init(const char *sock_path)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ofd->when = BSC_FD_READ;
|
||||
ofd->when = OSMO_FD_READ;
|
||||
ofd->cb = socket_accept;
|
||||
|
||||
rc = osmo_fd_register(ofd);
|
||||
@@ -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++;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ static int osmo_mslookup_server_mdns_rx(struct osmo_fd *osmo_fd, unsigned int wh
|
||||
|
||||
/* Parse the message and print it */
|
||||
n = read(osmo_fd->fd, buffer, sizeof(buffer));
|
||||
if (n < 0)
|
||||
if (n <= 0)
|
||||
return n;
|
||||
|
||||
ctx = talloc_named_const(server, 0, __func__);
|
||||
|
||||
@@ -454,6 +454,50 @@ static void test_gen_vectors_3g_only(void)
|
||||
comment_end();
|
||||
}
|
||||
|
||||
static void test_gen_vectors_3g_xor(void)
|
||||
{
|
||||
struct osmo_sub_auth_data aud2g;
|
||||
struct osmo_sub_auth_data aud3g;
|
||||
struct osmo_auth_vector vec;
|
||||
int rc;
|
||||
|
||||
comment_start();
|
||||
|
||||
aud2g = (struct osmo_sub_auth_data){ 0 };
|
||||
|
||||
aud3g = (struct osmo_sub_auth_data){
|
||||
.type = OSMO_AUTH_TYPE_UMTS,
|
||||
.algo = OSMO_AUTH_ALG_XOR,
|
||||
.u.umts.sqn = 0,
|
||||
};
|
||||
|
||||
osmo_hexparse("000102030405060708090a0b0c0d0e0f",
|
||||
aud3g.u.umts.k, sizeof(aud3g.u.umts.k));
|
||||
osmo_hexparse("00000000000000000000000000000000",
|
||||
aud3g.u.umts.opc, sizeof(aud3g.u.umts.opc));
|
||||
next_rand("b5039c57e4a75051551d1a390a71ce48", true);
|
||||
|
||||
vec = (struct osmo_auth_vector){ {0} };
|
||||
VERBOSE_ASSERT(aud3g.u.umts.sqn, == 0, "%"PRIu64);
|
||||
rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL);
|
||||
VERBOSE_ASSERT(rc, == 1, "%d");
|
||||
VERBOSE_ASSERT(aud3g.u.umts.sqn, == 0, "%"PRIu64);
|
||||
|
||||
VEC_IS(&vec,
|
||||
" rand: b5039c57e4a75051551d1a390a71ce48\n"
|
||||
" autn: 54e0a256565d0000b5029e54e0a25656\n"
|
||||
" ck: 029e54e0a256565d141032067cc047b5\n"
|
||||
" ik: 9e54e0a256565d141032067cc047b502\n"
|
||||
" res: b5029e54e0a256565d141032067cc047\n"
|
||||
" res_len: 10\n"
|
||||
" kc: 98e880384887f9fe\n"
|
||||
" sres: 0ec81877\n"
|
||||
" auth_types: 03000000\n"
|
||||
);
|
||||
|
||||
comment_end();
|
||||
}
|
||||
|
||||
void test_gen_vectors_bad_args()
|
||||
{
|
||||
struct osmo_auth_vector vec;
|
||||
@@ -622,6 +666,7 @@ int main(int argc, char **argv)
|
||||
test_gen_vectors_2g_only();
|
||||
test_gen_vectors_2g_plus_3g();
|
||||
test_gen_vectors_3g_only();
|
||||
test_gen_vectors_3g_xor();
|
||||
test_gen_vectors_bad_args();
|
||||
|
||||
printf("Done\n");
|
||||
|
||||
@@ -217,6 +217,29 @@ DAUC vector [2]: auth_types = 0x3
|
||||
===== test_gen_vectors_3g_only: SUCCESS
|
||||
|
||||
|
||||
===== test_gen_vectors_3g_xor
|
||||
aud3g.u.umts.sqn == 0
|
||||
DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys)
|
||||
DAUC 3G: k = 000102030405060708090a0b0c0d0e0f
|
||||
DAUC 3G: opc = 00000000000000000000000000000000
|
||||
DAUC 3G: for sqn ind 0, previous sqn was 0
|
||||
DAUC vector [0]: rand = b5039c57e4a75051551d1a390a71ce48
|
||||
DAUC vector [0]: sqn = 0
|
||||
DAUC vector [0]: autn = 54e0a256565d0000b5029e54e0a25656
|
||||
DAUC vector [0]: ck = 029e54e0a256565d141032067cc047b5
|
||||
DAUC vector [0]: ik = 9e54e0a256565d141032067cc047b502
|
||||
DAUC vector [0]: res = b5029e54e0a256565d141032067cc047
|
||||
DAUC vector [0]: res_len = 16
|
||||
DAUC vector [0]: deriving 2G from 3G
|
||||
DAUC vector [0]: kc = 98e880384887f9fe
|
||||
DAUC vector [0]: sres = 0ec81877
|
||||
DAUC vector [0]: auth_types = 0x3
|
||||
rc == 1
|
||||
aud3g.u.umts.sqn == 0
|
||||
vector matches expectations
|
||||
===== test_gen_vectors_3g_xor: SUCCESS
|
||||
|
||||
|
||||
===== test_gen_vectors_bad_args
|
||||
|
||||
- no auth data (a)
|
||||
|
||||
@@ -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)# ?
|
||||
@@ -47,7 +51,7 @@ OsmoHLR(config-hlr)# list
|
||||
database PATH
|
||||
euse NAME
|
||||
no euse NAME
|
||||
ussd route prefix PREFIX internal (own-msisdn|own-imsi)
|
||||
ussd route prefix PREFIX internal (own-msisdn|own-imsi|test-idle)
|
||||
ussd route prefix PREFIX external EUSE
|
||||
no ussd route prefix PREFIX
|
||||
ussd default-route external EUSE
|
||||
@@ -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
|
||||
|
||||
@@ -10,10 +10,11 @@ OsmoHLR# list
|
||||
subscriber (imsi|msisdn|id|imei) IDENT update aud2g none
|
||||
subscriber (imsi|msisdn|id|imei) IDENT update aud2g (comp128v1|comp128v2|comp128v3|xor) ki KI
|
||||
subscriber (imsi|msisdn|id|imei) IDENT update aud3g none
|
||||
subscriber (imsi|msisdn|id|imei) IDENT update aud3g milenage k K (op|opc) OP_C [ind-bitlen] [<0-28>]
|
||||
subscriber (imsi|msisdn|id|imei) IDENT update aud3g (milenage|xor) k K (op|opc) OP_C [ind-bitlen] [<0-28>]
|
||||
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
|
||||
@@ -267,6 +268,7 @@ OsmoHLR# subscriber id 101 show
|
||||
OsmoHLR# subscriber imsi 123456789023000 update aud3g ?
|
||||
none Delete 3G authentication data
|
||||
milenage Use Milenage algorithm
|
||||
xor Use XOR algorithm
|
||||
|
||||
OsmoHLR# subscriber imsi 123456789023000 update aud3g milenage ?
|
||||
k Set Encryption Key K
|
||||
|
||||
Reference in New Issue
Block a user