<p>Pau Espin Pedrol has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/11378">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">osmux: Move parse_cid of legacy dummy frames to own function<br><br>Backport from openbsc b010f869c915016b7fa97a26621582cd89de96b0.<br>Change-Id: I5766165985fbfcecc63d45b9e229322bc8cedf52<br>---<br>M src/libosmo-mgcp/mgcp_osmux.c<br>1 file changed, 15 insertions(+), 10 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/78/11378/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c</span><br><span>index 2e6307e..9081873 100644</span><br><span>--- a/src/libosmo-mgcp/mgcp_osmux.c</span><br><span>+++ b/src/libosmo-mgcp/mgcp_osmux.c</span><br><span>@@ -316,6 +316,20 @@</span><br><span>        return msg;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+static int osmux_legacy_dummy_parse_cid(struct sockaddr_in *addr, struct msgb *msg,</span><br><span style="color: hsl(120, 100%, 40%);">+                                     uint8_t *osmux_cid)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+        if (msg->len < 1 + sizeof(osmux_cid)) {</span><br><span style="color: hsl(120, 100%, 40%);">+         LOGP(DLMGCP, LOGL_ERROR,</span><br><span style="color: hsl(120, 100%, 40%);">+                   "Discarding truncated Osmux dummy load\n");</span><br><span style="color: hsl(120, 100%, 40%);">+            return -1;</span><br><span style="color: hsl(120, 100%, 40%);">+    }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   /* extract the osmux CID from the dummy message */</span><br><span style="color: hsl(120, 100%, 40%);">+    memcpy(osmux_cid, &msg->data[1], sizeof(*osmux_cid));</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%);">+</span><br><span> #define osmux_chunk_length(msg, rem) (rem - msg->len);</span><br><span> </span><br><span> int osmux_read_from_bsc_nat_cb(struct osmo_fd *ofd, unsigned int what)</span><br><span>@@ -379,17 +393,8 @@</span><br><span>     uint8_t osmux_cid;</span><br><span>   struct mgcp_conn_rtp *conn_net = NULL;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-      if (msg->len < 1 + sizeof(osmux_cid)) {</span><br><span style="color: hsl(0, 100%, 40%);">-           LOGP(DLMGCP, LOGL_ERROR,</span><br><span style="color: hsl(0, 100%, 40%);">-                     "Discarding truncated Osmux dummy load\n");</span><br><span style="color: hsl(120, 100%, 40%);">+    if (osmux_legacy_dummy_parse_cid(addr, msg, &osmux_cid) < 0)</span><br><span>          goto out;</span><br><span style="color: hsl(0, 100%, 40%);">-       }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-       LOGP(DLMGCP, LOGL_DEBUG, "Received Osmux dummy load from %s\n",</span><br><span style="color: hsl(0, 100%, 40%);">-            inet_ntoa(addr->sin_addr));</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-     /* extract the osmux CID from the dummy message */</span><br><span style="color: hsl(0, 100%, 40%);">-      memcpy(&osmux_cid, &msg->data[1], sizeof(osmux_cid));</span><br><span> </span><br><span>         endp = endpoint_lookup(cfg, osmux_cid, &addr->sin_addr, MGCP_DEST_BTS);</span><br><span>       if (!endp) {</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/11378">change 11378</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/11378"/><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: I5766165985fbfcecc63d45b9e229322bc8cedf52 </div>
<div style="display:none"> Gerrit-Change-Number: 11378 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Pau Espin Pedrol <pespin@sysmocom.de> </div>