[PATCH] libosmo-sccp[master]: ss7: Re-bind xUA server socket after setting new IP

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Fri Nov 17 12:03:01 UTC 2017


Review at  https://gerrit.osmocom.org/4893

ss7: Re-bind xUA server socket after setting new IP

In osmo-stp, cmd "local-ip" inside node "listen m3ua 2905" is actually
not applied. Because the server is created + bound at "listen" command
time using NULL as IP, and at "local-ip" time the IP is changed but the
server is not re-bound using the new IP, so it keeps listening at
0.0.0.0.

This implementation still has several drawbacks:
- We cannot identify in VTY 2 listen nodes (xUA servers) which use same
port but different IP.
- Server keeps first binding against 0.0.0.0 and then it switches to a
specific IP when the "local-ip" cmd is run. This can create different
issues in a host running more than one osmo-stp instance.

Correct fix for this would be to have the IP parameter in the "listen"
node, but that would break VTY compatibility with old configurations.

Related: OS#2647

Change-Id: I79738963d633bec70705ff159c5b2127cd498aa2
---
M src/osmo_ss7.c
M src/osmo_ss7_vty.c
2 files changed, 10 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/93/4893/1

diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index 86fb45c..769f00e 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -1801,12 +1801,17 @@
 int
 osmo_ss7_xua_server_set_local_host(struct osmo_xua_server *xs, const char *local_host)
 {
+	int rc;
 	OSMO_ASSERT(ss7_initialized);
 	osmo_talloc_replace_string(xs, &xs->cfg.local.host, local_host);
 
 	osmo_stream_srv_link_set_addr(xs->server, xs->cfg.local.host);
+	LOGP(DLSS7, LOGL_INFO, "Binding new local ip for %s Server %s:%u\n",
+		get_value_string(osmo_ss7_asp_protocol_vals, xs->cfg.proto),
+		xs->cfg.local.host, xs->cfg.local.port);
+	rc = osmo_stream_srv_link_open(xs->server);
 
-	return 0;
+	return rc;
 }
 
 void osmo_ss7_xua_server_destroy(struct osmo_xua_server *xs)
diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 4c67508..2c55049 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -466,7 +466,10 @@
 {
 	struct osmo_xua_server *xs = vty->index;
 
-	osmo_ss7_xua_server_set_local_host(xs, argv[0]);
+	if (osmo_ss7_xua_server_set_local_host(xs, argv[0]) < 0) {
+		vty_out(vty, "Unable to change xUA server IP to %s%s", argv[0], VTY_NEWLINE);
+		return CMD_WARNING;
+	}
 	return CMD_SUCCESS;
 }
 

-- 
To view, visit https://gerrit.osmocom.org/4893
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I79738963d633bec70705ff159c5b2127cd498aa2
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list