neels submitted this change.

View Change


Approvals: neels: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified
improve HNBAP error logging

We have a situation where HNBAP is not answered by osmo-hnbgw, and the
log is all silent. Add logging to a lot more of the possible HNBAP
failure paths to find out what is wrong.

Related: SYS#6810
Change-Id: I17d2809f59087d32e7c11a3ada1d3fadf6f0b660
---
M src/osmo-hnbgw/hnbgw.c
M src/osmo-hnbgw/hnbgw_hnbap.c
2 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/src/osmo-hnbgw/hnbgw.c b/src/osmo-hnbgw/hnbgw.c
index 6f74d04..43fcaca 100644
--- a/src/osmo-hnbgw/hnbgw.c
+++ b/src/osmo-hnbgw/hnbgw.c
@@ -155,8 +155,7 @@
struct ue_context *ue;

ue = talloc_zero(g_hnbgw, struct ue_context);
- if (!ue)
- return NULL;
+ OSMO_ASSERT(ue);

ue->hnb = hnb;
if (imsi)
diff --git a/src/osmo-hnbgw/hnbgw_hnbap.c b/src/osmo-hnbgw/hnbgw_hnbap.c
index b220918..f860173 100644
--- a/src/osmo-hnbgw/hnbgw_hnbap.c
+++ b/src/osmo-hnbgw/hnbgw_hnbap.c
@@ -194,6 +194,9 @@
rc = hnbap_encode_ueregisteraccepties(&accept_out, &accept);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_OCTET_STRING, &accept.uE_Identity.choice.iMSI);
if (rc < 0) {
+ LOGHNB(ue->hnb, DHNBAP, LOGL_ERROR,
+ "Failed to encode HNBAP UE Register Accept message for UE IMSI-%s TMSI-0x%08x\n",
+ ue->imsi, ue->tmsi);
return rc;
}

@@ -204,7 +207,12 @@

ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_HNBAP_UERegisterAccept, &accept_out);

- return hnbgw_hnbap_tx(ue->hnb, msg);
+ rc = hnbgw_hnbap_tx(ue->hnb, msg);
+ if (rc)
+ LOGHNB(ue->hnb, DHNBAP, LOGL_ERROR,
+ "Failed to enqueue HNBAP UE Register Accept message for UE IMSI-%s TMSI-0x%08x\n",
+ ue->imsi, ue->tmsi);
+ return rc;
}

static int hnbgw_tx_ue_register_rej(struct hnb_context *hnb, HNBAP_UE_Identity_t *ue_id, const struct HNBAP_Cause *cause)
@@ -426,6 +434,7 @@
}

if (rc < 0) {
+ LOGHNB(hnb, DHNBAP, LOGL_ERROR, "Failed to encode HNBAP UE Register Accept for TMSI 0x%08x\n", tmsi);
/* Encoding failed. Nothing in 'accept_out'. */
/* If we allocated the UE context but the UE REGISTER fails, get rid of it again: there will likely
* never be a UE DE-REGISTER for this UE from the HNB, and the ue_context would linger forever. */
@@ -441,6 +450,8 @@
&accept_out);
rc = hnbgw_hnbap_tx(hnb, msg);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_HNBAP_UERegisterAccept, &accept_out);
+ if (rc)
+ LOGHNB(hnb, DHNBAP, LOGL_ERROR, "Failed to transmit HNBAP UE Register Accept for TMSI 0x%08x\n", tmsi);
return rc;
}

@@ -642,14 +653,19 @@
ue = ue_context_by_imsi(imsi);
if (!ue)
ue = ue_allocated = ue_context_alloc(ctx, imsi, 0);
+ else
+ LOGHNB(ctx, DHNBAP, LOGL_DEBUG, "UE context for IMSI %s already exists\n", imsi);

/* Send UERegisterAccept */
rc = hnbgw_tx_ue_register_acc(ue);
if (rc < 0) {
+ LOGHNB(ctx, DHNBAP, LOGL_ERROR, "Failed to transmit HNBAP UE Register Accept for IMSI %s\n", imsi);
/* If we allocated the UE context but the UE REGISTER fails, get rid of it again: there will likely
* never be a UE DE-REGISTER for this UE from the HNB, and the ue_context would linger forever. */
- if (ue_allocated)
+ if (ue_allocated) {
ue_context_free(ue_allocated);
+ LOGHNB(ctx, DHNBAP, LOGL_INFO, "Freed UE context for IMSI %s\n", imsi);
+ }
}
free_and_return_rc:
hnbap_free_ueregisterrequesties(&ies);

To view, visit change 36141. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I17d2809f59087d32e7c11a3ada1d3fadf6f0b660
Gerrit-Change-Number: 36141
Gerrit-PatchSet: 4
Gerrit-Owner: neels <nhofmeyr@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: neels <nhofmeyr@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>
Gerrit-CC: dexter <pmaier@sysmocom.de>
Gerrit-MessageType: merged