aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2021-07-03 01:25:40 +0200
committerlaforge <laforge@osmocom.org>2021-07-05 12:07:55 +0000
commit454a2516f29eeeaa8a770ba9b91fbd661e9cd950 (patch)
treeb59366d34ba8c82f57499c63e66a94dac78d32d1
parent471df615e2ff8a20f089b813873810e8495ba72d (diff)
rsl: use tlvp_val16be() in rsl_rx_ipac_XXcx()
Instead of using tlvp_val16_unal() and then doing ntohs() here and there, convert the remote port to the host byte order once. Change-Id: Id883a976a03fd3022ed9d66f703b01244df2d9db
-rw-r--r--src/common/rsl.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/common/rsl.c b/src/common/rsl.c
index 57a95a15..18c03491 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -2625,9 +2625,8 @@ static int rsl_rx_ipac_XXcx(struct msgb *msg)
}
if (TLVP_PRES_LEN(&tp, RSL_IE_IPAC_REMOTE_PORT, 2)) {
- connect_port = tlvp_val16_unal(&tp, RSL_IE_IPAC_REMOTE_PORT);
- LOGPC(DRSL, LOGL_DEBUG, "connect_port=%u ",
- ntohs(connect_port));
+ connect_port = tlvp_val16be(&tp, RSL_IE_IPAC_REMOTE_PORT);
+ LOGPC(DRSL, LOGL_DEBUG, "connect_port=%u ", connect_port);
}
speech_mode = TLVP_VAL(&tp, RSL_IE_IPAC_SPEECH_MODE);
@@ -2743,7 +2742,7 @@ static int rsl_rx_ipac_XXcx(struct msgb *msg)
} else
ia.s_addr = connect_ip;
rc = osmo_rtp_socket_connect(lchan->abis_ip.rtp_socket,
- inet_ntoa(ia), ntohs(connect_port));
+ inet_ntoa(ia), connect_port);
if (rc < 0) {
LOGPLCHAN(lchan, DRTP, LOGL_ERROR, "Failed to connect RTP/RTCP sockets\n");
osmo_rtp_socket_free(lchan->abis_ip.rtp_socket);
@@ -2754,7 +2753,7 @@ static int rsl_rx_ipac_XXcx(struct msgb *msg)
}
/* save IP address and port number */
lchan->abis_ip.connect_ip = ntohl(ia.s_addr);
- lchan->abis_ip.connect_port = ntohs(connect_port);
+ lchan->abis_ip.connect_port = connect_port;
rc = osmo_rtp_get_bound_ip_port(lchan->abis_ip.rtp_socket,
&lchan->abis_ip.bound_ip,