This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-iuh/+/21899 )
Change subject: hnbgw: Introduce LOGHNB() macro for log context information
......................................................................
hnbgw: Introduce LOGHNB() macro for log context information
So far we don't really have any way of matching a given log message
to a specific hNB. Let's introduce a new log macro, together with
a configuration directive to select whether the hNB-ID or the
UMTS CellID shall be used.
Change-Id: I6113925216c6f88add2c6d27bdf47ccbb017f293
---
M include/osmocom/iuh/hnbgw.h
M src/hnbgw.c
M src/hnbgw_vty.c
3 files changed, 42 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
diff --git a/include/osmocom/iuh/hnbgw.h b/include/osmocom/iuh/hnbgw.h
index 4848c2f..fc8298d 100644
--- a/include/osmocom/iuh/hnbgw.h
+++ b/include/osmocom/iuh/hnbgw.h
@@ -18,6 +18,9 @@
DRANAP,
};
+#define LOGHNB(x, ss, lvl, fmt, args ...) \
+ LOGP(ss, lvl, "%s " fmt, hnb_context_name(x), ## args)
+
enum hnb_ctrl_node {
CTRL_NODE_HNB = _LAST_CTRL_NODE,
_LAST_CTRL_NODE_HNB
@@ -128,6 +131,8 @@
const char *iups_remote_addr_name;
uint16_t rnc_id;
bool hnbap_allow_tmsi;
+ /*! print hnb-id (true) or MCC-MNC-LAC-RAC-SAC (false) in logs */
+ bool log_prefix_hnb_id;
} config;
/*! SCTP listen socket for incoming connections */
struct osmo_stream_srv_link *iuh;
@@ -152,6 +157,7 @@
struct hnb_context *hnb_context_by_id(struct hnb_gw *gw, uint32_t cid);
struct hnb_context *hnb_context_by_identity_info(struct hnb_gw *gw, const char *identity_info);
+const char *hnb_context_name(struct hnb_context *ctx);
unsigned hnb_contexts(const struct hnb_gw *gw);
struct ue_context *ue_context_by_id(struct hnb_gw *gw, uint32_t id);
diff --git a/src/hnbgw.c b/src/hnbgw.c
index dd157d7..ba8a06f 100644
--- a/src/hnbgw.c
+++ b/src/hnbgw.c
@@ -83,6 +83,7 @@
/* strdup so we can easily talloc_free in the VTY code */
gw->config.iuh_local_ip = talloc_strdup(gw, HNBGW_LOCAL_IP_DEFAULT);
gw->config.iuh_local_port = IUH_DEFAULT_SCTP_PORT;
+ gw->config.log_prefix_hnb_id = true;
gw->next_ue_ctx_id = 23;
INIT_LLIST_HEAD(&gw->hnb_list);
@@ -296,6 +297,25 @@
return ctx;
}
+static const char *umts_cell_id_name(const struct umts_cell_id *ucid)
+{
+ static __thread char buf[40];
+
+ snprintf(buf, sizeof(buf), "%u-%u-L%u-R%u-S%u", ucid->mcc, ucid->mnc, ucid->lac, ucid->rac, ucid->sac);
+ return buf;
+}
+
+const char *hnb_context_name(struct hnb_context *ctx)
+{
+ if (!ctx)
+ return "NULL";
+
+ if (ctx->gw->config.log_prefix_hnb_id)
+ return ctx->identity_info;
+ else
+ return umts_cell_id_name(&ctx->id);
+}
+
void hnb_context_release(struct hnb_context *ctx)
{
struct hnbgw_context_map *map, *map2;
diff --git a/src/hnbgw_vty.c b/src/hnbgw_vty.c
index f2e51d4..a826246 100644
--- a/src/hnbgw_vty.c
+++ b/src/hnbgw_vty.c
@@ -296,6 +296,19 @@
return CMD_SUCCESS;
}
+DEFUN(cfg_hnbgw_log_prefix, cfg_hnbgw_log_prefix_cmd,
+ "log-prefix (hnb-id|umts-cell-id)",
+ "Configure the log message prefix\n"
+ "Use the hNB-ID as log message prefix\n"
+ "Use the UMTS Cell ID as log message prefix\n")
+{
+ if (!strcmp(argv[0], "hnb-id"))
+ g_hnb_gw->config.log_prefix_hnb_id = true;
+ else
+ g_hnb_gw->config.log_prefix_hnb_id = false;
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_hnbgw_iucs_remote_addr,
cfg_hnbgw_iucs_remote_addr_cmd,
"remote-addr NAME",
@@ -319,6 +332,8 @@
static int config_write_hnbgw(struct vty *vty)
{
vty_out(vty, "hnbgw%s", VTY_NEWLINE);
+ vty_out(vty, " log-prefix %s%s", g_hnb_gw->config.log_prefix_hnb_id ? "hnb-id" : "umts-cell-id",
+ VTY_NEWLINE);
return CMD_SUCCESS;
}
@@ -376,6 +391,7 @@
install_node(&hnbgw_node, config_write_hnbgw);
install_element(HNBGW_NODE, &cfg_hnbgw_rnc_id_cmd);
+ install_element(HNBGW_NODE, &cfg_hnbgw_log_prefix_cmd);
install_element(HNBGW_NODE, &cfg_hnbgw_iuh_cmd);
install_node(&iuh_node, config_write_hnbgw_iuh);
--
To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/21899
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Change-Id: I6113925216c6f88add2c6d27bdf47ccbb017f293
Gerrit-Change-Number: 21899
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210104/b5fb5622/attachment.htm>