<p>Neels Hofmeyr has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/10861">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">log: avoid logging early media as error<br><br>When the peer address is still 0.0.0.0, the endpoint is not yet configured.<br>This commonly happens before bridging a call is complete, so instead of ERROR<br>logging about an invalid packet, rather INFO-log this as "early media".<br><br>Related: OS#3539<br>Change-Id: I335f6453bd599be76eef08fcf9e5daed071e5b6d<br>---<br>M src/libosmo-mgcp/mgcp_network.c<br>1 file changed, 26 insertions(+), 13 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/61/10861/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c</span><br><span>index a73209b..d769ef3 100644</span><br><span>--- a/src/libosmo-mgcp/mgcp_network.c</span><br><span>+++ b/src/libosmo-mgcp/mgcp_network.c</span><br><span>@@ -874,19 +874,32 @@</span><br><span>   endp = conn->conn->endp;</span><br><span>       struct sockaddr_in zero_addr = {};</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-  if (memcmp(&zero_addr, &conn->end.addr, sizeof(zero_addr)) == 0</span><br><span style="color: hsl(0, 100%, 40%);">-          && conn->conn->mode == MGCP_CONN_LOOPBACK) {</span><br><span style="color: hsl(0, 100%, 40%);">-          /* HACK: for IuUP, we want to reply with an IuUP Initialization ACK upon the first RTP</span><br><span style="color: hsl(0, 100%, 40%);">-           * message received. We currently hackishly accomplish that by putting the endpoint in</span><br><span style="color: hsl(0, 100%, 40%);">-           * loopback mode and patching over the looped back RTP message to make it look like an</span><br><span style="color: hsl(0, 100%, 40%);">-           * ack. We don't know the femto cell's IP address and port until the RAB Assignment</span><br><span style="color: hsl(0, 100%, 40%);">-              * Response is received, but the nano3G expects an IuUP Initialization Ack before it even</span><br><span style="color: hsl(0, 100%, 40%);">-                * sends the RAB Assignment Response. Hence, if the remote address is 0.0.0.0 and the</span><br><span style="color: hsl(0, 100%, 40%);">-            * MGCP port is in loopback mode, allow looping back the packet to any source. */</span><br><span style="color: hsl(0, 100%, 40%);">-               LOGP(DRTP, LOGL_ERROR,</span><br><span style="color: hsl(0, 100%, 40%);">-               "endpoint:0x%x In loopback mode and remote address not set: allowing data from address: %s\n",</span><br><span style="color: hsl(0, 100%, 40%);">-                ENDPOINT_NUMBER(endp), inet_ntoa(addr->sin_addr));</span><br><span style="color: hsl(0, 100%, 40%);">-              return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+     if (memcmp(&zero_addr, &conn->end.addr, sizeof(zero_addr)) == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+         switch (conn->conn->mode) {</span><br><span style="color: hsl(120, 100%, 40%);">+             case MGCP_CONN_LOOPBACK:</span><br><span style="color: hsl(120, 100%, 40%);">+                      /* HACK: for IuUP, we want to reply with an IuUP Initialization ACK upon the first RTP</span><br><span style="color: hsl(120, 100%, 40%);">+                         * message received. We currently hackishly accomplish that by putting the endpoint in</span><br><span style="color: hsl(120, 100%, 40%);">+                         * loopback mode and patching over the looped back RTP message to make it look like an</span><br><span style="color: hsl(120, 100%, 40%);">+                         * ack. We don't know the femto cell's IP address and port until the RAB Assignment</span><br><span style="color: hsl(120, 100%, 40%);">+                    * Response is received, but the nano3G expects an IuUP Initialization Ack before it even</span><br><span style="color: hsl(120, 100%, 40%);">+                      * sends the RAB Assignment Response. Hence, if the remote address is 0.0.0.0 and the</span><br><span style="color: hsl(120, 100%, 40%);">+                  * MGCP port is in loopback mode, allow looping back the packet to any source. */</span><br><span style="color: hsl(120, 100%, 40%);">+                     LOGP(DRTP, LOGL_ERROR,</span><br><span style="color: hsl(120, 100%, 40%);">+                             "endpoint:0x%x In loopback mode and remote address not set:"</span><br><span style="color: hsl(120, 100%, 40%);">+                        " allowing data from address: %s\n",</span><br><span style="color: hsl(120, 100%, 40%);">+                        ENDPOINT_NUMBER(endp), inet_ntoa(addr->sin_addr));</span><br><span style="color: hsl(120, 100%, 40%);">+                    return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+           default:</span><br><span style="color: hsl(120, 100%, 40%);">+                      /* Receiving early media before the endpoint is configured. Instead of logging</span><br><span style="color: hsl(120, 100%, 40%);">+                         * this as an error that occurs on every call, keep it more low profile to not</span><br><span style="color: hsl(120, 100%, 40%);">+                         * confuse humans with expected errors. */</span><br><span style="color: hsl(120, 100%, 40%);">+                    LOGP(DRTP, LOGL_INFO,</span><br><span style="color: hsl(120, 100%, 40%);">+                      "endpoint:0x%x I:%s Rx RTP from %s, but remote address not set:"</span><br><span style="color: hsl(120, 100%, 40%);">+                            " dropping early media\n",</span><br><span style="color: hsl(120, 100%, 40%);">+                          ENDPOINT_NUMBER(endp), conn->conn->id, inet_ntoa(addr->sin_addr));</span><br><span style="color: hsl(120, 100%, 40%);">+                      return -1;</span><br><span style="color: hsl(120, 100%, 40%);">+            }</span><br><span>    }</span><br><span> </span><br><span>        /* Note: Check if the inbound RTP data comes from the same host to</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/10861">change 10861</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/10861"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-mgw </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I335f6453bd599be76eef08fcf9e5daed071e5b6d </div>
<div style="display:none"> Gerrit-Change-Number: 10861 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>