Compare commits

..

4 Commits

Author SHA1 Message Date
Oliver Smith
d4b4548589 Generate version.h files
Related: OS#6626
Change-Id: I716821b2426c28fc2500fa8cdf44b7b8cb339d65
2025-06-23 14:16:06 +02:00
Oliver Smith
bb7d5b2a61 Bump version: 1.9.0.2-1a71e → 1.9.1
Change-Id: Ib8bdcee7a6fa4ae9821d9748a8a7ea4aecbea62e
2025-04-02 15:12:36 +02:00
Oliver Smith
1a71e73fdc db: flush after changing schema version
Flush the cache after changing the version, to make the scenario less
likely that after an unclean shutdown the DB gets restored with the
right table layout but wrong version.

When that happens, osmo-hlr tries to upgrade the database layout again
and fails with errors like "duplicate column name".

Related: SYS#7394
Change-Id: I5943a1cb3447c038c6e7972f68f9656b73a9248b
2025-03-17 14:43:12 +01:00
Pau Espin Pedrol
bb8591dfab Drop use of deprecated vty is_config_node() cb
This callback was drepecated and is not ever called since
libosmocore.git 70ce871532ab21955e0955d7e230eae65438f047 (release 1.3.0).

See also libosmocore.git d31de237582f6fe3315d61bb9a488d4cda92654e.

Change-Id: I0a77ff4c0a880230116a361651c78c77328db989
2025-03-04 18:21:43 +01:00
9 changed files with 64 additions and 14 deletions

2
.gitignore vendored
View File

@@ -86,3 +86,5 @@ contrib/osmo-hlr.spec
/debian/osmo-mslookup-utils/
/debian/*.log
/debian/*.substvars
include/osmocom/*/version.h

10
debian/changelog vendored
View File

@@ -1,3 +1,13 @@
osmo-hlr (1.9.1) unstable; urgency=medium
[ Pau Espin Pedrol ]
* Drop use of deprecated vty is_config_node() cb
[ Oliver Smith ]
* db: flush after changing schema version
-- Oliver Smith <osmith@sysmocom.de> Wed, 02 Apr 2025 15:12:35 +0200
osmo-hlr (1.9.0) unstable; urgency=medium
[ Vadim Yanitskiy ]

View File

@@ -1,14 +1,25 @@
SUBDIRS = osmocom
osmocom/%/version.h: osmocom/%/version.h.tpl
$(AM_V_GEN)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)sed \
-e "s/{{VERSION}}/$$(echo '@VERSION@' | cut -d. -f1-3)/g" \
-e "s/{{VERSION_MAJOR}}/$$(echo '@VERSION@' | cut -d. -f1)/g" \
-e "s/{{VERSION_MINOR}}/$$(echo '@VERSION@' | cut -d. -f2)/g" \
-e "s/{{VERSION_PATCH}}/$$(echo '@VERSION@' | cut -d. -f3)/g" \
$< > $@
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/gsupclient/version.h \
osmocom/mslookup/mdns.h \
osmocom/mslookup/mdns_sock.h \
osmocom/mslookup/mslookup_client_fake.h \
osmocom/mslookup/mslookup_client.h \
osmocom/mslookup/mslookup_client_mdns.h \
osmocom/mslookup/mslookup.h \
osmocom/mslookup/version.h \
$(NULL)

View File

@@ -0,0 +1,16 @@
#pragma once
#define LIBOSMO_GSUP_CLIENT_VERSION {{VERSION}}
#define LIBOSMO_GSUP_CLIENT_VERSION_STR "{{VERSION}}"
#define LIBOSMO_GSUP_CLIENT_VERSION_MAJOR {{VERSION_MAJOR}}
#define LIBOSMO_GSUP_CLIENT_VERSION_MINOR {{VERSION_MINOR}}
#define LIBOSMO_GSUP_CLIENT_VERSION_PATCH {{VERSION_PATCH}}
#define LIBOSMO_GSUP_CLIENT_VERSION_GREATER_EQUAL(major, minor, patch) \
(LIBOSMO_GSUP_CLIENT_VERSION_MAJOR > (major) || \
(LIBOSMO_GSUP_CLIENT_VERSION_MAJOR == (major) && \
LIBOSMO_GSUP_CLIENT_VERSION_MINOR > (minor)) || \
(LIBOSMO_GSUP_CLIENT_VERSION_MAJOR == (major) && \
LIBOSMO_GSUP_CLIENT_VERSION_MINOR == (minor) && \
LIBOSMO_GSUP_CLIENT_VERSION_PATCH >= (patch)))

View File

@@ -48,7 +48,6 @@ enum hlr_vty_node {
#define A38_COMP128_KEY_LEN 16
#define MILENAGE_KEY_LEN 16
int hlr_vty_is_config_node(struct vty *vty, int node);
int hlr_vty_go_parent(struct vty *vty);
void hlr_vty_init(void *hlr_ctx);
void dgsm_vty_init(void);

View File

@@ -0,0 +1,16 @@
#pragma once
#define LIBOSMO_MSLOOKUP_VERSION {{VERSION}}
#define LIBOSMO_MSLOOKUP_VERSION_STR "{{VERSION}}"
#define LIBOSMO_MSLOOKUP_VERSION_MAJOR {{VERSION_MAJOR}}
#define LIBOSMO_MSLOOKUP_VERSION_MINOR {{VERSION_MINOR}}
#define LIBOSMO_MSLOOKUP_VERSION_PATCH {{VERSION_PATCH}}
#define LIBOSMO_MSLOOKUP_VERSION_GREATER_EQUAL(major, minor, patch) \
(LIBOSMO_MSLOOKUP_VERSION_MAJOR > (major) || \
(LIBOSMO_MSLOOKUP_VERSION_MAJOR == (major) && \
LIBOSMO_MSLOOKUP_VERSION_MINOR > (minor)) || \
(LIBOSMO_MSLOOKUP_VERSION_MAJOR == (major) && \
LIBOSMO_MSLOOKUP_VERSION_MINOR == (minor) && \
LIBOSMO_MSLOOKUP_VERSION_PATCH >= (patch)))

View File

@@ -595,6 +595,7 @@ struct db_context *db_open(void *ctx, const char *fname, bool enable_sqlite_logg
int rc;
bool has_sqlite_config_sqllog = false;
int version;
bool version_changed = false;
LOGP(DDB, LOGL_NOTICE, "using database: %s\n", fname);
LOGP(DDB, LOGL_INFO, "Compiled against SQLite3 lib version %s\n", SQLITE_VERSION);
@@ -672,6 +673,7 @@ struct db_context *db_open(void *ctx, const char *fname, bool enable_sqlite_logg
goto out_free;
}
version = CURRENT_SCHEMA_VERSION;
version_changed = true;
}
LOGP(DDB, LOGL_NOTICE, "Database '%s' has HLR DB schema version %d\n", dbc->fname, version);
@@ -686,6 +688,7 @@ struct db_context *db_open(void *ctx, const char *fname, bool enable_sqlite_logg
}
LOGP(DDB, LOGL_NOTICE, "Database '%s' has been upgraded to HLR DB schema version %d\n",
dbc->fname, version+1);
version_changed = true;
}
if (version != CURRENT_SCHEMA_VERSION) {
@@ -702,6 +705,12 @@ struct db_context *db_open(void *ctx, const char *fname, bool enable_sqlite_logg
goto out_free;
}
/* Flush the cache after changing the version, to make the scenario
* less likely that after an unclean shutdown the DB gets restored
* with the right table layout but wrong version (SYS#7394). */
if (version_changed)
sqlite3_db_cacheflush(dbc->db);
/* prepare all SQL statements */
for (i = 0; i < ARRAY_SIZE(dbc->stmt); i++) {
rc = sqlite3_prepare_v2(dbc->db, stmt_sql[i], -1,

View File

@@ -754,7 +754,6 @@ static struct vty_app_info vty_info = {
.name = "OsmoHLR",
.version = PACKAGE_VERSION,
.copyright = vlr_copyright,
.is_config_node = hlr_vty_is_config_node,
.go_parent_cb = hlr_vty_go_parent,
};

View File

@@ -881,18 +881,6 @@ int hlr_vty_go_parent(struct vty *vty)
return vty->node;
}
int hlr_vty_is_config_node(struct vty *vty, int node)
{
switch (node) {
/* add items that are not config */
case CONFIG_NODE:
return 0;
default:
return 1;
}
}
void hlr_vty_init(void *hlr_ctx)
{
cfg_reject_cause_cmd.string =