We truncated the diff of some files because they were too big.
If you want to see the full diff for every file, click here.
Changes of Revision 7
osmo-hlr.spec
Changed
x
1
2
3
Name: osmo-hlr
4
Requires: osmocom-latest
5
-Version: 1.6.2
6
+Version: 1.7.0
7
Release: 0
8
Summary: Osmocom Home Location Register for GSUP protocol towards OsmoSGSN and OsmoCSCN
9
License: AGPL-3.0-or-later AND GPL-2.0-or-later
10
Group: Productivity/Telephony/Servers
11
URL: https://osmocom.org/projects/osmo-hlr
12
-Source: osmo-hlr_1.6.2.tar.xz
13
+Source: osmo-hlr_1.7.0.tar.xz
14
Source1: rpmlintrc
15
BuildRequires: autoconf
16
BuildRequires: automake
17
18
%if 0%{?suse_version}
19
BuildRequires: systemd-rpm-macros
20
%endif
21
-BuildRequires: pkgconfig(libosmoabis) >= 1.4.0
22
-BuildRequires: pkgconfig(libosmocore) >= 1.8.0
23
-BuildRequires: pkgconfig(libosmoctrl) >= 1.8.0
24
-BuildRequires: pkgconfig(libosmogsm) >= 1.8.0
25
-BuildRequires: pkgconfig(libosmovty) >= 1.8.0
26
+BuildRequires: pkgconfig(libosmoabis) >= 1.5.0
27
+BuildRequires: pkgconfig(libosmocore) >= 1.9.0
28
+BuildRequires: pkgconfig(libosmoctrl) >= 1.9.0
29
+BuildRequires: pkgconfig(libosmogsm) >= 1.9.0
30
+BuildRequires: pkgconfig(libosmovty) >= 1.9.0
31
BuildRequires: pkgconfig(sqlite3)
32
BuildRequires: pkgconfig(talloc) >= 2.0.1
33
# only needed for populate_hlr_db.pl
34
osmo-hlr_1.6.2.dsc -> osmo-hlr_1.7.0.dsc
Changed
29
1
2
Source: osmo-hlr
3
Binary: osmo-hlr, osmo-hlr-dbg, libosmo-gsup-client0, libosmo-gsup-client-dev, libosmo-mslookup1, libosmo-mslookup-dev, osmo-mslookup-utils, osmo-hlr-doc
4
Architecture: any all
5
-Version: 1.6.2
6
+Version: 1.7.0
7
Maintainer: Osmocom team <openbsc@lists.osmocom.org>
8
Homepage: https://projects.osmocom.org/projects/osmo-hlr
9
Standards-Version: 3.9.6
10
Vcs-Browser: https://gitea.osmocom.org/cellular-infrastructure/osmo-hlr
11
Vcs-Git: https://gitea.osmocom.org/cellular-infrastructure/osmo-hlr
12
-Build-Depends: debhelper (>= 9), pkg-config, dh-autoreconf, autotools-dev, python3-minimal, libosmocore-dev (>= 1.8.0), libosmo-abis-dev (>= 1.4.0), libosmo-netif-dev (>= 1.3.0), libsqlite3-dev, sqlite3, osmo-gsm-manuals-dev (>= 1.4.0)
13
+Build-Depends: debhelper (>= 10), pkg-config, dh-autoreconf, autotools-dev, python3-minimal, libosmocore-dev (>= 1.9.0), libosmo-abis-dev (>= 1.5.0), libosmo-netif-dev (>= 1.4.0), libsqlite3-dev, sqlite3, osmo-gsm-manuals-dev (>= 1.5.0)
14
Package-List:
15
libosmo-gsup-client-dev deb net optional arch=any
16
libosmo-gsup-client0 deb libs optional arch=any
17
18
osmo-hlr-doc deb doc optional arch=all
19
osmo-mslookup-utils deb utils optional arch=any
20
Checksums-Sha1:
21
- f394a3764a307eb706979418c47b4699be6b20e0 172304 osmo-hlr_1.6.2.tar.xz
22
+ 8731f52ebdda028b265bf25266a86159fa2efd4a 174520 osmo-hlr_1.7.0.tar.xz
23
Checksums-Sha256:
24
- e1adfa4721652c14c0bc513846ba820df4ba7d1039c42dbb47e1bb677179373a 172304 osmo-hlr_1.6.2.tar.xz
25
+ 9b7c7f920e4017f4af101dd78bcda5305e86b292e40b3f664da49c4a757fd892 174520 osmo-hlr_1.7.0.tar.xz
26
Files:
27
- 432dfab6d84ffd5c03cfa8c6a7ad3fbb 172304 osmo-hlr_1.6.2.tar.xz
28
+ cae8d41c0a36b375dc6eb4c52345df24 174520 osmo-hlr_1.7.0.tar.xz
29
osmo-hlr_1.6.2.tar.xz/.tarball-version -> osmo-hlr_1.7.0.tar.xz/.tarball-version
Changed
4
1
2
-1.6.2
3
+1.7.0
4
osmo-hlr_1.6.2.tar.xz/configure.ac -> osmo-hlr_1.7.0.tar.xz/configure.ac
Changed
18
1
2
3
PKG_CHECK_MODULES(TALLOC, talloc >= 2.0.1)
4
5
-PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.8.0)
6
-PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.8.0)
7
-PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.8.0)
8
-PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.8.0)
9
-PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 1.4.0)
10
+PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.9.0)
11
+PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.9.0)
12
+PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.9.0)
13
+PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.9.0)
14
+PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 1.5.0)
15
16
PKG_CHECK_MODULES(SQLITE3, sqlite3)
17
18
osmo-hlr_1.6.2.tar.xz/contrib/osmo-hlr.spec.in -> osmo-hlr_1.7.0.tar.xz/contrib/osmo-hlr.spec.in
Changed
18
1
2
%if 0%{?suse_version}
3
BuildRequires: systemd-rpm-macros
4
%endif
5
-BuildRequires: pkgconfig(libosmoabis) >= 1.4.0
6
-BuildRequires: pkgconfig(libosmocore) >= 1.8.0
7
-BuildRequires: pkgconfig(libosmoctrl) >= 1.8.0
8
-BuildRequires: pkgconfig(libosmogsm) >= 1.8.0
9
-BuildRequires: pkgconfig(libosmovty) >= 1.8.0
10
+BuildRequires: pkgconfig(libosmoabis) >= 1.5.0
11
+BuildRequires: pkgconfig(libosmocore) >= 1.9.0
12
+BuildRequires: pkgconfig(libosmoctrl) >= 1.9.0
13
+BuildRequires: pkgconfig(libosmogsm) >= 1.9.0
14
+BuildRequires: pkgconfig(libosmovty) >= 1.9.0
15
BuildRequires: pkgconfig(sqlite3)
16
BuildRequires: pkgconfig(talloc) >= 2.0.1
17
# only needed for populate_hlr_db.pl
18
osmo-hlr_1.6.2.tar.xz/debian/changelog -> osmo-hlr_1.7.0.tar.xz/debian/changelog
Changed
45
1
2
-osmo-hlr (1.6.2) unstable; urgency=medium
3
+osmo-hlr (1.7.0) unstable; urgency=medium
4
5
+ Oliver Smith
6
+ * Run struct_endianness.py
7
+ * tests/db/db_test.err: adjust to XOR-3G rename
8
+ * debian: set compat level to 10
9
* systemd: depend on networking-online.target
10
11
- -- Oliver Smith <osmith@sysmocom.de> Fri, 26 May 2023 14:54:12 +0200
12
-
13
-osmo-hlr (1.6.1) unstable; urgency=medium
14
+ Pau Espin Pedrol
15
+ * mslookup: Call osmo_fd_unregister() before closing and changing bfd->fd
16
17
- * Run struct_endianness.py
18
- * tests: adjust to XOR-3G rename in libosmocore
19
+ Vadim Yanitskiy
20
+ * tests/auc/Makefile.am: put object files to LDADD
21
+ * tests/*/Makefile.am: move -I to AM_CPPFLAGS
22
+ * lu_fsm: fix memleak in lu_fsm_wait_insert_data_result()
23
+ * ussd: fix GSUP memleaks in rx_proc_ss_{req,error}()
24
+ * gsup_server: fix msgb memleak in osmo_gsup_server_read_cb()
25
+ * USSD: fix handling of ussd-DataCodingScheme != 0x0f
26
+
27
+ Alexander Couzens
28
+ * hlr: use talloc for memory allocation in osmo_gsup_create_insert_subscriber_data_msg
29
+ * Add support for multiple APN profiles for subscriber data
30
+
31
+ Harald Welte
32
+ * Introduce support for XOR-2G algorithm
33
+ * cosmetic: gen_ts_55_205_test_sets/func_template.c: Use tab-indent
34
+ * cosmetic: gen_ts_55_205_test_sets/main_template tabs istead of spaces
35
+ * Port to new libosmogsm 'struct osmo_sub_auth_data2'
36
+ * src/db.c: Switch from "const char *statements" to "const char * const"
37
+ * db: extend database schema to support 256bit K and/or OPc values
38
+ * Add VTY support for TUAK algorithm
39
40
- -- Oliver Smith <osmith@sysmocom.de> Thu, 23 Feb 2023 10:23:04 +0100
41
+ -- Pau Espin Pedrol <pespin@sysmocom.de> Tue, 12 Sep 2023 14:41:33 +0200
42
43
osmo-hlr (1.6.0) unstable; urgency=medium
44
45
osmo-hlr_1.6.2.tar.xz/debian/compat -> osmo-hlr_1.7.0.tar.xz/debian/compat
Changed
4
1
2
-9
3
+10
4
osmo-hlr_1.6.2.tar.xz/debian/control -> osmo-hlr_1.7.0.tar.xz/debian/control
Changed
24
1
2
Section: net
3
Priority: optional
4
Maintainer: Osmocom team <openbsc@lists.osmocom.org>
5
-Build-Depends: debhelper (>= 9),
6
+Build-Depends: debhelper (>= 10),
7
pkg-config,
8
dh-autoreconf,
9
autotools-dev,
10
python3-minimal,
11
- libosmocore-dev (>= 1.8.0),
12
- libosmo-abis-dev (>= 1.4.0),
13
- libosmo-netif-dev (>= 1.3.0),
14
+ libosmocore-dev (>= 1.9.0),
15
+ libosmo-abis-dev (>= 1.5.0),
16
+ libosmo-netif-dev (>= 1.4.0),
17
libsqlite3-dev,
18
sqlite3,
19
- osmo-gsm-manuals-dev (>= 1.4.0)
20
+ osmo-gsm-manuals-dev (>= 1.5.0)
21
Standards-Version: 3.9.6
22
Vcs-Browser: https://gitea.osmocom.org/cellular-infrastructure/osmo-hlr
23
Vcs-Git: https://gitea.osmocom.org/cellular-infrastructure/osmo-hlr
24
osmo-hlr_1.6.2.tar.xz/doc/examples/osmo-hlr.cfg -> osmo-hlr_1.7.0.tar.xz/doc/examples/osmo-hlr.cfg
Changed
11
1
2
bind ip 127.0.0.1
3
ussd route prefix *#100# internal own-msisdn
4
ussd route prefix *#101# internal own-imsi
5
+ ps
6
+ pdp-profiles default
7
+ profile 1
8
+ apn internet
9
+ profile 2
10
+ apn *
11
osmo-hlr_1.6.2.tar.xz/include/osmocom/hlr/auc.h -> osmo-hlr_1.7.0.tar.xz/include/osmocom/hlr/auc.h
Changed
10
1
2
#include <osmocom/crypt/auth.h>
3
4
int auc_compute_vectors(struct osmo_auth_vector *vec, unsigned int num_vec,
5
- struct osmo_sub_auth_data *aud2g,
6
- struct osmo_sub_auth_data *aud3g,
7
+ struct osmo_sub_auth_data2 *aud2g,
8
+ struct osmo_sub_auth_data2 *aud3g,
9
const uint8_t *rand_auts, const uint8_t *auts);
10
osmo-hlr_1.6.2.tar.xz/include/osmocom/hlr/db.h -> osmo-hlr_1.7.0.tar.xz/include/osmocom/hlr/db.h
Changed
21
1
2
3
/* obtain the authentication data for a given imsi */
4
int db_get_auth_data(struct db_context *dbc, const char *imsi,
5
- struct osmo_sub_auth_data *aud2g,
6
- struct osmo_sub_auth_data *aud3g,
7
+ struct osmo_sub_auth_data2 *aud2g,
8
+ struct osmo_sub_auth_data2 *aud3g,
9
int64_t *subscr_id);
10
11
int db_update_sqn(struct db_context *dbc, int64_t id,
12
13
* See https://sqlite.org/lang_datefunc.html, function datetime(). */
14
#define DB_LAST_LU_SEEN_FMT "%Y-%m-%d %H:%M:%S"
15
16
-/* Like struct osmo_sub_auth_data, but the keys are in hexdump representation.
17
+/* Like struct osmo_sub_auth_data2, but the keys are in hexdump representation.
18
* This is useful because SQLite requires them in hexdump format, and callers
19
* like the VTY and CTRL interface also have them available as hexdump to begin
20
* with. In the binary format, a VTY command would first need to hexparse,
21
osmo-hlr_1.6.2.tar.xz/include/osmocom/hlr/gsup_server.h -> osmo-hlr_1.7.0.tar.xz/include/osmocom/hlr/gsup_server.h
Changed
11
1
2
int osmo_gsup_configure_wildcard_apn(struct osmo_gsup_message *gsup,
3
uint8_t *apn_buf, size_t apn_buf_size);
4
int osmo_gsup_create_insert_subscriber_data_msg(struct osmo_gsup_message *gsup, const char *imsi, const char *msisdn,
5
- uint8_t *msisdn_enc, size_t msisdn_enc_size,
6
- uint8_t *apn_buf, size_t apn_buf_size,
7
- enum osmo_gsup_cn_domain cn_domain);
8
+ enum osmo_gsup_cn_domain cn_domain, void *talloc_ctx);
9
int osmo_gsup_forward_to_local_peer(struct osmo_gsup_server *server, const struct osmo_cni_peer_id *to_peer,
10
struct osmo_gsup_req *req, struct osmo_gsup_message *modified_gsup);
11
osmo-hlr_1.6.2.tar.xz/include/osmocom/hlr/hlr.h -> osmo-hlr_1.7.0.tar.xz/include/osmocom/hlr/hlr.h
Changed
16
1
2
struct hlr_euse *euse_default;
3
enum gsm48_gmm_cause reject_cause;
4
enum gsm48_gmm_cause no_proxy_reject_cause;
5
+ /* PS: APN default configuration used by Subscription Data on ISR */
6
+ struct {
7
+ struct {
8
+ bool enabled;
9
+ struct osmo_gsup_pdp_info pdp_infosOSMO_GSUP_MAX_NUM_PDP_INFO;
10
+ size_t num_pdp_infos;
11
+ } pdp_profile;
12
+ } ps;
13
14
/* NCSS (call independent) session guard timeout value */
15
int ncss_guard_timeout;
16
osmo-hlr_1.6.2.tar.xz/include/osmocom/hlr/hlr_vty.h -> osmo-hlr_1.7.0.tar.xz/include/osmocom/hlr/hlr_vty.h
Changed
17
1
2
MSLOOKUP_SERVER_NODE,
3
MSLOOKUP_SERVER_MSC_NODE,
4
MSLOOKUP_CLIENT_NODE,
5
+ PS_NODE,
6
+ PS_PDP_PROFILES_NODE,
7
+ PS_PDP_PROFILES_PROFILE_NODE,
8
};
9
10
11
#define A38_XOR_MIN_KEY_LEN 12
12
#define A38_XOR_MAX_KEY_LEN 16
13
+#define A38_XOR2G_KEY_LEN 16
14
#define A38_COMP128_KEY_LEN 16
15
#define MILENAGE_KEY_LEN 16
16
17
osmo-hlr_1.6.2.tar.xz/sql/hlr.sql -> osmo-hlr_1.7.0.tar.xz/sql/hlr.sql
Changed
20
1
2
CREATE TABLE auc_3g (
3
subscriber_id INTEGER PRIMARY KEY, -- subscriber.id
4
algo_id_3g INTEGER NOT NULL, -- enum osmo_auth_algo value
5
- k VARCHAR(32) NOT NULL, -- hex string: subscriber's secret key (128bit)
6
- op VARCHAR(32), -- hex string: operator's secret key (128bit)
7
- opc VARCHAR(32), -- hex string: derived from OP and K (128bit)
8
+ k VARCHAR(64) NOT NULL, -- hex string: subscriber's secret key (128/256bit)
9
+ op VARCHAR(64), -- hex string: operator's secret key (128/256bit)
10
+ opc VARCHAR(64), -- hex string: derived from OP and K (128/256bit)
11
sqn INTEGER NOT NULL DEFAULT 0, -- sequence number of key usage
12
-- nr of index bits at lower SQN end
13
ind_bitlen INTEGER NOT NULL DEFAULT 5
14
15
16
-- Set HLR database schema version number
17
-- Note: This constant is currently duplicated in src/db.c and must be kept in sync!
18
-PRAGMA user_version = 6;
19
+PRAGMA user_version = 7;
20
osmo-hlr_1.6.2.tar.xz/src/Makefile.am -> osmo-hlr_1.7.0.tar.xz/src/Makefile.am
Changed
10
1
2
db_bootstrap.h: $(BOOTSTRAP_SQL) $(srcdir)/db_sql2c.sed
3
echo "/* DO NOT EDIT THIS FILE. It is generated from files in osmo-hlr.git/sql/ */" > "$@"
4
echo "#pragma once" >> "$@"
5
- echo "static const char *stmt_bootstrap_sql = {" >> "$@"
6
+ echo "static const char * const stmt_bootstrap_sql = {" >> "$@"
7
cat "$(BOOTSTRAP_SQL)" \
8
| sed -f "$(srcdir)/db_sql2c.sed" \
9
>> "$@"
10
osmo-hlr_1.6.2.tar.xz/src/auc.c -> osmo-hlr_1.7.0.tar.xz/src/auc.c
Changed
72
1
2
-/* (C) 2015 by Harald Welte <laforge@gnumonks.org>
3
+/* (C) 2015-2023 by Harald Welte <laforge@gnumonks.org>
4
*
5
* All Rights Reserved
6
*
7
8
/* compute given number of vectors using either aud2g or aud2g or a combination
9
* of both. Handles re-synchronization if rand_auts and auts are set */
10
int auc_compute_vectors(struct osmo_auth_vector *vec, unsigned int num_vec,
11
- struct osmo_sub_auth_data *aud2g,
12
- struct osmo_sub_auth_data *aud3g,
13
+ struct osmo_sub_auth_data2 *aud2g,
14
+ struct osmo_sub_auth_data2 *aud3g,
15
const uint8_t *rand_auts, const uint8_t *auts)
16
{
17
unsigned int i;
18
19
: "2G only",
20
auts? ", with AUTS resync" : "");
21
if (aud3g) {
22
- DBGP("3G: k = %s\n", hexb(aud3g->u.umts.k));
23
+ DBGP("3G: k = %s\n", hex(aud3g->u.umts.k, aud3g->u.umts.k_len));
24
DBGP("3G: %s = %s\n",
25
aud3g->u.umts.opc_is_op? "OP" : "opc",
26
- hexb(aud3g->u.umts.opc));
27
+ hex(aud3g->u.umts.opc, aud3g->u.umts.opc_len));
28
DBGP("3G: for sqn ind %u, previous sqn was %" PRIu64 "\n",
29
aud3g->u.umts.ind, aud3g->u.umts.sqn);
30
}
31
32
if (aud3g) {
33
/* 3G or 3G + 2G case */
34
35
+ /* backwards-compatibiliy: We assume all RES are 8 bytes long */
36
+ veci.res_len = 8;
37
+
38
/* Do AUTS only for the first vector or we would use
39
* the same SQN for each following key. */
40
if ((i == 0) && auts) {
41
42
DBGP("vector %u: resync: rand_auts = %s\n",
43
i, hex(rand_auts, 16));
44
45
- rc = osmo_auth_gen_vec_auts(vec+i, aud3g, auts,
46
+ rc = osmo_auth_gen_vec_auts2(vec+i, aud3g, auts,
47
rand_auts, rand);
48
} else {
49
- rc = osmo_auth_gen_vec(vec+i, aud3g, rand);
50
+ rc = osmo_auth_gen_vec2(vec+i, aud3g, rand);
51
}
52
if (rc < 0) {
53
LOGP(DAUC, LOGL_ERROR, "Error in 3G vector "
54
55
56
DBGP("vector %u: calculating 2G separately\n", i);
57
58
- rc = osmo_auth_gen_vec(&vtmp, aud2g, rand);
59
+ rc = osmo_auth_gen_vec2(&vtmp, aud2g, rand);
60
if (rc < 0) {
61
LOGP(DAUC, LOGL_ERROR, "Error in 2G vector"
62
"generation: %u: rc = %d\n", i, rc);
63
64
veci.auth_types |= OSMO_AUTH_TYPE_GSM;
65
} else {
66
/* 2G only case */
67
- rc = osmo_auth_gen_vec(vec+i, aud2g, rand);
68
+ rc = osmo_auth_gen_vec2(vec+i, aud2g, rand);
69
if (rc < 0) {
70
LOGP(DAUC, LOGL_ERROR, "Error in 2G vector "
71
"generation: %u: rc = %d\n", i, rc);
72
osmo-hlr_1.6.2.tar.xz/src/ctrl.c -> osmo-hlr_1.7.0.tar.xz/src/ctrl.c
Changed
148
1
2
/* OsmoHLR Control Interface implementation */
3
4
-/* (C) 2017 sysmocom s.f.m.c. GmbH <info@sysmocom.de>
5
+/* (C) 2017-2023 sysmocom s.f.m.c. GmbH <info@sysmocom.de>
6
* All Rights Reserved
7
*
8
* Author: Max Suraev <msuraev@sysmocom.de>
9
10
#define SEL_BY_ID SEL_BY "id-"
11
12
extern bool auth_algo_parse(const char *alg_str, enum osmo_auth_algo *algo,
13
- int *minlen, int *maxlen);
14
+ int *minlen, int *maxlen, int *minlen_opc, int *maxlen_opc);
15
16
#define hexdump_buf(buf) osmo_hexdump_nospc((void*)buf, sizeof(buf))
17
18
19
);
20
}
21
22
-static void print_subscr_info_aud2g(struct ctrl_cmd *cmd, struct osmo_sub_auth_data *aud)
23
+static void print_subscr_info_aud2g(struct ctrl_cmd *cmd, struct osmo_sub_auth_data2 *aud)
24
{
25
if (aud->algo == OSMO_AUTH_ALG_NONE)
26
return;
27
28
hexdump_buf(aud->u.gsm.ki));
29
}
30
31
-static void print_subscr_info_aud3g(struct ctrl_cmd *cmd, struct osmo_sub_auth_data *aud)
32
+static void print_subscr_info_aud3g(struct ctrl_cmd *cmd, struct osmo_sub_auth_data2 *aud)
33
{
34
if (aud->algo == OSMO_AUTH_ALG_NONE)
35
return;
36
37
"\naud3g.k\t%s"
38
,
39
osmo_auth_alg_name(aud->algo),
40
- hexdump_buf(aud->u.umts.k));
41
+ osmo_hexdump_nospc(aud->u.umts.k, aud->u.umts.k_len));
42
/* hexdump uses a static string buffer, hence only one hexdump per
43
* printf(). */
44
ctrl_cmd_reply_printf(cmd,
45
46
"\naud3g.sqn\t%" PRIu64
47
,
48
aud->u.umts.opc_is_op? "op" : "opc",
49
- hexdump_buf(aud->u.umts.opc),
50
+ osmo_hexdump_nospc(aud->u.umts.opc, aud->u.umts.opc_len),
51
aud->u.umts.ind_bitlen,
52
aud->u.umts.sqn);
53
}
54
55
static int get_subscr_info_aud(struct ctrl_cmd *cmd, void *data)
56
{
57
const char *imsi;
58
- struct osmo_sub_auth_data aud2g;
59
- struct osmo_sub_auth_data aud3g;
60
+ struct osmo_sub_auth_data2 aud2g;
61
+ struct osmo_sub_auth_data2 aud3g;
62
struct hlr *hlr = data;
63
const char *by_selector = cmd->node;
64
int rc;
65
66
static int get_subscr_info_all(struct ctrl_cmd *cmd, void *data)
67
{
68
struct hlr_subscriber subscr;
69
- struct osmo_sub_auth_data aud2g;
70
- struct osmo_sub_auth_data aud3g;
71
+ struct osmo_sub_auth_data2 aud2g;
72
+ struct osmo_sub_auth_data2 aud3g;
73
struct hlr *hlr = data;
74
const char *by_selector = cmd->node;
75
int rc;
76
77
struct hlr_subscriber subscr;
78
struct hlr *hlr = data;
79
const char *by_selector = cmd->node;
80
- struct osmo_sub_auth_data aud2g;
81
- struct osmo_sub_auth_data aud3g_unused;
82
+ struct osmo_sub_auth_data2 aud2g;
83
+ struct osmo_sub_auth_data2 aud3g_unused;
84
int rc;
85
86
if (!get_subscriber(hlr->dbc, by_selector, &subscr, cmd))
87
88
}
89
if (strcmp(tok, "none") == 0) {
90
aud2g.algo = OSMO_AUTH_ALG_NONE;
91
- } else if (!auth_algo_parse(tok, &aud2g.algo, &minlen, &maxlen)) {
92
+ } else if (!auth_algo_parse(tok, &aud2g.algo, &minlen, &maxlen, NULL, NULL)) {
93
cmd->reply = "Unknown auth algorithm.";
94
return CTRL_CMD_ERROR;
95
}
96
97
struct hlr_subscriber subscr;
98
struct hlr *hlr = data;
99
const char *by_selector = cmd->node;
100
- struct osmo_sub_auth_data aud2g_unused;
101
- struct osmo_sub_auth_data aud3g;
102
+ struct osmo_sub_auth_data2 aud2g_unused;
103
+ struct osmo_sub_auth_data2 aud3g;
104
int rc;
105
106
if (!get_subscriber(hlr->dbc, by_selector, &subscr, cmd))
107
108
}
109
110
cmd->reply = talloc_asprintf(cmd, "%s,%s,%s,%s,%u", osmo_auth_alg_name(aud3g.algo),
111
- osmo_hexdump_nospc_c(cmd, aud3g.u.umts.k, sizeof(aud3g.u.umts.k)),
112
+ osmo_hexdump_nospc_c(cmd, aud3g.u.umts.k, aud3g.u.umts.k_len),
113
aud3g.u.umts.opc_is_op ? "OP" : "OPC",
114
- osmo_hexdump_nospc_c(cmd, aud3g.u.umts.opc, sizeof(aud3g.u.umts.opc)),
115
+ osmo_hexdump_nospc_c(cmd, aud3g.u.umts.opc, aud3g.u.umts.opc_len),
116
aud3g.u.umts.ind_bitlen);
117
return CTRL_CMD_REPLY;
118
}
119
120
struct hlr *hlr = data;
121
const char *by_selector = cmd->node;
122
char *tmp = NULL, *tok, *saveptr;
123
- int minlen = 0;
124
- int maxlen = 0;
125
+ int minlen = 0, minlen_opc = 0;
126
+ int maxlen = 0, maxlen_opc = 0;
127
struct sub_auth_data_str aud3g = {
128
.type = OSMO_AUTH_TYPE_UMTS,
129
.u.umts = {
130
131
}
132
if (strcmp(tok, "none") == 0) {
133
aud3g.algo = OSMO_AUTH_ALG_NONE;
134
- } else if (!auth_algo_parse(tok, &aud3g.algo, &minlen, &maxlen)) {
135
+ } else if (!auth_algo_parse(tok, &aud3g.algo, &minlen, &maxlen, &minlen_opc, &maxlen_opc)) {
136
cmd->reply = "Unknown auth algorithm.";
137
return CTRL_CMD_ERROR;
138
}
139
140
}
141
142
aud3g.u.umts.opc = tok;
143
- if (!osmo_is_hexstr(aud3g.u.umts.opc, MILENAGE_KEY_LEN * 2, MILENAGE_KEY_LEN * 2, true)) {
144
+ if (!osmo_is_hexstr(aud3g.u.umts.opc, minlen_opc * 2, maxlen_opc * 2, true)) {
145
cmd->reply = talloc_asprintf(cmd, "Invalid OP/OPC.");
146
return CTRL_CMD_ERROR;
147
}
148
osmo-hlr_1.6.2.tar.xz/src/db.c -> osmo-hlr_1.7.0.tar.xz/src/db.c
Changed
134
1
2
-/* (C) 2015 by Harald Welte <laforge@gnumonks.org>
3
+/* (C) 2015-2023 by Harald Welte <laforge@gnumonks.org>
4
*
5
* All Rights Reserved
6
*
7
8
#include "db_bootstrap.h"
9
10
/* This constant is currently duplicated in sql/hlr.sql and must be kept in sync! */
11
-#define CURRENT_SCHEMA_VERSION 6
12
+#define CURRENT_SCHEMA_VERSION 7
13
14
#define SEL_COLUMNS \
15
"id," \
16
17
talloc_free(dbc);
18
}
19
20
-static int db_run_statements(struct db_context *dbc, const char **statements, size_t statements_count)
21
+static int db_run_statements(struct db_context *dbc, const char * const *statements, size_t statements_count)
22
{
23
int rc = 0;
24
int i;
25
26
db_upgrade_v1(struct db_context *dbc)
27
{
28
int rc;
29
- const char *statements = {
30
+ const char * const statements = {
31
"ALTER TABLE subscriber ADD COLUMN last_lu_seen TIMESTAMP default NULL",
32
"PRAGMA user_version = 1",
33
};
34
35
static int db_upgrade_v2(struct db_context *dbc)
36
{
37
int rc;
38
- const char *statements = {
39
+ const char * const statements = {
40
"ALTER TABLE subscriber ADD COLUMN imei VARCHAR(14)",
41
"PRAGMA user_version = 2",
42
};
43
44
"ms_purged_ps," \
45
"last_lu_seen"
46
47
- const char *statements = {
48
+ const char * const statements = {
49
"BEGIN TRANSACTION",
50
"CREATE TEMPORARY TABLE subscriber_backup" SUBSCR_V3_CREATE,
51
"INSERT INTO subscriber_backup SELECT " SUBSCR_V2_COLUMN_NAMES " FROM subscriber",
52
53
static int db_upgrade_v4(struct db_context *dbc)
54
{
55
int rc;
56
- const char *statements = {
57
+ const char * const statements = {
58
"ALTER TABLE subscriber ADD COLUMN last_lu_seen_ps TIMESTAMP default NULL",
59
"PRAGMA user_version = 4",
60
};
61
62
static int db_upgrade_v5(struct db_context *dbc)
63
{
64
int rc;
65
- const char *statements = {
66
+ const char * const statements = {
67
"ALTER TABLE subscriber ADD COLUMN vlr_via_proxy VARCHAR",
68
"ALTER TABLE subscriber ADD COLUMN sgsn_via_proxy VARCHAR",
69
"PRAGMA user_version = 5",
70
71
static int db_upgrade_v6(struct db_context *dbc)
72
{
73
int rc;
74
- const char *statements = {
75
+ const char * const statements = {
76
"CREATE TABLE ind (\n"
77
" -- 3G auth IND pool to be used for this VLR\n"
78
" ind INTEGER PRIMARY KEY,\n"
79
80
return rc;
81
}
82
83
+static int db_upgrade_v7(struct db_context *dbc)
84
+{
85
+ int rc;
86
+ /* SQLite doesn't allow us to change the column type in-place, so we
87
+ * first rename the old table, create a new table and then copy
88
+ * the data over before deleting the old table */
89
+#define CREATE_AUC_3G_V7 \
90
+"CREATE TABLE auc_3g (\n" \
91
+" subscriber_id INTEGER PRIMARY KEY, -- subscriber.id\n" \
92
+" algo_id_3g INTEGER NOT NULL, -- enum osmo_auth_algo value\n" \
93
+" k VARCHAR(64) NOT NULL, -- hex string: subscriber's secret key (128/256bit)\n" \
94
+" op VARCHAR(64), -- hex string: operator's secret key (128/256bit)\n" \
95
+" opc VARCHAR(64), -- hex string: derived from OP and K (128/256bit)\n" \
96
+" sqn INTEGER NOT NULL DEFAULT 0, -- sequence number of key usage\n" \
97
+" -- nr of index bits at lower SQN end\n" \
98
+" ind_bitlen INTEGER NOT NULL DEFAULT 5\n" \
99
+");"
100
+ const char * const statements = {
101
+ "BEGIN TRANSACTION",
102
+ /* rename old table */
103
+ "ALTER TABLE auc_3g RENAME TO old_auc_3g",
104
+ /* create new table */
105
+ CREATE_AUC_3G_V7,
106
+ /* copy over old data */
107
+ "INSERT INTO auc_3g SELECT subscriber_id, algo_id_3g, k, op, opc,sqn, ind_bitlen FROM old_auc_3g",
108
+ /* delete old table */
109
+ "DROP TABLE old_auc_3g",
110
+ /* update user_version */
111
+ "PRAGMA user_version = 7",
112
+ "COMMIT",
113
+ };
114
+
115
+ rc = db_run_statements(dbc, statements, ARRAY_SIZE(statements));
116
+ if (rc != SQLITE_DONE) {
117
+ LOGP(DDB, LOGL_ERROR, "Unable to update HLR database schema to version 7\n");
118
+ return rc;
119
+ }
120
+ return rc;
121
+}
122
+
123
typedef int (*db_upgrade_func_t)(struct db_context *dbc);
124
static db_upgrade_func_t db_upgrade_path = {
125
db_upgrade_v1,
126
127
db_upgrade_v4,
128
db_upgrade_v5,
129
db_upgrade_v6,
130
+ db_upgrade_v7,
131
};
132
133
static int db_get_user_version(struct db_context *dbc)
134
osmo-hlr_1.6.2.tar.xz/src/db_auc.c -> osmo-hlr_1.7.0.tar.xz/src/db_auc.c
Changed
116
1
2
-/* (C) 2015 by Harald Welte <laforge@gnumonks.org>
3
+/* (C) 2015-2023 by Harald Welte <laforge@gnumonks.org>
4
*
5
* All Rights Reserved
6
*
7
8
}
9
10
/* hexparse a specific column of a sqlite prepared statement into dst (with length check)
11
- * returns 0 for success, -EIO on error */
12
-static int hexparse_stmt(uint8_t *dst, size_t dst_len, sqlite3_stmt *stmt, int col, const char *col_name,
13
- const char *imsi)
14
+ * returns byte length in case of success, -EIO on error */
15
+static int hexparse_stmt(uint8_t *dst, size_t dst_len_min, size_t dst_len_max, sqlite3_stmt *stmt,
16
+ int col, const char *col_name, const char *imsi)
17
{
18
const uint8_t *text;
19
size_t col_len;
20
21
/* Bytes are stored as hex strings in database, hence divide length by two */
22
col_len = sqlite3_column_bytes(stmt, col) / 2;
23
24
- if (col_len != dst_len) {
25
- LOGAUC(imsi, LOGL_ERROR, "Error reading %s, expected length %lu but has length %lu\n", col_name,
26
- dst_len, col_len);
27
+ if (col_len < dst_len_min) {
28
+ LOGAUC(imsi, LOGL_ERROR, "Error reading %s, expected min length %lu but has length %lu\n", col_name,
29
+ dst_len_min, col_len);
30
+ return -EIO;
31
+ }
32
+
33
+ if (col_len > dst_len_max) {
34
+ LOGAUC(imsi, LOGL_ERROR, "Error reading %s, expected max length %lu but has length %lu\n", col_name,
35
+ dst_len_max, col_len);
36
return -EIO;
37
}
38
39
40
return -EIO;
41
}
42
43
- if (osmo_hexparse((void *)text, dst, dst_len) != col_len)
44
+ if (osmo_hexparse((void *)text, dst, dst_len_max) != col_len)
45
return -EINVAL;
46
47
- return 0;
48
+ return col_len;
49
}
50
51
/* obtain the authentication data for a given imsi
52
53
* -ENOENT if the IMSI is not known, -ENOKEY if the IMSI is known but has no auth data,
54
* -EIO on db failure */
55
int db_get_auth_data(struct db_context *dbc, const char *imsi,
56
- struct osmo_sub_auth_data *aud2g,
57
- struct osmo_sub_auth_data *aud3g,
58
+ struct osmo_sub_auth_data2 *aud2g,
59
+ struct osmo_sub_auth_data2 *aud3g,
60
int64_t *subscr_id)
61
{
62
sqlite3_stmt *stmt = dbc->stmtDB_STMT_AUC_BY_IMSI;
63
64
/* obtain result values using sqlite3_column_*() */
65
if (sqlite3_column_type(stmt, 1) == SQLITE_INTEGER) {
66
/* we do have some 2G authentication data */
67
- if (hexparse_stmt(aud2g->u.gsm.ki, sizeof(aud2g->u.gsm.ki), stmt, 2, "Ki", imsi))
68
+ if (hexparse_stmt(aud2g->u.gsm.ki, sizeof(aud2g->u.gsm.ki), sizeof(aud2g->u.gsm.ki),
69
+ stmt, 2, "Ki", imsi) < 0)
70
goto end_2g;
71
aud2g->algo = sqlite3_column_int(stmt, 1);
72
aud2g->type = OSMO_AUTH_TYPE_GSM;
73
74
end_2g:
75
if (sqlite3_column_type(stmt, 3) == SQLITE_INTEGER) {
76
/* we do have some 3G authentication data */
77
- if (hexparse_stmt(aud3g->u.umts.k, sizeof(aud3g->u.umts.k), stmt, 4, "K", imsi)) {
78
+ rc = hexparse_stmt(aud3g->u.umts.k, 16, sizeof(aud3g->u.umts.k), stmt, 4, "K", imsi);
79
+ if (rc < 0) {
80
ret = -EIO;
81
goto out;
82
}
83
+ aud3g->u.umts.k_len = rc;
84
aud3g->algo = sqlite3_column_int(stmt, 3);
85
86
/* UMTS Subscribers can have either OP or OPC */
87
if (sqlite3_column_text(stmt, 5)) {
88
- if (hexparse_stmt(aud3g->u.umts.opc, sizeof(aud3g->u.umts.opc), stmt, 5, "OP", imsi)) {
89
+ rc = hexparse_stmt(aud3g->u.umts.opc, 16, sizeof(aud3g->u.umts.opc), stmt, 5, "OP", imsi);
90
+ if (rc < 0) {
91
ret = -EIO;
92
goto out;
93
}
94
+ aud3g->u.umts.opc_len = rc;
95
aud3g->u.umts.opc_is_op = 1;
96
} else {
97
- if (hexparse_stmt(aud3g->u.umts.opc, sizeof(aud3g->u.umts.opc), stmt, 6, "OPC", imsi)) {
98
+ rc = hexparse_stmt(aud3g->u.umts.opc, 16, sizeof(aud3g->u.umts.opc), stmt, 6, "OPC", imsi);
99
+ if (rc < 0) {
100
ret = -EIO;
101
goto out;
102
}
103
+ aud3g->u.umts.opc_len = rc;
104
aud3g->u.umts.opc_is_op = 0;
105
}
106
aud3g->u.umts.sqn = sqlite3_column_int64(stmt, 7);
107
108
unsigned int num_vec, const uint8_t *rand_auts,
109
const uint8_t *auts, bool separation_bit)
110
{
111
- struct osmo_sub_auth_data aud2g, aud3g;
112
+ struct osmo_sub_auth_data2 aud2g, aud3g;
113
int64_t subscr_id;
114
int ret = 0;
115
int rc;
116
osmo-hlr_1.6.2.tar.xz/src/db_hlr.c -> osmo-hlr_1.7.0.tar.xz/src/db_hlr.c
Changed
47
1
2
-/* (C) 2015 by Harald Welte <laforge@gnumonks.org>
3
+/* (C) 2015-2023 by Harald Welte <laforge@gnumonks.org>
4
*
5
* All Rights Reserved
6
*
7
8
case OSMO_AUTH_ALG_COMP128v1:
9
case OSMO_AUTH_ALG_COMP128v2:
10
case OSMO_AUTH_ALG_COMP128v3:
11
- case OSMO_AUTH_ALG_XOR:
12
+ case OSMO_AUTH_ALG_XOR_2G:
13
break;
14
+ case OSMO_AUTH_ALG_XOR_3G:
15
case OSMO_AUTH_ALG_MILENAGE:
16
LOGP(DAUC, LOGL_ERROR, "Cannot update auth tokens:"
17
" auth algo not suited for 2G: %s\n",
18
19
switch (aud->algo) {
20
case OSMO_AUTH_ALG_NONE:
21
case OSMO_AUTH_ALG_MILENAGE:
22
- case OSMO_AUTH_ALG_XOR:
23
+ case OSMO_AUTH_ALG_XOR_3G:
24
break;
25
case OSMO_AUTH_ALG_COMP128v1:
26
case OSMO_AUTH_ALG_COMP128v2:
27
case OSMO_AUTH_ALG_COMP128v3:
28
+ case OSMO_AUTH_ALG_XOR_2G:
29
LOGP(DAUC, LOGL_ERROR, "Cannot update auth tokens:"
30
" auth algo not suited for 3G: %s\n",
31
osmo_auth_alg_name(aud->algo));
32
33
34
if (aud->algo == OSMO_AUTH_ALG_NONE)
35
break;
36
- if (!osmo_is_hexstr(aud->u.umts.k, 32, 32, true)) {
37
+ if (!osmo_is_hexstr(aud->u.umts.k, 32, 64, true)) {
38
LOGP(DAUC, LOGL_ERROR, "Cannot update auth tokens:"
39
" Invalid K: '%s'\n", aud->u.umts.k);
40
return -EINVAL;
41
}
42
- if (!osmo_is_hexstr(aud->u.umts.opc, 32, 32, true)) {
43
+ if (!osmo_is_hexstr(aud->u.umts.opc, 32, 64, true)) {
44
LOGP(DAUC, LOGL_ERROR, "Cannot update auth tokens:"
45
" Invalid OP/OPC: '%s'\n", aud->u.umts.opc);
46
return -EINVAL;
47
osmo-hlr_1.6.2.tar.xz/src/gsup_server.c -> osmo-hlr_1.7.0.tar.xz/src/gsup_server.c
Changed
88
1
2
3
#include <osmocom/hlr/gsup_server.h>
4
#include <osmocom/hlr/gsup_router.h>
5
+#include <osmocom/hlr/hlr.h>
6
7
#define LOG_GSUP_CONN(conn, level, fmt, args...) \
8
LOGP(DLGSUP, level, "GSUP peer %s: " fmt, \
9
10
11
if (hh->proto == IPAC_PROTO_IPACCESS) {
12
rc = ipa_server_conn_ccm(conn, msg);
13
- if (rc < 0) {
14
- /* conn is already invalid here! */
15
- return -1;
16
- }
17
msgb_free(msg);
18
+ if (rc < 0) /* conn is already invalid here! */
19
+ return -1;
20
return 0;
21
}
22
23
24
* \paramout gsup The gsup message to populate.
25
* \paramin imsi The subscriber's IMSI.
26
* \paramin msisdn The subscriber's MSISDN.
27
- * \paramout msisdn_enc A buffer large enough to store the MSISDN in encoded form.
28
- * \paramin msisdn_enc_size Size of the buffer (must be >= OSMO_GSUP_MAX_CALLED_PARTY_BCD_LEN).
29
- * \paramout apn_buf A buffer large enough to store an APN (required if cn_domain is OSMO_GSUP_CN_DOMAIN_PS).
30
- * \paramin apn_buf_size Size of APN buffer (must be >= APN_MAXLEN).
31
* \paramin cn_domain The CN Domain of the subscriber connection.
32
+ * \paramin talloc_ctx To allocation memory for dynamic fields (msisdn, apn) in the gsup field
33
* \returns 0 on success, and negative on error.
34
*/
35
int osmo_gsup_create_insert_subscriber_data_msg(struct osmo_gsup_message *gsup, const char *imsi, const char *msisdn,
36
- uint8_t *msisdn_enc, size_t msisdn_enc_size,
37
- uint8_t *apn_buf, size_t apn_buf_size,
38
- enum osmo_gsup_cn_domain cn_domain)
39
+ enum osmo_gsup_cn_domain cn_domain,
40
+ void *talloc_ctx)
41
{
42
int len;
43
+ uint8_t *msisdn_buf = talloc_size(talloc_ctx, OSMO_GSUP_MAX_CALLED_PARTY_BCD_LEN);
44
45
OSMO_ASSERT(gsup);
46
*gsup = (struct osmo_gsup_message){
47
48
49
osmo_strlcpy(gsup->imsi, imsi, sizeof(gsup->imsi));
50
51
- if (msisdn_enc_size < OSMO_GSUP_MAX_CALLED_PARTY_BCD_LEN)
52
- return -ENOSPC;
53
-
54
- OSMO_ASSERT(msisdn_enc);
55
- len = gsm48_encode_bcd_number(msisdn_enc, msisdn_enc_size, 0, msisdn);
56
+ len = gsm48_encode_bcd_number(msisdn_buf, OSMO_GSUP_MAX_CALLED_PARTY_BCD_LEN, 0, msisdn);
57
if (len < 1) {
58
LOGP(DLGSUP, LOGL_ERROR, "%s: Error: cannot encode MSISDN '%s'\n", imsi, msisdn);
59
return -ENOSPC;
60
}
61
- gsup->msisdn_enc = msisdn_enc;
62
+ gsup->msisdn_enc = msisdn_buf;
63
gsup->msisdn_enc_len = len;
64
65
#pragma message "FIXME: deal with encoding the following data: gsup.hlr_enc"
66
67
gsup->cn_domain = cn_domain;
68
if (gsup->cn_domain == OSMO_GSUP_CN_DOMAIN_PS) {
69
- OSMO_ASSERT(apn_buf_size >= APN_MAXLEN);
70
- OSMO_ASSERT(apn_buf);
71
- /* FIXME: PDP infos - use more fine-grained access control
72
- instead of wildcard APN */
73
- osmo_gsup_configure_wildcard_apn(gsup, apn_buf, apn_buf_size);
74
+ if (g_hlr->ps.pdp_profile.enabled) {
75
+ OSMO_ASSERT(g_hlr->ps.pdp_profile.num_pdp_infos <= ARRAY_SIZE(g_hlr->ps.pdp_profile.pdp_infos));
76
+ OSMO_ASSERT(g_hlr->ps.pdp_profile.num_pdp_infos <= ARRAY_SIZE(gsup->pdp_infos));
77
+ memcpy(gsup->pdp_infos,
78
+ g_hlr->ps.pdp_profile.pdp_infos,
79
+ sizeof(struct osmo_gsup_pdp_info) * g_hlr->ps.pdp_profile.num_pdp_infos);
80
+ gsup->num_pdp_infos = g_hlr->ps.pdp_profile.num_pdp_infos;
81
+ } else {
82
+ uint8_t *apn_buf = talloc_size(talloc_ctx, APN_MAXLEN);
83
+ osmo_gsup_configure_wildcard_apn(gsup, apn_buf, APN_MAXLEN);
84
+ }
85
}
86
87
return 0;
88
osmo-hlr_1.6.2.tar.xz/src/hlr.c -> osmo-hlr_1.7.0.tar.xz/src/hlr.c
Changed
29
1
2
3
llist_for_each_entry(co, &g_hlr->gs->clients, list) {
4
struct osmo_gsup_message gsup = { };
5
- uint8_t msisdn_encOSMO_GSUP_MAX_CALLED_PARTY_BCD_LEN;
6
- uint8_t apnAPN_MAXLEN;
7
struct msgb *msg_out;
8
uint8_t *peer;
9
int peer_len;
10
11
subscr->imsi, cn_domain == OSMO_GSUP_CN_DOMAIN_PS ? "PS" : "CS",
12
osmo_quote_str(peer_compare, -1));
13
14
- if (osmo_gsup_create_insert_subscriber_data_msg(&gsup, subscr->imsi, subscr->msisdn, msisdn_enc,
15
- sizeof(msisdn_enc), apn, sizeof(apn), cn_domain) != 0) {
16
+ if (osmo_gsup_create_insert_subscriber_data_msg(&gsup, subscr->imsi, subscr->msisdn, cn_domain, OTC_SELECT) != 0) {
17
LOGP(DLGSUP, LOGL_ERROR,
18
"IMSI='%s': Cannot notify GSUP client; could not create gsup message "
19
"for %s:%u\n", subscr->imsi,
20
21
}
22
23
static const char vlr_copyright =
24
- "Copyright (C) 2016, 2017 by Harald Welte, sysmocom s.f.m.c. GmbH\r\n"
25
+ "Copyright (C) 2016-2023 by Harald Welte, sysmocom s.f.m.c. GmbH\r\n"
26
"License AGPLv3+: GNU AGPL version 3 or later <http://gnu.org/licenses/agpl-3.0.html>\r\n"
27
"This is free software: you are free to change and redistribute it.\r\n"
28
"There is NO WARRANTY, to the extent permitted by law.\r\n";
29
osmo-hlr_1.6.2.tar.xz/src/hlr_ussd.c -> osmo-hlr_1.7.0.tar.xz/src/hlr_ussd.c
Changed
77
1
2
talloc_free(rt);
3
}
4
5
-static struct hlr_ussd_route *ussd_route_lookup_7bit(struct hlr *hlr, const char *ussd_code)
6
+static struct hlr_ussd_route *ussd_route_lookup_for_req(struct hlr *hlr, const struct ss_request *req)
7
{
8
+ const uint8_t cgroup = req->ussd_data_dcs >> 4;
9
+ const uint8_t lang = req->ussd_data_dcs & 0x0f;
10
+ char ussd_codeGSM0480_USSD_7BIT_STRING_LEN;
11
struct hlr_ussd_route *rt;
12
+
13
+ ussd_code0 = '\0';
14
+
15
+ /* We support only the Coding Group 0 (GSM 7-bit default alphabeet). In fact,
16
+ * the USSD request is usually limited to *#0-9, so we don't really need to
17
+ * support other coding groups and languages. */
18
+ switch (cgroup) {
19
+ case 0:
20
+ /* The Language is usually set to '1111'B (unspecified), but some UEs
21
+ * are known to indicate '0000'B (German). */
22
+ if (lang != 0x0f) {
23
+ LOGP(DSS, LOGL_NOTICE, "USSD DataCodingScheme (0x%02x): "
24
+ "the Language is usually set to 15 (unspecified), "
25
+ "but the request indicates %u - ignoring this\n",
26
+ req->ussd_data_dcs, lang);
27
+ /* do not abort, attempt to decode as if it was '1111'B */
28
+ }
29
+
30
+ gsm_7bit_decode_n_ussd(&ussd_code0, sizeof(ussd_code),
31
+ req->ussd_data, (req->ussd_data_len * 8) / 7);
32
+ break;
33
+ default:
34
+ LOGP(DSS, LOGL_ERROR, "USSD DataCodingScheme (0x%02x): "
35
+ "Coding Group %u is not supported, expecting Coding Group 0\n",
36
+ req->ussd_data_dcs, cgroup);
37
+ return NULL;
38
+ }
39
+
40
llist_for_each_entry(rt, &hlr->ussd_routes, list) {
41
if (!strncmp(ussd_code, rt->prefix, strlen(rt->prefix))) {
42
LOGP(DSS, LOGL_DEBUG, "Found %s '%s' (prefix '%s') for USSD "
43
44
} else {
45
/* VLR->EUSE: MO USSD. VLR is known ('conn'), EUSE is to be resolved */
46
struct hlr_ussd_route *rt;
47
- rt = ussd_route_lookup_7bit(hlr, (const char *) req.ussd_text);
48
+ rt = ussd_route_lookup_for_req(hlr, &req);
49
if (rt) {
50
if (rt->is_external) {
51
ss->is_external = true;
52
53
if (!ss) {
54
LOGP(DSS, LOGL_ERROR, "%s/0x%08x: CONTINUE for unknown SS session\n",
55
gsup->imsi, gsup->session_id);
56
- osmo_gsup_req_respond_err(gsup_req, GMM_CAUSE_INV_MAND_INFO, "CONTINUE for unknown SS session");
57
+ osmo_gsup_req_respond_err(gsup_req, GMM_CAUSE_MSGT_INCOMP_P_STATE,
58
+ "CONTINUE for unknown SS session");
59
return;
60
}
61
62
63
if (!ss) {
64
LOGP(DSS, LOGL_ERROR, "%s/0x%08x: END for unknown SS session\n",
65
gsup->imsi, gsup->session_id);
66
+ osmo_gsup_req_respond_err(gsup_req, GMM_CAUSE_MSGT_INCOMP_P_STATE,
67
+ "END for unknown SS session");
68
return;
69
}
70
71
72
{
73
LOGP(DSS, LOGL_NOTICE, "%s/0x%08x: Process SS ERROR (%s)\n", req->gsup.imsi, req->gsup.session_id,
74
osmo_gsup_session_state_name(req->gsup.session_state));
75
+ osmo_gsup_req_free(req);
76
}
77
osmo-hlr_1.6.2.tar.xz/src/hlr_vty.c -> osmo-hlr_1.7.0.tar.xz/src/hlr_vty.c
Changed
201
1
2
*/
3
4
#include <errno.h>
5
+#include <string.h>
6
7
#include <osmocom/core/talloc.h>
8
#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
9
+#include <osmocom/gsm/apn.h>
10
+
11
#include <osmocom/vty/vty.h>
12
#include <osmocom/vty/stats.h>
13
#include <osmocom/vty/command.h>
14
15
return CMD_SUCCESS;
16
}
17
18
+struct cmd_node ps_node = {
19
+ PS_NODE,
20
+ "%s(config-hlr-ps)# ",
21
+ 1,
22
+};
23
+
24
+DEFUN(cfg_ps,
25
+ cfg_ps_cmd,
26
+ "ps",
27
+ "Configure the PS options")
28
+{
29
+ vty->node = PS_NODE;
30
+ return CMD_SUCCESS;
31
+}
32
+
33
+struct cmd_node ps_pdp_profiles_node = {
34
+ PS_PDP_PROFILES_NODE,
35
+ "%s(config-hlr-ps-pdp-profiles)# ",
36
+ 1,
37
+};
38
+
39
+DEFUN(cfg_ps_pdp_profiles,
40
+ cfg_ps_pdp_profiles_cmd,
41
+ "pdp-profiles default",
42
+ "Define a PDP profile set.\n"
43
+ "Define the global default profile.\n")
44
+{
45
+ g_hlr->ps.pdp_profile.enabled = true;
46
+
47
+ vty->node = PS_PDP_PROFILES_NODE;
48
+ return CMD_SUCCESS;
49
+}
50
+
51
+DEFUN(cfg_no_ps_pdp_profiles,
52
+ cfg_no_ps_pdp_profiles_cmd,
53
+ "no pdp-profiles default",
54
+ NO_STR
55
+ "Delete PDP profile.\n"
56
+ "Unique identifier for this PDP profile set.\n")
57
+{
58
+ g_hlr->ps.pdp_profile.enabled = false;
59
+ return CMD_SUCCESS;
60
+}
61
+
62
+
63
+
64
+struct cmd_node ps_pdp_profiles_profile_node = {
65
+ PS_PDP_PROFILES_PROFILE_NODE,
66
+ "%s(config-hlr-ps-pdp-profile)# ",
67
+ 1,
68
+};
69
+
70
+
71
+/* context_id == 0 means the slot is free */
72
+struct osmo_gsup_pdp_info *get_pdp_profile(uint8_t context_id)
73
+{
74
+ for (int i = 0; i < OSMO_GSUP_MAX_NUM_PDP_INFO; i++) {
75
+ struct osmo_gsup_pdp_info *info = &g_hlr->ps.pdp_profile.pdp_infosi;
76
+ if (info->context_id == context_id)
77
+ return info;
78
+ }
79
+
80
+ return NULL;
81
+}
82
+
83
+struct osmo_gsup_pdp_info *create_pdp_profile(uint8_t context_id)
84
+{
85
+ struct osmo_gsup_pdp_info *info = get_pdp_profile(0);
86
+ if (!info)
87
+ return NULL;
88
+
89
+ memset(info, 0, sizeof(*info));
90
+ info->context_id = context_id;
91
+ info->have_info = 1;
92
+
93
+ g_hlr->ps.pdp_profile.num_pdp_infos++;
94
+ return info;
95
+}
96
+
97
+void destroy_pdp_profile(struct osmo_gsup_pdp_info *info)
98
+{
99
+ info->context_id = 0;
100
+ if (info->apn_enc)
101
+ talloc_free((void *) info->apn_enc);
102
+
103
+ g_hlr->ps.pdp_profile.num_pdp_infos--;
104
+ memset(info, 0, sizeof(*info));
105
+}
106
+
107
+DEFUN(cfg_ps_pdp_profiles_profile,
108
+ cfg_ps_pdp_profiles_profile_cmd,
109
+ "profile <1-10>",
110
+ "Configure a PDP profile\n"
111
+ "Unique PDP context identifier. The lowest profile will be used as default context.\n")
112
+{
113
+ struct osmo_gsup_pdp_info *info;
114
+ uint8_t context_id = atoi(argv0);
115
+
116
+ info = get_pdp_profile(context_id);
117
+ if (!info) {
118
+ info = create_pdp_profile(context_id);
119
+ if (!info) {
120
+ vty_out(vty, "Failed to create profile %d!%s", context_id, VTY_NEWLINE);
121
+ return CMD_ERR_INCOMPLETE;
122
+ }
123
+ }
124
+
125
+ vty->node = PS_PDP_PROFILES_PROFILE_NODE;
126
+ vty->index = info;
127
+ return CMD_SUCCESS;
128
+}
129
+
130
+DEFUN(cfg_no_ps_pdp_profiles_profile,
131
+ cfg_no_ps_pdp_profiles_profile_cmd,
132
+ "no profile <1-10>",
133
+ NO_STR
134
+ "Delete a PDP profile\n"
135
+ "Unique PDP context identifier. The lowest profile will be used as default context.\n")
136
+{
137
+ struct osmo_gsup_pdp_info *info;
138
+ uint8_t context_id = atoi(argv0);
139
+
140
+ info = get_pdp_profile(context_id);
141
+ if (info)
142
+ destroy_pdp_profile(info);
143
+
144
+ return CMD_SUCCESS;
145
+}
146
+
147
+DEFUN(cfg_ps_pdp_profile_apn, cfg_ps_pdp_profile_apn_cmd,
148
+ "apn ID",
149
+ "Configure the APN.\n"
150
+ "APN name or * for wildcard apn.\n")
151
+{
152
+ struct osmo_gsup_pdp_info *info = vty->index;
153
+ const char *apn_name = argv0;
154
+
155
+ /* apn encoded takes one more byte than strlen() */
156
+ size_t apn_enc_len = strlen(apn_name) + 1;
157
+ uint8_t *apn_enc;
158
+ int ret;
159
+
160
+ if (apn_enc_len > APN_MAXLEN) {
161
+ vty_out(vty, "APN name is too long '%s'. Max is %d!%s", apn_name, APN_MAXLEN, VTY_NEWLINE);
162
+ return CMD_ERR_INCOMPLETE;
163
+ }
164
+
165
+ info->apn_enc = apn_enc = (uint8_t *) talloc_zero_size(g_hlr, apn_enc_len);
166
+ ret = info->apn_enc_len = osmo_apn_from_str(apn_enc, apn_enc_len, apn_name);
167
+ if (ret < 0) {
168
+ talloc_free(apn_enc);
169
+ info->apn_enc = NULL;
170
+ info->apn_enc_len = 0;
171
+ vty_out(vty, "Invalid APN name %s!", apn_name);
172
+ return CMD_WARNING;
173
+ }
174
+
175
+ return CMD_SUCCESS;
176
+}
177
+
178
+DEFUN(cfg_no_ps_pdp_profile_apn, cfg_no_ps_pdp_profile_apn_cmd,
179
+ "no apn",
180
+ NO_STR
181
+ "Delete the APN.\n")
182
+{
183
+ struct osmo_gsup_pdp_info *info = vty->index;
184
+ if (info->apn_enc) {
185
+ talloc_free((void *) info->apn_enc);
186
+ info->apn_enc = NULL;
187
+ info->apn_enc_len = 0;
188
+ }
189
+
190
+ return CMD_SUCCESS;
191
+}
192
+
193
+
194
static int config_write_hlr(struct vty *vty)
195
{
196
vty_out(vty, "hlr%s", VTY_NEWLINE);
197
198
return CMD_SUCCESS;
199
}
200
201
osmo-hlr_1.6.2.tar.xz/src/hlr_vty_subscr.c -> osmo-hlr_1.7.0.tar.xz/src/hlr_vty_subscr.c
Changed
195
1
2
/* OsmoHLR subscriber management VTY implementation */
3
-/* (C) 2017 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
4
+/* (C) 2017-2023 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
5
* All Rights Reserved
6
*
7
* This program is free software; you can redistribute it and/or modify
8
9
static void subscr_dump_full_vty(struct vty *vty, struct hlr_subscriber *subscr)
10
{
11
int rc;
12
- struct osmo_sub_auth_data aud2g;
13
- struct osmo_sub_auth_data aud3g;
14
+ struct osmo_sub_auth_data2 aud2g;
15
+ struct osmo_sub_auth_data2 aud3g;
16
17
vty_out(vty, " ID: %"PRIu64"%s", subscr->id, VTY_NEWLINE);
18
19
20
21
if (aud2g.type != OSMO_AUTH_TYPE_NONE && aud2g.type != OSMO_AUTH_TYPE_GSM) {
22
vty_out(vty, "%% Error: 2G auth data is not of type 'GSM'%s", VTY_NEWLINE);
23
- aud2g = (struct osmo_sub_auth_data){};
24
+ aud2g = (struct osmo_sub_auth_data2){};
25
}
26
27
if (aud3g.type != OSMO_AUTH_TYPE_NONE && aud3g.type != OSMO_AUTH_TYPE_UMTS) {
28
vty_out(vty, "%% Error: 3G auth data is not of type 'UMTS'%s", VTY_NEWLINE);
29
- aud3g = (struct osmo_sub_auth_data){};
30
+ aud3g = (struct osmo_sub_auth_data2){};
31
}
32
33
if (aud2g.algo != OSMO_AUTH_ALG_NONE && aud2g.type != OSMO_AUTH_TYPE_NONE) {
34
35
36
if (aud3g.algo != OSMO_AUTH_ALG_NONE && aud3g.type != OSMO_AUTH_TYPE_NONE) {
37
vty_out(vty, " 3G auth: %s%s", osmo_auth_alg_name(aud3g.algo), VTY_NEWLINE);
38
- vty_out(vty, " K=%s%s", hexdump_buf(aud3g.u.umts.k), VTY_NEWLINE);
39
+ vty_out(vty, " K=%s%s",
40
+ osmo_hexdump_nospc(aud3g.u.umts.k, aud3g.u.umts.k_len), VTY_NEWLINE);
41
vty_out(vty, " %s=%s%s", aud3g.u.umts.opc_is_op? "OP" : "OPC",
42
- hexdump_buf(aud3g.u.umts.opc), VTY_NEWLINE);
43
+ osmo_hexdump_nospc(aud3g.u.umts.opc, aud3g.u.umts.opc_len), VTY_NEWLINE);
44
vty_out(vty, " IND-bitlen=%u", aud3g.u.umts.ind_bitlen);
45
if (aud3g.u.umts.sqn)
46
vty_out(vty, " last-SQN=%"PRIu64, aud3g.u.umts.sqn);
47
48
return false;
49
}
50
51
-#define AUTH_ALG_TYPES_2G "(comp128v1|comp128v2|comp128v3|xor)"
52
+#define AUTH_ALG_TYPES_2G "(comp128v1|comp128v2|comp128v3|xor-2g)"
53
#define AUTH_ALG_TYPES_2G_HELP \
54
"Use COMP128v1 algorithm\n" \
55
"Use COMP128v2 algorithm\n" \
56
"Use COMP128v3 algorithm\n" \
57
- "Use XOR algorithm\n"
58
+ "Use XOR-2G algorithm\n"
59
60
-#define AUTH_ALG_TYPES_3G "milenage"
61
+#define AUTH_ALG_TYPES_3G "(milenage|tuak)"
62
#define AUTH_ALG_TYPES_3G_HELP \
63
- "Use Milenage algorithm\n"
64
+ "Use Milenage algorithm\n" \
65
+ "Use TUAK algorithm\n"
66
67
bool auth_algo_parse(const char *alg_str, enum osmo_auth_algo *algo,
68
- int *minlen, int *maxlen)
69
+ int *minlen, int *maxlen, int *minlen_opc, int *maxlen_opc)
70
{
71
+ /* Default: no OPc. True for all 2G algorithms, and 3G-XOR. Overridden below for real 3G AKA algorithms. */
72
+ if (minlen_opc)
73
+ *minlen_opc = 0;
74
+ if (maxlen_opc)
75
+ *maxlen_opc = 0;
76
+
77
if (!strcasecmp(alg_str, "none")) {
78
*algo = OSMO_AUTH_ALG_NONE;
79
*minlen = *maxlen = 0;
80
81
} else if (!strcasecmp(alg_str, "comp128v3")) {
82
*algo = OSMO_AUTH_ALG_COMP128v3;
83
*minlen = *maxlen = A38_COMP128_KEY_LEN;
84
- } else if (!strcasecmp(alg_str, "xor")) {
85
- *algo = OSMO_AUTH_ALG_XOR;
86
+ } else if (!strcasecmp(alg_str, "xor-3g")) {
87
+ *algo = OSMO_AUTH_ALG_XOR_3G;
88
*minlen = A38_XOR_MIN_KEY_LEN;
89
*maxlen = A38_XOR_MAX_KEY_LEN;
90
+ } else if (!strcasecmp(alg_str, "xor-2g")) {
91
+ *algo = OSMO_AUTH_ALG_XOR_2G;
92
+ *minlen = *maxlen = A38_XOR2G_KEY_LEN;
93
} else if (!strcasecmp(alg_str, "milenage")) {
94
*algo = OSMO_AUTH_ALG_MILENAGE;
95
*minlen = *maxlen = MILENAGE_KEY_LEN;
96
+ if (minlen_opc)
97
+ *minlen_opc = MILENAGE_KEY_LEN;
98
+ if (maxlen_opc)
99
+ *maxlen_opc = MILENAGE_KEY_LEN;
100
+ } else if (!strcasecmp(alg_str, "tuak")) {
101
+ *algo = OSMO_AUTH_ALG_TUAK;
102
+ *minlen = 16;
103
+ *maxlen = 32;
104
+ if (minlen_opc)
105
+ *minlen_opc = 32;
106
+ if (maxlen_opc)
107
+ *maxlen_opc = 32;
108
} else
109
return false;
110
return true;
111
112
.u.gsm.ki = ki,
113
};
114
115
- if (!auth_algo_parse(alg_type, &aud2g.algo, &minlen, &maxlen)) {
116
+ if (!auth_algo_parse(alg_type, &aud2g.algo, &minlen, &maxlen, NULL, NULL)) {
117
vty_out(vty, "%% Unknown auth algorithm: '%s'%s", alg_type, VTY_NEWLINE);
118
return CMD_WARNING;
119
}
120
121
SUBSCR_UPDATE_HELP
122
"Set UMTS authentication data (3G, and 2G with UMTS AKA)\n"
123
AUTH_ALG_TYPES_3G_HELP
124
- "Set Encryption Key K\n" "K as 32 hexadecimal characters\n"
125
- "Set OP key\n" "Set OPC key\n" "OP or OPC as 32 hexadecimal characters\n"
126
+ "Set Encryption Key K\n" "K as 32/64 hexadecimal characters\n"
127
+ "Set OP key\n" "Set OPC key\n" "OP or OPC as 32/64 hexadecimal characters\n"
128
"Set IND bit length\n" "IND bit length value (default: 5)\n")
129
{
130
struct hlr_subscriber subscr;
131
- int minlen = 0;
132
- int maxlen = 0;
133
+ int minlen = 0, minlen_opc = 0;
134
+ int maxlen = 0, maxlen_opc = 0;
135
int rc;
136
const char *id_type = argv0;
137
const char *id = argv1;
138
- const char *alg_type = AUTH_ALG_TYPES_3G;
139
- const char *k = argv2;
140
- bool opc_is_op = (strcasecmp("op", argv3) == 0);
141
- const char *op_opc = argv4;
142
- int ind_bitlen = argc > 6? atoi(argv6) : 5;
143
+ const char *alg_type = argv2;
144
+ const char *k = argv3;
145
+ bool opc_is_op = (strcasecmp("op", argv4) == 0);
146
+ const char *op_opc = argv5;
147
+ int ind_bitlen = argc > 7 ? atoi(argv7) : 5;
148
struct sub_auth_data_str aud3g = {
149
.type = OSMO_AUTH_TYPE_UMTS,
150
.u.umts = {
151
152
},
153
};
154
155
- if (!auth_algo_parse(alg_type, &aud3g.algo, &minlen, &maxlen)) {
156
+ if (!auth_algo_parse(alg_type, &aud3g.algo, &minlen, &maxlen, &minlen_opc, &maxlen_opc)) {
157
vty_out(vty, "%% Unknown auth algorithm: '%s'%s", alg_type, VTY_NEWLINE);
158
return CMD_WARNING;
159
}
160
161
if (!is_hexkey_valid(vty, "K", aud3g.u.umts.k, minlen, maxlen))
162
return CMD_WARNING;
163
164
- if (!is_hexkey_valid(vty, opc_is_op ? "OP" : "OPC", aud3g.u.umts.opc,
165
- MILENAGE_KEY_LEN, MILENAGE_KEY_LEN))
166
+ if (!is_hexkey_valid(vty, opc_is_op ? "OP" : "OPC", aud3g.u.umts.opc, minlen_opc, maxlen_opc))
167
return CMD_WARNING;
168
169
if (get_subscr_by_argv(vty, id_type, id, &subscr))
170
171
172
DEFUN(subscriber_aud3g_xor,
173
subscriber_aud3g_xor_cmd,
174
- SUBSCR_UPDATE "aud3g xor k K"
175
+ SUBSCR_UPDATE "aud3g xor-3g k K"
176
" ind-bitlen <0-28>",
177
SUBSCR_UPDATE_HELP
178
"Set UMTS authentication data (3G, and 2G with UMTS AKA)\n"
179
- "Use XOR algorithm\n"
180
+ "Use XOR-3G algorithm\n"
181
"Set Encryption Key K\n" "K as 32 hexadecimal characters\n"
182
"Set IND bit length\n" "IND bit length value (default: 5)\n")
183
{
184
185
},
186
};
187
188
- if (!auth_algo_parse("xor", &aud3g.algo, &minlen, &maxlen)) {
189
- vty_out(vty, "%% Unknown auth algorithm: '%s'%s", "xor", VTY_NEWLINE);
190
+ if (!auth_algo_parse("xor-3g", &aud3g.algo, &minlen, &maxlen, NULL, NULL)) {
191
+ vty_out(vty, "%% Unknown auth algorithm: '%s'%s", "xor-3g", VTY_NEWLINE);
192
return CMD_WARNING;
193
}
194
195
osmo-hlr_1.6.2.tar.xz/src/lu_fsm.c -> osmo-hlr_1.7.0.tar.xz/src/lu_fsm.c
Changed
26
1
2
struct lu *lu = fi->priv;
3
struct hlr_subscriber *subscr = &lu->subscr;
4
struct osmo_gsup_message gsup;
5
- uint8_t msisdn_encOSMO_GSUP_MAX_CALLED_PARTY_BCD_LEN;
6
- uint8_t apnAPN_MAXLEN;
7
8
if (osmo_gsup_create_insert_subscriber_data_msg(&gsup, subscr->imsi,
9
- subscr->msisdn, msisdn_enc, sizeof(msisdn_enc),
10
- apn, sizeof(apn),
11
- lu->is_ps? OSMO_GSUP_CN_DOMAIN_PS : OSMO_GSUP_CN_DOMAIN_CS)) {
12
+ subscr->msisdn,
13
+ lu->is_ps ? OSMO_GSUP_CN_DOMAIN_PS : OSMO_GSUP_CN_DOMAIN_CS,
14
+ OTC_SELECT)) {
15
lu_failure(lu, GMM_CAUSE_NET_FAIL, "cannot encode Insert Subscriber Data message");
16
return;
17
}
18
19
20
case OSMO_GSUP_MSGT_INSERT_DATA_ERROR:
21
lu_failure(lu, GMM_CAUSE_NET_FAIL, "Rx %s", osmo_gsup_message_type_name(req->gsup.message_type));
22
+ osmo_gsup_req_free(req);
23
break;
24
25
default:
26
osmo-hlr_1.6.2.tar.xz/src/mslookup/Makefile.am -> osmo-hlr_1.7.0.tar.xz/src/mslookup/Makefile.am
Changed
10
1
2
# This is _NOT_ the library release version, it's an API version.
3
# Please read chapter "Library interface versions" of the libtool documentation
4
# before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html
5
-LIBVERSION=1:0:0
6
+LIBVERSION=1:1:0
7
8
AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)/include
9
AM_CFLAGS = -fPIC -Wall $(PCSC_CFLAGS) $(TALLOC_CFLAGS) $(LIBOSMOCORE_CFLAGS)
10
osmo-hlr_1.6.2.tar.xz/src/mslookup/osmo-mslookup-client.c -> osmo-hlr_1.7.0.tar.xz/src/mslookup/osmo-mslookup-client.c
Changed
23
1
2
{
3
struct osmo_fd *ofd = &c->ofd;
4
5
+ osmo_fd_unregister(ofd);
6
close(ofd->fd);
7
ofd->fd = -1;
8
- osmo_fd_unregister(ofd);
9
10
llist_del(&c->entry);
11
talloc_free(c);
12
13
llist_for_each_entry_safe(c, n, &globals.socket_clients, entry)
14
socket_client_close(c);
15
if (osmo_fd_is_registered(&globals.socket_ofd)) {
16
+ osmo_fd_unregister(&globals.socket_ofd);
17
close(globals.socket_ofd.fd);
18
globals.socket_ofd.fd = -1;
19
- osmo_fd_unregister(&globals.socket_ofd);
20
}
21
}
22
23
osmo-hlr_1.6.2.tar.xz/tests/auc/Makefile.am -> osmo-hlr_1.7.0.tar.xz/tests/auc/Makefile.am
Changed
37
1
2
3
AM_CPPFLAGS = \
4
$(all_includes) \
5
+ -I$(top_srcdir)/include \
6
$(NULL)
7
8
AM_CFLAGS = \
9
-Wall \
10
-ggdb3 \
11
- -I$(top_srcdir)/include \
12
$(LIBOSMOCORE_CFLAGS) \
13
$(LIBOSMOGSM_CFLAGS) \
14
$(NULL)
15
16
$(NULL)
17
18
auc_test_LDADD = \
19
- $(top_srcdir)/src/auc.c \
20
- $(top_srcdir)/src/logging.c \
21
+ $(top_builddir)/src/auc.o \
22
+ $(top_builddir)/src/logging.o \
23
$(LIBOSMOCORE_LIBS) \
24
$(LIBOSMOGSM_LIBS) \
25
$(NULL)
26
27
$(NULL)
28
29
auc_ts_55_205_test_sets_LDADD = \
30
- $(top_srcdir)/src/auc.c \
31
- $(top_srcdir)/src/logging.c \
32
+ $(top_builddir)/src/auc.o \
33
+ $(top_builddir)/src/logging.o \
34
$(LIBOSMOCORE_LIBS) \
35
$(LIBOSMOGSM_LIBS) \
36
$(NULL)
37
osmo-hlr_1.6.2.tar.xz/tests/auc/auc_test.c -> osmo-hlr_1.7.0.tar.xz/tests/auc/auc_test.c
Changed
164
1
2
/* Subscriber with 2G-only (COMP128v1) authentication data */
3
static void test_gen_vectors_2g_only(void)
4
{
5
- struct osmo_sub_auth_data aud2g;
6
- struct osmo_sub_auth_data aud3g;
7
+ struct osmo_sub_auth_data2 aud2g;
8
+ struct osmo_sub_auth_data2 aud3g;
9
struct osmo_auth_vector vec;
10
int rc;
11
12
comment_start();
13
14
- aud2g = (struct osmo_sub_auth_data){
15
+ aud2g = (struct osmo_sub_auth_data2){
16
.type = OSMO_AUTH_TYPE_GSM,
17
.algo = OSMO_AUTH_ALG_COMP128v1,
18
};
19
20
osmo_hexparse("EB215756028D60E3275E613320AEC880",
21
aud2g.u.gsm.ki, sizeof(aud2g.u.gsm.ki));
22
23
- aud3g = (struct osmo_sub_auth_data){ 0 };
24
+ aud3g = (struct osmo_sub_auth_data2){ 0 };
25
26
next_rand("39fa2f4e3d523d8619a73b4f65c3e14d", true);
27
28
29
* reflects the default configuration of sysmoUSIM-SJS1 */
30
static void test_gen_vectors_2g_plus_3g(void)
31
{
32
- struct osmo_sub_auth_data aud2g;
33
- struct osmo_sub_auth_data aud3g;
34
+ struct osmo_sub_auth_data2 aud2g;
35
+ struct osmo_sub_auth_data2 aud3g;
36
struct osmo_auth_vector vec;
37
int rc;
38
39
comment_start();
40
41
- aud2g = (struct osmo_sub_auth_data){
42
+ aud2g = (struct osmo_sub_auth_data2){
43
.type = OSMO_AUTH_TYPE_GSM,
44
.algo = OSMO_AUTH_ALG_COMP128v1,
45
};
46
47
osmo_hexparse("EB215756028D60E3275E613320AEC880",
48
aud2g.u.gsm.ki, sizeof(aud2g.u.gsm.ki));
49
50
- aud3g = (struct osmo_sub_auth_data){
51
+ aud3g = (struct osmo_sub_auth_data2){
52
.type = OSMO_AUTH_TYPE_UMTS,
53
.algo = OSMO_AUTH_ALG_MILENAGE,
54
+ .u.umts.k_len = 16,
55
+ .u.umts.opc_len = 16,
56
.u.umts.sqn = 31,
57
};
58
59
60
* tuples are suitable for both 2G and 3G authentication */
61
static void test_gen_vectors_3g_only(void)
62
{
63
- struct osmo_sub_auth_data aud2g;
64
- struct osmo_sub_auth_data aud3g;
65
+ struct osmo_sub_auth_data2 aud2g;
66
+ struct osmo_sub_auth_data2 aud3g;
67
struct osmo_auth_vector vec;
68
struct osmo_auth_vector vecs3;
69
uint8_t auts14;
70
71
72
comment_start();
73
74
- aud2g = (struct osmo_sub_auth_data){ 0 };
75
+ aud2g = (struct osmo_sub_auth_data2){ 0 };
76
77
- aud3g = (struct osmo_sub_auth_data){
78
+ aud3g = (struct osmo_sub_auth_data2){
79
.type = OSMO_AUTH_TYPE_UMTS,
80
.algo = OSMO_AUTH_ALG_MILENAGE,
81
+ .u.umts.k_len = 16,
82
+ .u.umts.opc_len = 16,
83
.u.umts.sqn = 31,
84
};
85
86
87
* 2G and 3G authentication */
88
static void test_gen_vectors_3g_xor(void)
89
{
90
- struct osmo_sub_auth_data aud2g;
91
- struct osmo_sub_auth_data aud3g;
92
+ struct osmo_sub_auth_data2 aud2g;
93
+ struct osmo_sub_auth_data2 aud3g;
94
struct osmo_auth_vector vec;
95
int rc;
96
97
comment_start();
98
99
- aud2g = (struct osmo_sub_auth_data){ 0 };
100
+ aud2g = (struct osmo_sub_auth_data2){ 0 };
101
102
- aud3g = (struct osmo_sub_auth_data){
103
+ aud3g = (struct osmo_sub_auth_data2){
104
.type = OSMO_AUTH_TYPE_UMTS,
105
- .algo = OSMO_AUTH_ALG_XOR,
106
+ .algo = OSMO_AUTH_ALG_XOR_3G,
107
+ .u.umts.k_len = 16,
108
+ .u.umts.opc_len = 16,
109
.u.umts.sqn = 0,
110
};
111
112
113
int rc;
114
int i;
115
116
- struct osmo_sub_auth_data aud2g = {
117
+ struct osmo_sub_auth_data2 aud2g = {
118
.type = OSMO_AUTH_TYPE_GSM,
119
.algo = OSMO_AUTH_ALG_COMP128v1,
120
};
121
122
- struct osmo_sub_auth_data aud3g = {
123
+ struct osmo_sub_auth_data2 aud3g = {
124
.type = OSMO_AUTH_TYPE_UMTS,
125
.algo = OSMO_AUTH_ALG_MILENAGE,
126
+ .u.umts.k_len = 16,
127
+ .u.umts.opc_len = 16,
128
};
129
130
- struct osmo_sub_auth_data aud2g_noalg = {
131
+ struct osmo_sub_auth_data2 aud2g_noalg = {
132
.type = OSMO_AUTH_TYPE_GSM,
133
.algo = OSMO_AUTH_ALG_NONE,
134
};
135
136
- struct osmo_sub_auth_data aud3g_noalg = {
137
+ struct osmo_sub_auth_data2 aud3g_noalg = {
138
.type = OSMO_AUTH_TYPE_UMTS,
139
.algo = OSMO_AUTH_ALG_NONE,
140
+ .u.umts.k_len = 16,
141
+ .u.umts.opc_len = 16,
142
};
143
144
- struct osmo_sub_auth_data aud_notype = {
145
+ struct osmo_sub_auth_data2 aud_notype = {
146
.type = OSMO_AUTH_TYPE_NONE,
147
.algo = OSMO_AUTH_ALG_MILENAGE,
148
};
149
150
- struct osmo_sub_auth_data no_aud = {
151
+ struct osmo_sub_auth_data2 no_aud = {
152
.type = OSMO_AUTH_TYPE_NONE,
153
.algo = OSMO_AUTH_ALG_NONE,
154
};
155
156
struct {
157
- struct osmo_sub_auth_data *aud2g;
158
- struct osmo_sub_auth_data *aud3g;
159
+ struct osmo_sub_auth_data2 *aud2g;
160
+ struct osmo_sub_auth_data2 *aud3g;
161
uint8_t *rand_auts;
162
uint8_t *auts;
163
const char *label;
164
osmo-hlr_1.6.2.tar.xz/tests/auc/gen_ts_55_205_test_sets/func_template.c -> osmo-hlr_1.7.0.tar.xz/tests/auc/gen_ts_55_205_test_sets/func_template.c
Changed
78
1
2
3
static void {func_name}(void)
4
{{
5
- struct osmo_sub_auth_data aud2g;
6
- struct osmo_sub_auth_data aud3g;
7
- struct osmo_auth_vector vec;
8
- int rc;
9
-
10
- comment_start();
11
-
12
- aud2g = (struct osmo_sub_auth_data){{ 0 }};
13
-
14
- aud3g = (struct osmo_sub_auth_data){{
15
- .type = OSMO_AUTH_TYPE_UMTS,
16
- .algo = OSMO_AUTH_ALG_MILENAGE,
17
+ struct osmo_sub_auth_data2 aud2g;
18
+ struct osmo_sub_auth_data2 aud3g;
19
+ struct osmo_auth_vector vec;
20
+ int rc;
21
+
22
+ comment_start();
23
+
24
+ aud2g = (struct osmo_sub_auth_data2){{ 0 }};
25
+
26
+ aud3g = (struct osmo_sub_auth_data2){{
27
+ .type = OSMO_AUTH_TYPE_UMTS,
28
+ .algo = OSMO_AUTH_ALG_MILENAGE,
29
+ .u.umts.k_len = 16,
30
+ .u.umts.opc_len = 16,
31
.u.umts.sqn = 31,
32
- }};
33
+ }};
34
35
- osmo_hexparse("{Ki}",
36
- aud3g.u.umts.k, sizeof(aud3g.u.umts.k));
37
- osmo_hexparse("{OPc}",
38
- aud3g.u.umts.opc, sizeof(aud3g.u.umts.opc));
39
+ osmo_hexparse("{Ki}",
40
+ aud3g.u.umts.k, sizeof(aud3g.u.umts.k));
41
+ osmo_hexparse("{OPc}",
42
+ aud3g.u.umts.opc, sizeof(aud3g.u.umts.opc));
43
44
- osmo_hexparse("{RAND}",
45
- fake_rand, sizeof(fake_rand));
46
+ osmo_hexparse("{RAND}",
47
+ fake_rand, sizeof(fake_rand));
48
49
- vec = (struct osmo_auth_vector){{ {{0}} }};
50
+ vec = (struct osmo_auth_vector){{ {{0}} }};
51
+ vec.res_len = 8;
52
VERBOSE_ASSERT(aud3g.u.umts.sqn, == 31, "%"PRIu64);
53
- rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL);
54
- VERBOSE_ASSERT(rc, == 1, "%d");
55
+ rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL);
56
+ VERBOSE_ASSERT(rc, == 1, "%d");
57
VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64);
58
59
- VEC_IS(&vec,
60
- " rand: {RAND}\n"
61
- " ck: {MIL3G-CK}\n"
62
- " ik: {MIL3G-IK}\n"
63
- " res: {MIL3G-RES}0000000000000000\n"
64
- " kc: {Kc}\n"
65
- " sres: {SRES#1}\n"
66
- );
67
+ VEC_IS(&vec,
68
+ " rand: {RAND}\n"
69
+ " ck: {MIL3G-CK}\n"
70
+ " ik: {MIL3G-IK}\n"
71
+ " res: {MIL3G-RES}0000000000000000\n"
72
+ " kc: {Kc}\n"
73
+ " sres: {SRES#1}\n"
74
+ );
75
76
comment_end();
77
}}
78
osmo-hlr_1.6.2.tar.xz/tests/auc/gen_ts_55_205_test_sets/main_template.c -> osmo-hlr_1.7.0.tar.xz/tests/auc/gen_ts_55_205_test_sets/main_template.c
Changed
19
1
2
if (pos >= end) \
3
return buf; \
4
pos += snprintf(pos, sizeof(buf) - (pos - buf), \
5
- " " #what ": %s\n", \
6
+ " " #what ": %s\n", \
7
osmo_hexdump_nospc((void*)&vec->what, sizeof(vec->what)))
8
9
append(rand);
10
11
12
#define VEC_IS(vec, expect) do { \
13
char *_is = vec_str(vec); \
14
- if (strcmp(_is, expect)) { \
15
+ if (strcmp(_is, expect)) { \
16
fprintf(stderr, "MISMATCH! expected ==\n%s\n", \
17
expect); \
18
char *a = _is; \
19
osmo-hlr_1.6.2.tar.xz/tests/db/Makefile.am -> osmo-hlr_1.7.0.tar.xz/tests/db/Makefile.am
Changed
13
1
2
-AM_CFLAGS = \
3
+AM_CPPFLAGS = \
4
$(all_includes) \
5
-I$(top_srcdir)/include \
6
-I$(top_builddir)/include \
7
+ $(NULL)
8
+
9
+AM_CFLAGS = \
10
-Wall \
11
-ggdb3 \
12
$(LIBOSMOCORE_CFLAGS) \
13
osmo-hlr_1.6.2.tar.xz/tests/db/db_test.c -> osmo-hlr_1.7.0.tar.xz/tests/db/db_test.c
Changed
99
1
2
/* Not linking the real auc_compute_vectors(), just returning num_vec.
3
* This gets called by db_get_auc(), but we're only interested in its rc. */
4
int auc_compute_vectors(struct osmo_auth_vector *vec, unsigned int num_vec,
5
- struct osmo_sub_auth_data *aud2g,
6
- struct osmo_sub_auth_data *aud3g,
7
+ struct osmo_sub_auth_data2 *aud2g,
8
+ struct osmo_sub_auth_data2 *aud3g,
9
const uint8_t *rand_auts, const uint8_t *auts)
10
{ return num_vec; }
11
12
static struct db_context *dbc = NULL;
13
static void *ctx = NULL;
14
static struct hlr_subscriber g_subscr;
15
-static struct osmo_sub_auth_data g_aud2g;
16
-static struct osmo_sub_auth_data g_aud3g;
17
+static struct osmo_sub_auth_data2 g_aud2g;
18
+static struct osmo_sub_auth_data2 g_aud3g;
19
static int g_rc;
20
static int64_t g_id;
21
22
23
#undef Pb
24
}
25
26
-void dump_aud(const char *label, struct osmo_sub_auth_data *aud)
27
+void dump_aud(const char *label, struct osmo_sub_auth_data2 *aud)
28
{
29
if (aud->type == OSMO_AUTH_TYPE_NONE) {
30
fprintf(stderr, "%s: none\n", label);
31
return;
32
}
33
34
- fprintf(stderr, "%s: struct osmo_sub_auth_data {\n", label);
35
+ fprintf(stderr, "%s: struct osmo_sub_auth_data2 {\n", label);
36
#define Pf(name, fmt) \
37
Pfo(name, fmt, aud)
38
#define Phex(name) \
39
Pfv(name, "'%s'", osmo_hexdump_nospc(aud->name, sizeof(aud->name)))
40
+#define Phexl(name, len) \
41
+ Pfv(name, "'%s'", osmo_hexdump_nospc(aud->name, aud->len))
42
+
43
44
Pfv(type, "%s", osmo_sub_auth_type_name(aud->type));
45
Pfv(algo, "%s", osmo_auth_alg_name(aud->algo));
46
47
Phex(u.gsm.ki);
48
break;
49
case OSMO_AUTH_TYPE_UMTS:
50
- Phex(u.umts.opc);
51
+ Phexl(u.umts.opc, u.umts.opc_len);
52
Pf(u.umts.opc_is_op, "%u");
53
- Phex(u.umts.k);
54
+ Phexl(u.umts.k, u.umts.k_len);
55
Phex(u.umts.amf);
56
if (aud->u.umts.sqn) {
57
Pf(u.umts.sqn, "%"PRIu64);
58
59
60
#undef Pf
61
#undef Phex
62
+#undef Phexl
63
}
64
65
void db_raw_sql(struct db_context *dbc, const char *sql)
66
67
ASSERT_SEL_AUD(imsi0, 0, id);
68
69
ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
70
- mk_aud_2g(OSMO_AUTH_ALG_XOR, "CededEffacedAceFacedBadFadedBeef")),
71
+ mk_aud_2g(OSMO_AUTH_ALG_XOR_2G, "CededEffacedAceFacedBadFadedBeef")),
72
0);
73
ASSERT_SEL_AUD(imsi0, 0, id);
74
75
76
-ENOENT);
77
78
ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
79
- mk_aud_2g(OSMO_AUTH_ALG_XOR, "CededEffacedAceFacedBadFadedBeef")),
80
+ mk_aud_2g(OSMO_AUTH_ALG_XOR_2G, "CededEffacedAceFacedBadFadedBeef")),
81
0);
82
ASSERT_SEL_AUD(imsi0, 0, id);
83
84
85
ASSERT_SEL_AUD(imsi0, 0, id);
86
87
ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
88
- mk_aud_2g(OSMO_AUTH_ALG_XOR, "f000000000000f00000000000f000000f00000000")),
89
+ mk_aud_2g(OSMO_AUTH_ALG_XOR_2G, "f000000000000f00000000000f000000f00000000")),
90
-EINVAL);
91
ASSERT_SEL_AUD(imsi0, 0, id);
92
93
ASSERT_RC(db_subscr_update_aud_by_id(dbc, id,
94
- mk_aud_2g(OSMO_AUTH_ALG_XOR, "f00")),
95
+ mk_aud_2g(OSMO_AUTH_ALG_XOR_2G, "f00")),
96
-EINVAL);
97
ASSERT_SEL_AUD(imsi0, 0, id);
98
99
osmo-hlr_1.6.2.tar.xz/tests/db/db_test.err -> osmo-hlr_1.7.0.tar.xz/tests/db/db_test.err
Changed
201
1
2
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
3
DAUC IMSI='123456789000000': No 3G Auth Data
4
5
-2G: struct osmo_sub_auth_data {
6
+2G: struct osmo_sub_auth_data2 {
7
.type = GSM,
8
.algo = COMP128v1,
9
.u.gsm.ki = '0123456789abcdef0123456789abcdef',
10
11
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
12
DAUC IMSI='123456789000000': No 3G Auth Data
13
14
-2G: struct osmo_sub_auth_data {
15
+2G: struct osmo_sub_auth_data2 {
16
.type = GSM,
17
.algo = COMP128v1,
18
.u.gsm.ki = '0123456789abcdef0123456789abcdef',
19
20
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
21
DAUC IMSI='123456789000000': No 3G Auth Data
22
23
-2G: struct osmo_sub_auth_data {
24
+2G: struct osmo_sub_auth_data2 {
25
.type = GSM,
26
.algo = COMP128v2,
27
.u.gsm.ki = 'beadedbeeaced1ebbeddefacedfacade',
28
29
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
30
DAUC IMSI='123456789000000': No 3G Auth Data
31
32
-2G: struct osmo_sub_auth_data {
33
+2G: struct osmo_sub_auth_data2 {
34
.type = GSM,
35
.algo = COMP128v3,
36
.u.gsm.ki = 'deafbeddedbabeacceededfadeddecaf',
37
}
38
3G: none
39
40
-db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_XOR, "CededEffacedAceFacedBadFadedBeef")) --> 0
41
+db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_XOR_2G, "CededEffacedAceFacedBadFadedBeef")) --> 0
42
43
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
44
DAUC IMSI='123456789000000': No 3G Auth Data
45
46
-2G: struct osmo_sub_auth_data {
47
+2G: struct osmo_sub_auth_data2 {
48
.type = GSM,
49
- .algo = XOR,
50
+ .algo = XOR-2G,
51
.u.gsm.ki = 'cededeffacedacefacedbadfadedbeef',
52
}
53
3G: none
54
55
56
db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_NONE, NULL)) --> -ENOENT
57
58
-db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_XOR, "CededEffacedAceFacedBadFadedBeef")) --> 0
59
+db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_XOR_2G, "CededEffacedAceFacedBadFadedBeef")) --> 0
60
61
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
62
DAUC IMSI='123456789000000': No 3G Auth Data
63
64
-2G: struct osmo_sub_auth_data {
65
+2G: struct osmo_sub_auth_data2 {
66
.type = GSM,
67
- .algo = XOR,
68
+ .algo = XOR-2G,
69
.u.gsm.ki = 'cededeffacedacefacedbadfadedbeef',
70
}
71
3G: none
72
73
DAUC IMSI='123456789000000': No 2G Auth Data
74
75
2G: none
76
-3G: struct osmo_sub_auth_data {
77
+3G: struct osmo_sub_auth_data2 {
78
.type = UMTS,
79
.algo = MILENAGE,
80
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
81
82
DAUC IMSI='123456789000000': No 2G Auth Data
83
84
2G: none
85
-3G: struct osmo_sub_auth_data {
86
+3G: struct osmo_sub_auth_data2 {
87
.type = UMTS,
88
.algo = MILENAGE,
89
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
90
91
DAUC IMSI='123456789000000': No 2G Auth Data
92
93
2G: none
94
-3G: struct osmo_sub_auth_data {
95
+3G: struct osmo_sub_auth_data2 {
96
.type = UMTS,
97
.algo = MILENAGE,
98
.u.umts.opc = 'deaf0ff1ced0d0dabbedd1ced1cef00d',
99
100
DAUC IMSI='123456789000000': No 2G Auth Data
101
102
2G: none
103
-3G: struct osmo_sub_auth_data {
104
+3G: struct osmo_sub_auth_data2 {
105
.type = UMTS,
106
.algo = MILENAGE,
107
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
108
109
DAUC IMSI='123456789000000': No 2G Auth Data
110
111
2G: none
112
-3G: struct osmo_sub_auth_data {
113
+3G: struct osmo_sub_auth_data2 {
114
.type = UMTS,
115
.algo = MILENAGE,
116
.u.umts.opc = 'cededeffacedacefacedbadfadedbeef',
117
118
DAUC IMSI='123456789000000': No 2G Auth Data
119
120
2G: none
121
-3G: struct osmo_sub_auth_data {
122
+3G: struct osmo_sub_auth_data2 {
123
.type = UMTS,
124
.algo = MILENAGE,
125
.u.umts.opc = 'cededeffacedacefacedbadfadedbeef',
126
127
128
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
129
130
-2G: struct osmo_sub_auth_data {
131
+2G: struct osmo_sub_auth_data2 {
132
.type = GSM,
133
.algo = COMP128v3,
134
.u.gsm.ki = 'cededeffacedacefacedbadfadedbeef',
135
}
136
-3G: struct osmo_sub_auth_data {
137
+3G: struct osmo_sub_auth_data2 {
138
.type = UMTS,
139
.algo = MILENAGE,
140
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
141
142
143
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
144
145
-2G: struct osmo_sub_auth_data {
146
+2G: struct osmo_sub_auth_data2 {
147
.type = GSM,
148
.algo = COMP128v3,
149
.u.gsm.ki = 'cededeffacedacefacedbadfadedbeef',
150
}
151
-3G: struct osmo_sub_auth_data {
152
+3G: struct osmo_sub_auth_data2 {
153
.type = UMTS,
154
.algo = MILENAGE,
155
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
156
157
.u.umts.ind_bitlen = 5,
158
}
159
160
-db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_XOR, "f000000000000f00000000000f000000f00000000")) --> -EINVAL
161
+db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_XOR_2G, "f000000000000f00000000000f000000f00000000")) --> -EINVAL
162
DAUC Cannot update auth tokens: Invalid KI: 'f000000000000f00000000000f000000f00000000'
163
164
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
165
166
-2G: struct osmo_sub_auth_data {
167
+2G: struct osmo_sub_auth_data2 {
168
.type = GSM,
169
.algo = COMP128v3,
170
.u.gsm.ki = 'cededeffacedacefacedbadfadedbeef',
171
}
172
-3G: struct osmo_sub_auth_data {
173
+3G: struct osmo_sub_auth_data2 {
174
.type = UMTS,
175
.algo = MILENAGE,
176
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
177
178
.u.umts.ind_bitlen = 5,
179
}
180
181
-db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_XOR, "f00")) --> -EINVAL
182
+db_subscr_update_aud_by_id(dbc, id, mk_aud_2g(OSMO_AUTH_ALG_XOR_2G, "f00")) --> -EINVAL
183
DAUC Cannot update auth tokens: Invalid KI: 'f00'
184
185
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
186
187
-2G: struct osmo_sub_auth_data {
188
+2G: struct osmo_sub_auth_data2 {
189
.type = GSM,
190
.algo = COMP128v3,
191
.u.gsm.ki = 'cededeffacedacefacedbadfadedbeef',
192
}
193
-3G: struct osmo_sub_auth_data {
194
+3G: struct osmo_sub_auth_data2 {
195
.type = UMTS,
196
.algo = MILENAGE,
197
.u.umts.opc = 'beefedcafefaceacedaddeddecadefee',
198
199
200
db_get_auth_data(dbc, imsi0, &g_aud2g, &g_aud3g, &g_id) --> 0
201
osmo-hlr_1.6.2.tar.xz/tests/db_upgrade/create_subscribers.vty -> osmo-hlr_1.7.0.tar.xz/tests/db_upgrade/create_subscribers.vty
Changed
8
1
2
MSISDN: none
3
OsmoHLR# subscriber imsi 5555555 update msisdn 55555555555555
4
% Updated subscriber IMSI='5555555' to MSISDN='55555555555555'
5
-OsmoHLR# subscriber imsi 5555555 update aud2g xor ki 55555555555555555555555555555555
6
+OsmoHLR# subscriber imsi 5555555 update aud2g xor-2g ki 55555555555555555555555555555555
7
OsmoHLR# subscriber imsi 5555555 update aud3g milenage k 55555555555555555555555555555555 opc 55555555555555555555555555555555
8
osmo-hlr_1.6.2.tar.xz/tests/db_upgrade/db_upgrade_test.ok -> osmo-hlr_1.7.0.tar.xz/tests/db_upgrade/db_upgrade_test.ok
Changed
45
1
2
algo_id_2g|ki|subscriber_id
3
1|BeefedCafeFaceAcedAddedDecadeFee|1
4
2|33333333333333333333333333333333|4
5
-4|55555555555555555555555555555555|6
6
+6|55555555555555555555555555555555|6
7
8
Table: auc_3g
9
name|type|notnull|dflt_value|pk
10
11
DDB Database <PATH>test.db' has been upgraded to HLR DB schema version 4
12
DDB Database <PATH>test.db' has been upgraded to HLR DB schema version 5
13
DDB Database <PATH>test.db' has been upgraded to HLR DB schema version 6
14
+DDB Database <PATH>test.db' has been upgraded to HLR DB schema version 7
15
DMAIN Cmdline option --db-check: Database was opened successfully, quitting.
16
17
Resulting db:
18
19
algo_id_2g|ki|subscriber_id
20
1|BeefedCafeFaceAcedAddedDecadeFee|1
21
2|33333333333333333333333333333333|4
22
-4|55555555555555555555555555555555|6
23
+6|55555555555555555555555555555555|6
24
25
Table: auc_3g
26
name|type|notnull|dflt_value|pk
27
algo_id_3g|INTEGER|1||0
28
ind_bitlen|INTEGER|1|5|0
29
-k|VARCHAR(32)|1||0
30
-op|VARCHAR(32)|0||0
31
-opc|VARCHAR(32)|0||0
32
+k|VARCHAR(64)|1||0
33
+op|VARCHAR(64)|0||0
34
+opc|VARCHAR(64)|0||0
35
sqn|INTEGER|1|0|0
36
subscriber_id|INTEGER|0||1
37
38
39
rc = 0
40
DMAIN hlr starting
41
DDB using database: <PATH>test.db
42
-DDB Database <PATH>test.db' has HLR DB schema version 6
43
+DDB Database <PATH>test.db' has HLR DB schema version 7
44
DMAIN Cmdline option --db-check: Database was opened successfully, quitting.
45
osmo-hlr_1.6.2.tar.xz/tests/db_upgrade/hlr_db_v0.sql -> osmo-hlr_1.7.0.tar.xz/tests/db_upgrade/hlr_db_v0.sql
Changed
10
1
2
);
3
INSERT INTO auc_2g VALUES(1,1,'BeefedCafeFaceAcedAddedDecadeFee');
4
INSERT INTO auc_2g VALUES(4,2,'33333333333333333333333333333333');
5
-INSERT INTO auc_2g VALUES(6,4,'55555555555555555555555555555555');
6
+INSERT INTO auc_2g VALUES(6,6,'55555555555555555555555555555555');
7
CREATE TABLE auc_3g (
8
subscriber_id INTEGER PRIMARY KEY, -- subscriber.id
9
algo_id_3g INTEGER NOT NULL, -- enum osmo_auth_algo value
10
osmo-hlr_1.6.2.tar.xz/tests/gsup/Makefile.am -> osmo-hlr_1.7.0.tar.xz/tests/gsup/Makefile.am
Changed
12
1
2
AM_CPPFLAGS = \
3
$(all_includes) \
4
+ -I$(top_srcdir)/include \
5
$(NULL)
6
7
AM_CFLAGS = \
8
- -I$(top_srcdir)/include \
9
$(LIBOSMOCORE_CFLAGS) \
10
$(LIBOSMOGSM_CFLAGS) \
11
$(NULL)
12
osmo-hlr_1.6.2.tar.xz/tests/mslookup/Makefile.am -> osmo-hlr_1.7.0.tar.xz/tests/mslookup/Makefile.am
Changed
14
1
2
AM_CPPFLAGS = \
3
$(all_includes) \
4
+ -I$(top_srcdir)/include \
5
$(NULL)
6
7
AM_CFLAGS = \
8
-Wall \
9
-ggdb3 \
10
- -I$(top_srcdir)/include \
11
$(LIBOSMOCORE_CFLAGS) \
12
$(LIBOSMOGSM_CFLAGS) \
13
$(LIBOSMOABIS_CFLAGS) \
14
osmo-hlr_1.6.2.tar.xz/tests/test_nodes.vty -> osmo-hlr_1.7.0.tar.xz/tests/test_nodes.vty
Changed
67
1
2
OsmoHLR(config-hlr)# list
3
...
4
gsup
5
+ ps
6
database PATH
7
euse NAME
8
no euse NAME
9
10
ipa-name unnamed-HLR
11
ussd route prefix *#100# internal own-msisdn
12
ussd route prefix *#101# internal own-imsi
13
+ ps
14
+ pdp-profiles default
15
+ profile 1
16
+ apn internet
17
+ profile 2
18
+ apn *
19
end
20
21
OsmoHLR# configure terminal
22
23
client
24
mdns bind 239.192.23.42 4266
25
...
26
+OsmoHLR(config-mslookup-server)# end
27
+OsmoHLR# configure terminal
28
+
29
+OsmoHLR(config)# hlr
30
+OsmoHLR(config-hlr)# ps?
31
+ ps Configure the PS options
32
+
33
+OsmoHLR(config-hlr)# ps
34
+
35
+OsmoHLR(config-hlr-ps)# list
36
+...
37
+ pdp-profiles default
38
+ no pdp-profiles default
39
+...
40
+OsmoHLR(config-hlr-ps)# no pdp-profiles default
41
+
42
+
43
+OsmoHLR(config-hlr-ps)# pdp-profiles default
44
+OsmoHLR(config-hlr-ps-pdp-profiles)# ?
45
+...
46
+ profile Configure a PDP profile
47
+...
48
+OsmoHLR(config-hlr-ps-pdp-profiles)# profile 1
49
+
50
+OsmoHLR(config-hlr-ps-pdp-profile)# ?
51
+...
52
+ apn Configure the APN.
53
+...
54
+OsmoHLR(config-hlr-ps-pdp-profile)# apn internet
55
+OsmoHLR(config-hlr-ps-pdp-profile)# exit
56
+OsmoHLR(config-hlr-ps-pdp-profiles)# profile 2
57
+OsmoHLR(config-hlr-ps-pdp-profile)# apn *
58
+OsmoHLR(config-hlr-ps-pdp-profile)# show running-config
59
+...
60
+ ps
61
+ pdp-profiles default
62
+ profile 1
63
+ apn internet
64
+ profile 2
65
+ apn *
66
+...
67
osmo-hlr_1.6.2.tar.xz/tests/test_subscriber.ctrl -> osmo-hlr_1.7.0.tar.xz/tests/test_subscriber.ctrl
Changed
15
1
2
GET 112 subscriber.by-imsi-901991234567891.aud2g
3
GET_REPLY 112 subscriber.by-imsi-901991234567891.aud2g none
4
5
-SET 113 subscriber.by-imsi-901991234567891.aud2g xor,c01ffedc1cadaeac1d1f1edacac1ab0a
6
+SET 113 subscriber.by-imsi-901991234567891.aud2g xor-2g,c01ffedc1cadaeac1d1f1edacac1ab0a
7
SET_REPLY 113 subscriber.by-imsi-901991234567891.aud2g OK
8
9
+GET 114 subscriber.by-imsi-901991234567891.aud2g
10
+GET_REPLY 114 subscriber.by-imsi-901991234567891.aud2g XOR-2G,c01ffedc1cadaeac1d1f1edacac1ab0a
11
+
12
SET 115 subscriber.by-imsi-901991234567891.aud2g none
13
SET_REPLY 115 subscriber.by-imsi-901991234567891.aud2g OK
14
15
osmo-hlr_1.6.2.tar.xz/tests/test_subscriber.vty -> osmo-hlr_1.7.0.tar.xz/tests/test_subscriber.vty
Changed
82
1
2
subscriber (imsi|msisdn|id|imei) IDENT delete
3
subscriber (imsi|msisdn|id|imei) IDENT update msisdn (none|MSISDN)
4
subscriber (imsi|msisdn|id|imei) IDENT update aud2g none
5
- subscriber (imsi|msisdn|id|imei) IDENT update aud2g (comp128v1|comp128v2|comp128v3|xor) ki KI
6
+ subscriber (imsi|msisdn|id|imei) IDENT update aud2g (comp128v1|comp128v2|comp128v3|xor-2g) ki KI
7
subscriber (imsi|msisdn|id|imei) IDENT update aud3g none
8
- subscriber (imsi|msisdn|id|imei) IDENT update aud3g milenage k K (op|opc) OP_C ind-bitlen <0-28>
9
- subscriber (imsi|msisdn|id|imei) IDENT update aud3g xor k K ind-bitlen <0-28>
10
+ subscriber (imsi|msisdn|id|imei) IDENT update aud3g (milenage|tuak) k K (op|opc) OP_C ind-bitlen <0-28>
11
+ subscriber (imsi|msisdn|id|imei) IDENT update aud3g xor-3g k K ind-bitlen <0-28>
12
subscriber (imsi|msisdn|id|imei) IDENT update imei (none|IMEI)
13
subscriber (imsi|msisdn|id|imei) IDENT update network-access-mode (none|cs|ps|cs+ps)
14
show mslookup services
15
16
comp128v1 Use COMP128v1 algorithm
17
comp128v2 Use COMP128v2 algorithm
18
comp128v3 Use COMP128v3 algorithm
19
- xor Use XOR algorithm
20
+ xor-2g Use XOR-2G algorithm
21
22
OsmoHLR# subscriber imsi 123456789023000 update aud2g comp128v1 ?
23
ki Set Ki Encryption Key
24
25
OsmoHLR# subscriber imsi 123456789023000 update aud2g comp128v1 ki val ?
26
<cr>
27
28
-OsmoHLR# subscriber imsi 123456789023000 update aud2g xor ki Deaf0ff1ceD0d0DabbedD1ced1ceF00d
29
+OsmoHLR# subscriber imsi 123456789023000 update aud2g xor-2g ki Deaf0ff1ceD0d0DabbedD1ced1ceF00d
30
OsmoHLR# subscriber imsi 123456789023000 show
31
ID: 101
32
IMSI: 123456789023000
33
MSISDN: 423
34
-...
35
+ 2G auth: XOR-2G
36
KI=deaf0ff1ced0d0dabbedd1ced1cef00d
37
38
OsmoHLR# subscriber imsi 123456789023000 update aud2g comp128v1 ki BeefedCafeFaceAcedAddedDecadeFee
39
40
2G auth: COMP128v3
41
KI=c01ffedc1cadaeac1d1f1edacac1ab0a
42
43
-OsmoHLR# subscriber id 101 update aud2g xor ki CoiffedCicadaeAcidifiedAcaciaBoa
44
+OsmoHLR# subscriber id 101 update aud2g xor-2g ki CoiffedCicadaeAcidifiedAcaciaBoa
45
% Invalid value for KI: 'CoiffedCicadaeAcidifiedAcaciaBoa'
46
OsmoHLR# subscriber id 101 show
47
ID: 101
48
49
2G auth: COMP128v3
50
KI=c01ffedc1cadaeac1d1f1edacac1ab0a
51
52
-OsmoHLR# subscriber id 101 update aud2g xor ki C01ffedC1cadaeAc1d1f1edAcac1aB0aX
53
+OsmoHLR# subscriber id 101 update aud2g xor-2g ki C01ffedC1cadaeAc1d1f1edAcac1aB0aX
54
% Invalid value for KI: 'C01ffedC1cadaeAc1d1f1edAcac1aB0aX'
55
OsmoHLR# subscriber id 101 show
56
ID: 101
57
58
OsmoHLR# subscriber imsi 123456789023000 update aud3g ?
59
none Delete 3G authentication data
60
milenage Use Milenage algorithm
61
- xor Use XOR algorithm
62
+ tuak Use TUAK algorithm
63
+ xor-3g Use XOR-3G algorithm
64
65
OsmoHLR# subscriber imsi 123456789023000 update aud3g milenage ?
66
k Set Encryption Key K
67
68
OsmoHLR# subscriber imsi 123456789023000 update aud3g milenage k ?
69
- K K as 32 hexadecimal characters
70
+ K K as 32/64 hexadecimal characters
71
72
OsmoHLR# subscriber imsi 123456789023000 update aud3g milenage k Deaf0ff1ceD0d0DabbedD1ced1ceF00d ?
73
op Set OP key
74
opc Set OPC key
75
76
OsmoHLR# subscriber imsi 123456789023000 update aud3g milenage k Deaf0ff1ceD0d0DabbedD1ced1ceF00d opc ?
77
- OP_C OP or OPC as 32 hexadecimal characters
78
+ OP_C OP or OPC as 32/64 hexadecimal characters
79
80
OsmoHLR# subscriber imsi 123456789023000 update aud3g milenage k Deaf0ff1ceD0d0DabbedD1ced1ceF00d opc CededEffacedAceFacedBadFadedBeef ?
81
ind-bitlen Set IND bit length
82
osmo-hlr_1.6.2.tar.xz/tests/test_subscriber_errors.ctrl -> osmo-hlr_1.7.0.tar.xz/tests/test_subscriber_errors.ctrl
Changed
38
1
2
SET 55 subscriber.by-imsi-901990000000003.aud2g foobar,2134
3
ERROR 55 Unknown auth algorithm.
4
5
-SET 56 subscriber.by-imsi-901990000000003.aud2g xor,2134
6
+SET 56 subscriber.by-imsi-901990000000003.aud2g xor-2g,2134
7
ERROR 56 Invalid KI.
8
9
SET 57 subscriber.by-imsi-901990000000003.aud3g foobar
10
11
SET 58 subscriber.by-imsi-901990000000003.aud3g foobar,2134
12
ERROR 58 Unknown auth algorithm.
13
14
-SET 60 subscriber.by-imsi-901990000000003.aud3g milenage,2134
15
-ERROR 60 Invalid KI.
16
+SET 59 subscriber.by-imsi-901990000000003.aud3g milenage,2134
17
+ERROR 59 Invalid KI.
18
19
-SET 61 subscriber.by-imsi-901990000000003.aud3g milenage,c01ffedc1cadaeac1d1f1edacac1ab0a,AAA
20
-ERROR 61 Invalid format.
21
+SET 60 subscriber.by-imsi-901990000000003.aud3g milenage,c01ffedc1cadaeac1d1f1edacac1ab0a,AAA
22
+ERROR 60 Invalid format.
23
24
-SET 62 subscriber.by-imsi-901990000000003.aud3g milenage,c01ffedc1cadaeac1d1f1edacac1ab0a,OPC
25
-ERROR 62 Invalid format.
26
+SET 61 subscriber.by-imsi-901990000000003.aud3g milenage,c01ffedc1cadaeac1d1f1edacac1ab0a,OPC
27
+ERROR 61 Invalid format.
28
29
-SET 63 subscriber.by-imsi-901990000000003.aud3g milenage,c01ffedc1cadaeac1d1f1edacac1ab0a,OPC,zzz
30
-ERROR 63 Invalid OP/OPC.
31
+SET 62 subscriber.by-imsi-901990000000003.aud3g milenage,c01ffedc1cadaeac1d1f1edacac1ab0a,OPC,zzz
32
+ERROR 62 Invalid OP/OPC.
33
34
-SET 64 subscriber.by-imsi-901990000000003.aud3g milenage,c01ffedc1cadaeac1d1f1edacac1ab0a,OPC,fb2a3d1b360f599abab99db8669f8308,
35
-ERROR 64 Invalid format.
36
+SET 63 subscriber.by-imsi-901990000000003.aud3g milenage,c01ffedc1cadaeac1d1f1edacac1ab0a,OPC,fb2a3d1b360f599abab99db8669f8308,
37
+ERROR 63 Invalid format.
38
osmo-hlr_1.6.2.tar.xz/tests/testsuite.at -> osmo-hlr_1.7.0.tar.xz/tests/testsuite.at
Changed
15
1
2
cat $abs_srcdir/db/db_test.ok > expout
3
cat $abs_srcdir/db/db_test.err > experr
4
sqlite3 db_test.db < $abs_top_srcdir/sql/hlr.sql
5
-
6
-# Compatibility with libosmocore I446e54d0ddf4a18c46ee022b1249af73552e3ce1
7
-$abs_top_builddir/tests/db/db_test >out 2>err
8
-sed -i "s/XOR-3G,/XOR,/g" err
9
-
10
-AT_CHECK(cat out; cat err >&2, , expout, experr)
11
+AT_CHECK($abs_top_builddir/tests/db/db_test, , expout, experr)
12
AT_CLEANUP
13
14
# AT_SKIP_IF: disable for old sqlite versions, because the way we dump tables in the test doesn't work with it.
15