aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2019-08-20 06:00:47 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2019-08-20 06:12:15 +0200
commit4d158e6f0d060318f4f0587af3781f1103ecf63b (patch)
tree8f31d10a79d08e95e49a9f78f119e551dc14cc0a
parenta3cccdc51c47fb4c8a5bb4ceb9c839aaab03be77 (diff)
directly discard hnb that failed to register upon connectneels/test
-rw-r--r--include/osmocom/iuh/hnbgw.h1
-rw-r--r--src/hnbgw.c2
-rw-r--r--src/hnbgw_hnbap.c2
3 files changed, 4 insertions, 1 deletions
diff --git a/include/osmocom/iuh/hnbgw.h b/include/osmocom/iuh/hnbgw.h
index 4848c2f..cc907df 100644
--- a/include/osmocom/iuh/hnbgw.h
+++ b/include/osmocom/iuh/hnbgw.h
@@ -99,6 +99,7 @@ struct hnb_context {
/*! True if a HNB-REGISTER-REQ from this HNB has been accepted. Note that
* this entire data structure is freed if the HNB sends HNB-DE-REGISTER-REQ. */
+ bool hnb_register_attempted;
bool hnb_registered;
/* linked list of hnbgw_context_map */
diff --git a/src/hnbgw.c b/src/hnbgw.c
index 3f94a01..dea5c5a 100644
--- a/src/hnbgw.c
+++ b/src/hnbgw.c
@@ -287,7 +287,7 @@ struct hnb_context *hnb_context_alloc(struct hnb_gw *gw, struct osmo_stream_srv_
ctx->gw = gw;
ctx->conn = osmo_stream_srv_create(tall_hnb_ctx, link, new_fd, hnb_read_cb, NULL, ctx);
- if (!ctx->conn) {
+ if (!ctx->conn || (ctx->hnb_register_attempted && !ctx->hnb_registered)) {
LOGP(DMAIN, LOGL_INFO, "error while creating connection\n");
talloc_free(ctx);
return NULL;
diff --git a/src/hnbgw_hnbap.c b/src/hnbgw_hnbap.c
index 142b0d5..737536b 100644
--- a/src/hnbgw_hnbap.c
+++ b/src/hnbgw_hnbap.c
@@ -417,6 +417,8 @@ static int hnbgw_rx_hnb_register_req(struct hnb_context *ctx, ANY_t *in)
HNBRegisterRequestIEs_t ies;
int rc;
+ ctx->hnb_register_attempted = true;
+
rc = hnbap_decode_hnbregisterrequesties(&ies, in);
if (rc < 0) {
LOGP(DHNBAP, LOGL_ERROR, "Failure to decode HNB-REGISTER-REQ from %s: rc=%d\n",