aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2021-02-06 15:22:22 +0100
committerfixeria <vyanitskiy@sysmocom.de>2021-02-07 03:39:53 +0000
commitfe45b4eb1f830e561548092ce63e44452249d841 (patch)
tree4b4b71635032d8bd3a6aa915c89a26c5ad826209
parenta2da0e96e1a5ed5aa61437f7467410346f57ef67 (diff)
oml: avoid redundant ntohl() / htonl() conversion
-rw-r--r--src/common/oml.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/common/oml.c b/src/common/oml.c
index ce760640..b7b86e33 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -1384,7 +1384,6 @@ static int rx_oml_ipa_rsl_connect(struct gsm_bts_trx *trx, struct msgb *msg,
{
struct e1inp_sign_link *oml_link = trx->bts->oml_link;
uint16_t port = IPA_TCP_PORT_RSL;
- uint32_t ip = get_signlink_remote_ip(oml_link);
const char *trx_name = gsm_trx_name(trx);
struct in_addr in;
int rc;
@@ -1392,13 +1391,15 @@ static int rx_oml_ipa_rsl_connect(struct gsm_bts_trx *trx, struct msgb *msg,
uint8_t stream_id = 0;
if (TLVP_PRES_LEN(tp, NM_ATT_IPACC_DST_IP, 4))
- ip = ntohl(tlvp_val32_unal(tp, NM_ATT_IPACC_DST_IP));
+ in.s_addr = tlvp_val32_unal(tp, NM_ATT_IPACC_DST_IP);
+ else
+ in.s_addr = htonl(get_signlink_remote_ip(oml_link));
+
if (TLVP_PRES_LEN(tp, NM_ATT_IPACC_DST_IP_PORT, 2))
port = ntohs(tlvp_val16_unal(tp, NM_ATT_IPACC_DST_IP_PORT));
if (TLVP_PRES_LEN(tp, NM_ATT_IPACC_STREAM_ID, 1))
stream_id = *TLVP_VAL(tp, NM_ATT_IPACC_STREAM_ID);
- in.s_addr = htonl(ip);
LOGP(DOML, LOGL_INFO, "%s: Rx IPA RSL CONNECT IP=%s PORT=%u STREAM=0x%02x\n",
trx_name, inet_ntoa(in), port, stream_id);