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/.
Harald Welte gerrit-no-reply at lists.osmocom.org
Review at https://gerrit.osmocom.org/2254
Allow clients to specify local IP/port
Change-Id: Ief7ce8181442fd0f51c34cf598269ed3a6beacea
---
M examples/m3ua_example.c
M include/osmocom/sigtran/osmo_ss7.h
M src/osmo_ss7.c
M src/sccp_user.c
4 files changed, 9 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/54/2254/1
diff --git a/examples/m3ua_example.c b/examples/m3ua_example.c
index 07de7f3..d1247f5 100644
--- a/examples/m3ua_example.c
+++ b/examples/m3ua_example.c
@@ -106,7 +106,7 @@
if (client) {
- g_sccp = osmo_sccp_simple_client(NULL, "client", 23, OSMO_SS7_ASP_PROT_M3UA, 0, M3UA_PORT, "127.0.0.2");
+ g_sccp = osmo_sccp_simple_client(NULL, "client", 23, OSMO_SS7_ASP_PROT_M3UA, 0, NULL, M3UA_PORT, "127.0.0.2");
sccp_test_user_vty_install(g_sccp, OSMO_SCCP_SSN_BSC_BSSAP);
} else {
g_sccp = sua_server_helper();
diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h
index d765ae0..b8fab99 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -390,10 +390,11 @@
void osmo_ss7_xua_server_destroy(struct osmo_xua_server *xs);
+
struct osmo_sccp_instance *
osmo_sccp_simple_client(void *ctx, const char *name, uint32_t pc,
- enum osmo_ss7_asp_protocol prot,
- int local_port, int remote_port, const char *remote_ip);
+ enum osmo_ss7_asp_protocol prot, int local_port,
+ const char *local_ip, int remote_port, const char *remote_ip);
struct osmo_sccp_instance *
osmo_sccp_simple_server(void *ctx, uint32_t pc,
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index f7f2519..d569475 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -1031,6 +1031,8 @@
}
osmo_stream_cli_set_addr(asp->client, asp->cfg.remote.host);
osmo_stream_cli_set_port(asp->client, asp->cfg.remote.port);
+ osmo_stream_cli_set_local_addr(asp->client, asp->cfg.local.host);
+ osmo_stream_cli_set_local_port(asp->client, asp->cfg.local.port);
osmo_stream_cli_set_proto(asp->client, IPPROTO_SCTP);
osmo_stream_cli_set_reconnect_timeout(asp->client, 5);
osmo_stream_cli_set_connect_cb(asp->client, xua_cli_connect_cb);
diff --git a/src/sccp_user.c b/src/sccp_user.c
index 9ed57d4..57c0038 100644
--- a/src/sccp_user.c
+++ b/src/sccp_user.c
@@ -230,8 +230,8 @@
struct osmo_sccp_instance *
osmo_sccp_simple_client(void *ctx, const char *name, uint32_t pc,
- enum osmo_ss7_asp_protocol prot,
- int local_port, int remote_port, const char *remote_ip)
+ enum osmo_ss7_asp_protocol prot, int local_port,
+ const char *local_ip, int remote_port, const char *remote_ip)
{
struct osmo_ss7_instance *ss7;
struct osmo_ss7_as *as;
@@ -269,6 +269,7 @@
prot);
if (!asp)
goto out_rt;
+ asp->cfg.local.host = talloc_strdup(asp, local_ip);
asp->cfg.remote.host = talloc_strdup(asp, remote_ip);
osmo_ss7_as_add_asp(as, asp_name);
talloc_free(asp_name);
--
To view, visit https://gerrit.osmocom.org/2254
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ief7ce8181442fd0f51c34cf598269ed3a6beacea
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>