pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/libosmo-sccp/+/34610?usp=email )
Change subject: asp: Apply SCTP peer primary address changes after the ASP was started
......................................................................
asp: Apply SCTP peer primary address changes after the ASP was started
Related: OS#6077
Change-Id: I088b9a59ebfd85f3ce4a26f28bf41472d9b9da60
---
M src/osmo_ss7_vty.c
1 file changed, 27 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/10/34610/1
diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 000b1cf..cdca10d 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -714,11 +714,28 @@
{
struct osmo_ss7_asp *asp = vty->index;
bool is_primary = argc > 1;
+ int old_idx_primary = asp->cfg.local.idx_primary;
+ int rc;
if (osmo_ss7_asp_peer_add_host2(&asp->cfg.local, asp, argv[0], is_primary) != 0)
{
vty_out(vty, "%% Failed adding host '%s' to set%s", argv[0],
VTY_NEWLINE);
return CMD_WARNING;
}
+
+ if (!ss7_asp_is_started(asp))
+ return CMD_SUCCESS;
+ if (asp->cfg.proto == OSMO_SS7_ASP_PROT_IPA)
+ return CMD_SUCCESS;
+
+ /* The SCTP socket is already created, dynamically apply the new primary if it changed:
*/
+ if (is_primary && asp->cfg.local.idx_primary != old_idx_primary) {
+ if ((rc = ss7_asp_apply_peer_primary_address(asp)) < 0) {
+ /* Failed, rollback changes: */
+ asp->cfg.local.idx_primary = old_idx_primary;
+ vty_out(vty, "%% Failed announcing primary '%s' to peer%s", argv[0],
VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ }
return CMD_SUCCESS;
}
--
To view, visit
https://gerrit.osmocom.org/c/libosmo-sccp/+/34610?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: I088b9a59ebfd85f3ce4a26f28bf41472d9b9da60
Gerrit-Change-Number: 34610
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange