pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/34352?usp=email )
Change subject: asp,xua_srv: Use new osmo_stream API to request sockopt SCTP AUTH/ASCONF SUPPORTED ......................................................................
asp,xua_srv: Use new osmo_stream API to request sockopt SCTP AUTH/ASCONF SUPPORTED
Support to enable AUTH/ASCONF in the SCTP socket was added recently in libosmocore and libosmo-netif, in order to support the Peer Primary Address features used by the libosmo-sccp code. The code to request the AUTH/ASCONF support through setsockopt() was internally applied transparently by lisbosmo-netif's osmo_stream. This is not 100% disarable since other users of the library may not need/want that behavior. As a result, libosmo-netif's osmo_stream no longer enables the SCTP AUTH/ASCONF support by default, but it must be enabled through the new osmo_stream_{cli,srv_link}_set_param() API.
This change in behavior of the API/implementation can be done because all these new features are pretty new and no release of libosmocore/libosmo-netif/libosmo-sccp has been released yet.
Related: SYS#6501 Related: SYS#6558 Depends: libosmo-netif.git Change-Id I2607c1c926a625986cd851adc65dd8b4de83d6ab Change-Id: I16c97fc148792aa3e39b7414899660990c39dfff --- M TODO-RELEASE M src/osmo_ss7_asp.c M src/osmo_ss7_xua_srv.c 3 files changed, 39 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/52/34352/1
diff --git a/TODO-RELEASE b/TODO-RELEASE index 306eed9..172a1f9 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -11,5 +11,5 @@ libosmo-netif > 1.3.0 uses osmo_stream_*_set_name() libosmo-sccp add API osmo_ss7_asp_get_name(), osmo_ss7_asp_get_proto() osmo_sccp_simple_client_on_ss7_id() behavior change: ASPs asp-clnt-* defined through VTY must explicitly configure "role" and "sctp-role" -libosmo-netif > 1.3.0 flag OSMO_STREAM_SCTP_MSG_FLAGS_NOTIFICATION set by osmo_stream_cli_recv() +libosmo-netif > 1.3.0 osmo_stream_srv_link_set_param(), osmo_stream_srv_link_set_param() libosmo-sccp add API osmo_ss7_asp_peer_init(), osmo_ss7_asp_peer_set_hosts2(), osmo_ss7_asp_peer_add_host2() diff --git a/src/osmo_ss7_asp.c b/src/osmo_ss7_asp.c index c282730..ab01abd 100644 --- a/src/osmo_ss7_asp.c +++ b/src/osmo_ss7_asp.c @@ -722,6 +722,7 @@ { int rc; char bufloc[512], bufrem[512]; + uint8_t byte;
OSMO_ASSERT(ss7_initialized); osmo_ss7_asp_peer_snprintf(bufloc, sizeof(bufloc), &asp->cfg.local); @@ -758,6 +759,10 @@ else osmo_stream_cli_set_read_cb(asp->client, xua_cli_read_cb); osmo_stream_cli_set_data(asp->client, asp); + byte = 1; /*AUTH is needed by ASCONF. enable, don't abort socket creation if AUTH can't be enabled */ + osmo_stream_cli_set_param(asp->client, OSMO_STREAM_CLI_PAR_SCTP_SOCKOPT_AUTH_SUPPORTED, &byte, sizeof(byte)); + byte = 1; /* enable, don't abort socket creation if ASCONF can't be enabled */ + osmo_stream_cli_set_param(asp->client, OSMO_STREAM_CLI_PAR_SCTP_SOCKOPT_ASCONF_SUPPORTED, &byte, sizeof(byte)); rc = osmo_stream_cli_open(asp->client); if (rc < 0) { LOGPASP(asp, DLSS7, LOGL_ERROR, "Unable to open stream" diff --git a/src/osmo_ss7_xua_srv.c b/src/osmo_ss7_xua_srv.c index 04ae893..826c5ce 100644 --- a/src/osmo_ss7_xua_srv.c +++ b/src/osmo_ss7_xua_srv.c @@ -181,6 +181,7 @@ uint16_t local_port, const char *local_host) { struct osmo_xua_server *oxs = talloc_zero(inst, struct osmo_xua_server); + uint8_t byte;
OSMO_ASSERT(ss7_initialized); if (!oxs) @@ -205,6 +206,11 @@
osmo_ss7_xua_server_set_local_host(oxs, local_host);
+ byte = 1; /*AUTH is needed by ASCONF. enable, don't abort socket creation if AUTH can't be enabled */ + osmo_stream_srv_link_set_param(oxs->server, OSMO_STREAM_SRV_LINK_PAR_SCTP_SOCKOPT_AUTH_SUPPORTED, &byte, sizeof(byte)); + byte = 1; /* enable, don't abort socket creation if ASCONF can't be enabled */ + osmo_stream_srv_link_set_param(oxs->server, OSMO_STREAM_SRV_LINK_PAR_SCTP_SOCKOPT_ASCONF_SUPPORTED, &byte, sizeof(byte)); + LOGP(DLSS7, LOGL_INFO, "Created %s server on %s:%" PRIu16 "\n", get_value_string(osmo_ss7_asp_protocol_vals, proto), local_host, local_port);