mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
synced 2025-11-02 13:03:33 +00:00
[mgcp] Handle BTS and NET being on the same host
* Do not only check the IP but also the port to figure out where to send the data * Do not memset the endp->remote inside the bind_rtp but from inside the crcx as this will be modified by the MDCX
This commit is contained in:
@@ -251,7 +251,8 @@ static int rtp_data_cb(struct bsc_fd *fd, unsigned int what)
|
|||||||
* able to tell if this is legitimate.
|
* able to tell if this is legitimate.
|
||||||
*/
|
*/
|
||||||
#warning "Slight spec violation. With connection mode recvonly we should attempt to forward."
|
#warning "Slight spec violation. With connection mode recvonly we should attempt to forward."
|
||||||
dest = memcmp(&addr.sin_addr, &endp->remote, sizeof(addr.sin_addr)) == 0
|
dest = memcmp(&addr.sin_addr, &endp->remote, sizeof(addr.sin_addr)) == 0 &&
|
||||||
|
(endp->net_rtp == addr.sin_port || endp->net_rtcp == addr.sin_port)
|
||||||
? DEST_BTS : DEST_NETWORK;
|
? DEST_BTS : DEST_NETWORK;
|
||||||
proto = fd == &endp->local_rtp ? PROTO_RTP : PROTO_RTCP;
|
proto = fd == &endp->local_rtp ? PROTO_RTP : PROTO_RTCP;
|
||||||
|
|
||||||
@@ -309,9 +310,6 @@ static int create_bind(struct bsc_fd *fd, int port)
|
|||||||
|
|
||||||
static int bind_rtp(struct mgcp_endpoint *endp)
|
static int bind_rtp(struct mgcp_endpoint *endp)
|
||||||
{
|
{
|
||||||
/* set to zero until we get the info */
|
|
||||||
memset(&endp->remote, 0, sizeof(endp->remote));
|
|
||||||
|
|
||||||
if (create_bind(&endp->local_rtp, endp->rtp_port) != 0) {
|
if (create_bind(&endp->local_rtp, endp->rtp_port) != 0) {
|
||||||
DEBUGP(DMGCP, "Failed to create RTP port: %d on 0x%x\n",
|
DEBUGP(DMGCP, "Failed to create RTP port: %d on 0x%x\n",
|
||||||
endp->rtp_port, ENDPOINT_NUMBER(endp));
|
endp->rtp_port, ENDPOINT_NUMBER(endp));
|
||||||
@@ -644,6 +642,9 @@ static void handle_create_con(struct msgb *msg, struct sockaddr_in *source)
|
|||||||
/* initialize */
|
/* initialize */
|
||||||
endp->net_rtp = endp->net_rtcp = endp->bts_rtp = endp->bts_rtcp = 0;
|
endp->net_rtp = endp->net_rtcp = endp->bts_rtp = endp->bts_rtcp = 0;
|
||||||
|
|
||||||
|
/* set to zero until we get the info */
|
||||||
|
memset(&endp->remote, 0, sizeof(endp->remote));
|
||||||
|
|
||||||
/* bind to the port now */
|
/* bind to the port now */
|
||||||
endp->rtp_port = rtp_calculate_port(ENDPOINT_NUMBER(endp), rtp_base_port);
|
endp->rtp_port = rtp_calculate_port(ENDPOINT_NUMBER(endp), rtp_base_port);
|
||||||
if (!early_bind && bind_rtp(endp) != 0)
|
if (!early_bind && bind_rtp(endp) != 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user