Compare commits

...

16 Commits

Author SHA1 Message Date
Oliver Smith
41ee4e8534 Add post-upgrade script for automatic db upgrade
Closes: OS#5138
Change-Id: I34e943e5020285f63a2162010eb42675af1520bf
2021-06-01 09:13:57 +02:00
Keith
ca8e6efca6 vty: enable show subscribers filtered by IMEI
In 89fda3024a I added a
vty command to show a summary of filtered subscribers by imsi
or msisdn. In practice there is a also need to be able to
filter on IMEI.

The idea here is not to replace every operation that could be
done directly on the sql database in the vty, but this one
is useful.

Change-Id: Ic4a11d3ebcf8909c68e9f4617e94dc822491e008
2021-05-13 18:00:43 +00:00
Harald Welte
ed2e36316b add README.md file as customary for cgit, github, gitlab, etc.
Change-Id: Ide03584aae21d5972e96e7862feb86e1265c29b3
2021-03-21 22:46:07 +01:00
Keith
649c335602 Correct configuration written from vty
osmo-hlr would not read back written configuration due to
bad indentation in the mslookup->server->service section.

Also ipa-name was missing.

Change-Id: Ied4b9504f06a51c3895054a8b9d07a67eda3aeeb
2021-02-26 01:21:41 +01:00
Pau Espin Pedrol
6240465503 Bump version: 1.2.0.78-8c90-dirty → 1.3.0
Change-Id: Iffdee17c1f70f472fb9cfe722b77967c2634ea37
2021-02-23 18:13:54 +01:00
Harald Welte
8c9087dd16 manuals: generate vty reference xml at build time
Move 'doc' subdir further down to "make sure" the osmo-hlr binary is built
before the docs

Remove hlr_vty_reference from the source tree.

In manuals//Makefile.am use the new BUILT_REFERENCE_XML feature recently added
to osmo-gsm-manuals, and add a build target to generate the XML using the new
osmo-hlr --vty-ref-xml cmdline switch.

Change-Id: I02c9862ced48ce4271b328a0963d5f09086b295c
Depends: I613d692328050a036d05b49a436ab495fc2087ba
Related: OS#5041
2021-02-23 16:48:36 +00:00
Harald Welte
2bd1a45553 main: add --vty-ref-mode, use vty_dump_xml_ref_mode()
Change-Id: I939f75d6c03145dbe185d849b95b2dd99782f35c
Depends: Ie2022a7f9e167e5ceacf15350c037dd43768ff40
Related: OS#5041
2021-02-23 16:48:36 +00:00
Pau Espin Pedrol
d6993ea4b5 tests: Replace deprecated API log_set_print_filename
log_set_print_category_hex(0) is added in some places since the old API
used to set that internally to keep backward compatiblity.

Change-Id: I3cf46b7c24452254319d5c3eacceff418211bcf7
2021-02-19 13:31:13 +01:00
Pau Espin Pedrol
f551ccf9fb .gitignore: Ignore new autofoo tmp files
Change-Id: I155e9fd644263a8b47301f6b0986b9beb5a45d0f
2021-02-04 12:46:34 +01:00
Keith
b5a5676cff Fix Coverity Warnings
Explicitly check filter_type is not NULL even though the current code
never passed a NULL filter_type unless filter was also NULL.

Remove unreachable code.

Change-Id: Ib2bd9b2d6e9e559e61a895a25235669dae05fdf6
Related: coverity CID#216865
Related: coverity CID#216867
2021-01-30 07:35:26 +01:00
Keith
89fda3024a Add vty command to show summary of all or filtered subscribers
Adds the following commands:

show subscribers all - Display summary of all entries in HLR
show subscribers (imsi|msisdn|cs|ps) ... As above but filter on search field/string
show subscribers last seen - Display only subscribers with data in
Last LU update field, and sorts by Last LU.

Change-Id: I7f0573381a6d0d13841ac6d42d50f0e8389decf4
2021-01-29 21:26:08 +00:00
Oliver Smith
dd746949d0 configure.ac: set -std=gnu11
Change-Id: I5ea5365338248e29591a40ec1e19db95f8ae6877
2021-01-28 09:28:12 +00:00
Keith
cc90bfd0f4 Correct vty inline help for show subscriber
Change-Id: I035435859b60ce6d54da307c0d6397d4bd515439
2021-01-19 07:18:50 +00:00
Oliver Smith
f4d64cb98b contrib/jenkins: don't build osmo-gsm-manuals
Related: OS#4912
Change-Id: I22246f3ff105183a7a7a0279fd6c5cde9cd19952
2021-01-13 13:15:54 +01:00
Harald Welte
bd94b41fa8 auc_test.c: Add some comments on what the test cases actually do
Change-Id: Id2b9cf12823e05aeadc6f15df396f8a46ae1639d
2021-01-04 14:03:25 +01:00
Harald Welte
6e237d3a90 support the XOR algorithm for UMTS AKA
Test USIMs as specified by 3GPP use the XOR algorithm not only for 2G
but also for 3G.  libosmocore includes the XOR-3G support since v1.3.0,
but osmo-hlr somehow never made use of it.

Change-Id: I3a452af9c18cd90d00ab4766d6bd1679456bc1a2
Closes: OS#4924
2020-12-28 22:40:09 +01:00
34 changed files with 737 additions and 1821 deletions

1
.gitignore vendored
View File

@@ -26,6 +26,7 @@ m4
*.m4
missing
.deps
*~
*.pc
.libs

View File

@@ -1,9 +1,9 @@
AUTOMAKE_OPTIONS = foreign dist-bzip2
SUBDIRS = \
doc \
src \
include \
doc \
sql \
contrib \
tests \

66
README.md Normal file
View File

@@ -0,0 +1,66 @@
osmo-hlr - Osmocom HLR Implementation
=====================================
This repository contains a C-language implementation of a GSM Home
Location Register (HLR). It is part of the
[Osmocom](https://osmocom.org/) Open Source Mobile Communications
project.
Warning: While the HLR logical functionality is implemented, OsmoHLR
does not use the ETSI/3GPP TCAP/MAP protocol stack. Instead, a much
simpler custom protocol (GSUP) is used. This means, OsmoHLR is of
no use outside the context of an Osmocom core network. You can use
it with OsmoMSC, OsmoSGSN etc. - but not with third party components.
Homepage
--------
The official homepage of the project is
https://osmocom.org/projects/osmo-hlr/wiki
GIT Repository
--------------
You can clone from the official osmo-hlr.git repository using
git clone git://git.osmocom.org/osmo-hlr.git
git clone https://git.osmocom.org/osmo-hlr.git
There is a cgit interface at https://git.osmocom.org/osmo-hlr/
Documentation
-------------
User Manuals and VTY reference manuals are [optionally] built in PDF form
as part of the build process.
Pre-rendered PDF version of the current "master" can be found at
[User Manual](https://ftp.osmocom.org/docs/latest/osmohlr-usermanual.pdf)
as well as the VTY reference manuals
* [VTY Reference Manual for osmo-hlr](https://ftp.osmocom.org/docs/latest/osmohlr-vty-reference.pdf)
Mailing List
------------
Discussions related to osmo-hlr are happening on the
openbsc@lists.osmocom.org mailing list, please see
https://lists.osmocom.org/mailman/listinfo/openbsc for subscription
options and the list archive.
Please observe the [Osmocom Mailing List
Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules)
when posting.
Contributing
------------
Our coding standards are described at
https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards
We us a gerrit based patch submission/review process for managing
contributions. Please see
https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for
more details
The current patch queue for osmo-hlr can be seen at
https://gerrit.osmocom.org/#/q/project:osmo-hlr+status:open

View File

@@ -7,4 +7,3 @@
# 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

@@ -12,6 +12,8 @@ AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip 1.9])
AC_CONFIG_TESTDIR(tests)
CFLAGS="$CFLAGS -std=gnu11"
dnl kernel style compile messages
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
@@ -39,11 +41,11 @@ PKG_PROG_PKG_CONFIG([0.20])
PKG_CHECK_MODULES(TALLOC, [talloc >= 2.0.1])
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(LIBOSMOCORE, libosmocore >= 1.5.0)
PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.5.0)
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.5.0)
PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.5.0)
PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 1.1.0)
PKG_CHECK_MODULES(SQLITE3, sqlite3)

View File

@@ -2,3 +2,13 @@ SUBDIRS = \
systemd \
dgsm \
$(NULL)
EXTRA_DIST = osmo-hlr-post-upgrade.sh
install-data-hook:
install -Dm755 $(srcdir)/osmo-hlr-post-upgrade.sh \
-t $(DESTDIR)$(datadir)/osmocom/
uninstall-hook:
@$(PRE_UNINSTALL)
$(RM) $(DESTDIR)$(datadir)/osmocom/osmo-hlr-post-upgrade.sh

View File

@@ -35,7 +35,6 @@ osmo-build-dep.sh libosmo-abis
# Additional configure options and depends
CONFIG=""
if [ "$WITH_MANUALS" = "1" ]; then
osmo-build-dep.sh osmo-gsm-manuals
CONFIG="--enable-manuals"
fi

View File

@@ -0,0 +1,95 @@
#!/bin/sh -e
# SPDX-License-Identifier: AGPL-3.0-or-later
# Copyright 2021 sysmocom s.f.m.c GmbH <info@sysmocom.de>
#
# Packagers are supposed to call this script in post-upgrade, so it can safely
# upgrade the database scheme if required.
DB="/var/lib/osmocom/hlr.db"
IS_ACTIVE=0
msg() {
echo "osmo-hlr-post-upgrade: $@"
}
err() {
msg "ERROR: $@"
}
open_db() {
# Attempt to open the database with osmo-hlr-db-tool, it will fail if
# upgrading the schema is required
osmo-hlr-db-tool -s -l "$DB" create
}
check_upgrade_required() {
if ! [ -e "$DB" ]; then
msg "nothing to do (no existing database)"
exit 0
fi
if open_db 2>/dev/null; then
msg "nothing to do (database version is up to date)"
exit 0
fi
msg "database upgrade is required"
}
stop_service() {
if systemctl is-active -q osmo-hlr; then
IS_ACTIVE=1
msg "stopping osmo-hlr service"
systemctl stop osmo-hlr
# Verify that it stopped
for i in $(seq 1 100); do
if ! systemctl is-active -q osmo-hlr; then
return
fi
sleep 0.1
done
err "failed to stop osmo-hlr service"
exit 1
else
msg "osmo-hlr service is not running"
fi
}
create_backup() {
backup="$DB.$(date +%Y%m%d%H%M%S).bak"
msg "creating backup: $backup"
if [ -e "$backup" ]; then
err "backup already exists: $backup"
exit 1
fi
cp "$DB" "$backup"
}
upgrade() {
msg "performing database upgrade"
osmo-hlr-db-tool -s -U -l "$DB" create
if ! open_db 2>/dev/null; then
err "failed to open the database after upgrade"
err "osmo-hlr-db-tool output:"
open_db
# exit because of "set -e"
fi
msg "database upgrade successful"
}
start_service() {
if [ "$IS_ACTIVE" = "1" ]; then
msg "starting osmo-hlr service"
systemctl start osmo-hlr
fi
}
check_upgrade_required
stop_service
create_backup
upgrade
start_service

View File

@@ -29,11 +29,11 @@ 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(libosmoabis) >= 1.1.0
BuildRequires: pkgconfig(libosmocore) >= 1.5.0
BuildRequires: pkgconfig(libosmoctrl) >= 1.5.0
BuildRequires: pkgconfig(libosmogsm) >= 1.5.0
BuildRequires: pkgconfig(libosmovty) >= 1.5.0
BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(talloc) >= 2.0.1
# only needed for populate_hlr_db.pl
@@ -136,10 +136,13 @@ make %{?_smp_mflags} check || (find . -name testsuite.log -exec cat {} +)
%pre
%service_add_pre %{name}.service
%endif
%post
%if 0%{?suse_version}
%service_add_post %{name}.service
%endif
/usr/share/osmocom/osmo-hlr-post-upgrade.sh
%post -n libosmo-gsup-client0 -p /sbin/ldconfig
%postun -n libosmo-gsup-client0 -p /sbin/ldconfig
@@ -162,6 +165,8 @@ make %{?_smp_mflags} check || (find . -name testsuite.log -exec cat {} +)
%dir %{_sysconfdir}/osmocom
%config %{_sysconfdir}/osmocom/osmo-hlr.cfg
%{_unitdir}/osmo-hlr.service
%dir %{_datadir}/osmocom
%{_datadir}/osmocom/osmo-hlr-post-upgrade.sh
%files -n libosmo-gsup-client0
%{_libdir}/libosmo-gsup-client.so.0*

100
debian/changelog vendored
View File

@@ -1,3 +1,103 @@
osmo-hlr (1.3.0) unstable; urgency=medium
[ Alexander Couzens ]
* hlr: respect the num_auth_vectors requested
* hlr: remove unused internal USSD list
[ Oliver Smith ]
* add libosmo-mslookup abstract client
* add mDNS lookup method to libosmo-mslookup
* Makefile.am: fix pkgconfig_DATA
* add mDNS lookup method to libosmo-mslookup (#2)
* contrib/dgsm/ add example esme and dialplan
* mslookup_client.c: fix dereferencing null pointer
* mdns_msg.c: always call va_end
* mslookup_client_mdns.c: fix dereferencing null
* osmo-mslookup-client.c: fix dereferencing null
* osmo-mslookup-client: fix dereferencing null
* mdns_sock.c: fix resource leak of sock
* mdns_rfc.c: fix possible access of uninit. mem
* mslookup_client_mdns_test: disable by default
* mslookup_client_mdns_test: no automatic skip
* Cosmetic: mention OS#4491 in location cancel code
* hlr_vty_subscr: prettier output for last LU seen
* contrib: import RPM spec
* contrib: integrate RPM spec
* Makefile.am: EXTRA_DIST: debian, contrib/*.spec.in
* contrib/jenkins: don't build osmo-gsm-manuals
* configure.ac: set -std=gnu11
[ Neels Hofmeyr ]
* add osmo-mslookup-client program
* add osmo-mslookup-client program (#2)
* fix missing braces in LOGP_GSUP_FWD
* gsup_client.c: fix deprecation for client create func
* 1/2: refactor: add and use lu_fsm, osmo_gsup_req, osmo_ipa_name
* 2/2: wrap ipa_name in osmo_cni_peer_id with type enum and union
* gsup client: add up_down_cb(), add osmo_gsup_client_create3()
* db v5: prep for D-GSM: add vlr_via_proxy and sgsn_via_proxy
* enlarge the GSUP message headroom
* test_nodes.vty: remove cruft
* D-GSM 1/n: add mslookup server in osmo-hlr
* D-GSM 2/n: implement mDNS method of mslookup server
* D-GSM 3/n: implement roaming by mslookup in osmo-hlr
* gsup_server: send routing error back to the correct peer
* adoc: add D-GSM chapter to osmohlr-usermanual
* drop error log for when a subscriber does not exist
* vty: show subscriber: change format of 'last LU seen'
* vty: show subscriber: show lu d,h,m,s ago, not just seconds
* auc3g: officially wrap IND around IND_bitlen space
* make osmo_cni_peer_id_cmp() NULL safe
* osmo_gsup_req_new(): require from_peer != NULL
* gsup_server.c: properly handle negative rc from osmo_gsup_conn_ccm_get()
* osmo_mslookup_server_mdns_rx(): handle read() rc == 0
* hlr_subscr_nam(): fix condition to fix nam=false notifications
* esme_dgsm.py: add --always-fail option for debugging SMPP
* osmo-mslookup-client: fix segfault for respond_error() caller
* manual: describe subscriber import by SQL
[ Harald Welte ]
* Revert "add osmo-mslookup-client program"
* Revert "add mDNS lookup method to libosmo-mslookup"
* Use OSMO_FD_* instead of deprecated BSC_FD_*
* support the XOR algorithm for UMTS AKA
* auc_test.c: Add some comments on what the test cases actually do
* main: add --vty-ref-mode, use vty_dump_xml_ref_mode()
* manuals: generate vty reference xml at build time
[ Vadim Yanitskiy ]
* db: fix possible SQLite3 allocated memory leak in db_open()
* gsup_server: fix typo: s/omso_gsup_message/osmo_gsup_message/
* debian/control: change maintainer to the Osmocom team / mailing list
* cosmetic: fix spelling in logging message: existAnt -> existEnt
* doc/manuals: fix s/There/The/ in 'USSD Configuration'
* doc/manuals: re-organize description of internal USSD handlers
* USSD: fix handle_ussd(): do not free() unconditionally
* USSD: add special 'idle' handler to IUSE for testing
[ Eric ]
* configure.ac: fix libtool issue with clang and sanitizer
[ Philipp Maier ]
* doc: do not use loglevel info for log category ss
[ Pau Espin Pedrol ]
* configure.ac: Fix trailing whitespace
* doc: Update VTY reference xml file
* Support setting rt-prio and cpu-affinity mask through VTY
* Set TCP NODELAY sockopt to GSUP cli and srv connections
* contrib/jenkins: Enable parallel make in make distcheck
* .gitignore: Ignore new autofoo tmp files
* tests: Replace deprecated API log_set_print_filename
[ Keith ]
* osmo-hlr-db-tool: Make import from osmo-nitb less "lossy"
* Correct vty inline help for show subscriber
* Add vty command to show summary of all or filtered subscribers
* Fix Coverity Warnings
-- Pau Espin Pedrol <pespin@sysmocom.de> Tue, 23 Feb 2021 18:13:53 +0100
osmo-hlr (1.2.0) unstable; urgency=medium
[ Ruben Undheim ]

8
debian/control vendored
View File

@@ -8,12 +8,12 @@ Build-Depends: debhelper (>= 9),
dh-systemd (>= 1.5),
autotools-dev,
python3-minimal,
libosmocore-dev (>= 1.4.0),
libosmo-abis-dev,
libosmo-netif-dev,
libosmocore-dev (>= 1.5.0),
libosmo-abis-dev (>= 1.1.0),
libosmo-netif-dev (>= 1.1.0),
libsqlite3-dev,
sqlite3,
osmo-gsm-manuals-dev
osmo-gsm-manuals-dev (>= 1.1.0)
Standards-Version: 3.9.6
Vcs-Browser: http://cgit.osmocom.org/osmo-hlr
Vcs-Git: git://git.osmocom.org/osmo-hlr

View File

@@ -5,4 +5,5 @@
/usr/share/doc/osmo-hlr/sql/hlr.sql
/usr/share/doc/osmo-hlr/sql/hlr_data.sql
/usr/share/doc/osmo-hlr/examples/osmo-hlr.cfg
/usr/share/osmocom/osmo-hlr-post-upgrade.sh
/var/lib/osmocom

5
debian/postinst vendored Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/sh -e
# Debian's postinst script is called on both installation and upgrade. Call the
# post-upgrade script in both cases, it won't do anything if there is nothing
# to do.
/usr/share/osmocom/osmo-hlr-post-upgrade.sh

View File

@@ -14,6 +14,12 @@ if BUILD_MANUALS
include $(OSMO_GSM_MANUALS_DIR)/build/Makefile.asciidoc.inc
VTY_REFERENCE = osmohlr-vty-reference.xml
BUILT_REFERENCE_XML = $(builddir)/vty/hlr_vty_reference.xml
$(builddir)/vty/hlr_vty_reference.xml: $(top_builddir)/src/osmo-hlr
mkdir -p $(builddir)/vty
$(top_builddir)/src/osmo-hlr --vty-ref-xml > $@
include $(OSMO_GSM_MANUALS_DIR)/build/Makefile.vty-reference.inc
OSMO_REPOSITORY = osmo-hlr

File diff suppressed because it is too large Load Diff

View File

@@ -8,6 +8,13 @@
struct hlr;
enum stmt_idx {
DB_STMT_SEL_ALL,
DB_STMT_SEL_ALL_ORDER_LAST_SEEN,
DB_STMT_SEL_FILTER_MSISDN,
DB_STMT_SEL_FILTER_IMSI,
DB_STMT_SEL_FILTER_IMEI,
DB_STMT_SEL_FILTER_CS,
DB_STMT_SEL_FILTER_PS,
DB_STMT_SEL_BY_IMSI,
DB_STMT_SEL_BY_MSISDN,
DB_STMT_SEL_BY_ID,
@@ -148,6 +155,9 @@ int db_subscr_update_imei_by_imsi(struct db_context *dbc, const char* imsi, cons
int db_subscr_exists_by_imsi(struct db_context *dbc, const char *imsi);
int db_subscr_exists_by_msisdn(struct db_context *dbc, const char *msisdn);
int db_subscrs_get(struct db_context *dbc, const char *filter_type, const char *filter,
void (*get_cb)(struct hlr_subscriber *subscr, void *data), void *data,
int *count, const char **err);
int db_subscr_get_by_imsi(struct db_context *dbc, const char *imsi,
struct hlr_subscriber *subscr);
int db_subscr_get_by_msisdn(struct db_context *dbc, const char *msisdn,

View File

@@ -51,6 +51,14 @@
"sgsn_via_proxy"
static const char *stmt_sql[] = {
[DB_STMT_SEL_ALL] = "SELECT " SEL_COLUMNS " FROM subscriber;",
[DB_STMT_SEL_ALL_ORDER_LAST_SEEN] = "SELECT " SEL_COLUMNS " FROM subscriber "
"WHERE last_lu_seen IS NOT NULL ORDER BY last_lu_seen;",
[DB_STMT_SEL_FILTER_MSISDN] = "SELECT " SEL_COLUMNS " FROM subscriber WHERE msisdn LIKE $search ORDER BY msisdn",
[DB_STMT_SEL_FILTER_IMSI] = "SELECT " SEL_COLUMNS " FROM subscriber WHERE imsi LIKE $search ORDER BY imsi",
[DB_STMT_SEL_FILTER_IMEI] = "SELECT " SEL_COLUMNS " FROM subscriber WHERE imei LIKE $search ORDER BY imei",
[DB_STMT_SEL_FILTER_CS] = "SELECT " SEL_COLUMNS " FROM subscriber WHERE nam_cs = $search ORDER BY last_lu_seen",
[DB_STMT_SEL_FILTER_PS] = "SELECT " SEL_COLUMNS " FROM subscriber WHERE nam_ps = $search ORDER BY last_lu_seen",
[DB_STMT_SEL_BY_IMSI] = "SELECT " SEL_COLUMNS " FROM subscriber WHERE imsi = ?",
[DB_STMT_SEL_BY_MSISDN] = "SELECT " SEL_COLUMNS " FROM subscriber WHERE msisdn = ?",
[DB_STMT_SEL_BY_ID] = "SELECT " SEL_COLUMNS " FROM subscriber WHERE id = ?",

View File

@@ -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));
@@ -625,6 +625,94 @@ int db_subscr_get_by_msisdn(struct db_context *dbc, const char *msisdn,
return rc;
}
/*! Retrieve subscriber data from the HLR database.
* \param[in,out] dbc database context.
* \param[in] filter_type ASCII string of identifier type to search.
* \param[in] filter ASCII string to search.
* \param[in] get_cb pointer to call back function for data.
* \param[in,out] data pointer to pass to callback function.
* \param[in,out] count counter for number of matched subscribers.
* \param[in,our] err
* \returns 0 on success, -ENOENT if no subscriber was found, -EIO on
* database error.
*/
int db_subscrs_get(struct db_context *dbc, const char *filter_type, const char *filter,
void (*get_cb)(struct hlr_subscriber *subscr, void *data), void *data,
int *count, const char **err)
{
sqlite3_stmt *stmt;
char search[256];
int rc;
struct hlr_subscriber subscr;
bool show_ls = false;
if (!filter_type) {
stmt = dbc->stmt[DB_STMT_SEL_ALL];
} else if (strcmp(filter_type, "imei") == 0) {
stmt = dbc->stmt[DB_STMT_SEL_FILTER_IMEI];
} else if (strcmp(filter_type, "imsi") == 0) {
stmt = dbc->stmt[DB_STMT_SEL_FILTER_IMSI];
} else if (strcmp(filter_type, "msisdn") == 0) {
stmt = dbc->stmt[DB_STMT_SEL_FILTER_MSISDN];
} else if (strcmp(filter_type, "cs") == 0) {
stmt = dbc->stmt[DB_STMT_SEL_FILTER_CS];
} else if (strcmp(filter_type, "ps") == 0) {
stmt = dbc->stmt[DB_STMT_SEL_FILTER_PS];
} else if (strcmp(filter_type, "last_lu_seen") == 0) {
show_ls = true;
stmt = dbc->stmt[DB_STMT_SEL_ALL_ORDER_LAST_SEEN];
} else {
return -EIO;
}
if (filter_type && filter && strcmp(filter_type, "last_lu_seen") != 0) {
if (strcmp(filter, "on") == 0) {
sprintf(search, "%s", "1");
} else if (strcmp(filter, "off") == 0) {
sprintf(search, "%s", "0");
} else {
sprintf(search, "%%%s%%", filter);
}
if (!db_bind_text(stmt, "$search", search)) {
*err = sqlite3_errmsg(dbc->db);
return -EIO;
}
}
rc = sqlite3_step(stmt);
if (rc == SQLITE_DONE) {
db_remove_reset(stmt);
*err = "No matching subscriber(s)";
return -ENOENT;
}
while (rc == SQLITE_ROW) {
subscr = (struct hlr_subscriber){
.id = sqlite3_column_int64(stmt, 0),};
copy_sqlite3_text_to_buf(subscr.imsi, stmt, 1);
copy_sqlite3_text_to_buf(subscr.msisdn, stmt, 2);
copy_sqlite3_text_to_buf(subscr.imei, stmt, 3);
subscr.nam_cs = sqlite3_column_int(stmt, 9);
subscr.nam_ps = sqlite3_column_int(stmt, 10);
if (show_ls)
parse_last_lu_seen(&subscr.last_lu_seen, (const char *)sqlite3_column_text(stmt, 14),
subscr.imsi, "CS");
get_cb(&subscr, data);
rc = sqlite3_step(stmt);
(*count)++;
}
db_remove_reset(stmt);
if (rc != SQLITE_DONE) {
*err = sqlite3_errmsg(dbc->db);
LOGP(DAUC, LOGL_ERROR, "Cannot read subscribers from db:: %s\n", *err);
return rc;
}
*err = NULL;
return 0;
}
/*! Retrieve subscriber data from the HLR database.
* \param[in,out] dbc database context.
* \param[in] id ID of the subscriber in the HLR db.

View File

@@ -442,7 +442,7 @@ int config_write_mslookup(struct vty *vty)
msc = mslookup_server_msc_get(&mslookup_server_msc_wildcard, false);
if (msc)
config_write_msc_services(vty, " ", msc);
config_write_msc_services(vty, " ", msc);
llist_for_each_entry(msc, &g_hlr->mslookup.server.local_site_services, entry) {
if (!osmo_ipa_name_cmp(&mslookup_server_msc_wildcard, &msc->name))

View File

@@ -1,7 +1,7 @@
# This is _NOT_ the library release version, it's an API version.
# Please read chapter "Library interface versions" of the libtool documentation
# before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html
LIBVERSION=0:0:0
LIBVERSION=1:0:1
AM_CFLAGS = -Wall $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)/include \
$(TALLOC_CFLAGS) $(LIBOSMOCORE_CFLAGS) $(LIBOSMOABIS_CFLAGS)

View File

@@ -577,6 +577,10 @@ static void print_help()
printf(" -U --db-upgrade Allow HLR database schema upgrades.\n");
printf(" -C --db-check Quit after opening (and upgrading) the database.\n");
printf(" -V --version Print the version of OsmoHLR.\n");
printf("\nVTY reference generation:\n");
printf(" --vty-ref-mode MODE VTY reference generation mode (e.g. 'expert').\n");
printf(" --vty-ref-xml Generate the VTY reference XML output and exit.\n");
}
static struct {
@@ -592,10 +596,37 @@ static struct {
.db_upgrade = false,
};
static void handle_long_options(const char *prog_name, const int long_option)
{
static int vty_ref_mode = VTY_REF_GEN_MODE_DEFAULT;
switch (long_option) {
case 1:
vty_ref_mode = get_string_value(vty_ref_gen_mode_names, optarg);
if (vty_ref_mode < 0) {
fprintf(stderr, "%s: Unknown VTY reference generation "
"mode '%s'\n", prog_name, optarg);
exit(2);
}
break;
case 2:
fprintf(stderr, "Generating the VTY reference in mode '%s' (%s)\n",
get_value_string(vty_ref_gen_mode_names, vty_ref_mode),
get_value_string(vty_ref_gen_mode_desc, vty_ref_mode));
vty_dump_xml_ref_mode(stdout, (enum vty_ref_gen_mode) vty_ref_mode);
exit(0);
default:
fprintf(stderr, "%s: error parsing cmdline options\n", prog_name);
exit(2);
}
}
static void handle_options(int argc, char **argv)
{
while (1) {
int option_index = 0, c;
static int long_option = 0;
static struct option long_options[] = {
{"help", 0, 0, 'h'},
{"config-file", 1, 0, 'c'},
@@ -608,6 +639,8 @@ static void handle_options(int argc, char **argv)
{"db-upgrade", 0, 0, 'U' },
{"db-check", 0, 0, 'C' },
{"version", 0, 0, 'V' },
{"vty-ref-mode", 1, &long_option, 1},
{"vty-ref-xml", 0, &long_option, 2},
{0, 0, 0, 0}
};
@@ -617,6 +650,9 @@ static void handle_options(int argc, char **argv)
break;
switch (c) {
case 0:
handle_long_options(argv[0], long_option);
break;
case 'h':
print_usage();
print_help();
@@ -730,10 +766,10 @@ int main(int argc, char **argv)
osmo_stats_init(hlr_ctx);
vty_init(&vty_info);
ctrl_vty_init(hlr_ctx);
handle_options(argc, argv);
hlr_vty_init();
dgsm_vty_init();
osmo_cpu_sched_vty_init(hlr_ctx);
handle_options(argc, argv);
rc = vty_read_config_file(cmdline_opts.config_file, NULL);
if (rc < 0) {

View File

@@ -102,6 +102,8 @@ static int config_write_hlr_gsup(struct vty *vty)
vty_out(vty, " gsup%s", VTY_NEWLINE);
if (g_hlr->gsup_bind_addr)
vty_out(vty, " bind ip %s%s", g_hlr->gsup_bind_addr, VTY_NEWLINE);
if (g_hlr->gsup_unit_name.serno)
vty_out(vty, " ipa-name %s%s", g_hlr->gsup_unit_name.serno, VTY_NEWLINE);
return CMD_SUCCESS;
}

View File

@@ -44,13 +44,14 @@ static char *get_datestr(const time_t *t, char *buf, size_t bufsize)
return buf;
}
static void dump_last_lu_seen(struct vty *vty, const char *domain_label, time_t last_lu_seen)
static void dump_last_lu_seen(struct vty *vty, const char *domain_label, time_t last_lu_seen, bool only_age)
{
uint32_t age;
char datebuf[32];
if (!last_lu_seen)
return;
vty_out(vty, " last LU seen on %s: %s", domain_label, get_datestr(&last_lu_seen, datebuf, sizeof(datebuf)));
if (!only_age)
vty_out(vty, " last LU seen on %s: %s", domain_label, get_datestr(&last_lu_seen, datebuf, sizeof(datebuf)));
if (!timestamp_age(&last_lu_seen, &age))
vty_out(vty, " (invalid timestamp)%s", VTY_NEWLINE);
else {
@@ -64,7 +65,10 @@ static void dump_last_lu_seen(struct vty *vty, const char *domain_label, time_t
UNIT_AGO("h", 60*60);
UNIT_AGO("m", 60);
UNIT_AGO("s", 1);
vty_out(vty, " ago)%s", VTY_NEWLINE);
if (!only_age)
vty_out(vty, " ago)%s", VTY_NEWLINE);
else
vty_out(vty, " ago)");
#undef UNIT_AGO
}
}
@@ -108,8 +112,8 @@ static void subscr_dump_full_vty(struct vty *vty, struct hlr_subscriber *subscr)
vty_out(vty, " PS disabled%s", VTY_NEWLINE);
if (subscr->ms_purged_ps)
vty_out(vty, " PS purged%s", VTY_NEWLINE);
dump_last_lu_seen(vty, "CS", subscr->last_lu_seen);
dump_last_lu_seen(vty, "PS", subscr->last_lu_seen_ps);
dump_last_lu_seen(vty, "CS", subscr->last_lu_seen, false);
dump_last_lu_seen(vty, "PS", subscr->last_lu_seen_ps, false);
if (!*subscr->imsi)
return;
@@ -159,6 +163,28 @@ static void subscr_dump_full_vty(struct vty *vty, struct hlr_subscriber *subscr)
}
}
static void subscr_dump_summary_vty(struct hlr_subscriber *subscr, void *data)
{
struct vty *vty = data;
vty_out(vty, "%-5"PRIu64" %-12s %-16s", subscr->id,
*subscr->msisdn ? subscr->msisdn : "none",
*subscr->imsi ? subscr->imsi : "none");
if (*subscr->imei) {
char checksum = osmo_luhn(subscr->imei, 14);
if (checksum == -EINVAL)
vty_out(vty, " %-14s (INVALID LENGTH!)", subscr->imei);
else
vty_out(vty, " %-14s%c", subscr->imei, checksum);
} else {
vty_out(vty," ------------- ");
}
vty_out(vty, " %-2s%-2s ", subscr->nam_cs ? "CS" : "", subscr->nam_ps ? "PS" : "");
if (subscr->last_lu_seen)
dump_last_lu_seen(vty, "CS", subscr->last_lu_seen, true);
vty_out_newline(vty);
}
static int get_subscr_by_argv(struct vty *vty, const char *type, const char *id, struct hlr_subscriber *subscr)
{
char imei_buf[GSM23003_IMEI_NUM_DIGITS_NO_CHK+1];
@@ -186,10 +212,52 @@ static int get_subscr_by_argv(struct vty *vty, const char *type, const char *id,
return rc;
}
static void dump_summary_table_vty(struct vty *vty, bool header, bool show_ls)
{
const char *texts = "ID MSISDN IMSI IMEI NAM";
const char *lines = "----- ------------ ---------------- ---------------- -----";
const char *ls_text = " LAST SEEN";
const char *ls_line = " ------------";
if (header) {
if (!show_ls)
vty_out(vty, "%s%s%s%s", texts, VTY_NEWLINE, lines, VTY_NEWLINE);
else
vty_out(vty, "%s%s%s%s%s%s", texts, ls_text, VTY_NEWLINE, lines, ls_line, VTY_NEWLINE);
} else {
if (!show_ls)
vty_out(vty, "%s%s%s%s", lines, VTY_NEWLINE, texts, VTY_NEWLINE);
else
vty_out(vty, "%s%s%s%s%s%s", lines, ls_line, VTY_NEWLINE, texts, ls_text, VTY_NEWLINE);
}
}
static int get_subscrs(struct vty *vty, const char *filter_type, const char *filter)
{
int rc = -1;
int count = 0;
const char *err;
bool show_ls = (filter_type && strcmp(filter_type, "last_lu_seen") == 0);
dump_summary_table_vty(vty, true, show_ls);
rc = db_subscrs_get(g_hlr->dbc, filter_type, filter, subscr_dump_summary_vty, vty, &count, &err);
if (count > 40) {
dump_summary_table_vty(vty, false, show_ls);
}
if (count > 0)
vty_out(vty, " Subscribers Shown: %d%s", count, VTY_NEWLINE);
if (rc)
vty_out(vty, "%% %s%s", err, VTY_NEWLINE);
return rc;
}
#define SUBSCR_CMD "subscriber "
#define SUBSCR_CMD_HELP "Subscriber management commands\n"
#define SUBSCR_SHOW_HELP "Show subscriber information\n"
#define SUBSCRS_SHOW_HELP "Show all subscribers (with filter possibility)\n"
#define SUBSCR_ID "(imsi|msisdn|id|imei) IDENT"
#define SUBSCR_FILTER "(imei|imsi|msisdn) FILTER"
#define SUBSCR_ID_HELP \
"Identify subscriber by IMSI\n" \
"Identify subscriber by MSISDN (phone number)\n" \
@@ -207,7 +275,7 @@ static int get_subscr_by_argv(struct vty *vty, const char *type, const char *id,
DEFUN(subscriber_show,
subscriber_show_cmd,
SUBSCR "show",
SUBSCR_HELP "Show subscriber information\n")
SUBSCR_HELP SUBSCR_SHOW_HELP)
{
struct hlr_subscriber subscr;
const char *id_type = argv[0];
@@ -222,7 +290,50 @@ DEFUN(subscriber_show,
ALIAS(subscriber_show, show_subscriber_cmd,
"show " SUBSCR_CMD SUBSCR_ID,
SHOW_STR SUBSCR_CMD_HELP SUBSCR_ID_HELP);
SHOW_STR SUBSCR_SHOW_HELP SUBSCR_ID_HELP);
DEFUN(show_subscriber_all,
show_subscriber_all_cmd,
"show subscribers all",
SHOW_STR SUBSCRS_SHOW_HELP "Show summary of all subscribers\n")
{
if (get_subscrs(vty, NULL, NULL))
return CMD_WARNING;
return CMD_SUCCESS;
}
DEFUN(show_subscriber_filtered,
show_subscriber_filtered_cmd,
"show subscribers " SUBSCR_FILTER,
SHOW_STR SUBSCRS_SHOW_HELP
"Filter Subscribers by IMEI\n" "Filter Subscribers by IMSI\n" "Filter Subscribers by MSISDN\n"
"String to match in imei, imsi or msisdn\n")
{
const char *filter_type = argv[0];
const char *filter = argv[1];
if (get_subscrs(vty, filter_type, filter))
return CMD_WARNING;
return CMD_SUCCESS;
}
ALIAS(show_subscriber_filtered, show_subscriber_filtered_cmd2,
"show subscribers (cs|ps) (on|off)",
SHOW_STR SUBSCR_SHOW_HELP
"Filter Subscribers by CS Network Access Mode\n" "Filter Subscribers by PS Network Access Mode\n"
"Authorised\n" "Not Authorised\n");
DEFUN(show_subscriber_order_last_seen, show_subscriber_order_last_seen_cmd,
"show subscribers last-seen",
SHOW_STR SUBSCR_SHOW_HELP "Show Subscribers Ordered by Last Seen Time\n")
{
if (get_subscrs(vty, "last_lu_seen", NULL))
return CMD_WARNING;
return CMD_SUCCESS;
}
DEFUN(subscriber_create,
subscriber_create_cmd,
@@ -551,6 +662,55 @@ DEFUN(subscriber_aud3g,
return CMD_SUCCESS;
}
DEFUN(subscriber_aud3g_xor,
subscriber_aud3g_xor_cmd,
SUBSCR_UPDATE "aud3g xor k K"
" [ind-bitlen] [<0-28>]",
SUBSCR_UPDATE_HELP
"Set UMTS authentication data (3G, and 2G with UMTS AKA)\n"
"Use XOR algorithm\n"
"Set Encryption Key K\n" "K as 32 hexadecimal characters\n"
"Set IND bit length\n" "IND bit length value (default: 5)\n")
{
struct hlr_subscriber subscr;
int minlen = 0;
int maxlen = 0;
int rc;
const char *id_type = argv[0];
const char *id = argv[1];
const char *k = argv[2];
int ind_bitlen = argc > 4? atoi(argv[4]) : 5;
struct sub_auth_data_str aud3g = {
.type = OSMO_AUTH_TYPE_UMTS,
.u.umts = {
.k = k,
.opc_is_op = 0,
.opc = "00000000000000000000000000000000",
.ind_bitlen = ind_bitlen,
},
};
if (!auth_algo_parse("xor", &aud3g.algo, &minlen, &maxlen)) {
vty_out(vty, "%% Unknown auth algorithm: '%s'%s", "xor", VTY_NEWLINE);
return CMD_WARNING;
}
if (!is_hexkey_valid(vty, "K", aud3g.u.umts.k, minlen, maxlen))
return CMD_WARNING;
if (get_subscr_by_argv(vty, id_type, id, &subscr))
return CMD_WARNING;
rc = db_subscr_update_aud_by_id(g_hlr->dbc, subscr.id, &aud3g);
if (rc) {
vty_out(vty, "%% Error: cannot set 3G auth data for IMSI='%s'%s",
subscr.imsi, VTY_NEWLINE);
return CMD_WARNING;
}
return CMD_SUCCESS;
}
DEFUN(subscriber_imei,
subscriber_imei_cmd,
SUBSCR_UPDATE "imei (none|IMEI)",
@@ -628,6 +788,10 @@ DEFUN(subscriber_nam,
void hlr_vty_subscriber_init(void)
{
install_element_ve(&show_subscriber_all_cmd);
install_element_ve(&show_subscriber_filtered_cmd);
install_element_ve(&show_subscriber_filtered_cmd2);
install_element_ve(&show_subscriber_order_last_seen_cmd);
install_element_ve(&subscriber_show_cmd);
install_element_ve(&show_subscriber_cmd);
install_element(ENABLE_NODE, &subscriber_create_cmd);
@@ -637,6 +801,7 @@ void hlr_vty_subscriber_init(void)
install_element(ENABLE_NODE, &subscriber_aud2g_cmd);
install_element(ENABLE_NODE, &subscriber_no_aud3g_cmd);
install_element(ENABLE_NODE, &subscriber_aud3g_cmd);
install_element(ENABLE_NODE, &subscriber_aud3g_xor_cmd);
install_element(ENABLE_NODE, &subscriber_imei_cmd);
install_element(ENABLE_NODE, &subscriber_nam_cmd);
}

View File

@@ -113,6 +113,7 @@ int rand_get(uint8_t *rand, unsigned int len)
return len;
}
/* Subscriber with 2G-only (COMP128v1) authentication data */
static void test_gen_vectors_2g_only(void)
{
struct osmo_sub_auth_data aud2g;
@@ -174,6 +175,8 @@ static void test_gen_vectors_2g_only(void)
comment_end();
}
/* Subscriber with separate 2G (COMP128v1) and 3G (MILENAGE) authentication data,
* reflects the default configuration of sysmoUSIM-SJS1 */
static void test_gen_vectors_2g_plus_3g(void)
{
struct osmo_sub_auth_data aud2g;
@@ -284,6 +287,9 @@ void _test_gen_vectors_3g_only__expect_vecs(struct osmo_auth_vector vecs[3])
);
}
/* Subscriber with only 3G (MILENAGE) authentication data,
* reflects the default configuration of sysmoISIM-SJA2. Resulting
* tuples are suitable for both 2G and 3G authentication */
static void test_gen_vectors_3g_only(void)
{
struct osmo_sub_auth_data aud2g;
@@ -454,6 +460,55 @@ static void test_gen_vectors_3g_only(void)
comment_end();
}
/* Subscriber with only 3G (XOR) authentication data,
* reflects the default configuration of sysmoTSIM-SJAx as well
* as many "Test USIM" cards. Resulting tuples are suitable for both
* 2G and 3G authentication */
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();
}
/* Test a variety of invalid authentication data combinations */
void test_gen_vectors_bad_args()
{
struct osmo_auth_vector vec;
@@ -613,15 +668,20 @@ int main(int argc, char **argv)
void *tall_ctx = talloc_named_const(NULL, 1, "auc_test");
osmo_init_logging2(tall_ctx, &hlr_log_info);
log_set_print_filename(osmo_stderr_target, cmdline_opts.verbose);
log_set_print_filename2(osmo_stderr_target,
cmdline_opts.verbose ?
LOG_FILENAME_BASENAME :
LOG_FILENAME_NONE);
log_set_print_timestamp(osmo_stderr_target, 0);
log_set_use_color(osmo_stderr_target, 0);
log_set_print_category_hex(osmo_stderr_target, 0);
log_set_print_category(osmo_stderr_target, 1);
log_parse_category_mask(osmo_stderr_target, "DMAIN,1:DDB,1:DAUC,1");
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");

View File

@@ -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)

View File

@@ -106,9 +106,10 @@ int main()
void *tall_ctx = talloc_named_const(NULL, 1, "test");
msgb_talloc_ctx_init(tall_ctx, 0);
osmo_init_logging2(tall_ctx, &hlr_log_info);
log_set_print_filename(osmo_stderr_target, 0);
log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_NONE);
log_set_print_timestamp(osmo_stderr_target, 0);
log_set_use_color(osmo_stderr_target, 0);
log_set_print_category_hex(osmo_stderr_target, 0);
log_set_print_category(osmo_stderr_target, 1);
log_parse_category_mask(osmo_stderr_target, "DMAIN,1:DDB,1:DAUC,1");

View File

@@ -980,9 +980,13 @@ int main(int argc, char **argv)
handle_options(argc, argv);
osmo_init_logging2(ctx, &hlr_log_info);
log_set_print_filename(osmo_stderr_target, cmdline_opts.verbose);
log_set_print_filename2(osmo_stderr_target,
cmdline_opts.verbose ?
LOG_FILENAME_BASENAME :
LOG_FILENAME_NONE);
log_set_print_timestamp(osmo_stderr_target, 0);
log_set_use_color(osmo_stderr_target, 0);
log_set_print_category_hex(osmo_stderr_target, 0);
log_set_print_category(osmo_stderr_target, 1);
log_parse_category_mask(osmo_stderr_target, "DMAIN,1:DDB,1:DAUC,1");

View File

@@ -101,7 +101,7 @@ int main(int argc, char **argv)
{
ctx = talloc_named_const(NULL, 0, "gsup_test");
osmo_init_logging2(ctx, &info);
log_set_print_filename(osmo_stderr_target, 0);
log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_NONE);
log_set_print_timestamp(osmo_stderr_target, 0);
log_set_use_color(osmo_stderr_target, 0);
log_set_print_category(osmo_stderr_target, 1);

View File

@@ -583,7 +583,7 @@ int main()
void *ctx = talloc_named_const(NULL, 0, "main");
osmo_init_logging2(ctx, NULL);
log_set_print_filename(osmo_stderr_target, 0);
log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_NONE);
log_set_print_level(osmo_stderr_target, 1);
log_set_print_category(osmo_stderr_target, 1);
log_set_print_category_hex(osmo_stderr_target, 0);

View File

@@ -233,7 +233,7 @@ int main()
ctx = talloc_named_const(NULL, 0, "main");
osmo_init_logging2(ctx, NULL);
log_set_print_filename(osmo_stderr_target, 0);
log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_NONE);
log_set_print_level(osmo_stderr_target, 0);
log_set_print_category(osmo_stderr_target, 0);
log_set_print_category_hex(osmo_stderr_target, 0);

View File

@@ -174,7 +174,7 @@ int main()
ctx = talloc_named_const(NULL, 0, "main");
osmo_init_logging2(ctx, NULL);
log_set_print_filename(osmo_stderr_target, 0);
log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_NONE);
log_set_print_level(osmo_stderr_target, 0);
log_set_print_category(osmo_stderr_target, 0);
log_set_print_category_hex(osmo_stderr_target, 0);

View File

@@ -73,7 +73,7 @@ int main()
ctx = talloc_named_const(NULL, 0, "main");
osmo_init_logging2(ctx, NULL);
log_set_print_filename(osmo_stderr_target, 0);
log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_NONE);
log_set_print_level(osmo_stderr_target, 0);
log_set_print_category(osmo_stderr_target, 0);
log_set_print_category_hex(osmo_stderr_target, 0);

View File

@@ -13,6 +13,10 @@ OsmoHLR> ?
OsmoHLR> list
...
show gsup-connections
show subscribers all
show subscribers (imei|imsi|msisdn) FILTER
show subscribers (cs|ps) (on|off)
show subscribers last-seen
subscriber (imsi|msisdn|id|imei) IDENT show
show subscriber (imsi|msisdn|id|imei) IDENT
show mslookup services
@@ -103,6 +107,7 @@ hlr
database hlr_vty_test.db
gsup
bind ip 127.0.0.1
ipa-name unnamed-HLR
ussd route prefix *#100# internal own-msisdn
ussd route prefix *#101# internal own-imsi
end
@@ -341,9 +346,9 @@ OsmoHLR(config-mslookup-server-msc)# show running-config
mslookup
server
mdns bind 239.192.23.42 4266
service foo.bar at 123.45.67.89 1011
service baz.bar at 121.31.41.5 1617
service baz.bar at a:b:c::d 1819
service foo.bar at 123.45.67.89 1011
service baz.bar at 121.31.41.5 1617
service baz.bar at a:b:c::d 1819
msc MSC-1
msc msc-901-70-23
service foo.bar at 76.54.32.10 1234
@@ -397,8 +402,8 @@ OsmoHLR(config-mslookup-client)# show running-config
mslookup
server
mdns bind 239.192.23.42 4266
service foo.bar at 123.45.67.89 1011
service baz.bar at 121.31.41.5 1617
service foo.bar at 123.45.67.89 1011
service baz.bar at 121.31.41.5 1617
msc MSC-1
msc msc-901-70-23
service foo.bar at 76.54.32.10 1234
@@ -429,9 +434,9 @@ OsmoHLR(config-mslookup-server)# show running-config
mslookup
server
mdns bind 239.192.23.42 4266
service foo.bar at 123.45.67.89 1011
service baz.bar at 121.31.41.5 1617
service gsup.hlr at 23.42.17.11 4223
service foo.bar at 123.45.67.89 1011
service baz.bar at 121.31.41.5 1617
service gsup.hlr at 23.42.17.11 4223
msc MSC-1
msc msc-901-70-23
service foo.bar at 76.54.32.10 1234

View File

@@ -11,6 +11,7 @@ OsmoHLR# list
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 xor k K [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
@@ -268,6 +269,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