pespin has uploaded this change for review.

View Change

sigtran: N-DISCONNECT.req: Use proper SCCP-User release reason

Until recently, libosmo-sigtran was incorrectly expecting low-level
wire-format cause in N-DISCONNECT.req. Nowadays it supports specific
reason values in the SCCP-User SAP, so use those instead.

Related: OS#2601
Change-Id: I6b0b2a9e64ada0473eab28bcc71363e04790ba97
---
M TODO-RELEASE
M include/osmocom/smlc/sccp_lb_inst.h
M src/osmo-smlc/lb_conn.c
M src/osmo-smlc/lb_peer.c
M src/osmo-smlc/sccp_lb_inst.c
5 files changed, 13 insertions(+), 7 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-smlc refs/changes/05/43805/1
diff --git a/TODO-RELEASE b/TODO-RELEASE
index 0ed7189..b6d61b1 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -7,3 +7,4 @@
# If any interfaces have been added since the last public release: c:r:a + 1.
# If any interfaces have been removed or changed since the last public release: c:r:0.
#library what description / commit summary line
+libosmo-sigtran >2.3.0 OSMO_SCCP_REL_REASON_NSU_*
diff --git a/include/osmocom/smlc/sccp_lb_inst.h b/include/osmocom/smlc/sccp_lb_inst.h
index 525eac0..ea0a529 100644
--- a/include/osmocom/smlc/sccp_lb_inst.h
+++ b/include/osmocom/smlc/sccp_lb_inst.h
@@ -60,4 +60,4 @@
int sccp_lb_down_l2_co(struct sccp_lb_inst *sli, uint32_t conn_id, struct msgb *l2);
int sccp_lb_down_l2_cl(struct sccp_lb_inst *sli, const struct osmo_sccp_addr *called_addr, struct msgb *l2);

-int sccp_lb_disconnect(struct sccp_lb_inst *sli, uint32_t conn_id, uint32_t cause);
+int sccp_lb_disconnect(struct sccp_lb_inst *sli, uint32_t conn_id, enum osmo_sccp_release_reason_nsu reason);
diff --git a/src/osmo-smlc/lb_conn.c b/src/osmo-smlc/lb_conn.c
index f2fa3d1..7801878 100644
--- a/src/osmo-smlc/lb_conn.c
+++ b/src/osmo-smlc/lb_conn.c
@@ -173,7 +173,9 @@

if (lb_conn->lb_peer) {
/* Todo: pass a useful SCCP cause? */
- sccp_lb_disconnect(lb_conn->lb_peer->sli, lb_conn->sccp_conn_id, 0);
+ sccp_lb_disconnect(lb_conn->lb_peer->sli,
+ lb_conn->sccp_conn_id,
+ OSMO_SCCP_REL_REASON_NSU_DISC_NORMAL);
lb_conn->lb_peer = NULL;
}

diff --git a/src/osmo-smlc/lb_peer.c b/src/osmo-smlc/lb_peer.c
index d9d3b38..f70b49e 100644
--- a/src/osmo-smlc/lb_peer.c
+++ b/src/osmo-smlc/lb_peer.c
@@ -280,7 +280,8 @@
OSMO_ASSERT(ctx);
LOG_LB_PEER(lbp, LOGL_ERROR, "Receiving CO message on Lb peer that has not done a proper RESET yet."
" Disconnecting on incoming message, sending RESET to Lb peer.\n");
- sccp_lb_disconnect(lbp->sli, ctx->conn_id, 0);
+ sccp_lb_disconnect(lbp->sli, ctx->conn_id,
+ OSMO_SCCP_REL_REASON_NSU_DISC_END_USER_FAILURE);
/* No valid RESET procedure has happened here yet. */
lb_peer_reset(lbp);
return;
diff --git a/src/osmo-smlc/sccp_lb_inst.c b/src/osmo-smlc/sccp_lb_inst.c
index cea74bf..3238b9d 100644
--- a/src/osmo-smlc/sccp_lb_inst.c
+++ b/src/osmo-smlc/sccp_lb_inst.c
@@ -240,7 +240,8 @@

rc = lb_peer_up_l2(sli, peer_addr, true, conn_id, oph->msg);
if (rc)
- osmo_sccp_tx_disconn(scu, conn_id, my_addr, SCCP_RETURN_CAUSE_UNQUALIFIED);
+ osmo_sccp_tx_disconn(scu, conn_id, my_addr,
+ OSMO_SCCP_REL_REASON_NSU_CREF_END_USER_ORIGIN);
break;

case OSMO_PRIM(OSMO_SCU_PRIM_N_DATA, PRIM_OP_INDICATION):
@@ -265,7 +266,8 @@
/* Make sure the lb_conn is dropped. It might seem more optimal to combine the disconnect() into
* up_l2(), but since an up_l2() dispatch might already cause the lb_conn to be discarded for other
* reasons, a separate disconnect() with a separate conn_id lookup is actually necessary. */
- sccp_lb_disconnect(sli, conn_id, 0);
+ sccp_lb_disconnect(sli, conn_id,
+ OSMO_SCCP_REL_REASON_NSU_DISC_SCCP_USER_ORIGIN);
break;

case OSMO_PRIM(OSMO_SCU_PRIM_N_UNITDATA, PRIM_OP_INDICATION):
@@ -385,7 +387,7 @@
return sccp_lb_sap_down(sli, &prim->oph);
}

-int sccp_lb_disconnect(struct sccp_lb_inst *sli, uint32_t conn_id, uint32_t cause)
+int sccp_lb_disconnect(struct sccp_lb_inst *sli, uint32_t conn_id, enum osmo_sccp_release_reason_nsu reason)
{
- return osmo_sccp_tx_disconn(sli->scu, conn_id, NULL, cause);
+ return osmo_sccp_tx_disconn(sli->scu, conn_id, NULL, reason);
}

To view, visit change 43805. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: osmo-smlc
Gerrit-Branch: master
Gerrit-Change-Id: I6b0b2a9e64ada0473eab28bcc71363e04790ba97
Gerrit-Change-Number: 43805
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin@sysmocom.de>