From 10d4815bb1b4b548ec0bc97611b2e7ac45e0ebc5 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Fri, 17 Nov 2017 12:57:25 +0100 Subject: 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 --- include/osmocom/sigtran/osmo_ss7.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/osmocom/sigtran') diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h index 71c2022..94d5e8a 100644 --- a/include/osmocom/sigtran/osmo_ss7.h +++ b/include/osmocom/sigtran/osmo_ss7.h @@ -108,6 +108,8 @@ osmo_ss7_instance_find_or_create(void *ctx, uint32_t id); void osmo_ss7_instance_destroy(struct osmo_ss7_instance *inst); int osmo_ss7_instance_set_pc_fmt(struct osmo_ss7_instance *inst, uint8_t c0, uint8_t c1, uint8_t c2); +int osmo_ss7_instance_bind(struct osmo_ss7_instance *inst); +int osmo_ss7_bind_all_instances(); /*********************************************************************** * MTP Users (Users of MTP, such as SCCP or ISUP) @@ -440,6 +442,9 @@ struct osmo_xua_server * osmo_ss7_xua_server_create(struct osmo_ss7_instance *inst, enum osmo_ss7_asp_protocol proto, uint16_t local_port, const char *local_host); +int +osmo_ss7_xua_server_bind(struct osmo_xua_server *xs); + int osmo_ss7_xua_server_set_local_host(struct osmo_xua_server *xs, const char *local_host); -- cgit v1.2.3