Projects
osmocom:latest
osmo-hlr
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 9
View file
osmo-hlr_1.8.0.dsc -> osmo-hlr_1.9.0.dsc
Changed
@@ -2,13 +2,13 @@ Source: osmo-hlr Binary: osmo-hlr, osmo-hlr-dbg, libosmo-gsup-client0, libosmo-gsup-client-dev, libosmo-mslookup1, libosmo-mslookup-dev, osmo-mslookup-utils, osmo-hlr-doc Architecture: any all -Version: 1.8.0 +Version: 1.9.0 Maintainer: Osmocom team <openbsc@lists.osmocom.org> Homepage: https://projects.osmocom.org/projects/osmo-hlr Standards-Version: 3.9.6 Vcs-Browser: https://gitea.osmocom.org/cellular-infrastructure/osmo-hlr Vcs-Git: https://gitea.osmocom.org/cellular-infrastructure/osmo-hlr -Build-Depends: debhelper (>= 10), pkg-config, dh-autoreconf, autotools-dev, python3-minimal, libosmocore-dev (>= 1.10.0), libosmo-abis-dev (>= 1.6.0), libosmo-netif-dev (>= 1.5.0), libsqlite3-dev, sqlite3, osmo-gsm-manuals-dev (>= 1.6.0) +Build-Depends: debhelper (>= 10), pkg-config, dh-autoreconf, autotools-dev, python3-minimal, libosmocore-dev (>= 1.11.0), libosmo-abis-dev (>= 2.0.0), libosmo-netif-dev (>= 1.6.0), libsqlite3-dev, sqlite3, osmo-gsm-manuals-dev (>= 1.6.0) Package-List: libosmo-gsup-client-dev deb net optional arch=any libosmo-gsup-client0 deb libs optional arch=any @@ -19,8 +19,8 @@ osmo-hlr-doc deb doc optional arch=all osmo-mslookup-utils deb utils optional arch=any Checksums-Sha1: - d860d2a24cb405e333781028a5a4c3ce4a794d9e 176436 osmo-hlr_1.8.0.tar.xz + 0c08465093e59a66772df776ce31aa14c26de4c7 178248 osmo-hlr_1.9.0.tar.xz Checksums-Sha256: - a191ca37c5b2ceb89bdbaec580cf93d11d5ca788dbbcec24c53a0b01a627ecc0 176436 osmo-hlr_1.8.0.tar.xz + 6f38d9f59f81e41b0125daa6d49be461b3a60fcdd4cfd091e70559cf46a82e74 178248 osmo-hlr_1.9.0.tar.xz Files: - 7adde67ba5cb72d60ff781839ccc26e7 176436 osmo-hlr_1.8.0.tar.xz + d96574b43521b9c5138b6ce6c0613d91 178248 osmo-hlr_1.9.0.tar.xz
View file
osmo-hlr_1.8.0.tar.xz/.tarball-version -> osmo-hlr_1.9.0.tar.xz/.tarball-version
Changed
@@ -1 +1 @@ -1.8.0 +1.9.0
View file
osmo-hlr_1.8.0.tar.xz/configure.ac -> osmo-hlr_1.9.0.tar.xz/configure.ac
Changed
@@ -41,11 +41,11 @@ PKG_CHECK_MODULES(TALLOC, talloc >= 2.0.1) -PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.10.0) -PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.10.0) -PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.10.0) -PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.10.0) -PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 1.6.0) +PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.11.0) +PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.11.0) +PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.11.0) +PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.11.0) +PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 2.0.0) PKG_CHECK_MODULES(SQLITE3, sqlite3)
View file
osmo-hlr_1.8.0.tar.xz/contrib/jenkins.sh -> osmo-hlr_1.9.0.tar.xz/contrib/jenkins.sh
Changed
@@ -29,7 +29,8 @@ export LD_LIBRARY_PATH="$inst/lib" export PATH="$inst/bin:$PATH" -osmo-build-dep.sh libosmocore "" ac_cv_path_DOXYGEN=false +osmo-build-dep.sh libosmocore "" --disable-doxygen +osmo-build-dep.sh libosmo-netif "" --disable-doxygen osmo-build-dep.sh libosmo-abis # Additional configure options and depends
View file
osmo-hlr_1.8.0.tar.xz/debian/changelog -> osmo-hlr_1.9.0.tar.xz/debian/changelog
Changed
@@ -1,3 +1,30 @@ +osmo-hlr (1.9.0) unstable; urgency=medium + + Vadim Yanitskiy + * subscriber-create-on-demand: rework configuration + * subscriber-create-on-demand: add mode for MSISDN=IMSI + + Alexander Couzens + * gsupclient: Introduce gsup_client_mux + * gsupclient: add missing SPDX line + * debian/copyright: add gsup_client under GPLv2+ + + Pau Espin Pedrol + * gsup: Replace deprecated ipa_msg_push_header() + * jenkins.sh: libosmo-netif no longer depends on libosmo-abis + * Drop use of libosmo-abis osmocom/abis/ipaccess.h + * gsup_client: Add new APIs to avoid users accessing struct fields + * gsup_client: Avoid double memset 0 + * Drop unneeded use of abis/ipa.h header + * jenkins.sh: Use --disable-doxygen configure param + + Mychaela N. Falconia + * vty: always emit reject-cause lines in saved config + * change default reject cause to plmn-not-allowed + * change default no-proxy reject cause to net-fail + + -- Oliver Smith <osmith@sysmocom.de> Wed, 12 Feb 2025 12:17:52 +0100 + osmo-hlr (1.8.0) unstable; urgency=medium Vadim Yanitskiy
View file
osmo-hlr_1.8.0.tar.xz/debian/control -> osmo-hlr_1.9.0.tar.xz/debian/control
Changed
@@ -7,9 +7,9 @@ dh-autoreconf, autotools-dev, python3-minimal, - libosmocore-dev (>= 1.10.0), - libosmo-abis-dev (>= 1.6.0), - libosmo-netif-dev (>= 1.5.0), + libosmocore-dev (>= 1.11.0), + libosmo-abis-dev (>= 2.0.0), + libosmo-netif-dev (>= 1.6.0), libsqlite3-dev, sqlite3, osmo-gsm-manuals-dev (>= 1.6.0)
View file
osmo-hlr_1.8.0.tar.xz/debian/copyright -> osmo-hlr_1.9.0.tar.xz/debian/copyright
Changed
@@ -6,6 +6,10 @@ Copyright: 2016-2022 Sysmocom s. f. m. c. GmbH <info@sysmocom.de> License: AGPL-3+ +Files: src/gsupclient/* +Copyright: 2014-2016,2019 by sysmocom s.f.m.c. GmbH <info@sysmocom.de> +License: GPL-2+ + License: AGPL-3+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by @@ -19,3 +23,17 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. + +License: GPL-2+ + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>.
View file
osmo-hlr_1.8.0.tar.xz/include/Makefile.am -> osmo-hlr_1.9.0.tar.xz/include/Makefile.am
Changed
@@ -3,6 +3,7 @@ nobase_include_HEADERS = \ osmocom/gsupclient/cni_peer_id.h \ osmocom/gsupclient/gsup_client.h \ + osmocom/gsupclient/gsup_client_mux.h \ osmocom/gsupclient/gsup_req.h \ osmocom/mslookup/mdns.h \ osmocom/mslookup/mdns_sock.h \
View file
osmo-hlr_1.8.0.tar.xz/include/osmocom/gsupclient/gsup_client.h -> osmo-hlr_1.9.0.tar.xz/include/osmocom/gsupclient/gsup_client.h
Changed
@@ -20,6 +20,9 @@ */ #pragma once +#include <stdint.h> +#include <stdbool.h> + #include <osmocom/core/timer.h> #include <osmocom/gsm/oap_client.h> #include <osmocom/gsm/ipa.h> @@ -40,6 +43,7 @@ typedef bool (*osmo_gsup_client_up_down_cb_t)(struct osmo_gsup_client *gsupc, bool up); +/* NOTE: THIS STRUCT IS CONSIDERED PRIVATE, AVOID ACCESSING ITS FIELDS! */ struct osmo_gsup_client { const char *unit_name; /* same as ipa_dev->unit_name, for backwards compat */ @@ -99,3 +103,12 @@ const struct osmo_gsup_message *gsup_msg); struct msgb *osmo_gsup_client_msgb_alloc(void); +void *osmo_gsup_client_get_data(const struct osmo_gsup_client *gsupc); +void osmo_gsup_client_set_data(struct osmo_gsup_client *gsupc, void *data); + +const char *osmo_gsup_client_get_rem_addr(const struct osmo_gsup_client *gsupc); +uint16_t osmo_gsup_client_get_rem_port(const struct osmo_gsup_client *gsupc); + +bool osmo_gsup_client_is_connected(const struct osmo_gsup_client *gsupc); +const struct ipaccess_unit *osmo_gsup_client_get_ipaccess_unit(const struct osmo_gsup_client *gsupc); +
View file
osmo-hlr_1.9.0.tar.xz/include/osmocom/gsupclient/gsup_client_mux.h
Added
@@ -0,0 +1,56 @@ +/* + * (C) 2019 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de> + * All Rights Reserved + * + * Author: Neels Hofmeyr + * + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#pragma once + +#include <osmocom/gsm/gsup.h> + +struct gsup_client_mux; +struct ipaccess_unit; + +struct gsup_client_mux_rx_cb { + int (*func)(struct gsup_client_mux *gcm, void *data, const struct osmo_gsup_message *gsup_msg); + void *data; +}; + +/* A GSUP client shared between code paths for various GSUP Message Classes. + * The main task is to dispatch GSUP messages to code paths corresponding to the respective Message Class, i.e. + * subscriber management, SMS, SS/USSD and inter-MSC messaging. + * If a GSUP Message Class IE is present in the message, the received message is dispatched directly to the rx_cb entry + * for that Message Class. Otherwise, the Message Class is determined by a switch() on the Message Type.*/ +struct gsup_client_mux { + struct osmo_gsup_client *gsup_client; + + /* Target clients by enum osmo_gsup_message_class */ + struct gsup_client_mux_rx_cb rx_cbOSMO_GSUP_MESSAGE_CLASS_ARRAYSIZE; +}; + +struct gsup_client_mux *gsup_client_mux_alloc(void *talloc_ctx); +int gsup_client_mux_start(struct gsup_client_mux *gcm, const char *gsup_server_addr_str, uint16_t gsup_server_port, + struct ipaccess_unit *ipa_dev); + +int gsup_client_mux_tx(struct gsup_client_mux *gcm, const struct osmo_gsup_message *gsup_msg); +void gsup_client_mux_tx_set_source(const struct gsup_client_mux *gcm, struct osmo_gsup_message *gsup_msg); +void gsup_client_mux_tx_error_reply(struct gsup_client_mux *gcm, const struct osmo_gsup_message *gsup_orig, + enum gsm48_gmm_cause cause); + +int gsup_client_mux_rx(struct osmo_gsup_client *gsup_client, struct msgb *msg);
View file
osmo-hlr_1.8.0.tar.xz/include/osmocom/hlr/gsup_server.h -> osmo-hlr_1.9.0.tar.xz/include/osmocom/hlr/gsup_server.h
Changed
@@ -2,9 +2,9 @@ #include <osmocom/core/linuxlist.h> #include <osmocom/core/msgb.h> -#include <osmocom/abis/ipa.h> -#include <osmocom/abis/ipaccess.h> #include <osmocom/gsm/gsup.h> +#include <osmocom/gsm/protocol/ipaccess.h> +#include <osmocom/abis/ipa.h> #include <osmocom/gsupclient/cni_peer_id.h> #include <osmocom/gsupclient/gsup_req.h>
View file
osmo-hlr_1.8.0.tar.xz/include/osmocom/hlr/hlr.h -> osmo-hlr_1.9.0.tar.xz/include/osmocom/hlr/hlr.h
Changed
@@ -39,6 +39,13 @@ extern struct osmo_tdef g_hlr_tdefs; +enum subscr_create_on_demand_mode { + SUBSCR_COD_MODE_DISABLED = 0, + SUBSCR_COD_MODE_NO_MSISDN, + SUBSCR_COD_MODE_RAND_MSISDN, + SUBSCR_COD_MODE_MSISDN_FROM_IMSI, +}; + struct hlr { /* GSUP server pointer */ struct osmo_gsup_server *gs; @@ -80,10 +87,12 @@ bool store_imei; - bool subscr_create_on_demand; - /* Bitmask of DB_SUBSCR_FLAG_* */ - uint8_t subscr_create_on_demand_flags; - unsigned int subscr_create_on_demand_rand_msisdn_len; + struct { + enum subscr_create_on_demand_mode mode; + unsigned int rand_msisdn_len; + /* Bitmask of DB_SUBSCR_FLAG_* */ + uint8_t flags; + } subscr_create_on_demand; struct { bool allow_startup;
View file
osmo-hlr_1.8.0.tar.xz/src/gsup_server.c -> osmo-hlr_1.9.0.tar.xz/src/gsup_server.c
Changed
@@ -24,11 +24,12 @@ #include <osmocom/core/msgb.h> #include <osmocom/core/logging.h> #include <osmocom/core/linuxlist.h> -#include <osmocom/abis/ipa.h> -#include <osmocom/abis/ipaccess.h> #include <osmocom/gsm/gsm48_ie.h> #include <osmocom/gsm/apn.h> +#include <osmocom/gsm/protocol/ipaccess.h> +#include <osmocom/gsm/ipa.h> #include <osmocom/gsm/gsm23003.h> +#include <osmocom/abis/ipa.h> #include <osmocom/hlr/gsup_server.h> #include <osmocom/hlr/gsup_router.h> @@ -49,7 +50,7 @@ int proto_ext, struct msgb *msg_tx) { ipa_prepend_header_ext(msg_tx, proto_ext); - ipa_msg_push_header(msg_tx, IPAC_PROTO_OSMO); + ipa_prepend_header(msg_tx, IPAC_PROTO_OSMO); ipa_server_conn_send(conn->conn, msg_tx); }
View file
osmo-hlr_1.8.0.tar.xz/src/gsupclient/Makefile.am -> osmo-hlr_1.9.0.tar.xz/src/gsupclient/Makefile.am
Changed
@@ -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=1:0:1 +LIBVERSION=2:0:2 AM_CFLAGS = -Wall $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)/include \ $(TALLOC_CFLAGS) $(LIBOSMOCORE_CFLAGS) $(LIBOSMOABIS_CFLAGS) @@ -11,6 +11,7 @@ libosmo_gsup_client_la_SOURCES = \ cni_peer_id.c \ gsup_client.c \ + gsup_client_mux.c \ gsup_req.c \ $(NULL)
View file
osmo-hlr_1.8.0.tar.xz/src/gsupclient/cni_peer_id.c -> osmo-hlr_1.9.0.tar.xz/src/gsupclient/cni_peer_id.c
Changed
@@ -2,6 +2,8 @@ * * All Rights Reserved * + * SPDX-License-Identifier: GPL-2.0-or-later + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or
View file
osmo-hlr_1.8.0.tar.xz/src/gsupclient/gsup_client.c -> osmo-hlr_1.9.0.tar.xz/src/gsupclient/gsup_client.c
Changed
@@ -6,6 +6,8 @@ * Author: Jacob Erlbeck * Author: Neels Hofmeyr * + * SPDX-License-Identifier: GPL-2.0-or-later + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -24,6 +26,7 @@ #include <osmocom/gsupclient/gsup_client.h> #include <osmocom/abis/ipa.h> +#include <osmocom/gsm/ipa.h> #include <osmocom/gsm/oap_client.h> #include <osmocom/gsm/protocol/ipaccess.h> #include <osmocom/core/msgb.h> @@ -42,7 +45,7 @@ msg->l2h = msgb_put(msg, 1); msg->l2h0 = IPAC_MSGT_PING; - ipa_msg_push_header(msg, IPAC_PROTO_IPACCESS); + ipa_prepend_header(msg, IPAC_PROTO_IPACCESS); ipa_client_conn_send(gsupc->link, msg); } @@ -112,7 +115,7 @@ struct msgb *msg_tx) { ipa_prepend_header_ext(msg_tx, proto_ext); - ipa_msg_push_header(msg_tx, IPAC_PROTO_OSMO); + ipa_prepend_header(msg_tx, IPAC_PROTO_OSMO); ipa_client_conn_send(gsupc->link, msg_tx); /* msg_tx is now queued and will be freed. */ } @@ -304,7 +307,7 @@ OSMO_ASSERT(config->ipa_dev->unit_name); - gsupc = talloc_zero(talloc_ctx, struct osmo_gsup_client); + gsupc = talloc(talloc_ctx, struct osmo_gsup_client); OSMO_ASSERT(gsupc); *gsupc = (struct osmo_gsup_client){ .unit_name = (const char *)config->ipa_dev->unit_name, /* API backwards compat */ @@ -447,3 +450,36 @@ { return msgb_alloc_headroom(4000, 64, __func__); } + +void *osmo_gsup_client_get_data(const struct osmo_gsup_client *gsupc) +{ + return gsupc->data; +} + +void osmo_gsup_client_set_data(struct osmo_gsup_client *gsupc, void *data) +{ + gsupc->data = data; +} + +const char *osmo_gsup_client_get_rem_addr(const struct osmo_gsup_client *gsupc) +{ + if (!gsupc->link) + return NULL; + return gsupc->link->addr; +} +uint16_t osmo_gsup_client_get_rem_port(const struct osmo_gsup_client *gsupc) +{ + if (!gsupc->link) + return 0; + return gsupc->link->port; +} + +bool osmo_gsup_client_is_connected(const struct osmo_gsup_client *gsupc) +{ + return gsupc->is_connected; +} + +const struct ipaccess_unit *osmo_gsup_client_get_ipaccess_unit(const struct osmo_gsup_client *gsupc) +{ + return gsupc->ipa_dev; +}
View file
osmo-hlr_1.9.0.tar.xz/src/gsupclient/gsup_client_mux.c
Added
@@ -0,0 +1,196 @@ +/* Directing individual GSUP messages to their respective handlers. */ +/* + * (C) 2019 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de> + * All Rights Reserved + * + * Author: Neels Hofmeyr + * + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include <errno.h> + +#include <osmocom/core/logging.h> + +#include <osmocom/gsupclient/gsup_client.h> +#include <osmocom/gsupclient/gsup_client_mux.h> + +static enum osmo_gsup_message_class gsup_client_mux_classify(struct gsup_client_mux *gcm, + const struct osmo_gsup_message *gsup_msg) +{ + if (gsup_msg->message_class) + return gsup_msg->message_class; + + LOGP(DLGSUP, LOGL_DEBUG, "No explicit GSUP Message Class, trying to guess from message type %s\n", + osmo_gsup_message_type_name(gsup_msg->message_type)); + + switch (gsup_msg->message_type) { + case OSMO_GSUP_MSGT_PROC_SS_REQUEST: + case OSMO_GSUP_MSGT_PROC_SS_RESULT: + case OSMO_GSUP_MSGT_PROC_SS_ERROR: + return OSMO_GSUP_MESSAGE_CLASS_USSD; + + /* GSM 04.11 code implementing MO SMS */ + case OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR: + case OSMO_GSUP_MSGT_MO_FORWARD_SM_RESULT: + case OSMO_GSUP_MSGT_READY_FOR_SM_ERROR: + case OSMO_GSUP_MSGT_READY_FOR_SM_RESULT: + case OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST: + return OSMO_GSUP_MESSAGE_CLASS_SMS; + + default: + return OSMO_GSUP_MESSAGE_CLASS_SUBSCRIBER_MANAGEMENT; + } +} + +/* Non-static for unit tests */ +int gsup_client_mux_rx(struct osmo_gsup_client *gsup_client, struct msgb *msg) +{ + struct gsup_client_mux *gcm = osmo_gsup_client_get_data(gsup_client); + struct osmo_gsup_message gsup; + enum osmo_gsup_message_class message_class; + int rc; + + rc = osmo_gsup_decode(msgb_l2(msg), msgb_l2len(msg), &gsup); + if (rc < 0) { + LOGP(DLGSUP, LOGL_ERROR, "Failed to decode GSUP message: '%s' (%d) %s\n", + get_value_string(gsm48_gmm_cause_names, -rc), -rc, osmo_hexdump(msg->data, msg->len)); + goto msgb_free_and_return; + } + + if (!gsup.imsi0) { + LOGP(DLGSUP, LOGL_ERROR, "Failed to decode GSUP message: missing IMSI\n"); + if (OSMO_GSUP_IS_MSGT_REQUEST(gsup.message_type)) + gsup_client_mux_tx_error_reply(gcm, &gsup, GMM_CAUSE_INV_MAND_INFO); + rc = -GMM_CAUSE_INV_MAND_INFO; + goto msgb_free_and_return; + } + + message_class = gsup_client_mux_classify(gcm, &gsup); + + if (message_class <= OSMO_GSUP_MESSAGE_CLASS_UNSET || message_class >= ARRAY_SIZE(gcm->rx_cb)) { + LOGP(DLGSUP, LOGL_ERROR, "Failed to classify GSUP message target\n"); + rc = -EINVAL; + goto msgb_free_and_return; + } + + if (!gcm->rx_cbmessage_class.func) { + LOGP(DLGSUP, LOGL_ERROR, "No receiver set up for GSUP Message Class %s\n", osmo_gsup_message_class_name(message_class)); + rc = -ENOTSUP; + goto msgb_free_and_return; + } + + rc = gcm->rx_cbmessage_class.func(gcm, gcm->rx_cbmessage_class.data, &gsup); + +msgb_free_and_return: + msgb_free(msg); + return rc; +} + +/* Make it clear that struct gsup_client_mux should be talloc allocated, so that it can be used as talloc parent. */ +struct gsup_client_mux *gsup_client_mux_alloc(void *talloc_ctx) +{ + return talloc_zero(talloc_ctx, struct gsup_client_mux); +} + +/* Start a GSUP client to serve this gsup_client_mux. */ +int gsup_client_mux_start(struct gsup_client_mux *gcm, const char *gsup_server_addr_str, uint16_t gsup_server_port, + struct ipaccess_unit *ipa_dev) +{ + gcm->gsup_client = osmo_gsup_client_create2(gcm, ipa_dev, + gsup_server_addr_str, + gsup_server_port, + &gsup_client_mux_rx, NULL); + if (!gcm->gsup_client) + return -ENOMEM; + osmo_gsup_client_set_data(gcm->gsup_client, gcm); + return 0; +} + +int gsup_client_mux_tx(struct gsup_client_mux *gcm, const struct osmo_gsup_message *gsup_msg) +{ + struct msgb *msg; + int rc; + + if (!gcm || !gcm->gsup_client) { + LOGP(DLGSUP, LOGL_ERROR, "GSUP link is down, cannot send GSUP message\n"); + return -ENOTSUP; + } + + msg = osmo_gsup_client_msgb_alloc(); + rc = osmo_gsup_encode(msg, gsup_msg); + if (rc < 0) { + LOGP(DLGSUP, LOGL_ERROR, "Failed to encode GSUP message: '%s'\n", strerror(-rc)); + return rc; + } + + return osmo_gsup_client_send(gcm->gsup_client, msg); +} + +/* Set GSUP source_name to our local IPA name */ +void gsup_client_mux_tx_set_source(const struct gsup_client_mux *gcm, + struct osmo_gsup_message *gsup_msg) +{ + const char *local_msc_name; + const struct ipaccess_unit *ipa_dev; + + if (!gcm) + return; + if (!gcm->gsup_client) + return; + ipa_dev = osmo_gsup_client_get_ipaccess_unit(gcm->gsup_client); + if (!ipa_dev) + return; + local_msc_name = ipa_dev->serno; + if (!local_msc_name) + return; + gsup_msg->source_name = (const uint8_t *) local_msc_name; + gsup_msg->source_name_len = strlen(local_msc_name) + 1; +} + +/* Transmit GSUP error in response to original message */ +void gsup_client_mux_tx_error_reply(struct gsup_client_mux *gcm, const struct osmo_gsup_message *gsup_orig, + enum gsm48_gmm_cause cause) +{ + struct osmo_gsup_message gsup_reply; + + /* No need to answer if we couldn't parse an ERROR message type, only REQUESTs need an error reply. */ + if (!OSMO_GSUP_IS_MSGT_REQUEST(gsup_orig->message_type)) + return; + + gsup_reply = (struct osmo_gsup_message){ + .cause = cause, + .message_type = OSMO_GSUP_TO_MSGT_ERROR(gsup_orig->message_type), + .message_class = gsup_orig->message_class, + .destination_name = gsup_orig->source_name, + .destination_name_len = gsup_orig->source_name_len, + + /* RP-Message-Reference is mandatory for SM Service */ + .sm_rp_mr = gsup_orig->sm_rp_mr, + }; + + OSMO_STRLCPY_ARRAY(gsup_reply.imsi, gsup_orig->imsi); + gsup_client_mux_tx_set_source(gcm, &gsup_reply); + + /* For SS/USSD, it's important to keep both session state and ID IEs */ + if (gsup_orig->session_state != OSMO_GSUP_SESSION_STATE_NONE) { + gsup_reply.session_state = OSMO_GSUP_SESSION_STATE_END; + gsup_reply.session_id = gsup_orig->session_id; + } + + if (osmo_gsup_client_enc_send(gcm->gsup_client, &gsup_reply)) + LOGP(DLGSUP, LOGL_ERROR, "Failed to send Error reply (imsi=%s)\n", + osmo_quote_str(gsup_orig->imsi, -1)); +}
View file
osmo-hlr_1.8.0.tar.xz/src/gsupclient/gsup_req.c -> osmo-hlr_1.9.0.tar.xz/src/gsupclient/gsup_req.c
Changed
@@ -2,6 +2,8 @@ * * All Rights Reserved * + * SPDX-License-Identifier: GPL-2.0-or-later + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or
View file
osmo-hlr_1.8.0.tar.xz/src/hlr.c -> osmo-hlr_1.9.0.tar.xz/src/hlr.c
Changed
@@ -204,23 +204,34 @@ { char msisdnGSM23003_MSISDN_MAX_DIGITS + 1; int rc; - unsigned int rand_msisdn_len = g_hlr->subscr_create_on_demand_rand_msisdn_len; - if (!g_hlr->subscr_create_on_demand) - return -1; if (db_subscr_exists_by_imsi(g_hlr->dbc, imsi) == 0) return -1; - if (rand_msisdn_len && generate_new_msisdn(msisdn, imsi, rand_msisdn_len) != 0) + + switch (g_hlr->subscr_create_on_demand.mode) { + case SUBSCR_COD_MODE_MSISDN_FROM_IMSI: + OSMO_STRLCPY_ARRAY(msisdn, imsi); + break; + case SUBSCR_COD_MODE_RAND_MSISDN: + if (generate_new_msisdn(msisdn, imsi, g_hlr->subscr_create_on_demand.rand_msisdn_len) != 0) + return -1; + break; + case SUBSCR_COD_MODE_NO_MSISDN: + msisdn0 = '\0'; + break; + case SUBSCR_COD_MODE_DISABLED: + default: return -1; + } LOGP(DMAIN, LOGL_INFO, "IMSI='%s': Creating subscriber on demand\n", imsi); - rc = db_subscr_create(g_hlr->dbc, imsi, g_hlr->subscr_create_on_demand_flags); + rc = db_subscr_create(g_hlr->dbc, imsi, g_hlr->subscr_create_on_demand.flags); if (rc) { LOGP(DMAIN, LOGL_ERROR, "Failed to create subscriber on demand (rc=%d): IMSI='%s'\n", rc, imsi); return rc; } - if (!rand_msisdn_len) + if (msisdn0 == '\0') return 0; /* Update MSISDN of the new (just allocated) subscriber */ @@ -768,8 +779,8 @@ g_hlr->db_file_path = talloc_strdup(g_hlr, HLR_DEFAULT_DB_FILE_PATH); g_hlr->mslookup.server.mdns.domain_suffix = talloc_strdup(g_hlr, OSMO_MDNS_DOMAIN_SUFFIX_DEFAULT); g_hlr->mslookup.client.mdns.domain_suffix = talloc_strdup(g_hlr, OSMO_MDNS_DOMAIN_SUFFIX_DEFAULT); - g_hlr->reject_cause = GMM_CAUSE_IMSI_UNKNOWN; - g_hlr->no_proxy_reject_cause = GMM_CAUSE_IMSI_UNKNOWN; + g_hlr->reject_cause = GMM_CAUSE_PLMN_NOTALLOWED; + g_hlr->no_proxy_reject_cause = GMM_CAUSE_NET_FAIL; /* Init default (call independent) SS session guard timeout value */ g_hlr->ncss_guard_timeout = NCSS_GUARD_TIMEOUT_DEFAULT;
View file
osmo-hlr_1.8.0.tar.xz/src/hlr_vty.c -> osmo-hlr_1.9.0.tar.xz/src/hlr_vty.c
Changed
@@ -282,40 +282,55 @@ return CMD_SUCCESS; } +static void config_write_subscr_create_on_demand(struct vty *vty) +{ + const uint8_t flags = g_hlr->subscr_create_on_demand.flags; + const char *flags_str; + + switch (g_hlr->subscr_create_on_demand.mode) { + case SUBSCR_COD_MODE_MSISDN_FROM_IMSI: + vty_out(vty, " subscriber-create-on-demand msisdn-from-imsi"); + break; + case SUBSCR_COD_MODE_RAND_MSISDN: + vty_out(vty, " subscriber-create-on-demand %u", + g_hlr->subscr_create_on_demand.rand_msisdn_len); + break; + case SUBSCR_COD_MODE_NO_MSISDN: + vty_out(vty, " subscriber-create-on-demand no-msisdn"); + break; + case SUBSCR_COD_MODE_DISABLED: + default: + vty_out(vty, " no subscriber-create-on-demand%s", VTY_NEWLINE); + return; + } + + if ((flags & DB_SUBSCR_FLAG_NAM_CS) && (flags & DB_SUBSCR_FLAG_NAM_PS)) + flags_str = "cs+ps"; + else if (flags & DB_SUBSCR_FLAG_NAM_CS) + flags_str = "cs"; + else if (flags & DB_SUBSCR_FLAG_NAM_PS) + flags_str = "ps"; + else + flags_str = "none"; + vty_out(vty, " %s%s", flags_str, VTY_NEWLINE); +} + static int config_write_hlr(struct vty *vty) { vty_out(vty, "hlr%s", VTY_NEWLINE); - if (g_hlr->reject_cause != GMM_CAUSE_IMSI_UNKNOWN) - vty_out(vty, " reject-cause not-found %s%s", - get_value_string_or_null(gsm48_gmm_cause_vty_names, - (uint32_t) g_hlr->reject_cause), VTY_NEWLINE); - if (g_hlr->no_proxy_reject_cause != GMM_CAUSE_IMSI_UNKNOWN) - vty_out(vty, " reject-cause no-proxy %s%s", - get_value_string_or_null(gsm48_gmm_cause_vty_names, - (uint32_t) g_hlr->no_proxy_reject_cause), VTY_NEWLINE); + vty_out(vty, " reject-cause not-found %s%s", + get_value_string_or_null(gsm48_gmm_cause_vty_names, + (uint32_t) g_hlr->reject_cause), VTY_NEWLINE); + vty_out(vty, " reject-cause no-proxy %s%s", + get_value_string_or_null(gsm48_gmm_cause_vty_names, + (uint32_t) g_hlr->no_proxy_reject_cause), VTY_NEWLINE); if (g_hlr->store_imei) vty_out(vty, " store-imei%s", VTY_NEWLINE); if (g_hlr->db_file_path && strcmp(g_hlr->db_file_path, HLR_DEFAULT_DB_FILE_PATH)) vty_out(vty, " database %s%s", g_hlr->db_file_path, VTY_NEWLINE); - if (g_hlr->subscr_create_on_demand) { - const char *flags_str = "none"; - uint8_t flags = g_hlr->subscr_create_on_demand_flags; - unsigned int rand_msisdn_len = g_hlr->subscr_create_on_demand_rand_msisdn_len; - - if ((flags & DB_SUBSCR_FLAG_NAM_CS) && (flags & DB_SUBSCR_FLAG_NAM_PS)) - flags_str = "cs+ps"; - else if (flags & DB_SUBSCR_FLAG_NAM_CS) - flags_str = "cs"; - else if (flags & DB_SUBSCR_FLAG_NAM_PS) - flags_str = "ps"; - - if (rand_msisdn_len) - vty_out(vty, " subscriber-create-on-demand %i %s%s", rand_msisdn_len, flags_str, VTY_NEWLINE); - else - vty_out(vty, " subscriber-create-on-demand no-msisdn %s%s", flags_str, VTY_NEWLINE); - } + config_write_subscr_create_on_demand(vty); return CMD_SUCCESS; } @@ -796,29 +811,37 @@ } DEFUN(cfg_subscr_create_on_demand, cfg_subscr_create_on_demand_cmd, - "subscriber-create-on-demand (no-msisdn|<3-15>) (none|cs|ps|cs+ps)", + "subscriber-create-on-demand (no-msisdn|msisdn-from-imsi|<3-15>) (none|cs|ps|cs+ps)", "Make a new record when a subscriber is first seen.\n" "Do not automatically assign MSISDN.\n" + "Assign MSISDN identical to subscriber's IMSI.\n" "Length of an automatically assigned MSISDN.\n" "Do not allow any NAM (Network Access Mode) by default.\n" "Allow access to circuit switched NAM by default.\n" "Allow access to packet switched NAM by default.\n" "Allow access to circuit and packet switched NAM by default.\n") { + enum subscr_create_on_demand_mode mode; unsigned int rand_msisdn_len = 0; uint8_t flags = 0x00; - if (strcmp(argv0, "no-msisdn") != 0) + if (strcmp(argv0, "no-msisdn") == 0) { + mode = SUBSCR_COD_MODE_NO_MSISDN; + } else if (strcmp(argv0, "msisdn-from-imsi") == 0) { + mode = SUBSCR_COD_MODE_MSISDN_FROM_IMSI; + } else { /* random MSISDN */ + mode = SUBSCR_COD_MODE_RAND_MSISDN; rand_msisdn_len = atoi(argv0); + } if (strstr(argv1, "cs")) flags |= DB_SUBSCR_FLAG_NAM_CS; if (strstr(argv1, "ps")) flags |= DB_SUBSCR_FLAG_NAM_PS; - g_hlr->subscr_create_on_demand = true; - g_hlr->subscr_create_on_demand_rand_msisdn_len = rand_msisdn_len; - g_hlr->subscr_create_on_demand_flags = flags; + g_hlr->subscr_create_on_demand.mode = mode; + g_hlr->subscr_create_on_demand.rand_msisdn_len = rand_msisdn_len; + g_hlr->subscr_create_on_demand.flags = flags; return CMD_SUCCESS; } @@ -827,7 +850,7 @@ "no subscriber-create-on-demand", "Do not make a new record when a subscriber is first seen.\n") { - g_hlr->subscr_create_on_demand = false; + g_hlr->subscr_create_on_demand.mode = SUBSCR_COD_MODE_DISABLED; return CMD_SUCCESS; }
View file
osmo-hlr_1.8.0.tar.xz/src/remote_hlr.c -> osmo-hlr_1.9.0.tar.xz/src/remote_hlr.c
Changed
@@ -20,7 +20,7 @@ #include <osmocom/gsm/protocol/gsm_04_08_gprs.h> #include <osmocom/gsm/gsup.h> #include <osmocom/gsm/gsm23003.h> -#include <osmocom/abis/ipa.h> +#include <osmocom/gsm/ipa.h> #include <osmocom/gsupclient/gsup_client.h> #include <osmocom/hlr/logging.h> #include <osmocom/hlr/hlr.h> @@ -66,7 +66,7 @@ * The local MSC shall be indicated by gsup.destination_name. */ static int remote_hlr_rx(struct osmo_gsup_client *gsupc, struct msgb *msg) { - struct remote_hlr *rh = gsupc->data; + struct remote_hlr *rh = osmo_gsup_client_get_data(gsupc); struct proxy_subscr proxy_subscr; struct osmo_gsup_message gsup; int rc; @@ -108,7 +108,7 @@ static bool remote_hlr_up_down(struct osmo_gsup_client *gsupc, bool up) { - struct remote_hlr *remote_hlr = gsupc->data; + struct remote_hlr *remote_hlr = osmo_gsup_client_get_data(gsupc); struct remote_hlr_pending_up *p, *n; if (!up) { LOG_REMOTE_HLR(remote_hlr, LOGL_NOTICE, "link to remote HLR is down, removing GSUP client\n"); @@ -127,7 +127,7 @@ bool remote_hlr_is_up(struct remote_hlr *remote_hlr) { - return remote_hlr && remote_hlr->gsupc && remote_hlr->gsupc->is_connected; + return remote_hlr && remote_hlr->gsupc && osmo_gsup_client_is_connected(remote_hlr->gsupc); } struct remote_hlr *remote_hlr_get_or_connect(const struct osmo_sockaddr_str *addr, bool connect, @@ -180,7 +180,7 @@ return NULL; } - rh->gsupc->data = rh; + osmo_gsup_client_set_data(rh->gsupc, rh); llist_add(&rh->entry, &remote_hlrs); add_result_cb:
View file
osmo-hlr_1.8.0.tar.xz/tests/test_nodes.vty -> osmo-hlr_1.9.0.tar.xz/tests/test_nodes.vty
Changed
@@ -73,7 +73,7 @@ reject-cause (not-found|no-proxy) (imsi-unknown|illegal-ms|plmn-not-allowed|la-not-allowed|roaming-not-allowed|no-suitable-cell-in-la|net-fail|congestion|auth-unacceptable|proto-error-unspec) store-imei no store-imei - subscriber-create-on-demand (no-msisdn|<3-15>) (none|cs|ps|cs+ps) + subscriber-create-on-demand (no-msisdn|msisdn-from-imsi|<3-15>) (none|cs|ps|cs+ps) no subscriber-create-on-demand OsmoHLR(config-hlr)# gsup @@ -113,8 +113,11 @@ logging level dgsm notice ... hlr + reject-cause not-found plmn-not-allowed + reject-cause no-proxy net-fail store-imei database hlr_vty_test.db + no subscriber-create-on-demand gsup bind ip 127.0.0.1 ipa-name unnamed-HLR
View file
osmo-hlr_1.8.0.tar.xz/tests/test_subscr_create_on_demand.vty -> osmo-hlr_1.9.0.tar.xz/tests/test_subscr_create_on_demand.vty
Changed
@@ -10,6 +10,14 @@ subscriber-create-on-demand no-msisdn none ... +OsmoHLR(config-hlr)# subscriber-create-on-demand msisdn-from-imsi cs+ps +OsmoHLR(config-hlr)# show running-config +... +hlr +... + subscriber-create-on-demand msisdn-from-imsi cs+ps +... + OsmoHLR(config-hlr)# subscriber-create-on-demand 3 none OsmoHLR(config-hlr)# show running-config ...
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.