lynxis submitted this change.
tcap_as_loadshare: add TCAP IPA MT_TID_ACCEPT_NEW_TRAN
With MT_TID_ACCEPT_NEW_TRANS a TCAP loadsharing ASP can control if
it receives new TCAP transactions (TCAP Begin messages).
When disabled, a TCAP loadsharing ASP will still receive TCAP transaction inside
their TCAP range as well transaction associated via transaction tracking.
Related: SYS#8283
Change-Id: Id4e7bb022a0c8b52369f6ded2729cf6cf8679556
---
M src/ss7_asp.c
M src/ss7_asp.h
M src/tcap_as_loadshare.c
M src/tcap_as_loadshare.h
M src/tcap_as_loadshare_vty.c
5 files changed, 101 insertions(+), 7 deletions(-)
diff --git a/src/ss7_asp.c b/src/ss7_asp.c
index 63038d9..bb2130c 100644
--- a/src/ss7_asp.c
+++ b/src/ss7_asp.c
@@ -58,6 +58,7 @@
#include "ss7_internal.h"
#include "ss7_xua_srv.h"
#include "ss7_qos_class.h"
+#include "tcap_as_loadshare.h"
#include "xua_asp_fsm.h"
#include "xua_as_fsm.h"
#include "xua_lm_sap.h"
@@ -778,6 +779,11 @@
/* The SUA code internally needs SCCP to work */
if (proto == OSMO_SS7_ASP_PROT_SUA)
osmo_ss7_ensure_sccp(inst);
+
+#ifdef WITH_TCAP_LOADSHARING
+ tcap_asp_init(asp);
+#endif /* WITH_TCAP_LOADSHARING */
+
return asp;
}
diff --git a/src/ss7_asp.h b/src/ss7_asp.h
index b7f0058..6e1d056 100644
--- a/src/ss7_asp.h
+++ b/src/ss7_asp.h
@@ -105,6 +105,8 @@
#ifdef WITH_TCAP_LOADSHARING
struct {
bool enabled;
+ /* is this ASP available for new TCAP sessions (Begin) */
+ bool accept_new_trans;
} tcap;
#endif /* WITH_TCAP_LOADSHARING */
diff --git a/src/tcap_as_loadshare.c b/src/tcap_as_loadshare.c
index 8dc20c6..a163629 100644
--- a/src/tcap_as_loadshare.c
+++ b/src/tcap_as_loadshare.c
@@ -260,7 +260,9 @@
for (unsigned int i = 0; i < as->num_assoc_asps; i++) {
assoc = ss7_as_asp_assoc_llist_round_robin(as, &as->tcap.last_asp_idx_sent);
- if (assoc && osmo_ss7_asp_active(assoc->asp) && assoc->asp->tcap.enabled)
+ if (assoc && osmo_ss7_asp_active(assoc->asp) &&
+ assoc->asp->tcap.enabled &&
+ assoc->asp->tcap.accept_new_trans)
return assoc->asp;
}
return NULL;
@@ -807,6 +809,7 @@
MT_TID_ADD_RANGE = 0x01,
MT_TID_ACK = 0x02,
MT_TID_NACK = 0x03,
+ MT_TID_ACCEPT_NEW_TRANS = 0x04,
};
enum ipa_tcap_routing_nack_error {
@@ -839,6 +842,14 @@
uint8_t err;
} __attribute__((packed));
+/* Controls if the ASP may receive new transaction (TCAP Begin).
+ *
+ * When the ASP disabled new transaction, it still receive TCAP transactions which matches
+ * the DTID (TCAP Continue/End) or if transaction tracking matches an ongoing transaction. */
+struct ipa_tcap_routing_accept_new_trans {
+ uint8_t accept;
+} __attribute__((packed));
+
static struct msgb *ipa_tcap_routing_alloc(uint32_t seq_nr, uint8_t mt)
{
struct ipa_tcap_routing_hdr hdr = {
@@ -968,6 +979,25 @@
rc = ipa_tx_tcap_routing_ack(asp, osmo_ntohl(hdr->seq));
break;
}
+ case MT_TID_ACCEPT_NEW_TRANS:
+ if (msgb_length(msg) < sizeof(*hdr) + sizeof(struct ipa_tcap_routing_accept_new_trans)) {
+ LOGPASP(asp, DLTCAP, LOGL_ERROR, "TCAP routing message is too small (accept new transactions)\n");
+ rc = -EINVAL;
+ goto out;
+ }
+
+ msgb_pull(msg, sizeof(*hdr));
+
+ asp->tcap.accept_new_trans = msgb_pull_u8(msg) & 0x1;
+ if (asp->tcap.accept_new_trans)
+ LOGPASP(asp, DLTCAP, LOGL_INFO,
+ "TCAP New transaction command: ASP will receive new TCAP transactions\n");
+ else
+ LOGPASP(asp, DLTCAP, LOGL_INFO,
+ "TCAP New transaction command: ASP won't receive new TCAP transactions\n");
+
+ rc = ipa_tx_tcap_routing_ack(asp, osmo_ntohl(hdr->seq));
+ break;
case MT_TID_ACK: /* shouldn't received from other end */
case MT_TID_NACK: /* shouldn't received from other end */
default:
@@ -1102,6 +1132,9 @@
if (as->tcap.contains_pc || as->tcap.contains_ssn)
tcap_range_as_update_pc_ssn(as);
+
+ /* Reset accept new transaction to default */
+ asp->tcap.accept_new_trans = true;
}
/** When the ASP goes down
@@ -1157,3 +1190,8 @@
tcap_trans_track_garbage_collect_stop(as);
tcap_trans_track_entries_free_all(as);
}
+
+void tcap_asp_init(struct osmo_ss7_asp *asp)
+{
+ asp->tcap.accept_new_trans = true;
+}
diff --git a/src/tcap_as_loadshare.h b/src/tcap_as_loadshare.h
index f790493..a89ca09 100644
--- a/src/tcap_as_loadshare.h
+++ b/src/tcap_as_loadshare.h
@@ -35,6 +35,8 @@
/* Traffic STP -> AS -> ASP (Tx path) Loadshare towards the TCAP routing AS */
int tcap_as_select_asp_loadshare(struct osmo_ss7_asp **asp, struct osmo_ss7_as *as, const struct xua_msg *xua);
+void tcap_asp_init(struct osmo_ss7_asp *asp);
+
/* When the ASP got dissassociated */
void tcap_as_del_asp(struct osmo_ss7_as *as, struct osmo_ss7_asp *asp);
diff --git a/src/tcap_as_loadshare_vty.c b/src/tcap_as_loadshare_vty.c
index e6506e8..243711c 100644
--- a/src/tcap_as_loadshare_vty.c
+++ b/src/tcap_as_loadshare_vty.c
@@ -42,7 +42,12 @@
static int show_one_tcap_range(struct vty *vty, const struct osmo_ss7_as *as, const struct tcap_range *tcrng)
{
- vty_out(vty, "%-7u %-7u %3u %-13s %-12s%s", tcrng->tid_start, tcrng->tid_end, tcrng->ssn, osmo_ss7_pointcode_print(as->inst, tcrng->pc), tcrng->asp->cfg.name, VTY_NEWLINE);
+ vty_out(vty, "%-7u %-7u %3u %-13s %-12s %-9s%s",
+ tcrng->tid_start, tcrng->tid_end,
+ tcrng->ssn, osmo_ss7_pointcode_print(as->inst, tcrng->pc),
+ tcrng->asp->cfg.name,
+ tcrng->asp->tcap.accept_new_trans ? "YES" : "NO",
+ VTY_NEWLINE);
return CMD_SUCCESS;
}
@@ -72,14 +77,13 @@
return CMD_WARNING;
}
- vty_out(vty, "Tid Min Tid Max SSN PC ASP Name %s", VTY_NEWLINE);
- vty_out(vty, "------- ------- --- ------------- ------------%s", VTY_NEWLINE);
+ vty_out(vty, "Tid Min Tid Max SSN PC ASP Name New trans%s", VTY_NEWLINE);
+ vty_out(vty, "------- ------- --- ------------- ------------ ---------%s", VTY_NEWLINE);
hash_for_each(as->tcap.tid_ranges, i, tcrng, list) {
show_one_tcap_range(vty, as, tcrng);
}
-
return CMD_SUCCESS;
}
@@ -112,8 +116,8 @@
return CMD_WARNING;
}
- vty_out(vty, "Tid Min Tid Max SSN PC ASP Name %s", VTY_NEWLINE);
- vty_out(vty, "------- ------- --- ------------- ------------%s", VTY_NEWLINE);
+ vty_out(vty, "Tid Min Tid Max SSN PC ASP Name New trans%s", VTY_NEWLINE);
+ vty_out(vty, "------- ------- --- ------------- ------------ ---------%s", VTY_NEWLINE);
hash_for_each(as->tcap.tid_ranges, i, tcrng, list) {
if (tid < tcrng->tid_start || tid > tcrng->tid_end)
@@ -121,6 +125,47 @@
show_one_tcap_range(vty, as, tcrng);
}
+ return CMD_SUCCESS;
+}
+
+DEFUN(show_cs7_as_name_tcap_loadshare, show_cs7_as_name_tcap_loadshare_cmd,
+ "show cs7 instance <0-15> as name AS_NAME tcap loadshare",
+ SHOW_STR CS7_STR INST_STR INST_STR "Application Server (AS)\n"
+ "Look up AS with a given name\n"
+ "Name of the Application Server (AS)\n"
+ "Show tcap loadshare\n"
+ "Show tcap loadshare\n")
+{
+ int id = atoi(argv[0]);
+ const char *as_name = argv[1];
+ struct osmo_ss7_instance *inst;
+ struct osmo_ss7_as *as = NULL;
+ struct ss7_as_asp_assoc *assoc;
+
+ inst = osmo_ss7_instance_find(id);
+ if (!inst) {
+ vty_out(vty, "No SS7 instance %d found%s", id, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ as = osmo_ss7_as_find_by_name(inst, as_name);
+ if (!as) {
+ vty_out(vty, "No AS %s found%s", as_name, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ vty_out(vty, "AS ASP Name Loadshare%s", VTY_NEWLINE);
+ vty_out(vty, "-------------- -------------- ---------%s", VTY_NEWLINE);
+
+ llist_for_each_entry(assoc, &as->assoc_asp_list, as_entry) {
+ if (!assoc->asp->tcap.enabled)
+ continue;
+
+ vty_out(vty, "%-14s %-14s %-9s%s",
+ as_name, assoc->asp->cfg.name,
+ assoc->asp->tcap.accept_new_trans ? "Yes" : "No",
+ VTY_NEWLINE);
+ }
return CMD_SUCCESS;
}
@@ -129,4 +174,5 @@
{
install_lib_element_ve(&show_cs7_as_name_tcapranges_cmd);
install_lib_element_ve(&show_cs7_as_name_tcapranges_tid_cmd);
+ install_lib_element_ve(&show_cs7_as_name_tcap_loadshare_cmd);
}
To view, visit change 43999. To unsubscribe, or for help writing mail filters, visit settings.