<p>lynxis lazus <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/21574">View Change</a></p><div style="white-space:pre-wrap">Approvals:
laforge: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
Jenkins Builder: Verified
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">gprs_ns2_sns: use different binds for the initial connection<br><br>In case the first bind is not working the SNS would never build a<br>succesful connection to the SGSN. Iterate over all binds by<br>using an offset.<br>Instead of tracking the binds use an offset instead of a direct pointer.<br>This might result in skipping the order of the next bind.<br><br>Change-Id: I4a0a0608dac6ad8b5769ada2a14ca23f61eb0bcb<br>---<br>M src/gb/gprs_ns2_sns.c<br>1 file changed, 13 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c</span><br><span>index b7fbbf8..0676b61 100644</span><br><span>--- a/src/gb/gprs_ns2_sns.c</span><br><span>+++ b/src/gb/gprs_ns2_sns.c</span><br><span>@@ -117,6 +117,8 @@</span><br><span> struct sns_endpoint *initial;</span><br><span> /* all SNS PDU will be sent over this nsvc */</span><br><span> struct gprs_ns2_vc *sns_nsvc;</span><br><span style="color: hsl(120, 100%, 40%);">+ /* iterate over the binds after all remote has been tested */</span><br><span style="color: hsl(120, 100%, 40%);">+ int bind_offset;</span><br><span> </span><br><span> /* local configuration to send to the remote end */</span><br><span> struct gprs_ns_ie_ip4_elem *ip4_local;</span><br><span>@@ -714,9 +716,15 @@</span><br><span> return;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- bind = ns2_ip_get_bind_by_index(nsi, remote, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+ bind = ns2_ip_get_bind_by_index(nsi, remote, gss->bind_offset);</span><br><span> if (!bind) {</span><br><span style="color: hsl(0, 100%, 40%);">- return;</span><br><span style="color: hsl(120, 100%, 40%);">+ if (gss->bind_offset) {</span><br><span style="color: hsl(120, 100%, 40%);">+ gss->bind_offset = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ bind = ns2_ip_get_bind_by_index(nsi, remote, gss->bind_offset);</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%);">+ if (!bind)</span><br><span style="color: hsl(120, 100%, 40%);">+ return;</span><br><span> }</span><br><span> </span><br><span> /* setup the NSVC */</span><br><span>@@ -1335,9 +1343,12 @@</span><br><span> return;</span><br><span> } else if (!gss->initial) {</span><br><span> gss->initial = llist_first_entry(&gss->sns_endpoints, struct sns_endpoint, list);</span><br><span style="color: hsl(120, 100%, 40%);">+ gss->bind_offset = 0;</span><br><span> } else if (gss->initial->list.next == &gss->sns_endpoints) {</span><br><span> /* last entry, continue with first */</span><br><span> gss->initial = llist_first_entry(&gss->sns_endpoints, struct sns_endpoint, list);</span><br><span style="color: hsl(120, 100%, 40%);">+ gss->bind_offset++;</span><br><span style="color: hsl(120, 100%, 40%);">+ gss->bind_offset %= ns2_ip_count_bind(nse->nsi, &gss->initial->saddr);</span><br><span> } else {</span><br><span> /* next element is an entry */</span><br><span> gss->initial = llist_entry(gss->initial->list.next, struct sns_endpoint, list);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/21574">change 21574</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/+/21574"/><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: I4a0a0608dac6ad8b5769ada2a14ca23f61eb0bcb </div>
<div style="display:none"> Gerrit-Change-Number: 21574 </div>
<div style="display:none"> Gerrit-PatchSet: 12 </div>
<div style="display:none"> Gerrit-Owner: lynxis lazus <lynxis@fe80.eu> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: lynxis lazus <lynxis@fe80.eu> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>