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.orgHello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/4893 to look at the new patch set (#3). 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 to have a "local-ip" line in the config file, otherwise osmo-stp will not listen on the socket. Related: OS#2647 Change-Id: I79738963d633bec70705ff159c5b2127cd498aa2 --- M doc/examples/osmo-stp.cfg M include/osmocom/sigtran/osmo_ss7.h M src/osmo_ss7.c M src/osmo_ss7_vty.c M src/sccp_user.c 5 files changed, 28 insertions(+), 11 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/93/4893/3 diff --git a/doc/examples/osmo-stp.cfg b/doc/examples/osmo-stp.cfg index 960bf33..013181f 100644 --- a/doc/examples/osmo-stp.cfg +++ b/doc/examples/osmo-stp.cfg @@ -18,3 +18,4 @@ xua rkm routing-key-allocation dynamic-permitted listen m3ua 2905 accept-asp-connections dynamic-permitted + local-ip 0.0.0.0 diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h index 71c2022..59c0416 100644 --- a/include/osmocom/sigtran/osmo_ss7.h +++ b/include/osmocom/sigtran/osmo_ss7.h @@ -441,6 +441,9 @@ 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); void osmo_ss7_xua_server_destroy(struct osmo_xua_server *xs); diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c index 86fb45c..fc00525 100644 --- a/src/osmo_ss7.c +++ b/src/osmo_ss7.c @@ -1745,7 +1745,7 @@ return NULL; } -/*! \brief create a new xUA server listening to given ip/port +/*! \brief create a new xUA server configured with given ip/port * \param[in] ctx talloc allocation context * \param[in] proto protocol (xUA variant) to use * \param[in] local_port local SCTP port to bind/listen to @@ -1757,7 +1757,6 @@ uint16_t local_port, const char *local_host) { struct osmo_xua_server *oxs = talloc_zero(inst, struct osmo_xua_server); - int rc; OSMO_ASSERT(ss7_initialized); if (!oxs) @@ -1781,13 +1780,6 @@ osmo_stream_srv_link_set_port(oxs->server, oxs->cfg.local.port); osmo_stream_srv_link_set_proto(oxs->server, asp_proto_to_ip_proto(proto)); - rc = osmo_stream_srv_link_open(oxs->server); - if (rc < 0) { - osmo_stream_srv_link_destroy(oxs->server); - oxs->server = NULL; - talloc_free(oxs); - } - oxs->inst = inst; llist_add_tail(&oxs->list, &inst->xua_servers); @@ -1798,6 +1790,19 @@ return oxs; } +/*! \brief Set the xUA server to bind/listen to the currently configured ip/port + * \param[in] xs xUA server to operate + * \returns 0 on success, negative value on error. + */ +int +osmo_ss7_xua_server_bind(struct osmo_xua_server *xs) +{ + LOGP(DLSS7, LOGL_INFO, "Binding %s Server to %s:%u\n", + get_value_string(osmo_ss7_asp_protocol_vals, xs->cfg.proto), + xs->cfg.local.host, xs->cfg.local.port); + return osmo_stream_srv_link_open(xs->server); +} + int osmo_ss7_xua_server_set_local_host(struct osmo_xua_server *xs, const char *local_host) { diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c index cbbb9e3..80738e6 100644 --- a/src/osmo_ss7_vty.c +++ b/src/osmo_ss7_vty.c @@ -467,6 +467,10 @@ struct osmo_xua_server *xs = vty->index; osmo_ss7_xua_server_set_local_host(xs, argv[0]); + if (osmo_ss7_xua_server_bind(xs) < 0) { + vty_out(vty, "Unable to bind xUA server to IP %s%s", argv[0], VTY_NEWLINE); + return CMD_WARNING; + } return CMD_SUCCESS; } @@ -491,8 +495,7 @@ vty_out(vty, " listen %s %u%s", get_value_string(osmo_ss7_asp_protocol_vals, xs->cfg.proto), xs->cfg.local.port, VTY_NEWLINE); - if (xs->cfg.local.host) - vty_out(vty, " local-ip %s%s", xs->cfg.local.host, VTY_NEWLINE); + vty_out(vty, " local-ip %s%s", xs->cfg.local.host ? : "0.0.0.0", VTY_NEWLINE); if (xs->cfg.accept_dyn_reg) vty_out(vty, " accept-asp-connections dynamic-permitted%s", VTY_NEWLINE); } 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 @@ { 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 @@ 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) -- To view, visit https://gerrit.osmocom.org/4893 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I79738963d633bec70705ff159c5b2127cd498aa2 Gerrit-PatchSet: 3 Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder