diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2023-09-08 16:51:47 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2023-09-08 18:14:37 +0200 |
commit | 13a341e813439ae1d4651ee0b61a55c12dfd25d0 (patch) | |
tree | 3399d7efd8a5a6c74585d5f78e223a076eb0013b /src | |
parent | 0937875983784d8e1516ed3aed8f8a5d8f6ec216 (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/osmo_ss7_asp.c | 5 | ||||
-rw-r--r-- | src/osmo_ss7_xua_srv.c | 8 |
2 files changed, 13 insertions, 0 deletions
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 osmo_ss7_asp_restart(struct osmo_ss7_asp *asp) { 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 @@ int osmo_ss7_asp_restart(struct osmo_ss7_asp *asp) 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..57e909a 100644 --- a/src/osmo_ss7_xua_srv.c +++ b/src/osmo_ss7_xua_srv.c @@ -227,6 +227,7 @@ osmo_ss7_xua_server_bind(struct osmo_xua_server *xs) { char buf[512]; int rc; + uint8_t byte; const char *proto = get_value_string(osmo_ss7_asp_protocol_vals, xs->cfg.proto); rc = osmo_ss7_asp_peer_snprintf(buf, sizeof(buf), &xs->cfg.local); @@ -236,6 +237,13 @@ osmo_ss7_xua_server_bind(struct osmo_xua_server *xs) LOGP(DLSS7, LOGL_INFO, "(Re)binding %s Server to %s\n", proto, buf); } + + /* Applying xUA Server config which may have changed through VTY on the srv_link before opening it: */ + 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(xs->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(xs->server, OSMO_STREAM_SRV_LINK_PAR_SCTP_SOCKOPT_ASCONF_SUPPORTED, &byte, sizeof(byte)); + return osmo_stream_srv_link_open(xs->server); } |