aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2021-05-11 16:25:21 +0200
committerHarald Welte <laforge@osmocom.org>2021-05-13 18:11:51 +0200
commite9b21ff256c4269bde090ca8e942c738f0da97c4 (patch)
tree5fde6ebc6c68552670844d3fa4ba477ba050c74e
parent2cf796a2a5942d9b7be3eb83be62e2ac4359fd35 (diff)
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
-rw-r--r--include/osmocom/sigtran/osmo_ss7.h4
-rw-r--r--src/osmo_ss7_vty.c67
-rw-r--r--src/xua_default_lm_fsm.c9
3 files changed, 78 insertions, 2 deletions
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 {
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@gnumonks.org>
+/* (C) 2015-2021 by Harald Welte <laforge@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 @@ DEFUN_ATTR(asp_shutdown, asp_shutdown_cmd,
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 @@ static void write_one_asp(struct vty *vty, struct osmo_ss7_asp *asp, bool show_d
}
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 @@ static void vty_init_shared(void *ctx)
{
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 @@ static void vty_init_shared(void *ctx)
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..ca488a7 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@gnumonks.org>
+/* (C) 2017-2021 by Harald Welte <laforge@gnumonks.org>
* All Rights Reserved
*
* SPDX-License-Identifier: GPL-2.0+
@@ -170,6 +170,13 @@ static int lm_timer_cb(struct osmo_fsm_inst *fi)
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) */
+ LOGPFSM(fi, "quirk no_notify active; locally emulate AS-INACTIVE.ind\n");
+ 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 */