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/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hnodeb/+/26349 ) Change subject: hnbap: Improve rx path and implement HnbRegisterReject ...................................................................... hnbap: Improve rx path and implement HnbRegisterReject The process is shut down if we receive such a message. Change-Id: Id4656140b7f51b07860dcbeed449ed68c3a9f85a --- M src/osmo-hnodeb/hnbap.c 1 file changed, 78 insertions(+), 12 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve osmith: Looks good to me, but someone else must approve pespin: Looks good to me, approved diff --git a/src/osmo-hnodeb/hnbap.c b/src/osmo-hnodeb/hnbap.c index 585354b..3287eeb 100644 --- a/src/osmo-hnodeb/hnbap.c +++ b/src/osmo-hnodeb/hnbap.c @@ -33,6 +33,7 @@ #include <osmocom/hnodeb/hnbap.h> #include <osmocom/hnodeb/hnodeb.h> #include <osmocom/hnodeb/iuh.h> +#include <osmocom/hnodeb/hnb_shutdown_fsm.h> static int hnb_rx_hnb_register_acc(struct hnb *hnb, ANY_t *in) { @@ -44,12 +45,31 @@ } hnb->rnc_id = accept.rnc_id; - LOGP(DHNBAP, LOGL_INFO, "HNB Register accept with RNC ID %u\n", hnb->rnc_id); + LOGP(DHNBAP, LOGL_INFO, "Rx HNB Register accept with RNC ID %u\n", hnb->rnc_id); hnbap_free_hnbregisteraccepties(&accept); return 0; } +static int hnb_rx_hnb_register_rej(struct hnb *hnb, ANY_t *in) +{ + int rc; + HNBAP_HNBRegisterRejectIEs_t reject; + + rc = hnbap_decode_hnbregisterrejecties(&reject, in); + if (rc < 0) { + LOGP(DHNBAP, LOGL_NOTICE, "Rx HNB Register Reject: parse failure\n"); + return -EINVAL; + } + + LOGP(DHNBAP, LOGL_NOTICE, "Rx HNB Register Reject with cause %s\n", + hnbap_cause_str(&reject.cause)); + hnbap_free_hnbregisterrejecties(&reject); + + hnb_shutdown(hnb, "Rx HNB Register Reject", false); + return 0; +} + static int hnb_rx_ue_register_acc(struct hnb *hnb, ANY_t *in) { int rc; @@ -79,6 +99,53 @@ return 0; } +static int hnb_hnbap_rx_initiating(struct hnb *hnb, struct HNBAP_InitiatingMessage *init) +{ + int rc; + + switch (init->procedureCode) { + default: + LOGP(DHNBAP, LOGL_ERROR, "Rx HNBAP initiatingMessage %ld unsupported\n", init->procedureCode); + rc = -ENOSPC; + break; + } + return rc; +} + +static int hnb_hnbap_rx_successful(struct hnb *hnb, struct HNBAP_SuccessfulOutcome *succ) +{ + int rc; + + switch (succ->procedureCode) { + case HNBAP_ProcedureCode_id_HNBRegister: + /* Get HNB id and send UE Register request */ + rc = hnb_rx_hnb_register_acc(hnb, &succ->value); + break; + case HNBAP_ProcedureCode_id_UERegister: + rc = hnb_rx_ue_register_acc(hnb, &succ->value); + break; + default: + rc = -ENOSPC; + break; + } + return rc; +} + +static int hnb_hnbap_rx_unsuccessful(struct hnb *hnb, struct HNBAP_UnsuccessfulOutcome *unsucc) +{ + int rc; + + switch (unsucc->procedureCode) { + case HNBAP_ProcedureCode_id_HNBRegister: + rc = hnb_rx_hnb_register_rej(hnb, &unsucc->value); + break; + default: + rc = -ENOSPC; + break; + } + return rc; +} + int hnb_hnbap_rx(struct hnb *hnb, struct msgb *msg) { HNBAP_HNBAP_PDU_t _pdu, *pdu = &_pdu; @@ -93,21 +160,20 @@ return -EINVAL; } - if (pdu->present != HNBAP_HNBAP_PDU_PR_successfulOutcome) { - LOGP(DHNBAP, LOGL_ERROR, "Unexpected HNBAP message received\n"); - } - - switch (pdu->choice.successfulOutcome.procedureCode) { - case HNBAP_ProcedureCode_id_HNBRegister: - /* Get HNB id and send UE Register request */ - rc = hnb_rx_hnb_register_acc(hnb, &pdu->choice.successfulOutcome.value); + switch (pdu->present) { + case HNBAP_HNBAP_PDU_PR_initiatingMessage: + rc = hnb_hnbap_rx_initiating(hnb, &pdu->choice.initiatingMessage); break; - case HNBAP_ProcedureCode_id_UERegister: - rc = hnb_rx_ue_register_acc(hnb, &pdu->choice.successfulOutcome.value); + case HNBAP_HNBAP_PDU_PR_successfulOutcome: + rc = hnb_hnbap_rx_successful(hnb, &pdu->choice.successfulOutcome); break; + case HNBAP_HNBAP_PDU_PR_unsuccessfulOutcome: + rc = hnb_hnbap_rx_unsuccessful(hnb, &pdu->choice.unsuccessfulOutcome); + break; + case HNBAP_HNBAP_PDU_PR_NOTHING: /* No components present */ default: + LOGP(DHNBAP, LOGL_ERROR, "Unexpected HNBAP message received\n"); rc = -ENOSPC; - break; } return rc; -- To view, visit https://gerrit.osmocom.org/c/osmo-hnodeb/+/26349 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnodeb Gerrit-Branch: master Gerrit-Change-Id: Id4656140b7f51b07860dcbeed449ed68c3a9f85a Gerrit-Change-Number: 26349 Gerrit-PatchSet: 4 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann at sysmocom.de> Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: osmith <osmith 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/20211125/ec9c9f20/attachment.htm>