aboutsummaryrefslogtreecommitdiffstats
path: root/src/sccp_user.c
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2017-11-17 12:57:25 +0100
committerHarald Welte <laforge@gnumonks.org>2017-12-20 16:04:08 +0000
commit10d4815bb1b4b548ec0bc97611b2e7ac45e0ebc5 (patch)
tree9dd55111832b35ae1d9d71defbcb9bdf652befd4 /src/sccp_user.c
parent6cd8d1243711f4de2f1314c7b87b972572cdec4e (diff)
ss7: Re-bind xUA server socket after setting new IP
In osmo-stp, cmd "local-ip" inside node "listen m3ua 2905" was actually not being applied, because the server was created + bound at "listen" command time using NULL as IP, and at "local-ip" time the IP was changed but the server was not re-bound using the new IP, so it kept listening at 0.0.0.0. With this patch, we defer binding the socket to "local-ip" cmd time, after the IP has been applied. As a result, if no "local-ip" command is provided, then the bind never happens, which means it is now mandatory that users of osmo_ss7_xua_server_create API not using osmo_ss7_xua_server_set_local_host call new provided API osmo_ss7_xua_server_bind. Another new API osmo_ss7_bind_all_instances is provided to easily make sure all servers are bound after configuration process. This is specially important for servers which doesn't contain the "local-ip" parameter. Users of osmo_sccp_simple_server API are not affected by this change, and they not requrie to call any new API. Furthermore, using osmo_ss7_xua_server_bind in VTY code ensures the xUA server is automatically bound to the new address if the operator changes the "local-ip" cmd at runtime. Related: OS#2647 Change-Id: I79738963d633bec70705ff159c5b2127cd498aa2
Diffstat (limited to 'src/sccp_user.c')
-rw-r--r--src/sccp_user.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/sccp_user.c b/src/sccp_user.c
index d9de8d7..cd89c88 100644
--- a/src/sccp_user.c
+++ b/src/sccp_user.c
@@ -521,6 +521,7 @@ osmo_sccp_simple_server_on_ss7_id(void *ctx, uint32_t ss7_id, uint32_t pc,
{
struct osmo_ss7_instance *ss7;
struct osmo_xua_server *xs;
+ int rc;
if (local_port < 0)
local_port = osmo_ss7_asp_protocol_port(prot);
@@ -535,6 +536,10 @@ osmo_sccp_simple_server_on_ss7_id(void *ctx, uint32_t ss7_id, uint32_t pc,
if (!xs)
goto out_ss7;
+ rc = osmo_ss7_xua_server_bind(xs);
+ if (rc < 0)
+ goto out_xs;
+
/* Allocate SCCP stack */
ss7->sccp = osmo_sccp_instance_create(ss7, NULL);
if (!ss7->sccp)