Skip to content

Commit 12c4557

Browse files
committed
mgw: iuup: Trigger Init on CN-side CRCX if RAN-side was already initialized
Prior to this patch, osmo-mgw would wait until first IuUP Data frame would be received on RAN-side (from HNB) to trigger active initialization (Tx IuUP-Init) on CN-side conn towards CN. With this patch, this happens ASAP, whenever the CN-side conn is created by HNBGW when it receives the RAB-ASS-RESP from HNB. Related: OS#6685 Change-Id: Iab0af88852994e73bfe6c3b27fe196fd655cce03
1 parent b317b00 commit 12c4557

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

include/osmocom/mgcp/mgcp_iuup.h

+1
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ void mgcp_conn_iuup_cleanup(struct mgcp_conn_rtp *conn_rtp);
3131
int mgcp_conn_iuup_dispatch_rtp(struct msgb *msg);
3232
int mgcp_conn_iuup_send_rtp(struct mgcp_conn_rtp *conn_src_rtp, struct mgcp_conn_rtp *conn_dest_rtp, struct msgb *msg);
3333
int mgcp_conn_iuup_send_dummy(struct mgcp_conn_rtp *conn_rtp);
34+
int mgcp_conn_iuup_event_rx_crcx_mdcx(struct mgcp_conn_rtp *conn_rtp);

src/libosmo-mgcp/mgcp_endp.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <osmocom/mgcp/mgcp.h>
2525
#include <osmocom/mgcp/mgcp_protocol.h>
2626
#include <osmocom/mgcp/mgcp_conn.h>
27+
#include <osmocom/mgcp/mgcp_iuup.h>
2728
#include <osmocom/mgcp/mgcp_endp.h>
2829
#include <osmocom/mgcp/mgcp_trunk.h>
2930

@@ -677,7 +678,7 @@ static int mgcp_endp_update_virtual(struct mgcp_endpoint *endp, struct mgcp_conn
677678
}
678679
break;
679680
case MGCP_RTP_IUUP:
680-
break;
681+
return mgcp_conn_iuup_event_rx_crcx_mdcx(conn_rtp);
681682
default:
682683
return -523;
683684
}

src/libosmo-mgcp/mgcp_iuup.c

+41
Original file line numberDiff line numberDiff line change
@@ -753,3 +753,44 @@ int mgcp_conn_iuup_send_dummy(struct mgcp_conn_rtp *conn_rtp)
753753

754754
return 0;
755755
}
756+
757+
/* To be called every time an CRCX/MDCX is received.
758+
* returns: 0 if conn can continue, MGCP negative code if an error ocurred during setup */
759+
int mgcp_conn_iuup_event_rx_crcx_mdcx(struct mgcp_conn_rtp *conn_rtp)
760+
{
761+
struct mgcp_conn *peer_conn;
762+
struct mgcp_conn_rtp *peer_conn_rtp;
763+
OSMO_ASSERT(mgcp_conn_rtp_is_iuup(conn_rtp));
764+
765+
/* keep waiting to receive remote address through CRCX/MDCX */
766+
if (!mgcp_rtp_end_remote_addr_available(&conn_rtp->end))
767+
return 0;
768+
769+
/* Conn already IuUP-configured/initialized, nothing to be done. */
770+
if (conn_rtp->iuup.configured)
771+
return 0;
772+
773+
/* Reached this point, conn_rtp is an IuUP conn which can be configured
774+
* and was not yet configured. If its sister conn in the endpoint was
775+
* already configured as IuUP "passive", then we know this one can be
776+
* configured as IuUP "active" right now. In that case, do so.
777+
* This usually happens on an HNBGW co-located MGW, where during
778+
* RAB-ASS-REQ the RAN-side conn (sister conn here) was already
779+
* configured and then upon rx of RAB-ASS-RESP it sets up (CRCX) the
780+
* CN-side IuUP conn (rt_conn here).
781+
*/
782+
peer_conn = mgcp_find_dst_conn(conn_rtp->conn);
783+
/* No peer conn yet, nothing to be done. */
784+
if (!peer_conn)
785+
return 0;
786+
peer_conn_rtp = mgcp_conn_get_conn_rtp(peer_conn);
787+
788+
if (mgcp_conn_rtp_is_iuup(peer_conn_rtp) &&
789+
peer_conn_rtp->iuup.configured &&
790+
!conn_rtp->iuup.active_init) {
791+
LOG_CONN_RTP(conn_rtp, LOGL_INFO, "Sister IuUP conn in endp configured as passive, init this one as active\n");
792+
OSMO_ASSERT(peer_conn_rtp->iuup.init_ind);
793+
_conn_iuup_configure_as_active(conn_rtp, peer_conn_rtp->iuup.init_ind);
794+
}
795+
return 0;
796+
}

0 commit comments

Comments
 (0)