pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/40001?usp=email )
Change subject: ipa: Use pseudo-random number for SLS in TCP-client too ......................................................................
ipa: Use pseudo-random number for SLS in TCP-client too
Previous commit (see below) replaced the SLS generation from using the LSB of the file descriptor to a pseudo-random SLS since the former didn't really achieve enough entropy in real world use cases.
However, that commit only applied it for TCP-server conns, but forgot to update TCP-client ones. Present commit fixes that missing part. asp->asp_id is already being set using a pseudo-randome number in xua_cli_connect_cb().
Fixes: 2c9ba16c2c0210a189c72064eafad5ef336254cd Related: SYS#6543 Related: SYS#6802 Change-Id: I837505868b608ac5ed658a7e98bb3eeebe3e852c --- M src/osmo_ss7_asp.c 1 file changed, 3 insertions(+), 4 deletions(-)
Approvals: osmith: Looks good to me, approved Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve
diff --git a/src/osmo_ss7_asp.c b/src/osmo_ss7_asp.c index 3f6500c..f785264 100644 --- a/src/osmo_ss7_asp.c +++ b/src/osmo_ss7_asp.c @@ -1027,7 +1027,6 @@ /* read call-back for IPA/SCCPlite socket */ static int ipa_cli_read_cb(struct osmo_stream_cli *conn, int res, struct msgb *msg) { - int fd = osmo_stream_cli_get_fd(conn); struct osmo_ss7_asp *asp = osmo_stream_cli_get_data(conn);
if (res <= 0) { @@ -1042,9 +1041,9 @@
msg->dst = asp; rate_ctr_inc2(asp->ctrg, SS7_ASP_CTR_PKT_RX_TOTAL); - /* we can use the 'fd' return value of osmo_stream_srv_get_fd() here unverified as all we do - * is 'roll the dice' to obtain a 4-bit SLS value. */ - return ipa_rx_msg(asp, msg, fd & 0xf); + /* we simply use the lower 4 bits of the asp_id, which is initialized to a pseudo-random value upon + * connect */ + return ipa_rx_msg(asp, msg, asp->asp_id & 0xf); }
/* read call-back for M3UA-over-TCP socket */