From b521a2ed09b368a30d2cd17190a3a574a79c68ab Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 29 Oct 2019 22:06:23 +0100 Subject: vty: Permit configuration of ASPs in SCTP client mode The M3UA specification states that either of the two roles should be the SCTP client and the other the server. It also states that the default for the SGP is to operate as server. However, it permits other configurations. Let's allow this to be configured by the VTY. We need to ensure that while in ASP role, we don't send any NOTIFY messages to the peer SG. Change-Id: I7452a862d45da35dcd58654ca17222eb52d26f1f Closes: OS#2005 --- src/osmo_ss7_vty.c | 19 +++++++++++++++++++ src/xua_as_fsm.c | 4 ++++ tests/vty/ss7_asp_test.vty | 2 ++ 3 files changed, 25 insertions(+) diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c index 1b8b043..35640df 100644 --- a/src/osmo_ss7_vty.c +++ b/src/osmo_ss7_vty.c @@ -661,6 +661,24 @@ DEFUN(asp_role, asp_role_cmd, return CMD_SUCCESS; } +DEFUN(sctp_role, asp_sctp_role_cmd, + "sctp-role (client|server)", + "Specify the SCTP role for this ASP\n" + "Operate as SCTP client; connect to a server\n" + "Operate as SCTP server; wait for client connections\n") +{ + struct osmo_ss7_asp *asp = vty->index; + + if (!strcmp(argv[0], "client")) + asp->cfg.is_server = false; + else if (!strcmp(argv[0], "server")) + asp->cfg.is_server = true; + else + OSMO_ASSERT(0); + + return CMD_SUCCESS; +} + DEFUN(asp_block, asp_block_cmd, "block", "Allows a SCTP Association with ASP, but doesn't let it become active\n") @@ -1876,6 +1894,7 @@ static void vty_init_shared(void *ctx) install_element(L_CS7_ASP_NODE, &asp_local_ip_cmd); install_element(L_CS7_ASP_NODE, &asp_qos_class_cmd); install_element(L_CS7_ASP_NODE, &asp_role_cmd); + install_element(L_CS7_ASP_NODE, &asp_sctp_role_cmd); install_element(L_CS7_ASP_NODE, &asp_block_cmd); install_element(L_CS7_ASP_NODE, &asp_shutdown_cmd); diff --git a/src/xua_as_fsm.c b/src/xua_as_fsm.c index cf75ef3..97a2107 100644 --- a/src/xua_as_fsm.c +++ b/src/xua_as_fsm.c @@ -51,6 +51,10 @@ static int asp_notify_all_as(struct osmo_ss7_as *as, struct osmo_xlm_prim_notify if (!asp) continue; + /* NOTIFY are only sent by SG or IPSP role */ + if (asp->cfg.role == OSMO_SS7_ASP_ROLE_ASP) + continue; + if (!asp->fi || asp->fi->state == XUA_ASP_S_DOWN) continue; diff --git a/tests/vty/ss7_asp_test.vty b/tests/vty/ss7_asp_test.vty index bc899eb..eeda4c8 100644 --- a/tests/vty/ss7_asp_test.vty +++ b/tests/vty/ss7_asp_test.vty @@ -216,6 +216,7 @@ ss7_asp_vty_test(config-cs7-asp)# list local-ip A.B.C.D qos-class <0-255> role (sg|asp|ipsp) + sctp-role (client|server) block shutdown @@ -226,6 +227,7 @@ ss7_asp_vty_test(config-cs7-asp)# ? local-ip Specify Local IP Address from which to contact ASP qos-class Specify QoS Class of ASP role Specify the xUA role for this ASP + sctp-role Specify the SCTP role for this ASP block Allows a SCTP Association with ASP, but doesn't let it become active shutdown Terminates SCTP association; New associations will be rejected -- cgit v1.2.3