abis_nm_ipaccess_rsl_connect(): use msgb to compose attr
So far the function uses insane byte array magic numbers to compose the OML "RSL Connect" message. For VAMOS, I intend to modify that message. To ensure sanity, first change the attr composition to msgb_put*(). Related: OS#4940 Change-Id: Iba005635cf86aee1fde77d58ef203e28eed92281
This commit is contained in:
parent
aa01d326ff
commit
5979f2bcce
|
@ -3014,32 +3014,29 @@ static void rsl_connect_timeout(void *data)
|
||||||
int abis_nm_ipaccess_rsl_connect(struct gsm_bts_trx *trx,
|
int abis_nm_ipaccess_rsl_connect(struct gsm_bts_trx *trx,
|
||||||
uint32_t ip, uint16_t port, uint8_t stream)
|
uint32_t ip, uint16_t port, uint8_t stream)
|
||||||
{
|
{
|
||||||
|
struct msgb *attr;
|
||||||
struct in_addr ia;
|
struct in_addr ia;
|
||||||
uint8_t attr[] = { NM_ATT_IPACC_STREAM_ID, 0,
|
|
||||||
NM_ATT_IPACC_DST_IP_PORT, 0, 0,
|
|
||||||
NM_ATT_IPACC_DST_IP, 0, 0, 0, 0 };
|
|
||||||
|
|
||||||
int attr_len = sizeof(attr);
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
osmo_timer_setup(&trx->rsl_connect_timeout, rsl_connect_timeout, trx);
|
osmo_timer_setup(&trx->rsl_connect_timeout, rsl_connect_timeout, trx);
|
||||||
|
|
||||||
ia.s_addr = htonl(ip);
|
attr = msgb_alloc(32, "RSL-connect-attr");
|
||||||
attr[1] = stream;
|
msgb_tv_put(attr, NM_ATT_IPACC_STREAM_ID, stream);
|
||||||
attr[3] = port >> 8;
|
msgb_tv16_put(attr, NM_ATT_IPACC_DST_IP_PORT, port);
|
||||||
attr[4] = port & 0xff;
|
|
||||||
memcpy(attr + 6, &ia.s_addr, sizeof(uint32_t));
|
|
||||||
|
|
||||||
/* if ip == 0, we use the default IP */
|
/* if ip == 0, we use the default IP */
|
||||||
if (ip == 0)
|
if (ip != 0) {
|
||||||
attr_len -= 5;
|
ia.s_addr = htonl(ip);
|
||||||
|
msgb_tv_fixed_put(attr, NM_ATT_IPACC_DST_IP, 4, (void*)&ia.s_addr);
|
||||||
|
}
|
||||||
|
|
||||||
LOG_TRX(trx, DNM, LOGL_INFO, "IPA RSL CONNECT IP=%s PORT=%u STREAM=0x%02x\n",
|
LOG_TRX(trx, DNM, LOGL_INFO, "IPA RSL CONNECT IP=%s PORT=%u STREAM=0x%02x\n",
|
||||||
inet_ntoa(ia), port, stream);
|
inet_ntoa(ia), port, stream);
|
||||||
|
|
||||||
error = abis_nm_ipaccess_msg(trx->bts, NM_MT_IPACC_RSL_CONNECT,
|
error = abis_nm_ipaccess_msg(trx->bts, NM_MT_IPACC_RSL_CONNECT,
|
||||||
NM_OC_BASEB_TRANSC, trx->bts->bts_nr,
|
NM_OC_BASEB_TRANSC, trx->bts->bts_nr,
|
||||||
trx->nr, 0xff, attr, attr_len);
|
trx->nr, 0xff, attr->data, attr->len);
|
||||||
|
msgb_free(attr);
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
osmo_timer_schedule(&trx->rsl_connect_timeout, 60, 0);
|
osmo_timer_schedule(&trx->rsl_connect_timeout, 60, 0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue