laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/34264?usp=email )
Change subject: ipa: use LSBs of file descriptor as SLS in IPA->M3UA direction ......................................................................
ipa: use LSBs of file descriptor as SLS in IPA->M3UA direction
when IPA/SCCPlite traffic traverses the osmo_ss7 stack, so far the SLS of the MTP3 label was always set to 0 (default initialization).
However, in order to achieve a better distribution of signaling traffic in SS7 networks that actually utilize the SLS to select any links (or ASPs), it makes sense to use non-zero values.
Instead of introducing some kind of new, configurable attribute for each ASP (IPA client connection), let's simply use the lower 4 bits of the file descriptor integer. Those file descriptors should have a roughly equal distribution, resulting in traffic (from multiple IPA clients) to be spread across the 4-bit SLS number space.
Also, this mechanism ensures that traffic from one IPA client will always get the same SLS and hence routed the same way in any underlying CS7/SS7 network.
Change-Id: Ice7bab997b84cfed00c7d6d780c70f4e9fac6002 Related: SYS#6543 --- M src/ipa.c M src/osmo_ss7.c M src/xua_internal.h 3 files changed, 35 insertions(+), 6 deletions(-)
Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved fixeria: Looks good to me, but someone else must approve
diff --git a/src/ipa.c b/src/ipa.c index 8daa5e0..a77d331 100644 --- a/src/ipa.c +++ b/src/ipa.c @@ -211,7 +211,7 @@ return sccp_msg_out; }
-static int ipa_rx_msg_sccp(struct osmo_ss7_asp *asp, struct msgb *msg) +static int ipa_rx_msg_sccp(struct osmo_ss7_asp *asp, struct msgb *msg, uint8_t sls) { int rc; struct m3ua_data_hdr data_hdr; @@ -276,6 +276,7 @@ data_hdr.si = MTP_SI_SCCP; data_hdr.opc = osmo_htonl(opc); data_hdr.dpc = osmo_htonl(dpc); + data_hdr.sls = sls; data_hdr.ni = as->inst->cfg.network_indicator; /* Create M3UA message in XUA structure */ xua = m3ua_xfer_from_data(&data_hdr, msgb_l2(msg), msgb_l2len(msg)); @@ -292,8 +293,9 @@ /*! \brief process M3UA message received from socket * \param[in] asp Application Server Process receiving \a msg * \param[in] msg received message buffer. Callee takes ownership! + * \param[in] sls The SLS (signaling link selector) field to use in the generated M3UA header * \returns 0 on success; negative on error */ -int ipa_rx_msg(struct osmo_ss7_asp *asp, struct msgb *msg) +int ipa_rx_msg(struct osmo_ss7_asp *asp, struct msgb *msg, uint8_t sls) { struct ipaccess_head *hh; int rc; @@ -309,7 +311,7 @@ rc = ipa_rx_msg_ccm(asp, msg); break; case IPAC_PROTO_SCCP: - rc = ipa_rx_msg_sccp(asp, msg); + rc = ipa_rx_msg_sccp(asp, msg, sls); break; default: rc = ss7_asp_rx_unknown(asp, hh->proto, msg); diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c index b8124d1..440014a 100644 --- a/src/osmo_ss7.c +++ b/src/osmo_ss7.c @@ -2046,7 +2046,7 @@ } msg->dst = asp;
- return ipa_rx_msg(asp, msg); + return ipa_rx_msg(asp, msg, ofd->fd & 0xf); }
/* netif code tells us we can read something from the socket */ @@ -2194,7 +2194,7 @@ } msg->dst = asp; rate_ctr_inc2(asp->ctrg, SS7_ASP_CTR_PKT_RX_TOTAL); - return ipa_rx_msg(asp, msg); + return ipa_rx_msg(asp, msg, ofd->fd & 0xf); }
static int xua_cli_read_cb(struct osmo_stream_cli *conn) diff --git a/src/xua_internal.h b/src/xua_internal.h index 26cb3fc..93f6140 100644 --- a/src/xua_internal.h +++ b/src/xua_internal.h @@ -116,7 +116,7 @@ const struct xua_msg_part *rctx_ie);
int ipa_tx_xua_as(struct osmo_ss7_as *as, struct xua_msg *xua); -int ipa_rx_msg(struct osmo_ss7_asp *asp, struct msgb *msg); +int ipa_rx_msg(struct osmo_ss7_asp *asp, struct msgb *msg, uint8_t sls);
int osmo_isup_party_parse(char *out_digits, const uint8_t *in, unsigned int in_num_bytes, bool odd);