pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/34348?usp=email ) Change subject: stream: Add new stream_{cli,srv_link} parameters to set SCTP_INITMSG sockopt values ...................................................................... stream: Add new stream_{cli,srv_link} parameters to set SCTP_INITMSG sockopt values This will allow osmo_stream users (like libosmo-sccp) to set SCTP_INITMSG related parameters, like number on inbound/outbound streams, connect attempts, connect timeout. Related: SYS#6558 Change-Id: I5343c7659881b29e0201e72badbc2d07e1ef2dca --- M include/osmocom/netif/stream.h M src/stream_cli.c M src/stream_srv.c 3 files changed, 62 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved diff --git a/include/osmocom/netif/stream.h b/include/osmocom/netif/stream.h index f78df8a..6ee5820 100644 --- a/include/osmocom/netif/stream.h +++ b/include/osmocom/netif/stream.h @@ -45,6 +45,8 @@ enum osmo_stream_srv_link_param { OSMO_STREAM_SRV_LINK_PAR_SCTP_SOCKOPT_AUTH_SUPPORTED, /* uint8_t: 0 disable, 1 enable, 2 force disable, 3 force enable */ OSMO_STREAM_SRV_LINK_PAR_SCTP_SOCKOPT_ASCONF_SUPPORTED, /* uint8_t: 0 disable, 1 enable, 2 force disable, 3 force enable */ + OSMO_STREAM_SRV_LINK_PAR_SCTP_INIT_NUM_OSTREAMS, /* uint16_t: amount of streams */ + OSMO_STREAM_SRV_LINK_PAR_SCTP_INIT_MAX_INSTREAMS, /* uint16_t: amount of streams */ }; int osmo_stream_srv_link_set_param(struct osmo_stream_srv_link *link, enum osmo_stream_srv_link_param par, @@ -117,6 +119,10 @@ enum osmo_stream_cli_param { OSMO_STREAM_CLI_PAR_SCTP_SOCKOPT_AUTH_SUPPORTED, /* uint8_t: 0 disable, 1 enable, 2 force disable, 3 force enable */ OSMO_STREAM_CLI_PAR_SCTP_SOCKOPT_ASCONF_SUPPORTED, /* uint8_t: 0 disable, 1 enable, 2 force disable, 3 force enable */ + OSMO_STREAM_CLI_PAR_SCTP_INIT_NUM_OSTREAMS, /* uint16_t: amount of streams */ + OSMO_STREAM_CLI_PAR_SCTP_INIT_MAX_INSTREAMS, /* uint16_t: amount of streams */ + OSMO_STREAM_CLI_PAR_SCTP_INIT_MAX_ATTEMPTS, /* uint16_t: amount of attempts */ + OSMO_STREAM_CLI_PAR_SCTP_INIT_TIMEOUT, /* uint16_t: milliseconds */ }; int osmo_stream_cli_set_param(struct osmo_stream_cli *cli, enum osmo_stream_cli_param par, diff --git a/src/stream_cli.c b/src/stream_cli.c index 16d033e..23e1900 100644 --- a/src/stream_cli.c +++ b/src/stream_cli.c @@ -1023,6 +1023,34 @@ cli->ma_pars.sctp.sockopt_asconf_supported.abort_on_failure = val8 > 1; cli->ma_pars.sctp.sockopt_asconf_supported.value = (val8 == 1 || val8 == 3) ? 1 : 0; break; + case OSMO_STREAM_CLI_PAR_SCTP_INIT_NUM_OSTREAMS: + if (!val || val_len != sizeof(uint16_t)) + return -EINVAL; + cli->ma_pars.sctp.sockopt_initmsg.set = true; + cli->ma_pars.sctp.sockopt_initmsg.num_ostreams_present = true; + cli->ma_pars.sctp.sockopt_initmsg.num_ostreams_value = *(uint16_t *)val; + break; + case OSMO_STREAM_CLI_PAR_SCTP_INIT_MAX_INSTREAMS: + if (!val || val_len != sizeof(uint16_t)) + return -EINVAL; + cli->ma_pars.sctp.sockopt_initmsg.set = true; + cli->ma_pars.sctp.sockopt_initmsg.max_instreams_present = true; + cli->ma_pars.sctp.sockopt_initmsg.max_instreams_value = *(uint16_t *)val; + break; + case OSMO_STREAM_CLI_PAR_SCTP_INIT_MAX_ATTEMPTS: + if (!val || val_len != sizeof(uint16_t)) + return -EINVAL; + cli->ma_pars.sctp.sockopt_initmsg.set = true; + cli->ma_pars.sctp.sockopt_initmsg.max_attempts_present = true; + cli->ma_pars.sctp.sockopt_initmsg.max_attempts_value = *(uint16_t *)val; + break; + case OSMO_STREAM_CLI_PAR_SCTP_INIT_TIMEOUT: + if (!val || val_len != sizeof(uint16_t)) + return -EINVAL; + cli->ma_pars.sctp.sockopt_initmsg.set = true; + cli->ma_pars.sctp.sockopt_initmsg.max_init_timeo_present = true; + cli->ma_pars.sctp.sockopt_initmsg.max_init_timeo_value = *(uint16_t *)val; + break; default: return -ENOENT; }; diff --git a/src/stream_srv.c b/src/stream_srv.c index 186ec02..b404604 100644 --- a/src/stream_srv.c +++ b/src/stream_srv.c @@ -488,6 +488,20 @@ link->ma_pars.sctp.sockopt_asconf_supported.abort_on_failure = val8 > 1; link->ma_pars.sctp.sockopt_asconf_supported.value = (val8 == 1 || val8 == 3) ? 1 : 0; break; + case OSMO_STREAM_SRV_LINK_PAR_SCTP_INIT_NUM_OSTREAMS: + if (!val || val_len != sizeof(uint16_t)) + return -EINVAL; + link->ma_pars.sctp.sockopt_initmsg.set = true; + link->ma_pars.sctp.sockopt_initmsg.num_ostreams_present = true; + link->ma_pars.sctp.sockopt_initmsg.num_ostreams_value = *(uint16_t *)val; + break; + case OSMO_STREAM_SRV_LINK_PAR_SCTP_INIT_MAX_INSTREAMS: + if (!val || val_len != sizeof(uint16_t)) + return -EINVAL; + link->ma_pars.sctp.sockopt_initmsg.set = true; + link->ma_pars.sctp.sockopt_initmsg.max_instreams_present = true; + link->ma_pars.sctp.sockopt_initmsg.max_instreams_value = *(uint16_t *)val; + break; default: return -ENOENT; }; -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/34348?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I5343c7659881b29e0201e72badbc2d07e1ef2dca Gerrit-Change-Number: 34348 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> Gerrit-Reviewer: laforge <laforge@osmocom.org> Gerrit-Reviewer: pespin <pespin@sysmocom.de> Gerrit-MessageType: merged