pespin has uploaded this change for review.

View Change

mgcp_network: Allow rx of IuUP in loopback mode with set rem IP address and unset rem port

An osmo-mgw client (eg. osmo-hnbgw) may wish to initially set a remote
IP address as a hint during CRCX, hence the IP address may already be
set while the port may be unset. We had special cases to handle IuUP
Initialization phase while in loopback mode and IP address being unset,
but we didn't handle the special case where IP address may be set but
port isn't.

Related: SYS#6657
Change-Id: Idd833997abce46886e9664505b2776fa5dadc8db
---
M src/libosmo-mgcp/mgcp_network.c
1 file changed, 43 insertions(+), 0 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/76/35176/1
diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c
index b1bce97..b423aee 100644
--- a/src/libosmo-mgcp/mgcp_network.c
+++ b/src/libosmo-mgcp/mgcp_network.c
@@ -860,6 +860,32 @@
}
}

+ if (osmo_sockaddr_port(&conn->end.addr.u.sa) == 0) {
+ switch (conn->conn->mode) {
+ case MGCP_CONN_LOOPBACK:
+ /* HACK: for IuUP, we want to reply with an IuUP Initialization ACK upon the first RTP
+ * message received. We currently hackishly accomplish that by putting the endpoint in
+ * loopback mode and patching over the looped back RTP message to make it look like an
+ * ack. We don't know the femto cell's IP address and port until the RAB Assignment
+ * Response is received, but the nano3G expects an IuUP Initialization Ack before it even
+ * sends the RAB Assignment Response. Hence, if the port number is 0 and the
+ * MGCP conn is in loopback mode, allow looping back the packet to any port. */
+ LOGPCONN(conn->conn, DRTP, LOGL_ERROR,
+ "In loopback mode and remote port not set: allowing data from address: %s\n",
+ osmo_sockaddr_to_str(addr));
+ return 0;
+
+ default:
+ /* Receiving early media before the endpoint is configured. Instead of logging
+ * this as an error that occurs on every call, keep it more low profile to not
+ * confuse humans with expected errors. */
+ LOGPCONN(conn->conn, DRTP, LOGL_INFO,
+ "Rx RTP from %s, but remote address not set: dropping early media\n",
+ osmo_sockaddr_to_str(addr));
+ return -1;
+ }
+ }
+
/* Note: Check if the inbound RTP data comes from the same host to
* which we send our outgoing RTP traffic. */
if (conn->end.addr.u.sa.sa_family != addr->u.sa.sa_family ||

To view, visit change 35176. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: Idd833997abce46886e9664505b2776fa5dadc8db
Gerrit-Change-Number: 35176
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin@sysmocom.de>
Gerrit-MessageType: newchange