laforge has submitted this change. (
https://gerrit.osmocom.org/c/osmo-hnbgw/+/36475?usp=email )
Change subject: HNBAP: Use proper cause values during HNB-REGISTER-REQ processing
......................................................................
HNBAP: Use proper cause values during HNB-REGISTER-REQ processing
When we reject the HNB-REGISTER-REQ, let's use an as specific as possible
cause value to let the peer know why we rejected registration.
Change-Id: Iadddd26b751a9fd80c829068792aa93cd538c43d
---
M src/osmo-hnbgw/hnbgw_hnbap.c
1 file changed, 26 insertions(+), 6 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
diff --git a/src/osmo-hnbgw/hnbgw_hnbap.c b/src/osmo-hnbgw/hnbgw_hnbap.c
index 32b0904..5cca3cb 100644
--- a/src/osmo-hnbgw/hnbgw_hnbap.c
+++ b/src/osmo-hnbgw/hnbgw_hnbap.c
@@ -49,16 +49,19 @@
return 0;
}
-static int hnbgw_tx_hnb_register_rej(struct hnb_context *ctx)
+static int hnbgw_tx_hnb_register_rej(struct hnb_context *ctx, const HNBAP_Cause_t
*cause)
{
HNBAP_HNBRegisterReject_t reject_out;
HNBAP_HNBRegisterRejectIEs_t reject;
struct msgb *msg;
int rc;
- reject.presenceMask = 0,
- reject.cause.present = HNBAP_Cause_PR_radioNetwork;
- reject.cause.choice.radioNetwork = HNBAP_CauseRadioNetwork_unspecified;
+ OSMO_ASSERT(cause);
+
+ LOGHNB(ctx, DHNBAP, LOGL_ERROR, "Rejecting HNB Register Request cause=%s\n",
hnbap_cause_str(cause));
+
+ reject.presenceMask = 0;
+ reject.cause = *cause;
/* encode the Information Elements */
memset(&reject_out, 0, sizeof(reject_out));
@@ -414,6 +417,7 @@
char identity_str[256];
const char *cell_id_str;
struct timespec tp;
+ HNBAP_Cause_t cause;
rc = hnbap_decode_hnbregisterrequesties(&ies, in);
if (rc < 0) {
@@ -440,7 +444,9 @@
if (!hnbp) {
LOGHNB(ctx, DHNBAP, LOGL_NOTICE, "Rejecting unknonwn HNB with identity %s\n",
identity_str);
hnbap_free_hnbregisterrequesties(&ies);
- return hnbgw_tx_hnb_register_rej(ctx);
+ cause.present = HNBAP_Cause_PR_radioNetwork;
+ cause.choice.radioNetwork = HNBAP_CauseRadioNetwork_unauthorised_HNB;
+ return hnbgw_tx_hnb_register_rej(ctx, &cause);
}
ctx->persistent = hnbp;
hnbp->ctx = ctx;
@@ -480,7 +486,9 @@
* misconfigurations or someone trying to impersonate an already working HNB: */
LOGHNB(ctx, DHNBAP, LOGL_ERROR, "rejecting HNB-REGISTER-REQ with duplicate cell
identity %s\n", cell_id_str);
hnbap_free_hnbregisterrequesties(&ies);
- return hnbgw_tx_hnb_register_rej(ctx);
+ cause.present = HNBAP_Cause_PR_radioNetwork;
+ cause.choice.radioNetwork = HNBAP_CauseRadioNetwork_hNB_parameter_mismatch;
+ return hnbgw_tx_hnb_register_rej(ctx, &cause);
}
}
--
To view, visit
https://gerrit.osmocom.org/c/osmo-hnbgw/+/36475?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: Iadddd26b751a9fd80c829068792aa93cd538c43d
Gerrit-Change-Number: 36475
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged