sccp: Handle N-NOTICE.ind (Routing Failure of SCCP CL messages)

ITU Q.714 2.8:
"""
When an end node is informed of a routing failure, this information
is forwarded towards the SCCP user by using the N-DISCONNECT primitive
(refer to reason for release in 2.1.1.2.4/Q.711) or the N-NOTICE primitive
(refer to reason for return in 2.2.2.2.4/Q.711)
"""

We are already handling N-DISCONNECT.ind for CO messages, but
N-NOTICE.ind for CL messages was not being handled.

If CL messages are not arriving to the Lb peer, then reset the link
and mark the peer as disconnected, until a new RESET can successfully fo
through.

Related: OS#5917
Change-Id: I4bfea43a99c768162faefde06558941f697bd718
This commit is contained in:
Pau Espin Pedrol
2025-07-16 18:11:59 +02:00
parent 1416f6497f
commit c45aa8f571

View File

@@ -85,6 +85,36 @@ struct sccp_lb_inst *sccp_lb_init(void *talloc_ctx, struct osmo_sccp_instance *s
return sli;
}
static void handle_notice_ind(struct sccp_lb_inst *sli, const struct osmo_scu_notice_param *ni)
{
struct lb_peer *lbp;
lbp = lb_peer_find(sli, &ni->calling_addr);
if (!lbp) {
LOG_SCCP_LB(sli, LOGL_DEBUG, "(calling_addr=%s) N-NOTICE.ind cause=%u='%s' importance=%u didn't match any lb_peer, ignoring\n",
osmo_sccp_addr_dump(&ni->calling_addr),
ni->cause, osmo_sccp_return_cause_name(ni->cause),
ni->importance);
return;
}
LOG_LB_PEER(lbp, LOGL_NOTICE, "N-NOTICE.ind cause=%u='%s' importance=%u\n",
ni->cause, osmo_sccp_return_cause_name(ni->cause),
ni->importance);
switch (ni->cause) {
case SCCP_RETURN_CAUSE_SUBSYSTEM_CONGESTION:
case SCCP_RETURN_CAUSE_NETWORK_CONGESTION:
/* Transient failures (hopefully), keep going. */
return;
default:
break;
}
/* Messages are not arriving to lb_peer. Signal it is unavailable to update local state. */
osmo_fsm_inst_dispatch(lbp->fi, LB_PEER_EV_UNAVAILABLE, NULL);
}
static void handle_pcstate_ind(struct sccp_lb_inst *sli, const struct osmo_scu_pcstate_param *pcst)
{
struct osmo_ss7_instance *cs7 = osmo_sccp_get_ss7(sli->sccp);
@@ -253,6 +283,11 @@ static int sccp_lb_sap_up(struct osmo_prim_hdr *oph, void *_scu)
rc = lb_peer_up_l2(sli, peer_addr, false, 0, oph->msg);
break;
case OSMO_PRIM(OSMO_SCU_PRIM_N_NOTICE, PRIM_OP_INDICATION):
handle_notice_ind(sli, &prim->u.notice);
rc = 0;
break;
case OSMO_PRIM(OSMO_SCU_PRIM_N_PCSTATE, PRIM_OP_INDICATION):
handle_pcstate_ind(sli, &prim->u.pcstate);
rc = 0;