Projects
osmocom:master
osmo-hnbgw
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 76
View file
osmo-hnbgw.spec
Changed
@@ -18,13 +18,13 @@ Name: osmo-hnbgw Requires: osmocom-master -Version: 1.5.0.21.1ee4 +Version: 1.5.0.24.0560 Release: 0 Summary: OsmoHNBGW: Osmocom's Base Station Controller for 2G CS mobile networks License: AGPL-3.0-or-later AND GPL-2.0-or-later Group: Hardware/Mobile URL: https://osmocom.org/projects/osmohnbgw -Source: osmo-hnbgw_1.5.0.21.1ee4.tar.xz +Source: osmo-hnbgw_1.5.0.24.0560.tar.xz Source1: rpmlintrc BuildRequires: automake >= 1.9 BuildRequires: libtool >= 2
View file
commit_05605354ef64f361ee39d21705fc4dd346f47e4e.txt
Added
View file
commit_1ee44400a4cac51f56a1b8b9f8da480966bb4505.txt
Deleted
View file
osmo-hnbgw_1.5.0.21.1ee4.dsc -> osmo-hnbgw_1.5.0.24.0560.dsc
Changed
@@ -2,7 +2,7 @@ Source: osmo-hnbgw Binary: osmo-hnbgw, osmo-hnbgw-dbg, osmo-hnbgw-doc Architecture: any all -Version: 1.5.0.21.1ee4 +Version: 1.5.0.24.0560 Maintainer: Osmocom team <openbsc@lists.osmocom.org> Homepage: https://projects.osmocom.org/projects/osmo-hnbgw Standards-Version: 3.9.8 @@ -14,8 +14,8 @@ osmo-hnbgw-dbg deb debug extra arch=any osmo-hnbgw-doc deb doc optional arch=all Checksums-Sha1: - 06dcd959ac17efef465e632b35852e98a1761b64 101268 osmo-hnbgw_1.5.0.21.1ee4.tar.xz + 3013577993bc54297a3659d1c2681278c5c946c3 101656 osmo-hnbgw_1.5.0.24.0560.tar.xz Checksums-Sha256: - 6bbcfd3e3148a4034bbd7d15199bb621e0c16121a1202014c4ff30cf1c4f0c2a 101268 osmo-hnbgw_1.5.0.21.1ee4.tar.xz + 671d7ffd54fc3dd1d4b051181a95e6f679403135813514a9a0aa42eb23c845c5 101656 osmo-hnbgw_1.5.0.24.0560.tar.xz Files: - c23c5bf0f076ec73edc519b7b7822683 101268 osmo-hnbgw_1.5.0.21.1ee4.tar.xz + 2ccfd27122b71e5cb95d7fa686ce0603 101656 osmo-hnbgw_1.5.0.24.0560.tar.xz
View file
osmo-hnbgw_1.5.0.21.1ee4.tar.xz/.tarball-version -> osmo-hnbgw_1.5.0.24.0560.tar.xz/.tarball-version
Changed
@@ -1 +1 @@ -1.5.0.21-1ee4 +1.5.0.24-0560
View file
osmo-hnbgw_1.5.0.21.1ee4.tar.xz/debian/changelog -> osmo-hnbgw_1.5.0.24.0560.tar.xz/debian/changelog
Changed
@@ -1,8 +1,8 @@ -osmo-hnbgw (1.5.0.21.1ee4) unstable; urgency=medium +osmo-hnbgw (1.5.0.24.0560) unstable; urgency=medium * Automatically generated changelog entry for building the Osmocom master feed - -- Osmocom OBS scripts <info@osmocom.org> Mon, 19 Feb 2024 20:50:48 +0000 + -- Osmocom OBS scripts <info@osmocom.org> Fri, 08 Mar 2024 09:00:59 +0000 osmo-hnbgw (1.5.0) unstable; urgency=medium
View file
osmo-hnbgw_1.5.0.21.1ee4.tar.xz/src/osmo-hnbgw/hnbgw.c -> osmo-hnbgw_1.5.0.24.0560.tar.xz/src/osmo-hnbgw/hnbgw.c
Changed
@@ -47,85 +47,10 @@ {} }; -void g_hnbgw_alloc(void *ctx) -{ - OSMO_ASSERT(!g_hnbgw); - g_hnbgw = talloc_zero(ctx, struct hnbgw); - - /* strdup so we can easily talloc_free in the VTY code */ - g_hnbgw->config.iuh_local_ip = talloc_strdup(g_hnbgw, HNBGW_LOCAL_IP_DEFAULT); - g_hnbgw->config.iuh_local_port = IUH_DEFAULT_SCTP_PORT; - g_hnbgw->config.log_prefix_hnb_id = true; - - /* Set zero PLMN to detect a missing PLMN when transmitting RESET */ - g_hnbgw->config.plmn = (struct osmo_plmn_id){ 0, 0, false }; - g_hnbgw->next_ue_ctx_id = 23; - INIT_LLIST_HEAD(&g_hnbgw->hnb_list); - INIT_LLIST_HEAD(&g_hnbgw->ue_list); - INIT_LLIST_HEAD(&g_hnbgw->sccp.users); - - g_hnbgw->mgw_pool = mgcp_client_pool_alloc(g_hnbgw); - g_hnbgw->config.mgcp_client = mgcp_client_conf_alloc(g_hnbgw); - -#if ENABLE_PFCP - g_hnbgw->config.pfcp.remote_port = OSMO_PFCP_PORT; -#endif - - g_hnbgw->sccp.cnpool_iucs = (struct hnbgw_cnpool){ - .domain = DOMAIN_CS, - .pool_name = "iucs", - .peer_name = "msc", - .default_remote_pc = DEFAULT_PC_MSC, - .vty = { - .nri_bitlen = OSMO_NRI_BITLEN_DEFAULT, - .null_nri_ranges = osmo_nri_ranges_alloc(g_hnbgw), - }, - .cnlink_ctrg_desc = &msc_ctrg_desc, - - .ctrs = rate_ctr_group_alloc(g_hnbgw, &iucs_ctrg_desc, 0), - }; - INIT_LLIST_HEAD(&g_hnbgw->sccp.cnpool_iucs.cnlinks); - - g_hnbgw->sccp.cnpool_iups = (struct hnbgw_cnpool){ - .domain = DOMAIN_PS, - .pool_name = "iups", - .peer_name = "sgsn", - .default_remote_pc = DEFAULT_PC_SGSN, - .vty = { - .nri_bitlen = OSMO_NRI_BITLEN_DEFAULT, - .null_nri_ranges = osmo_nri_ranges_alloc(g_hnbgw), - }, - .cnlink_ctrg_desc = &sgsn_ctrg_desc, - - .ctrs = rate_ctr_group_alloc(g_hnbgw, &iups_ctrg_desc, 0), - }; - INIT_LLIST_HEAD(&g_hnbgw->sccp.cnpool_iups.cnlinks); -} - -static struct hnb_context *hnb_context_by_id(uint32_t cid) -{ - struct hnb_context *hnb; - - llist_for_each_entry(hnb, &g_hnbgw->hnb_list, list) { - if (hnb->id.cid == cid) - return hnb; - } - - return NULL; -} - -struct hnb_context *hnb_context_by_identity_info(const char *identity_info) -{ - struct hnb_context *hnb; - - llist_for_each_entry(hnb, &g_hnbgw->hnb_list, list) { - if (strcmp(identity_info, hnb->identity_info) == 0) - return hnb; - } - - return NULL; -} +/*********************************************************************** + * UE Context + ***********************************************************************/ struct ue_context *ue_context_by_id(uint32_t id) { @@ -212,6 +137,146 @@ talloc_free(ue); } + +/*********************************************************************** + * HNB Context + ***********************************************************************/ + +/* look-up HNB context by id. Used from CTRL */ +static struct hnb_context *hnb_context_by_id(uint32_t cid) +{ + struct hnb_context *hnb; + + llist_for_each_entry(hnb, &g_hnbgw->hnb_list, list) { + if (hnb->id.cid == cid) + return hnb; + } + + return NULL; +} + +/* look-up HNB context by identity_info. Used from VTY */ +struct hnb_context *hnb_context_by_identity_info(const char *identity_info) +{ + struct hnb_context *hnb; + + llist_for_each_entry(hnb, &g_hnbgw->hnb_list, list) { + if (strcmp(identity_info, hnb->identity_info) == 0) + return hnb; + } + + return NULL; +} + +static int hnb_read_cb(struct osmo_stream_srv *conn); +static int hnb_closed_cb(struct osmo_stream_srv *conn); + +static struct hnb_context *hnb_context_alloc(struct osmo_stream_srv_link *link, int new_fd) +{ + struct hnb_context *ctx; + + ctx = talloc_zero(g_hnbgw, struct hnb_context); + if (!ctx) + return NULL; + INIT_LLIST_HEAD(&ctx->map_list); + + ctx->conn = osmo_stream_srv_create(g_hnbgw, link, new_fd, hnb_read_cb, hnb_closed_cb, ctx); + if (!ctx->conn) { + LOGP(DMAIN, LOGL_INFO, "error while creating connection\n"); + talloc_free(ctx); + return NULL; + } + + llist_add_tail(&ctx->list, &g_hnbgw->hnb_list); + return ctx; +} + +const char *umts_cell_id_name(const struct umts_cell_id *ucid) +{ + const char *fmtstr = "%03u-%02u-L%u-R%u-S%u-C%u"; + + if (g_hnbgw->config.plmn.mnc_3_digits) + fmtstr = "%03u-%03u-L%u-R%u-S%u-C%u"; + + return talloc_asprintf(OTC_SELECT, fmtstr, ucid->mcc, ucid->mnc, ucid->lac, ucid->rac, + ucid->sac, ucid->cid); +} + +const char *hnb_context_name(struct hnb_context *ctx) +{ + char *result; + if (!ctx) + return "NULL"; + + if (ctx->conn) { + char hostbuf_rINET6_ADDRSTRLEN; + char portbuf_r6; + int fd = osmo_stream_srv_get_ofd(ctx->conn)->fd; + + /* get remote addr */ + if (osmo_sock_get_ip_and_port(fd, hostbuf_r, sizeof(hostbuf_r), portbuf_r, sizeof(portbuf_r), false) == 0) + result = talloc_asprintf(OTC_SELECT, "%s:%s", hostbuf_r, portbuf_r); + else + result = "?"; + } else { + result = "disconnected"; + } + + if (g_hnbgw->config.log_prefix_hnb_id) + result = talloc_asprintf(OTC_SELECT, "%s %s", result, ctx->identity_info); + else + result = talloc_asprintf(OTC_SELECT, "%s %s", result, umts_cell_id_name(&ctx->id)); + return result; +} + +void hnb_context_release_ue_state(struct hnb_context *ctx) +{ + struct hnbgw_context_map *map, *map2; + + /* deactivate all context maps */ + llist_for_each_entry_safe(map, map2, &ctx->map_list, hnb_list) { + context_map_hnb_released(map); + /* hnbgw_context_map will remove itself from lists when it is ready. */ + } + ue_context_free_by_hnb(ctx); +} + +void hnb_context_release(struct hnb_context *ctx) +{ + struct hnbgw_context_map *map; + + LOGHNB(ctx, DMAIN, LOGL_INFO, "Releasing HNB context\n"); + + /* remove from the list of HNB contexts */ + llist_del(&ctx->list); + + hnb_context_release_ue_state(ctx); + + if (ctx->conn) { /* we own a conn, we must free it: */ + LOGHNB(ctx, DMAIN, LOGL_INFO, "Closing HNB SCTP connection %s\n", + osmo_sock_get_name2(osmo_stream_srv_get_ofd(ctx->conn)->fd)); + /* Avoid our closed_cb calling hnb_context_release() again: */ + osmo_stream_srv_set_data(ctx->conn, NULL); + osmo_stream_srv_destroy(ctx->conn); + } /* else: we are called from closed_cb, so conn is being freed separately */ + + /* hnbgw_context_map are still listed in ctx->map_list, but we are freeing ctx. Remove all entries from the + * list, but keep the hnbgw_context_map around for graceful release. They are also listed under + * hnbgw_cnlink->map_list, and will remove themselves when ready. */ + while ((map = llist_first_entry_or_null(&ctx->map_list, struct hnbgw_context_map, hnb_list))) { + llist_del(&map->hnb_list); + map->hnb_ctx = NULL; + } + + talloc_free(ctx); +} + + + +/*********************************************************************** + * SCTP Socket / stream handling + ***********************************************************************/ + static int hnb_read_cb(struct osmo_stream_srv *conn) { struct hnb_context *hnb = osmo_stream_srv_get_data(conn); @@ -331,101 +396,6 @@ return 0; } -static struct hnb_context *hnb_context_alloc(struct osmo_stream_srv_link *link, int new_fd) -{ - struct hnb_context *ctx; - - ctx = talloc_zero(g_hnbgw, struct hnb_context); - if (!ctx) - return NULL; - INIT_LLIST_HEAD(&ctx->map_list); - - ctx->conn = osmo_stream_srv_create(g_hnbgw, link, new_fd, hnb_read_cb, hnb_closed_cb, ctx); - if (!ctx->conn) { - LOGP(DMAIN, LOGL_INFO, "error while creating connection\n"); - talloc_free(ctx); - return NULL; - } - - llist_add_tail(&ctx->list, &g_hnbgw->hnb_list); - return ctx; -} - -const char *umts_cell_id_name(const struct umts_cell_id *ucid) -{ - return talloc_asprintf(OTC_SELECT, "%u-%u-L%u-R%u-S%u-C%u", ucid->mcc, ucid->mnc, ucid->lac, ucid->rac, - ucid->sac, ucid->cid); -} - -const char *hnb_context_name(struct hnb_context *ctx) -{ - char *result; - if (!ctx) - return "NULL"; - - if (ctx->conn) { - char hostbuf_rINET6_ADDRSTRLEN; - char portbuf_r6; - int fd = osmo_stream_srv_get_ofd(ctx->conn)->fd; - - /* get remote addr */ - if (osmo_sock_get_ip_and_port(fd, hostbuf_r, sizeof(hostbuf_r), portbuf_r, sizeof(portbuf_r), false) == 0) - result = talloc_asprintf(OTC_SELECT, "%s:%s", hostbuf_r, portbuf_r); - else - result = "?"; - } else { - result = "disconnected"; - } - - if (g_hnbgw->config.log_prefix_hnb_id) - result = talloc_asprintf(OTC_SELECT, "%s %s", result, ctx->identity_info); - else - result = talloc_asprintf(OTC_SELECT, "%s %s", result, umts_cell_id_name(&ctx->id)); - return result; -} - -void hnb_context_release_ue_state(struct hnb_context *ctx) -{ - struct hnbgw_context_map *map, *map2; - - /* deactivate all context maps */ - llist_for_each_entry_safe(map, map2, &ctx->map_list, hnb_list) { - context_map_hnb_released(map); - /* hnbgw_context_map will remove itself from lists when it is ready. */ - } - ue_context_free_by_hnb(ctx); -} - -void hnb_context_release(struct hnb_context *ctx) -{ - struct hnbgw_context_map *map; - - LOGHNB(ctx, DMAIN, LOGL_INFO, "Releasing HNB context\n"); - - /* remove from the list of HNB contexts */ - llist_del(&ctx->list); - - hnb_context_release_ue_state(ctx); - - if (ctx->conn) { /* we own a conn, we must free it: */ - LOGHNB(ctx, DMAIN, LOGL_INFO, "Closing HNB SCTP connection %s\n", - osmo_sock_get_name2(osmo_stream_srv_get_ofd(ctx->conn)->fd)); - /* Avoid our closed_cb calling hnb_context_release() again: */ - osmo_stream_srv_set_data(ctx->conn, NULL); - osmo_stream_srv_destroy(ctx->conn); - } /* else: we are called from closed_cb, so conn is being freed separately */ - - /* hnbgw_context_map are still listed in ctx->map_list, but we are freeing ctx. Remove all entries from the - * list, but keep the hnbgw_context_map around for graceful release. They are also listed under - * hnbgw_cnlink->map_list, and will remove themselves when ready. */ - while ((map = llist_first_entry_or_null(&ctx->map_list, struct hnbgw_context_map, hnb_list))) { - llist_del(&map->hnb_list); - map->hnb_ctx = NULL; - } - - talloc_free(ctx); -} - /*! call-back when the listen FD has something to read */ int hnbgw_rua_accept_cb(struct osmo_stream_srv_link *srv, int fd) { @@ -604,3 +574,59 @@ .go_parent_cb = hnbgw_vty_go_parent, .copyright = HNBGW_COPYRIGHT, }; + +void g_hnbgw_alloc(void *ctx) +{ + OSMO_ASSERT(!g_hnbgw); + g_hnbgw = talloc_zero(ctx, struct hnbgw); + + /* strdup so we can easily talloc_free in the VTY code */ + g_hnbgw->config.iuh_local_ip = talloc_strdup(g_hnbgw, HNBGW_LOCAL_IP_DEFAULT); + g_hnbgw->config.iuh_local_port = IUH_DEFAULT_SCTP_PORT; + g_hnbgw->config.log_prefix_hnb_id = true; + + /* Set zero PLMN to detect a missing PLMN when transmitting RESET */ + g_hnbgw->config.plmn = (struct osmo_plmn_id){ 0, 0, false }; + + g_hnbgw->next_ue_ctx_id = 23; + INIT_LLIST_HEAD(&g_hnbgw->hnb_list); + INIT_LLIST_HEAD(&g_hnbgw->ue_list); + INIT_LLIST_HEAD(&g_hnbgw->sccp.users); + + g_hnbgw->mgw_pool = mgcp_client_pool_alloc(g_hnbgw); + g_hnbgw->config.mgcp_client = mgcp_client_conf_alloc(g_hnbgw); + +#if ENABLE_PFCP + g_hnbgw->config.pfcp.remote_port = OSMO_PFCP_PORT; +#endif + + g_hnbgw->sccp.cnpool_iucs = (struct hnbgw_cnpool){ + .domain = DOMAIN_CS, + .pool_name = "iucs", + .peer_name = "msc", + .default_remote_pc = DEFAULT_PC_MSC, + .vty = { + .nri_bitlen = OSMO_NRI_BITLEN_DEFAULT, + .null_nri_ranges = osmo_nri_ranges_alloc(g_hnbgw), + }, + .cnlink_ctrg_desc = &msc_ctrg_desc, + + .ctrs = rate_ctr_group_alloc(g_hnbgw, &iucs_ctrg_desc, 0), + }; + INIT_LLIST_HEAD(&g_hnbgw->sccp.cnpool_iucs.cnlinks); + + g_hnbgw->sccp.cnpool_iups = (struct hnbgw_cnpool){ + .domain = DOMAIN_PS, + .pool_name = "iups", + .peer_name = "sgsn", + .default_remote_pc = DEFAULT_PC_SGSN, + .vty = { + .nri_bitlen = OSMO_NRI_BITLEN_DEFAULT, + .null_nri_ranges = osmo_nri_ranges_alloc(g_hnbgw), + }, + .cnlink_ctrg_desc = &sgsn_ctrg_desc, + + .ctrs = rate_ctr_group_alloc(g_hnbgw, &iups_ctrg_desc, 0), + }; + INIT_LLIST_HEAD(&g_hnbgw->sccp.cnpool_iups.cnlinks); +}
View file
osmo-hnbgw_1.5.0.21.1ee4.tar.xz/src/osmo-hnbgw/osmo_hnbgw_main.c -> osmo-hnbgw_1.5.0.24.0560.tar.xz/src/osmo-hnbgw/osmo_hnbgw_main.c
Changed
@@ -1,6 +1,6 @@ /* OsmoHNBGW main routine */ -/* (C) 2015 by Harald Welte <laforge@gnumonks.org> +/* (C) 2015-2024 by Harald Welte <laforge@gnumonks.org> * (C) 2016-2023 by sysmocom s.f.m.c. GmbH <info@sysmocom.de> * All Rights Reserved * @@ -19,6 +19,7 @@ * */ +#include <signal.h> #include <getopt.h> #include "config.h" @@ -64,6 +65,32 @@ NULL, }; +static void signal_handler(int signum) +{ + fprintf(stdout, "signal %u received\n", signum); + + switch (signum) { + case SIGABRT: + /* in case of abort, we want to obtain a talloc report and + * then run default SIGABRT handler, who will generate coredump + * and abort the process. abort() should do this for us after we + * return, but program wouldn't exit if an external SIGABRT is + * received. + */ + talloc_report(tall_vty_ctx, stderr); + talloc_report_full(g_hnbgw, stderr); + signal(SIGABRT, SIG_DFL); + raise(SIGABRT); + break; + case SIGUSR1: + talloc_report(tall_vty_ctx, stderr); + talloc_report_full(g_hnbgw, stderr); + break; + default: + break; + } +} + static void print_usage(void) { printf("Usage: osmo-hnbgw\n"); @@ -313,6 +340,11 @@ } } + signal(SIGABRT, &signal_handler); + signal(SIGUSR1, &signal_handler); + signal(SIGUSR2, &signal_handler); + osmo_init_ignore_signals(); + while (1) { rc = osmo_select_main_ctx(0); if (rc < 0)
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
.