From 737016a9542ae8086b4db745ece29bc2532a98e3 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 19 Nov 2019 01:26:13 +0100 Subject: asp: Don't override ASP and SCTP role when re-entering asp node The code to set the default role (SG) and default SCTP role (server) must only be executed when the ASP node is first created. Subsequent times entering the pre-existing ASP node should not overwrite those role settings [or any other configuration for that matter] Change-Id: I068996a5e0d870043b652fb69a3c300adc6fda7c Closes: OS#4271 --- src/osmo_ss7_vty.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c index 0a3cea4..08d8c43 100644 --- a/src/osmo_ss7_vty.c +++ b/src/osmo_ss7_vty.c @@ -574,13 +574,16 @@ DEFUN(cs7_asp, cs7_asp_cmd, return CMD_WARNING; } - asp = osmo_ss7_asp_find_or_create(inst, name, remote_port, local_port, protocol); + asp = osmo_ss7_asp_find(inst, name, remote_port, local_port, protocol); if (!asp) { - vty_out(vty, "cannot create ASP '%s'%s", name, VTY_NEWLINE); - return CMD_WARNING; + asp = osmo_ss7_asp_find_or_create(inst, name, remote_port, local_port, protocol); + if (!asp) { + vty_out(vty, "cannot create ASP '%s'%s", name, VTY_NEWLINE); + return CMD_WARNING; + } + asp->cfg.is_server = true; + asp->cfg.role = OSMO_SS7_ASP_ROLE_SG; } - asp->cfg.is_server = true; - asp->cfg.role = OSMO_SS7_ASP_ROLE_SG; vty->node = L_CS7_ASP_NODE; vty->index = asp; -- cgit v1.2.3