[PATCH] libosmo-sccp[master]: fix: use proper disconnect prim param type

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Jan 27 09:00:05 UTC 2017


Hello Jenkins Builder,

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

    https://gerrit.osmocom.org/1676

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

fix: use proper disconnect prim param type

For the N-DISCONNECT prim, parse CREF, RLC and RLSD from the proper parameter
struct type: osmo_scu_disconn_param instead of osmo_scu_connect_param.

Before this, the conn_id ended up in the wrong place and the other side always
received a zero conn_id.

Tested only for the RLSD case, which fixes Iu-Release message evaluation for
all except the very first SUA conn received by the CN components.

In all three cases, set:

* param->responding_addr to conn->called_addr.
* param->originator to OSMO_SCCP_ORIG_UNDEFINED.

Change-Id: I446f2fe57cc3b7c52723f3ab82836513a5d37752
---
M src/sua.c
1 file changed, 12 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/76/1676/2

diff --git a/src/sua.c b/src/sua.c
index c363cdb..2b4c64e 100644
--- a/src/sua.c
+++ b/src/sua.c
@@ -981,7 +981,7 @@
 {
 	struct osmo_scu_prim *prim;
 	struct sua_connection *conn;
-	struct osmo_scu_connect_param *param;
+	struct osmo_scu_disconn_param *param;
 	struct xua_msg_part *data_ie = xua_msg_find_tag(xua, SUA_IEI_DATA);
 	struct msgb *upmsg;
 	uint32_t conn_id = xua_msg_get_u32(xua, SUA_IEI_DEST_REF);
@@ -1000,15 +1000,13 @@
 	/* fill primitive */
 	upmsg = sua_msgb_alloc();
 	prim = (struct osmo_scu_prim *) msgb_put(upmsg, sizeof(*prim));
-	param = &prim->u.connect;
+	param = &prim->u.disconnect;
 	osmo_prim_init(&prim->oph, SCCP_SAP_USER,
 			OSMO_SCU_PRIM_N_DISCONNECT,
 			PRIM_OP_INDICATION, upmsg);
 	param->conn_id = conn_id;
-	memcpy(&param->called_addr, &conn->called_addr,
-		sizeof(param->called_addr));
-	memcpy(&param->calling_addr, &conn->calling_addr,
-		sizeof(param->calling_addr));
+	param->responding_addr = conn->called_addr;
+	param->originator = OSMO_SCCP_ORIG_UNDEFINED;
 	//param->in_sequence_control;
 	/* TODO evaluate cause:
 	 * cause = xua_msg_get_u32(xua, SUA_IEI_CAUSE); */
@@ -1035,7 +1033,7 @@
 {
 	struct osmo_scu_prim *prim;
 	struct sua_connection *conn;
-	struct osmo_scu_connect_param *param;
+	struct osmo_scu_disconn_param *param;
 	struct xua_msg_part *data_ie = xua_msg_find_tag(xua, SUA_IEI_DATA);
 	struct msgb *upmsg;
 	uint32_t conn_id = xua_msg_get_u32(xua, SUA_IEI_DEST_REF);
@@ -1053,7 +1051,7 @@
 	/* fill primitive */
 	upmsg = sua_msgb_alloc();
 	prim = (struct osmo_scu_prim *) msgb_put(upmsg, sizeof(*prim));
-	param = &prim->u.connect;
+	param = &prim->u.disconnect;
 	osmo_prim_init(&prim->oph, SCCP_SAP_USER,
 			OSMO_SCU_PRIM_N_DISCONNECT,
 			PRIM_OP_INDICATION, upmsg); /* what primitive? */
@@ -1068,10 +1066,8 @@
 		memcpy(upmsg->l2h, data_ie->dat, data_ie->len);
 	}
 
-	memcpy(&param->called_addr, &conn->called_addr,
-		sizeof(param->called_addr));
-	memcpy(&param->calling_addr, &conn->calling_addr,
-		sizeof(param->calling_addr));
+	param->responding_addr = conn->called_addr;
+	param->originator = OSMO_SCCP_ORIG_UNDEFINED;
 
 	/* send to user SAP */
 	link->user->prim_cb(&prim->oph, link);
@@ -1087,7 +1083,7 @@
 {
 	struct osmo_scu_prim *prim;
 	struct sua_connection *conn;
-	struct osmo_scu_connect_param *param;
+	struct osmo_scu_disconn_param *param;
 	struct msgb *upmsg;
 	uint32_t conn_id = xua_msg_get_u32(xua, SUA_IEI_DEST_REF);
 
@@ -1104,7 +1100,7 @@
 	/* fill primitive */
 	upmsg = sua_msgb_alloc();
 	prim = (struct osmo_scu_prim *) msgb_put(upmsg, sizeof(*prim));
-	param = &prim->u.connect;
+	param = &prim->u.disconnect;
 	osmo_prim_init(&prim->oph, SCCP_SAP_USER,
 			OSMO_SCU_PRIM_N_DISCONNECT,
 			PRIM_OP_CONFIRM, upmsg); /* what primitive? */
@@ -1113,10 +1109,8 @@
 	/* source reference */
 	param->importance = xua_msg_get_u32(xua, SUA_IEI_IMPORTANCE);
 
-	memcpy(&param->called_addr, &conn->called_addr,
-		sizeof(param->called_addr));
-	memcpy(&param->calling_addr, &conn->calling_addr,
-		sizeof(param->calling_addr));
+	param->responding_addr = conn->called_addr;
+	param->originator = OSMO_SCCP_ORIG_UNDEFINED;
 
 	/* send to user SAP */
 	link->user->prim_cb(&prim->oph, link);

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I446f2fe57cc3b7c52723f3ab82836513a5d37752
Gerrit-PatchSet: 2
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>


More information about the gerrit-log mailing list