summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-05-02 18:02:56 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-05-02 18:21:53 +0200
commitb86cc95df32346bf77afd2005c5430d8c6a6d6ae (patch)
tree5d40d94cda4d60d776876db00cccc35f06079fb4
parentf3041d11101f6254a6a0933f37db51104752c5ed (diff)
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.
-rw-r--r--src/sua.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/sua.c b/src/sua.c
index 1b63866..fadf2c3 100644
--- a/src/sua.c
+++ b/src/sua.c
@@ -982,7 +982,7 @@ static int sua_rx_coref(struct osmo_sua_link *link, struct xua_msg *xua)
{
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 @@ static int sua_rx_coref(struct osmo_sua_link *link, struct xua_msg *xua)
/* 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 @@ static int sua_rx_relre(struct osmo_sua_link *link, struct xua_msg *xua)
{
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);
@@ -1052,7 +1050,7 @@ static int sua_rx_relre(struct osmo_sua_link *link, struct xua_msg *xua)
/* 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? */
@@ -1067,10 +1065,8 @@ static int sua_rx_relre(struct osmo_sua_link *link, struct xua_msg *xua)
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);
@@ -1086,7 +1082,7 @@ static int sua_rx_relco(struct osmo_sua_link *link, struct xua_msg *xua)
{
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);
@@ -1102,7 +1098,7 @@ static int sua_rx_relco(struct osmo_sua_link *link, struct xua_msg *xua)
/* 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? */
@@ -1111,10 +1107,8 @@ static int sua_rx_relco(struct osmo_sua_link *link, struct xua_msg *xua)
/* 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);