pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmo-sigtran/+/41637?usp=email )


Change subject: tcap: Forbid tcap-routing in ASP mode
......................................................................

tcap: Forbid tcap-routing in ASP mode

The tcap-routing feature is only expected to be used so far by osmo-stp,
which runs in SG role. Disable it for programs running under ASP role.

Change-Id: I4ccfa9ae06c756dd6626045a8e9f14ae79bcfa34
---
M src/ss7_as_vty.c
M src/tcap_as_loadshare.c
2 files changed, 14 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran 
refs/changes/37/41637/1

diff --git a/src/ss7_as_vty.c b/src/ss7_as_vty.c
index f7f3cfe..92e16bb 100644
--- a/src/ss7_as_vty.c
+++ b/src/ss7_as_vty.c
@@ -709,8 +709,10 @@
        install_lib_element(L_CS7_AS_NODE, &as_no_traf_mode_cmd);
        install_lib_element(L_CS7_AS_NODE, &as_sls_shift_cmd);
 #ifdef WITH_TCAP_LOADSHARING
-       install_lib_element(L_CS7_AS_NODE, &as_tcap_routing_cmd);
-       install_lib_element(L_CS7_AS_NODE, &as_no_tcap_routing_cmd);
+       if (cs7_role == CS7_ROLE_SG) {
+               install_lib_element(L_CS7_AS_NODE, &as_tcap_routing_cmd);
+               install_lib_element(L_CS7_AS_NODE, &as_no_tcap_routing_cmd);
+       }
 #endif /* WITH_TCAP_LOADSHARING */
        install_lib_element(L_CS7_AS_NODE, &as_bindingtable_reset_cmd);
        install_lib_element(L_CS7_AS_NODE, &as_recov_tout_cmd);
diff --git a/src/tcap_as_loadshare.c b/src/tcap_as_loadshare.c
index 28d8175..623bd3b 100644
--- a/src/tcap_as_loadshare.c
+++ b/src/tcap_as_loadshare.c
@@ -46,6 +46,7 @@
 #include "sccp_internal.h"
 #include "ss7_asp.h"
 #include "ss7_internal.h"
+#include "ss7_vty.h"
 #include "tcap_as_loadshare.h"
 #include "tcap_trans_tracking.h"
 #include "xua_internal.h"
@@ -707,10 +708,18 @@
 int ipa_rx_msg_osmo_ext_tcap_routing(struct osmo_ss7_asp *asp, struct msgb 
*msg)
 {
        int rc = 0;
-       struct osmo_ss7_as *as = ipa_find_as_for_asp(asp);
+       struct osmo_ss7_as *as;
        struct ipa_tcap_routing_hdr *hdr;
        enum ipa_tcap_routing_msg_types routing_msg;

+       if (cs7_role != CS7_ROLE_SG) {
+               LOGPASP(asp, DLTCAP, LOGL_ERROR,
+                       "Rx unexpected OSMO IPA EXT TCAP ROUTING msg in role != 
CS7_ROLE_SG!\n");
+               rc = -ENOENT;
+               goto out;
+       }
+
+       as = ipa_find_as_for_asp(asp);
        if (!as) {
                LOGPASP(asp, DLTCAP, LOGL_ERROR, "Rx message for IPA ASP 
without AS?!\n");
                rc = -ENOENT;

--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/41637?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I4ccfa9ae06c756dd6626045a8e9f14ae79bcfa34
Gerrit-Change-Number: 41637
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>

Reply via email to