Change in libosmo-sccp[master]: osmo_ss7: introduce notion of configurable 'quirks'

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
Tue May 11 16:32:53 UTC 2021


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/24213 )


Change subject: osmo_ss7: introduce notion of configurable 'quirks'
......................................................................

osmo_ss7: introduce notion of configurable 'quirks'

A quirk is an implementation work-around in order to establish
interoperability with another implementation, either a buggy one or
one that follows a different interpretation of a given spec.

For now, we introduce a first quirk affecting when we (in ASP role)
send an ASP-ACTIVE message to the SG.

Closes: OS#5145
Change-Id: Idd947ea39d743eb1bc9342ad9d098036821da45b
---
M include/osmocom/sigtran/osmo_ss7.h
M src/osmo_ss7_vty.c
M src/xua_default_lm_fsm.c
3 files changed, 77 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/13/24213/1

diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h
index a278b59..8370dd9 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -427,9 +427,13 @@
 		struct osmo_ss7_asp_peer local;
 		struct osmo_ss7_asp_peer remote;
 		uint8_t qos_class;
+		uint32_t quirks;
 	} cfg;
 };
 
+/*! Peer SG doesn't send NTFY(AS-INACTIVE) after ASP-UP procedure */
+#define OSMO_SS7_ASP_QUIRK_NO_NOTIFY	0x00000001
+
 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,
 				const char* const* hosts, size_t host_cnt);
diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 4db3c53..bc84bca 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -1,6 +1,6 @@
 /* Core SS7 Instance/Linkset/Link/AS/ASP VTY Interface */
 
-/* (C) 2015-2017 by Harald Welte <laforge at gnumonks.org>
+/* (C) 2015-2021 by Harald Welte <laforge at gnumonks.org>
  * All Rights Reserved
  *
  * SPDX-License-Identifier: GPL-2.0+
@@ -55,6 +55,15 @@
 	"MTP3 User Adaptation\n"	\
 	"IPA Multiplex (SCCP Lite)\n"
 
+static const struct value_string asp_quirk_names[] = {
+	{ OSMO_SS7_ASP_QUIRK_NO_NOTIFY, "no_notify" },
+	{ 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" },
+	{ 0, NULL }
+};
 
 /***********************************************************************
  * Core CS7 Configuration
@@ -747,6 +756,44 @@
 	return CMD_WARNING;
 }
 
+DEFUN_ATTR(asp_quirk, asp_quirk_cmd,
+	"OVERWRITTEN",
+	"OVERWRITTEN\n",
+	CMD_ATTR_IMMEDIATE)
+{
+	struct osmo_ss7_asp *asp = vty->index;
+#if 0	/* we only have one quirk, so there is no argv[0] yet! */
+	int quirk = get_string_value(asp_quirk_names, argv[0]);
+#else
+	int quirk = get_string_value(asp_quirk_names, "no_notify");
+#endif
+
+	if (quirk < 0)
+		return CMD_WARNING;
+
+	asp->cfg.quirks |= quirk;
+	return CMD_SUCCESS;
+}
+
+DEFUN_ATTR(asp_no_quirk, asp_no_quirk_cmd,
+	"OVERWRITTEN",
+	"OVERWRITTEN\n",
+	CMD_ATTR_IMMEDIATE)
+{
+	struct osmo_ss7_asp *asp = vty->index;
+#if 0	/* we only have one quirk, so there is no argv[0] yet! */
+	int quirk = get_string_value(asp_quirk_names, argv[0]);
+#else
+	int quirk = get_string_value(asp_quirk_names, "no_notify");
+#endif
+
+	if (quirk < 0)
+		return CMD_WARNING;
+
+	asp->cfg.quirks &= ~quirk;
+	return CMD_SUCCESS;
+}
+
 DEFUN(show_cs7_asp, show_cs7_asp_cmd,
 	"show cs7 instance <0-15> asp",
 	SHOW_STR CS7_STR INST_STR INST_STR "Application Server Process (ASP)\n")
@@ -814,6 +861,11 @@
 	}
 	if (!asp->cfg.is_server)
 		vty_out(vty, "  sctp-role client%s", VTY_NEWLINE);
+	for (i = 0; i < 32; i++) {
+		if (!(asp->cfg.quirks & (1 << i)))
+			continue;
+		vty_out(vty, "  quirk %s%s", get_value_string(asp_quirk_names, (1 << i)), VTY_NEWLINE);
+	}
 }
 
 
@@ -2029,6 +2081,17 @@
 {
 	g_ctx = ctx;
 
+	asp_quirk_cmd.string = vty_cmd_string_from_valstr(ctx, asp_quirk_names,
+							  "quirk (", "|", ")", VTY_DO_LOWER);
+	asp_quirk_cmd.doc = vty_cmd_string_from_valstr(ctx, asp_quirk_descs,
+							"Enable quirk to work around interop issues\n",
+							"\n", "\n", 0);
+	asp_no_quirk_cmd.string = vty_cmd_string_from_valstr(ctx, asp_quirk_names,
+							  "no quirk (", "|", ")", VTY_DO_LOWER);
+	asp_no_quirk_cmd.doc = vty_cmd_string_from_valstr(ctx, asp_quirk_descs,
+							NO_STR "Disable quirk to work around interop issues\n",
+							"\n", "\n", 0);
+
 	install_lib_element_ve(&show_cs7_user_cmd);
 	install_lib_element_ve(&show_cs7_xua_cmd);
 	install_lib_element_ve(&show_cs7_config_cmd);
@@ -2057,6 +2120,8 @@
 	install_lib_element(L_CS7_ASP_NODE, &asp_sctp_role_cmd);
 	install_lib_element(L_CS7_ASP_NODE, &asp_block_cmd);
 	install_lib_element(L_CS7_ASP_NODE, &asp_shutdown_cmd);
+	install_lib_element(L_CS7_ASP_NODE, &asp_quirk_cmd);
+	install_lib_element(L_CS7_ASP_NODE, &asp_no_quirk_cmd);
 
 	install_node(&as_node, NULL);
 	install_lib_element_ve(&show_cs7_as_cmd);
diff --git a/src/xua_default_lm_fsm.c b/src/xua_default_lm_fsm.c
index 338f4ae..1c047be 100644
--- a/src/xua_default_lm_fsm.c
+++ b/src/xua_default_lm_fsm.c
@@ -1,5 +1,5 @@
 /* Default XUA Layer Manager */
-/* (C) 2017 by Harald Welte <laforge at gnumonks.org>
+/* (C) 2017-2021 by Harald Welte <laforge at gnumonks.org>
  * All Rights Reserved
  *
  * SPDX-License-Identifier: GPL-2.0+
@@ -170,6 +170,12 @@
 		restart_asp(fi);
 		break;
 	case T_WAIT_NOTIFY:
+		if (lmp->asp->cfg.quirks & OSMO_SS7_ASP_QUIRK_NO_NOTIFY) {
+			/* some implementations don't send the NOTIFY which they SHOULD
+			 * according to RFC4666 (see OS#5145) */
+			osmo_fsm_inst_dispatch(fi, LM_E_AS_INACTIVE_IND, NULL);
+			break;
+		}
 		/* No AS has reported via NOTIFY that is was
 		 * (statically) configured at the SG for this ASP, so
 		 * let's dynamically register */

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

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: Idd947ea39d743eb1bc9342ad9d098036821da45b
Gerrit-Change-Number: 24213
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210511/86cf909e/attachment.htm>


More information about the gerrit-log mailing list