Change in libosmo-sccp[master]: Constrain connection ID allocation to 24 bits

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

laforge gerrit-no-reply at lists.osmocom.org
Tue May 11 20:54:47 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/24181 )

Change subject: Constrain connection ID allocation to 24 bits
......................................................................

Constrain connection ID allocation to 24 bits

We currently use the local connection ID on the SCU SAP also as local
reference on the wire-line SCCP messages.  However, the latter only has
a 24 bit range, so we should make sure to wrap accordingly on
allocation.

Change-Id: I414d29271da48ac0b05a688ce9e949a66e4d0d92
Closes: OS#3921
Related: OS#3871
---
M src/sccp_scoc.c
1 file changed, 4 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/src/sccp_scoc.c b/src/sccp_scoc.c
index 1ce08f8..244e6d3 100644
--- a/src/sccp_scoc.c
+++ b/src/sccp_scoc.c
@@ -499,7 +499,10 @@
 	uint32_t conn_id;
 
 	do {
-		conn_id = user->inst->next_id++;
+		/* modulo 2^24 as we currently use the connection ID also as local
+		 * reference, and that is limited to 24 bits */
+		user->inst->next_id = (user->inst->next_id + 1) %  (1 << 24);
+		conn_id = user->inst->next_id;
 	} while (conn_find_by_id(user->inst, conn_id));
 
 	return conn_create_id(user, conn_id);

-- 
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/24181
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: I414d29271da48ac0b05a688ce9e949a66e4d0d92
Gerrit-Change-Number: 24181
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
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/20210511/fcf885ab/attachment.htm>


More information about the gerrit-log mailing list