diff options
author | Stefan Sperling <ssperling@sysmocom.de> | 2018-02-19 17:02:12 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-02-22 20:29:06 +0000 |
commit | c964a2cfa1b08e5bbda5d721a7a0095d26b53791 (patch) | |
tree | 0f4297fef512c33b6efc7556cbcc5fc60130b2e6 /include/osmocom/iuh/hnbgw.h | |
parent | e1c01a02624b12a5c6396d47902482fa97217b23 (diff) |
ensure unique CellIDs in HNB-GW
If we receive a HNB-REGISTER-REQ with a cell ID which is already used
by another registered NNB, log an error and send HNB-REGISTER-REJECT.
Tested manually by running two 'hnb-test' programs concurrently (they
need to listen on different telnet ports; this port is hard-coded so
I compiled two different hnb-test binaries).
Then I issued the 'hnbap hnb register' command on the telnet interface
of each, and verified that the correct action is logged by osmo-hnbgw.
Both hnb-test programs can connect, but only one of them can register
at a time. Killing a registered 'hnb-test' program terminates its
connection and allows the previously rejected one to register.
The new rejection log message looks like this:
hnbgw_hnbap.c:429 rejecting HNB-REGISTER-REQ with duplicate cell
identity MCC=901,MNC=99,LAC=49406,RAC=66,SAC=43947,CID=182250155
from (r=127.0.0.1:42828<->l=127.0.0.1:29169)
This change depends on a new API in libosmo-netif, which is added in
https://gerrit.osmocom.org/#/c/6844/
Change-Id: Iffd441eb2b6b75dfbe001b49b01bea015ca6e11c
Depends: I8ed78fe39c463e9018756700d13ee5ebe003b57f
Related: OS#2789
Diffstat (limited to 'include/osmocom/iuh/hnbgw.h')
-rw-r--r-- | include/osmocom/iuh/hnbgw.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/include/osmocom/iuh/hnbgw.h b/include/osmocom/iuh/hnbgw.h index 094f31f..b79bcc1 100644 --- a/include/osmocom/iuh/hnbgw.h +++ b/include/osmocom/iuh/hnbgw.h @@ -97,6 +97,10 @@ struct hnb_context { /*! SCTP stream ID for RUA */ uint16_t rua_stream; + /*! 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_registered; + /* linked list of hnbgw_context_map */ struct llist_head map_list; }; @@ -157,7 +161,7 @@ struct ue_context *ue_context_alloc(struct hnb_context *hnb, const char *imsi, void ue_context_free(struct ue_context *ue); struct hnb_context *hnb_context_alloc(struct hnb_gw *gw, struct osmo_stream_srv_link *link, int new_fd); -void hnb_context_release(struct hnb_context *ctx); +void hnb_context_release(struct hnb_context *ctx, bool destroy_conn); void hnbgw_vty_init(struct hnb_gw *gw, void *tall_ctx); int hnbgw_vty_go_parent(struct vty *vty); |