laforge has uploaded this change for review. ( 
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, 24 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/75/36475/1

diff --git a/src/osmo-hnbgw/hnbgw_hnbap.c b/src/osmo-hnbgw/hnbgw_hnbap.c
index d17bd5c..fd25e59 100644
--- a/src/osmo-hnbgw/hnbgw_hnbap.c
+++ b/src/osmo-hnbgw/hnbgw_hnbap.c
@@ -49,16 +49,17 @@
        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;
+       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));
@@ -412,6 +413,9 @@
        char identity_str[256];
        const char *cell_id_str;
        struct timespec tp;
+       HNBAP_Cause_t cause = {
+               .present = HNBAP_Cause_PR_radioNetwork,
+       };

        rc = hnbap_decode_hnbregisterrequesties(&ies, in);
        if (rc < 0) {
@@ -438,7 +442,8 @@
        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.choice.radioNetwork = 
HNBAP_CauseRadioNetwork_unauthorised_HNB;
+               return hnbgw_tx_hnb_register_rej(ctx, &cause);
        }
        ctx->persistent = hnbp;
        hnbp->ctx = ctx;
@@ -478,7 +483,8 @@
                         * 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.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: 1
Gerrit-Owner: laforge <lafo...@osmocom.org>
Gerrit-MessageType: newchange

Reply via email to