summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-05-27 20:47:03 +0700
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-05-28 16:53:51 +0700
commit0ed7c0ee5ffdf8e20824a73a0a3ce9f687c04341 (patch)
tree797fc059c04ebe679d8b3aaaba92d5262ad26600
parentcab00398c256f89794ad0ae9016ccc2ed1962031 (diff)
trxcon: fix l1ctl_proc_est_req_h0(): convert to host byte order
L1CTL is using the network byte order, because this protocol is spoken between different devices and architectures. Somehow I forgot about this while adding SETFH command back in 2018. Change-Id: Ia2f70f0d5e35b6bf05e1fa6fb51a15c1bbe3ca4c Related: OS#4546
-rw-r--r--src/host/trxcon/l1ctl.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c
index e722624c..84e1ec6f 100644
--- a/src/host/trxcon/l1ctl.c
+++ b/src/host/trxcon/l1ctl.c
@@ -595,7 +595,8 @@ static int l1ctl_proc_est_req_h0(struct trx_instance *trx, struct l1ctl_h0 *h)
static int l1ctl_proc_est_req_h1(struct trx_instance *trx, struct l1ctl_h1 *h)
{
- int rc;
+ uint16_t ma[64];
+ int i, rc;
LOGP(DL1C, LOGL_NOTICE, "L1CTL_DM_EST_REQ indicates a Frequency "
"Hopping (hsn=%u, maio=%u, chans=%u) channel\n",
@@ -607,8 +608,12 @@ static int l1ctl_proc_est_req_h1(struct trx_instance *trx, struct l1ctl_h1 *h)
return -EINVAL;
}
+ /* Convert from network to host byte order */
+ for (i = 0; i < h->n; i++)
+ ma[i] = ntohs(h->ma[i]);
+
/* Forward hopping parameters to TRX */
- rc = trx_if_cmd_setfh(trx, h->hsn, h->maio, h->ma, h->n);
+ rc = trx_if_cmd_setfh(trx, h->hsn, h->maio, ma, h->n);
if (rc)
return rc;