hnbap: Improve logging around HNBAP HNB Register Request

Change-Id: I279ef563b38fb0dd3e6a72162db91d8503f91af8
This commit is contained in:
Pau Espin 2022-09-27 14:57:05 +02:00
parent 55239c2cca
commit 25cd41f3b5
1 changed files with 9 additions and 7 deletions

View File

@ -399,11 +399,15 @@ static int hnbgw_rx_hnb_register_req(struct hnb_context *ctx, ANY_t *in)
HNBAP_HNBRegisterRequestIEs_t ies;
int rc;
struct osmo_plmn_id plmn;
struct osmo_fd *ofd = osmo_stream_srv_get_ofd(ctx->conn);
char name[OSMO_SOCK_NAME_MAXLEN];
osmo_sock_get_name_buf(name, sizeof(name), ofd->fd);
rc = hnbap_decode_hnbregisterrequesties(&ies, in);
if (rc < 0) {
LOGHNB(ctx, DHNBAP, LOGL_ERROR, "Failure to decode HNB-REGISTER-REQ from %s: rc=%d\n",
ctx->identity_info, rc);
LOGHNB(ctx, DHNBAP, LOGL_ERROR, "Failure to decode HNB-REGISTER-REQ %s from %s: rc=%d\n",
ctx->identity_info, name, rc);
return rc;
}
@ -420,19 +424,17 @@ static int hnbgw_rx_hnb_register_req(struct hnb_context *ctx, ANY_t *in)
llist_for_each_entry(hnb, &ctx->gw->hnb_list, list) {
if (hnb->hnb_registered && ctx != hnb && memcmp(&ctx->id, &hnb->id, sizeof(ctx->id)) == 0) {
struct osmo_fd *ofd = osmo_stream_srv_get_ofd(ctx->conn);
char *name = osmo_sock_get_name(ctx, ofd->fd);
LOGHNB(ctx, DHNBAP, LOGL_ERROR, "rejecting HNB-REGISTER-REQ with duplicate cell identity "
"MCC=%u,MNC=%u,LAC=%u,RAC=%u,SAC=%u,CID=%u from %s\n",
ctx->id.mcc, ctx->id.mnc, ctx->id.lac, ctx->id.rac, ctx->id.sac, ctx->id.cid, name);
talloc_free(name);
hnbap_free_hnbregisterrequesties(&ies);
return hnbgw_tx_hnb_register_rej(ctx);
}
}
LOGHNB(ctx, DHNBAP, LOGL_DEBUG, "HNB-REGISTER-REQ from %s%s\n", ctx->identity_info,
ctx->hnb_registered ? " (duplicated)" : "");
LOGHNB(ctx, DHNBAP, LOGL_DEBUG, "HNB-REGISTER-REQ %s MCC=%u,MNC=%u,LAC=%u,RAC=%u,SAC=%u,CID=%u from %s%s\n",
ctx->identity_info, ctx->id.mcc, ctx->id.mnc, ctx->id.lac, ctx->id.rac, ctx->id.sac, ctx->id.cid,
name, ctx->hnb_registered ? " (duplicated)" : "");
ctx->hnb_registered = true;