diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-07-09 17:33:58 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-07-09 18:18:45 +0200 |
commit | 612f387fc93818877063dbd221803c9528f3413b (patch) | |
tree | 9ccfb8fa52e0d4b0f3f771720c3b56d2df2202a0 /src/common | |
parent | ed966f0428065c758917e5255b5d0859cd5b99c5 (diff) |
rsl: Fix the audio handling after the 'alignment' handling fix
The issue got introduced in fcdba6bfaca9e016f35fc9fa826948ec74f66121
when moving from the uint32_t pointer to a plain int. The code
was now like this:
if (connect_ip > 0) {
if (connect_ip == 0)
lookup_ip_based_on_rsl
...
Coverity detected this as logically dead code and it was breaking
audio handling for the osmo-bsc case. Remove the tristate handling,
the RSL behavior is that leaving out port/ip is like specifying it
as zero.
Fixes: Coverity CID 1040769
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/rsl.c | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/src/common/rsl.c b/src/common/rsl.c index 6dca7417..616ae0d6 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -1252,6 +1252,7 @@ static int rsl_rx_ipac_XXcx(struct msgb *msg) uint16_t connect_port = 0; int rc, inc_ip_port = 0, port; char *name; + struct in_addr ia; if (dch->c.msg_type == RSL_MT_IPAC_CRCX) name = "CRCX"; @@ -1353,36 +1354,30 @@ static int rsl_rx_ipac_XXcx(struct msgb *msg) } } - if (connect_ip && connect_port) { - struct in_addr ia; - /* Special rule: If connect_ip == 0.0.0.0, use RSL IP - * address */ - if (connect_ip == 0) { + /* Special rule: If connect_ip == 0.0.0.0, use RSL IP + * address */ + if (connect_ip == 0) { struct ipabis_link *link = - lchan->ts->trx->rsl_link; + lchan->ts->trx->rsl_link; ia.s_addr = htonl(link->ip); - } else - ia.s_addr = connect_ip; - rc = osmo_rtp_socket_connect(lchan->abis_ip.rtp_socket, - inet_ntoa(ia), ntohs(connect_port)); - if (rc < 0) { - LOGP(DRSL, LOGL_ERROR, - "%s Failed to connect RTP/RTCP sockets\n", - gsm_lchan_name(lchan)); - osmo_rtp_socket_free(lchan->abis_ip.rtp_socket); - lchan->abis_ip.rtp_socket = NULL; - msgb_queue_flush(&lchan->dl_tch_queue); - return tx_ipac_XXcx_nack(lchan, RSL_ERR_RES_UNAVAIL, - inc_ip_port, dch->c.msg_type); - } - /* save IP address and port number */ - lchan->abis_ip.connect_ip = ntohl(ia.s_addr); - lchan->abis_ip.connect_port = ntohs(connect_port); - - } else { - /* FIXME: discard all codec frames */ + } else + ia.s_addr = connect_ip; + rc = osmo_rtp_socket_connect(lchan->abis_ip.rtp_socket, + inet_ntoa(ia), ntohs(connect_port)); + if (rc < 0) { + LOGP(DRSL, LOGL_ERROR, + "%s Failed to connect RTP/RTCP sockets\n", + gsm_lchan_name(lchan)); + osmo_rtp_socket_free(lchan->abis_ip.rtp_socket); + lchan->abis_ip.rtp_socket = NULL; + msgb_queue_flush(&lchan->dl_tch_queue); + return tx_ipac_XXcx_nack(lchan, RSL_ERR_RES_UNAVAIL, + inc_ip_port, dch->c.msg_type); } + /* save IP address and port number */ + lchan->abis_ip.connect_ip = ntohl(ia.s_addr); + lchan->abis_ip.connect_port = ntohs(connect_port); rc = osmo_rtp_get_bound_ip_port(lchan->abis_ip.rtp_socket, &lchan->abis_ip.bound_ip, |