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/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/19880 )
Change subject: Fix change in ss7 server default listen addr, keeps backward-compatibility behavior
......................................................................
Fix change in ss7 server default listen addr, keeps backward-compatibility behavior
Previous commit changed the default bind/listen address of the server
from NULL (0.0.0.0) to 127.0.0.1, hence breaking some setups where no
"local-ip" was defined and hence from then on were only listening on
localhost by default.
Let's instead bind to "::" if IPv6 is available, which covers any IPv6
and/or IPv4 address. If not available, keep binding to 0.0.0.0.
Similarly, if IPv6 is available set default remote to both ::1 and
127.0.0.1 to allow it working against processes listening on IPv4 or
IPv6 addresses.
Change-Id: Id4718267df2390f70cec519042dc12bac0cd2876
---
M src/osmo_ss7_vty.c
1 file changed, 39 insertions(+), 4 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 4591156..3035844 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -26,6 +26,7 @@
#include <stdint.h>
#include <string.h>
+#include <netdb.h>
#include <arpa/inet.h>
#include <osmocom/vty/vty.h>
@@ -1801,6 +1802,32 @@
osmo_sccp_vty_write_cs7_node(vty, " ", inst->sccp);
}
+static bool ipv6_sctp_supported(const char *host, bool bind)
+{
+ int rc;
+ struct addrinfo hints;
+ struct addrinfo *result;
+ memset(&hints, 0, sizeof(struct addrinfo));
+ hints.ai_family = AF_INET6;
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_flags = AI_NUMERICHOST;
+ hints.ai_protocol = 0; /* Any protocol */
+
+ if (bind) /* For wildcard IP address */
+ hints.ai_flags |= AI_PASSIVE;
+
+ /* man getaddrinfo: Either node or service, but not both, may be NULL. */
+ OSMO_ASSERT(host);
+ rc = getaddrinfo(host, NULL, &hints, &result);
+ if (rc != 0) {
+ LOGP(DLSS7, LOGL_NOTICE, "Default IPv6 address %s not supported: %s\n",
+ host, gai_strerror(rc));
+ return false;
+ } else {
+ freeaddrinfo(result);
+ return true;
+ }
+}
int osmo_ss7_vty_go_parent(struct vty *vty)
{
@@ -1814,11 +1841,19 @@
case L_CS7_ASP_NODE:
asp = vty->index;
/* If no local addr was set */
- if (!asp->cfg.local.host_cnt)
- osmo_ss7_asp_peer_add_host(&asp->cfg.local, asp, "localhost");
+ if (!asp->cfg.local.host_cnt) {
+ /* "::" Covers both IPv4 and IPv6 */
+ if (ipv6_sctp_supported("::", true))
+ osmo_ss7_asp_peer_add_host(&asp->cfg.local, asp, "::");
+ else
+ osmo_ss7_asp_peer_add_host(&asp->cfg.local, asp, "0.0.0.0");
+ }
/* If no remote addr was set */
- if (!asp->cfg.remote.host_cnt)
- osmo_ss7_asp_peer_add_host(&asp->cfg.remote, asp, "localhost");
+ if (!asp->cfg.remote.host_cnt) {
+ osmo_ss7_asp_peer_add_host(&asp->cfg.remote, asp, "127.0.0.1");
+ if (ipv6_sctp_supported("::1", false))
+ osmo_ss7_asp_peer_add_host(&asp->cfg.remote, asp, "::1");
+ }
osmo_ss7_asp_restart(asp);
vty->node = L_CS7_NODE;
vty->index = asp->inst;
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/19880
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: Id4718267df2390f70cec519042dc12bac0cd2876
Gerrit-Change-Number: 19880
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200829/e30215fb/attachment.htm>