<p>Harald Welte <strong>merged</strong> this change.</p><p><a href="https://gerrit.osmocom.org/10408">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">mgcp_client: check local port only once<br><br>When the user has set a local port for the mgcp client we want the<br>client to exit if this port is already occupied. If no port is set the<br>IETF default port is configured automatically. When we find this port<br>occupied we try up to 100 times the next port to find a useable port.<br><br>Since the for loop that controls the attempts always sets the port<br>config it uses for its checks it will mistakenly assume that the user<br>has set a port on the second cycle.<br><br>- Make sure we only check for the default port in the first cycle<br><br>Change-Id: Ic1fd1018d68fcac94961321615bfdd726465532d<br>---<br>M src/libosmo-mgcp-client/mgcp_client.c<br>1 file changed, 1 insertion(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/libosmo-mgcp-client/mgcp_client.c b/src/libosmo-mgcp-client/mgcp_client.c</span><br><span>index 3663163..c10abc9 100644</span><br><span>--- a/src/libosmo-mgcp-client/mgcp_client.c</span><br><span>+++ b/src/libosmo-mgcp-client/mgcp_client.c</span><br><span>@@ -801,7 +801,7 @@</span><br><span>               * configured then we assume that the user has choosen</span><br><span>                * that port conciously and we will not try to resolve</span><br><span>                * this by silently choosing a different port. */</span><br><span style="color: hsl(0, 100%, 40%);">-               if (mgcp->actual.local_port != MGCP_CLIENT_LOCAL_PORT_DEFAULT)</span><br><span style="color: hsl(120, 100%, 40%);">+             if (mgcp->actual.local_port != MGCP_CLIENT_LOCAL_PORT_DEFAULT && i == 0)</span><br><span>                  return -EINVAL;</span><br><span> </span><br><span>          /* Choose a new port number to try next */</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/10408">change 10408</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/10408"/><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: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ic1fd1018d68fcac94961321615bfdd726465532d </div>
<div style="display:none"> Gerrit-Change-Number: 10408 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: dexter <pmaier@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>