pespin has submitted this change. (
https://gerrit.osmocom.org/c/osmo-hnbgw/+/29415 )
Change subject: hnbgw: Unregister HNB if SCTP link is restarted
......................................................................
hnbgw: Unregister HNB if SCTP link is restarted
Sometimes an hNodeB may reconnect (SCTP INIT) using same SCTP tuple without
closing the previous conn. This is handled by the SCTP stack by means of
pushing a RESET notification up the stack to the sctp_recvmsg() user.
Let's handle this by marking the HNB as unregistered, since most
probably a HNB Register Req comes next as the upper layer state is
considered lost.
Depends: libosmo-netif.git Change-Id I0ee94846a15a23950b9d70eaaef1251267296bdd
Related: SYS#6113
Change-Id: Ib22881b1a34b1c3dd350912b3de8904917cf34ef
---
M src/osmo-hnbgw/hnbgw.c
1 file changed, 19 insertions(+), 2 deletions(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/osmo-hnbgw/hnbgw.c b/src/osmo-hnbgw/hnbgw.c
index 8c2dc64..124a647 100644
--- a/src/osmo-hnbgw/hnbgw.c
+++ b/src/osmo-hnbgw/hnbgw.c
@@ -251,8 +251,25 @@
msg->dst = hnb;
rc = osmo_stream_srv_recv(conn, msg);
- if (rc == -EAGAIN) {
- /* Notification received */
+ /* Notification received */
+ if (msgb_sctp_msg_flags(msg) & OSMO_STREAM_SCTP_MSG_FLAGS_NOTIFICATION) {
+ union sctp_notification *notif = (union sctp_notification *)msgb_data(msg);
+ switch (notif->sn_header.sn_type) {
+ case SCTP_ASSOC_CHANGE:
+ switch (notif->sn_assoc_change.sac_state) {
+ case SCTP_RESTART:
+ LOGHNB(hnb, DMAIN, LOGL_NOTICE, "HNB SCTP conn RESTARTed, marking as
HNBAP-unregistered\n");
+ hnb->hnb_registered = false;
+ break;
+ }
+ break;
+ }
+ msgb_free(msg);
+ return 0;
+ } else if (rc == -EAGAIN) {
+ /* Older versions of osmo_stream_srv_recv() not supporting
+ * msgb_sctp_msg_flags() may still return -EAGAIN when an sctp
+ * notification is received. */
msgb_free(msg);
return 0;
} else if (rc < 0) {
--
To view, visit
https://gerrit.osmocom.org/c/osmo-hnbgw/+/29415
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: Ib22881b1a34b1c3dd350912b3de8904917cf34ef
Gerrit-Change-Number: 29415
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged