[PATCH] openbsc[master]: osmux: Add negotiation state so race conditions can't disabl...

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/.

daniel gerrit-no-reply at lists.osmocom.org
Thu Jul 7 08:27:37 UTC 2016


Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/480

to look at the new patch set (#2).

osmux: Add negotiation state so race conditions can't disable osmux

Without this commit it is possible that osmux is disabled again on links with
high jitter. This happens when an MGCP response without X-Osmux header is
received before the NAT receives an Osmux dummy frame from the other side.

Ticket: SYS#2628, SYS#2627
Sponsored-by: On-Waves ehf
Change-Id: Id624b0279aee5e2412059a10296ce7896e2d4628
---
M openbsc/include/openbsc/osmux.h
M openbsc/src/libmgcp/mgcp_protocol.c
M openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
3 files changed, 7 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/80/480/2

diff --git a/openbsc/include/openbsc/osmux.h b/openbsc/include/openbsc/osmux.h
index 82b8fa3..0b64a7f 100644
--- a/openbsc/include/openbsc/osmux.h
+++ b/openbsc/include/openbsc/osmux.h
@@ -28,6 +28,7 @@
 
 enum osmux_state {
 	OSMUX_STATE_DISABLED = 0,
+	OSMUX_STATE_NEGOTIATING,
 	OSMUX_STATE_ACTIVATING,
 	OSMUX_STATE_ENABLED,
 };
diff --git a/openbsc/src/libmgcp/mgcp_protocol.c b/openbsc/src/libmgcp/mgcp_protocol.c
index 1819cea..ff0fc3e 100644
--- a/openbsc/src/libmgcp/mgcp_protocol.c
+++ b/openbsc/src/libmgcp/mgcp_protocol.c
@@ -277,7 +277,7 @@
 	if (!addr)
 		addr = mgcp_net_src_addr(endp);
 
-	if (endp->osmux.state == OSMUX_STATE_ACTIVATING)
+	if (endp->osmux.state == OSMUX_STATE_NEGOTIATING)
 		sprintf(osmux_extension, "\nX-Osmux: %u", endp->osmux.cid);
 	else
 		osmux_extension[0] = '\0';
@@ -811,13 +811,13 @@
 	if (endp->ci == CI_UNUSED)
 		goto error2;
 
-	/* Annotate Osmux circuit ID and set it to activating state until this
+	/* Annotate Osmux circuit ID and set it to negotiating state until this
 	 * is fully set up from the dummy load.
 	 */
 	endp->osmux.state = OSMUX_STATE_DISABLED;
 	if (osmux_cid >= 0) {
 		endp->osmux.cid = osmux_cid;
-		endp->osmux.state = OSMUX_STATE_ACTIVATING;
+		endp->osmux.state = OSMUX_STATE_NEGOTIATING;
 	} else if(endp->cfg->osmux == OSMUX_USAGE_ONLY) {
 		LOGP(DMGCP, LOGL_ERROR,
 			"Osmux only and no osmux offered on 0x%x\n", ENDPOINT_NUMBER(endp));
diff --git a/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c b/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
index 9fd9967..4884786 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
@@ -590,7 +590,7 @@
 		 */
 		if (mgcp_endp->osmux.allocated_cid >= 0 &&
 		    mgcp_endp->osmux.state != OSMUX_STATE_ENABLED) {
-			mgcp_endp->osmux.state = OSMUX_STATE_ACTIVATING;
+			mgcp_endp->osmux.state = OSMUX_STATE_NEGOTIATING;
 			mgcp_endp->osmux.cid = mgcp_endp->osmux.allocated_cid;
 		}
 
@@ -680,6 +680,7 @@
 
 	LOGP(DMGCP, LOGL_NOTICE, "bsc accepted to use Osmux (cid=%u)\n",
 	     osmux_cid);
+	endp->osmux.state = OSMUX_STATE_ACTIVATING;
 	return;
 err:
 	osmux_release_cid(endp);
@@ -747,7 +748,7 @@
 		return;
 	}
 
-	if (endp->osmux.state == OSMUX_STATE_ACTIVATING)
+	if (endp->osmux.state == OSMUX_STATE_NEGOTIATING)
 		bsc_mgcp_osmux_confirm(endp, (const char *) msg->l2h);
 
 	/* If we require osmux and it is disabled.. fail */

-- 
To view, visit https://gerrit.osmocom.org/480
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Id624b0279aee5e2412059a10296ce7896e2d4628
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list