pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-mgw/+/29590 )

Change subject: osmux: Use available API to check if remote end is known
......................................................................

osmux: Use available API to check if remote end is known

Since recently the port is guaranteed to be placed at
CRCX/MDCX in the sockaddr, hence we can check it using the API instead
of checking manually only for the address part.

In osmux_send_dummy() we actually fix a bug where an in_addr was being
compared against a struct sockaddr.

Change-Id: I736e7f4c51e577d8eb0b96bc776f984f928b6d27
---
M src/libosmo-mgcp/mgcp_osmux.c
1 file changed, 2 insertions(+), 7 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c
index 242f907..de0bc38 100644
--- a/src/libosmo-mgcp/mgcp_osmux.c
+++ b/src/libosmo-mgcp/mgcp_osmux.c
@@ -504,7 +504,6 @@
         *  overlapping RTP SSRC traveling to the BTSes behind the BSC,
         *  similarly, for flows traveling to the MSC.
         */
-       struct in6_addr addr_unset = {};
        static const uint32_t rtp_ssrc_winlen = UINT32_MAX / (OSMUX_CID_MAX + 
1);
        uint16_t osmux_dummy = endp->trunk->cfg->osmux_dummy;

@@ -517,10 +516,7 @@
        }

        /* Wait until we have the connection information from MDCX */
-       if (memcmp(&conn->end.addr, &addr_unset,
-                  conn->end.addr.u.sa.sa_family == AF_INET6 ?
-                       sizeof(struct in6_addr) :
-                       sizeof(struct in_addr)) == 0) {
+       if (!mgcp_rtp_end_remote_addr_available(&conn->end)) {
                LOGPCONN(conn->conn, DOSMUX, LOGL_INFO,
                        "Osmux remote address/port still unknown\n");
                return -1;
@@ -622,7 +618,6 @@
        char ipbuf[INET6_ADDRSTRLEN];
        struct osmux_hdr *osmuxh;
        int buf_len;
-       struct in_addr addr_unset = {};

        /*! The dummy packet will not be sent via the actual OSMUX connection,
         *  instead it is sent out of band to port where the remote OSMUX
@@ -634,7 +629,7 @@
         *  approach is simple though. */

        /* Wait until we have the connection information from MDCX */
-       if (memcmp(&conn->end.addr, &addr_unset, sizeof(addr_unset)) == 0)
+       if (!mgcp_rtp_end_remote_addr_available(&conn->end))
                return 0;

        if (endp_osmux_state_check(endp, conn, true) < 0)

--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29590
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I736e7f4c51e577d8eb0b96bc776f984f928b6d27
Gerrit-Change-Number: 29590
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to