<p>lynxis lazus has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/21845">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">gprs_ns2_fr: setup_device: allow to setup a device a fresh dahdi device<br><br>When a dahdi device hasn't been setupped yet, ioctl IF_GET_PROTO fails<br>with invalid argument.<br>Also fix the device check to skip ioctl's if the device is also in the<br>correct state.<br><br>Change-Id: I398d056546e35465a2944e1b4a86a8c93b3e5f7a<br>---<br>M src/gb/gprs_ns2_fr.c<br>1 file changed, 5 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/45/21845/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c</span><br><span>index 1a6b92f..3435cf7 100644</span><br><span>--- a/src/gb/gprs_ns2_fr.c</span><br><span>+++ b/src/gb/gprs_ns2_fr.c</span><br><span>@@ -476,16 +476,17 @@</span><br><span>   req.ifr_settings.size = sizeof(buffer);</span><br><span>      req.ifr_settings.type = IF_GET_PROTO;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+     /* EINVAL is returned when no protocol has been set */</span><br><span>       rc = ioctl(sock, SIOCWANDEV, &req);</span><br><span style="color: hsl(0, 100%, 40%);">- if (rc < 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+      if (rc < 0 && errno != EINVAL) {</span><br><span>          LOGP(DLNS, LOGL_ERROR, "%s: Unable to get FR protocol information: %s\n",</span><br><span>               netif, strerror(errno));</span><br><span>                goto err;</span><br><span>    }</span><br><span> </span><br><span>        /* check if the device is good */</span><br><span style="color: hsl(0, 100%, 40%);">-       if (req.ifr_settings.type != IF_PROTO_FR && fr->lmi != LMI_NONE) {</span><br><span style="color: hsl(0, 100%, 40%);">-           LOGP(DLNS, LOGL_INFO, "%s: has correct frame relay mode and lmi\n", netif);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (rc == 0 && req.ifr_settings.type == IF_PROTO_FR && fr->lmi == LMI_NONE) {</span><br><span style="color: hsl(120, 100%, 40%);">+              LOGP(DLNS, LOGL_NOTICE, "%s: has correct frame relay mode and lmi\n", netif);</span><br><span>              goto ifup;</span><br><span>   }</span><br><span> </span><br><span>@@ -516,6 +517,7 @@</span><br><span>  /* monitored events count */</span><br><span>         fr->n393 = 4;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+  LOGP(DLNS, LOGL_ERROR, "%s: Setting frame relay related parameters\n", netif);</span><br><span>     rc = ioctl(sock, SIOCWANDEV, &req);</span><br><span>      if (rc) {</span><br><span>            LOGP(DLNS, LOGL_ERROR, "%s: Unable to set FR protocol on information: %s\n",</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/21845">change 21845</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/c/libosmocore/+/21845"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I398d056546e35465a2944e1b4a86a8c93b3e5f7a </div>
<div style="display:none"> Gerrit-Change-Number: 21845 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: lynxis lazus <lynxis@fe80.eu> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>