Neels Hofmeyr has submitted this change and it was merged. (
https://gerrit.osmocom.org/10861 )
Change subject: log: avoid logging early media as error
......................................................................
log: avoid logging early media as error
When the peer address is still 0.0.0.0, the endpoint is not yet configured.
This commonly happens before bridging a call is complete, so instead of ERROR
logging about an invalid packet, rather INFO-log this as "early media".
Related: OS#3539
Change-Id: I335f6453bd599be76eef08fcf9e5daed071e5b6d
---
M src/libosmo-mgcp/mgcp_network.c
1 file changed, 26 insertions(+), 13 deletions(-)
Approvals:
Jenkins Builder: Verified
Harald Welte: Looks good to me, approved
diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c
index a73209b..d769ef3 100644
--- a/src/libosmo-mgcp/mgcp_network.c
+++ b/src/libosmo-mgcp/mgcp_network.c
@@ -874,19 +874,32 @@
endp = conn->conn->endp;
struct sockaddr_in zero_addr = {};
- if (memcmp(&zero_addr, &conn->end.addr, sizeof(zero_addr)) == 0
- && conn->conn->mode == 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 remote
address is 0.0.0.0 and the
- * MGCP port is in loopback mode, allow looping back the packet
to any source. */
- LOGP(DRTP, LOGL_ERROR,
- "endpoint:0x%x In loopback mode and remote address not
set: allowing data from address: %s\n",
- ENDPOINT_NUMBER(endp), inet_ntoa(addr->sin_addr));
- return 0;
+ if (memcmp(&zero_addr, &conn->end.addr, sizeof(zero_addr)) == 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
remote address is 0.0.0.0 and the
+ * MGCP port is in loopback mode, allow looping back
the packet to any source. */
+ LOGP(DRTP, LOGL_ERROR,
+ "endpoint:0x%x In loopback mode and remote address
not set:"
+ " allowing data from address: %s\n",
+ ENDPOINT_NUMBER(endp), inet_ntoa(addr->sin_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. */
+ LOGP(DRTP, LOGL_INFO,
+ "endpoint:0x%x I:%s Rx RTP from %s, but remote
address not set:"
+ " dropping early media\n",
+ ENDPOINT_NUMBER(endp), conn->conn->id,
inet_ntoa(addr->sin_addr));
+ return -1;
+ }
}
/* Note: Check if the inbound RTP data comes from the same host to
--
To view, visit https://gerrit.osmocom.org/10861
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I335f6453bd599be76eef08fcf9e5daed071e5b6d
Gerrit-Change-Number: 10861
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <[email protected]>
Gerrit-Reviewer: Harald Welte <[email protected]>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Neels Hofmeyr <[email protected]>