Fix IuUP RTP hdr seqnr field not incremented
Previous commit add osmo_io changed mgcp_udp_send() implementation from
"return sendto()", which is documented as:
"return the number of bytes sent. Otherwise, -1 shall be returned"
to "return mgcp_udp_send_msg()", which in turn calls
"return osmo_iofd_sendto_msgb()", and which is documented as:
"\returns 0 in case of success (takes msgb ownership), -1 on error
(doesn't take msgb ownership)."
So successful return code changed from >0 (bytes sent) to ==0,
but forgot to update mgcp_send_iuup() return code path check (and also
some related function documentation calling mgcp_udp_send()".
This commit fixes all the related aspects of that return code change.
Related: SYS#6907
Fixes: 352b967d1b
Change-Id: I154e1e41cd02fd4d9b88ad98fc7c4d657246c589
This commit is contained in:
parent
352b967d1b
commit
388b48d14e
|
@ -468,7 +468,7 @@ static int mgcp_send_iuup(struct mgcp_endpoint *endp, struct msgb *msg,
|
|||
struct rtp_hdr *hdr = (struct rtp_hdr *)msgb_data(msg);
|
||||
int buflen = msgb_length(msg);
|
||||
char *dest_name;
|
||||
int len;
|
||||
int rc;
|
||||
|
||||
OSMO_ASSERT(conn_src);
|
||||
OSMO_ASSERT(conn_dst);
|
||||
|
@ -514,16 +514,16 @@ static int mgcp_send_iuup(struct mgcp_endpoint *endp, struct msgb *msg,
|
|||
/* Forward a copy of the RTP data to a debug ip/port */
|
||||
forward_data_tap(rtp_end->rtp, &conn_src->tap_out, msg);
|
||||
|
||||
len = mgcp_udp_send(rtp_end->rtp, &rtp_end->addr, (char *)hdr, buflen);
|
||||
rc = mgcp_udp_send(rtp_end->rtp, &rtp_end->addr, (char *)hdr, buflen);
|
||||
|
||||
if (len <= 0)
|
||||
return len;
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
rtpconn_rate_ctr_add(conn_dst, endp, RTP_PACKETS_TX_CTR, 1);
|
||||
rtpconn_rate_ctr_add(conn_dst, endp, RTP_OCTETS_TX_CTR, len);
|
||||
rtpconn_rate_ctr_add(conn_dst, endp, RTP_OCTETS_TX_CTR, buflen);
|
||||
rtp_state->alt_rtp_tx_sequence++;
|
||||
|
||||
return len;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Received TNL primitive from IuUP layer FSM, transmit it further down to the
|
||||
|
|
|
@ -1062,7 +1062,7 @@ static int mgcp_udp_send_msg(struct osmo_io_fd *iofd, const struct osmo_sockaddr
|
|||
* \param[in] addr destination ip-address.
|
||||
* \param[in] buf buffer that holds the data to be send.
|
||||
* \param[in] len length of the data to be sent.
|
||||
* \returns bytes sent, -1 on error. */
|
||||
* \returns 0 in case of success, -1 on error. */
|
||||
int mgcp_udp_send(struct osmo_io_fd *iofd, const struct osmo_sockaddr *addr, const char *buf, int len)
|
||||
{
|
||||
struct msgb *msg = msgb_alloc_c(iofd, len, "mgcp_udp_send");
|
||||
|
@ -1077,7 +1077,7 @@ int mgcp_udp_send(struct osmo_io_fd *iofd, const struct osmo_sockaddr *addr, con
|
|||
/*! send RTP dummy packet (to keep NAT connection open).
|
||||
* \param[in] endp mcgp endpoint that holds the RTP connection.
|
||||
* \param[in] conn associated RTP connection.
|
||||
* \returns bytes sent, -1 on error. */
|
||||
* \returns 0 in case of success, -1 on error. */
|
||||
int mgcp_send_dummy(struct mgcp_endpoint *endp, struct mgcp_conn_rtp *conn)
|
||||
{
|
||||
int rc;
|
||||
|
@ -1113,7 +1113,7 @@ int mgcp_send_dummy(struct mgcp_endpoint *endp, struct mgcp_conn_rtp *conn)
|
|||
rc = mgcp_udp_send(conn->end.rtcp, &rtcp_addr,
|
||||
rtp_dummy_payload, sizeof(rtp_dummy_payload));
|
||||
|
||||
if (rc >= 0)
|
||||
if (rc == 0)
|
||||
return rc;
|
||||
|
||||
failed:
|
||||
|
|
|
@ -695,7 +695,7 @@ void conn_osmux_disable(struct mgcp_conn_rtp *conn)
|
|||
|
||||
/*! send RTP dummy packet to OSMUX connection port.
|
||||
* \param[in] conn associated RTP connection
|
||||
* \returns bytes sent, -1 on error */
|
||||
* \returns 0 in case of success, -1 on error */
|
||||
int osmux_send_dummy(struct mgcp_conn_rtp *conn)
|
||||
{
|
||||
char ipbuf[INET6_ADDRSTRLEN];
|
||||
|
|
Loading…
Reference in New Issue