[S] Change in libosmo-sccp[master]: asp: Apply SCTP peer primary address changes after the ASP was started

2023-10-04 Thread pespin
pespin has submitted this change. ( 
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(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved
  osmith: Looks good to me, but someone else must approve




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 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


[S] Change in libosmo-sccp[master]: asp: Apply SCTP peer primary address changes after the ASP was started

2023-10-04 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmo-sccp/+/34610?usp=email )

Change subject: asp: Apply SCTP peer primary address changes after the ASP was 
started
..


Patch Set 1: Code-Review+2


--
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 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Wed, 04 Oct 2023 10:15:07 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[S] Change in libosmo-sccp[master]: asp: Apply SCTP peer primary address changes after the ASP was started

2023-10-04 Thread osmith
Attention is currently required from: pespin.

osmith has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmo-sccp/+/34610?usp=email )

Change subject: asp: Apply SCTP peer primary address changes after the ASP was 
started
..


Patch Set 1: Code-Review+1


--
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 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Attention: pespin 
Gerrit-Comment-Date: Wed, 04 Oct 2023 08:25:39 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[S] Change in libosmo-sccp[master]: asp: Apply SCTP peer primary address changes after the ASP was started

2023-10-03 Thread laforge
Attention is currently required from: pespin.

laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmo-sccp/+/34610?usp=email )

Change subject: asp: Apply SCTP peer primary address changes after the ASP was 
started
..


Patch Set 1: Code-Review+1


--
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 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Attention: pespin 
Gerrit-Comment-Date: Tue, 03 Oct 2023 12:40:35 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[S] Change in libosmo-sccp[master]: asp: Apply SCTP peer primary address changes after the ASP was started

2023-10-02 Thread pespin
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 
Gerrit-MessageType: newchange