Change in libosmo-sccp[master]: m3ua/sua: Add new snm_inactive quirk

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
Thu May 13 20:00:29 UTC 2021


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

Change subject: m3ua/sua: Add new snm_inactive quirk
......................................................................

m3ua/sua: Add new snm_inactive quirk

This quirk allows the M3UA + SUA code to accept SSNM/SNM traffic despite
being in AS-INACTIVE state.  This is forbidden by the RFCs but there
are some implementations that apparently just don't care what is
specified.

Change-Id: I193dd546b3e3c00e29f192d0d1bf7819b3e194be
Closes: OS#5148
---
M include/osmocom/sigtran/osmo_ss7.h
M src/m3ua.c
M src/osmo_ss7_vty.c
M src/sua.c
4 files changed, 23 insertions(+), 8 deletions(-)

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



diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h
index a799b04..3d13b6a 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -432,9 +432,11 @@
 };
 
 /*! Peer SG doesn't send NTFY(AS-INACTIVE) after ASP-UP procedure */
-#define OSMO_SS7_ASP_QUIRK_NO_NOTIFY	0x00000001
+#define OSMO_SS7_ASP_QUIRK_NO_NOTIFY		0x00000001
 /*! Accept DAUD in ASP role (RFC states only permitted in ASP->SG role) */
-#define OSMO_SS7_ASP_QUIRK_DAUD_IN_ASP	0x00000002
+#define OSMO_SS7_ASP_QUIRK_DAUD_IN_ASP		0x00000002
+/*! Accept SSNM even if ASP is in AS-INACTIVE state */
+#define OSMO_SS7_ASP_QUIRK_SNM_INACTIVE		0x00000004
 
 int osmo_ss7_asp_peer_snprintf(char* buf, size_t buf_len, struct osmo_ss7_asp_peer *peer);
 int osmo_ss7_asp_peer_set_hosts(struct osmo_ss7_asp_peer *peer, void *talloc_ctx,
diff --git a/src/m3ua.c b/src/m3ua.c
index 9fe17ad..e2db6c1 100644
--- a/src/m3ua.c
+++ b/src/m3ua.c
@@ -938,9 +938,15 @@
 {
 	/* SNM only permitted in ACTIVE state */
 	if (asp->fi->state != XUA_ASP_S_ACTIVE) {
-		LOGPASP(asp, DLM3UA, LOGL_NOTICE, "Received M3UA SNM while ASP in state %s\n",
-			osmo_fsm_inst_state_name(asp->fi));
-		return M3UA_ERR_UNEXPECTED_MSG;
+		if (asp->fi->state == XUA_ASP_S_INACTIVE &&
+		    asp->cfg.quirks & OSMO_SS7_ASP_QUIRK_SNM_INACTIVE) {
+			LOGPASP(asp, DLM3UA, LOGL_NOTICE, "quirk snm_inactive active: "
+				"Accepting SNM in state %s\n", osmo_fsm_inst_state_name(asp->fi));
+		} else {
+			LOGPASP(asp, DLM3UA, LOGL_ERROR, "Rx M3UA SNM not permitted "
+				"while ASP in state %s\n", osmo_fsm_inst_state_name(asp->fi));
+			return M3UA_ERR_UNEXPECTED_MSG;
+		}
 	}
 
 	switch (asp->cfg.role) {
diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index b2e3192..dcbe9b2 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -58,12 +58,14 @@
 static const struct value_string asp_quirk_names[] = {
 	{ OSMO_SS7_ASP_QUIRK_NO_NOTIFY,		"no_notify" },
 	{ OSMO_SS7_ASP_QUIRK_DAUD_IN_ASP,	"daud_in_asp" },
+	{ OSMO_SS7_ASP_QUIRK_SNM_INACTIVE,	"snm_inactive" },
 	{ 0, NULL }
 };
 
 static const struct value_string asp_quirk_descs[] = {
 	{ OSMO_SS7_ASP_QUIRK_NO_NOTIFY, "Peer SG doesn't send NTFY(AS-INACTIVE) after ASP-UP" },
 	{ OSMO_SS7_ASP_QUIRK_DAUD_IN_ASP, "Allow Rx of DAUD in ASP role" },
+	{ OSMO_SS7_ASP_QUIRK_SNM_INACTIVE, "Allow Rx of [S]SNM in AS-INACTIVE state" },
 	{ 0, NULL }
 };
 
diff --git a/src/sua.c b/src/sua.c
index 997b511..8415fa3 100644
--- a/src/sua.c
+++ b/src/sua.c
@@ -949,9 +949,14 @@
 {
 	/* SNM only permitted in ACTIVE state */
 	if (asp->fi->state != XUA_ASP_S_ACTIVE) {
-		LOGPASP(asp, DLSUA, LOGL_NOTICE, "Received M3UA SNM while ASP in state %s\n",
-			osmo_fsm_inst_state_name(asp->fi));
-		return SUA_ERR_UNEXPECTED_MSG;
+		if (asp->fi->state == XUA_ASP_S_INACTIVE && asp->cfg.quirks & OSMO_SS7_ASP_QUIRK_SNM_INACTIVE) {
+			LOGPASP(asp, DLSUA, LOGL_NOTICE, "quirk snm_inactive active: "
+				"Accepting SSNM in state %s\n", osmo_fsm_inst_state_name(asp->fi));
+		} else {
+			LOGPASP(asp, DLM3UA, LOGL_ERROR, "Rx SUA SSNM not permitted "
+				"while ASP in state %s\n", osmo_fsm_inst_state_name(asp->fi));
+			return SUA_ERR_UNEXPECTED_MSG;
+		}
 	}
 
 	switch (asp->cfg.role) {

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

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: I193dd546b3e3c00e29f192d0d1bf7819b3e194be
Gerrit-Change-Number: 24216
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
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/20210513/3f90bdbe/attachment.htm>


More information about the gerrit-log mailing list