<p>neels <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/19901">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">handover: fix detection for ambiguous HO neighbor ident<br><br>Adding rate counter checks to TC_ho_neighbor_config_1 (1.c) uncovers that the<br>test passes for the wrong reason. The ambiguous cell identification should be<br>the cause for the handover error, but the log shows that instead a handover is<br>attempted to BTS 3 which is not connected.<br><br>find_handover_target_cell() first tries to find a precise match of values, and<br>in a second pass applies wildcards like BSIC_ANY and<br>NEIGHBOR_IDENT_KEY_ANY_BTS. That second pass lacks detection of ambiguous<br>matches.<br><br>Use the same code for both passes, by encapsulating in a loop of two, which<br>first runs with exact_match == true and then false.<br><br>Proper detection of the ambiguous target cell identification in<br>TC_ho_neighbor_config_1() is shown by the resulting 'handover:error' count,<br>see I10bc0b67ca8dcf41dbb02332ed18017e819c2b32 (osmo-ttcn3-hacks).<br><br>Related: OS#4736<br>Related: I10bc0b67ca8dcf41dbb02332ed18017e819c2b32 (osmo-ttcn3-hacks)<br>Change-Id: Ib0087b6566ae4d82f8c3ef272c1256bcd1d08bf1<br>---<br>M src/osmo-bsc/handover_logic.c<br>1 file changed, 21 insertions(+), 19 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/osmo-bsc/handover_logic.c b/src/osmo-bsc/handover_logic.c</span><br><span>index 071228e..ade330d 100644</span><br><span>--- a/src/osmo-bsc/handover_logic.c</span><br><span>+++ b/src/osmo-bsc/handover_logic.c</span><br><span>@@ -183,32 +183,34 @@</span><br><span>          /* No explicit neighbor entries exist for this BTS. Hence apply the legacy default behavior that all</span><br><span>                  * local cells are neighbors. */</span><br><span>             struct gsm_bts *bts;</span><br><span style="color: hsl(0, 100%, 40%);">-            struct gsm_bts *wildcard_match = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+                int i;</span><br><span> </span><br><span>           LOG_HO(conn, LOGL_DEBUG, "No explicit neighbors, regarding all local cells as neighbors\n");</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-              llist_for_each_entry(bts, &net->bts_list, list) {</span><br><span style="color: hsl(0, 100%, 40%);">-                        struct neighbor_ident_key bts_key = *bts_ident_key(bts);</span><br><span style="color: hsl(0, 100%, 40%);">-                        if (neighbor_ident_key_match(&bts_key, search_for, true)) {</span><br><span style="color: hsl(0, 100%, 40%);">-                         if (local_target_cell) {</span><br><span style="color: hsl(0, 100%, 40%);">-                                        if (log_errors)</span><br><span style="color: hsl(0, 100%, 40%);">-                                         LOG_HO(conn, LOGL_ERROR,</span><br><span style="color: hsl(0, 100%, 40%);">-                                                       "NEIGHBOR CONFIGURATION ERROR: Multiple local cells match %s"</span><br><span style="color: hsl(0, 100%, 40%);">-                                                 " (BTS %d and BTS %d)."</span><br><span style="color: hsl(0, 100%, 40%);">-                                                       " Aborting Handover because of ambiguous network topology.\n",</span><br><span style="color: hsl(0, 100%, 40%);">-                                                neighbor_ident_key_name(search_for),</span><br><span style="color: hsl(0, 100%, 40%);">-                                                    local_target_cell->nr, bts->nr);</span><br><span style="color: hsl(0, 100%, 40%);">-                                   return -EINVAL;</span><br><span style="color: hsl(120, 100%, 40%);">+               /* For i == 0, look for an exact 1:1 match of all ident_key fields.</span><br><span style="color: hsl(120, 100%, 40%);">+            * For i == 1, interpret wildcard values, when no exact match exists. */</span><br><span style="color: hsl(120, 100%, 40%);">+              for (i = 0; i < 2; i++) {</span><br><span style="color: hsl(120, 100%, 40%);">+                  bool exact_match = !i;</span><br><span style="color: hsl(120, 100%, 40%);">+                        llist_for_each_entry(bts, &net->bts_list, list) {</span><br><span style="color: hsl(120, 100%, 40%);">+                              struct neighbor_ident_key bts_key = *bts_ident_key(bts);</span><br><span style="color: hsl(120, 100%, 40%);">+                              if (neighbor_ident_key_match(&bts_key, search_for, exact_match)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                        if (local_target_cell) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                              if (log_errors)</span><br><span style="color: hsl(120, 100%, 40%);">+                                                       LOG_HO(conn, LOGL_ERROR,</span><br><span style="color: hsl(120, 100%, 40%);">+                                                             "NEIGHBOR CONFIGURATION ERROR: Multiple local cells match %s"</span><br><span style="color: hsl(120, 100%, 40%);">+                                                               " (BTS %d and BTS %d)."</span><br><span style="color: hsl(120, 100%, 40%);">+                                                             " Aborting Handover because of ambiguous network topology.\n",</span><br><span style="color: hsl(120, 100%, 40%);">+                                                              neighbor_ident_key_name(search_for),</span><br><span style="color: hsl(120, 100%, 40%);">+                                                          local_target_cell->nr, bts->nr);</span><br><span style="color: hsl(120, 100%, 40%);">+                                         return -EINVAL;</span><br><span style="color: hsl(120, 100%, 40%);">+                                       }</span><br><span style="color: hsl(120, 100%, 40%);">+                                     local_target_cell = bts;</span><br><span>                             }</span><br><span style="color: hsl(0, 100%, 40%);">-                               local_target_cell = bts;</span><br><span>                     }</span><br><span style="color: hsl(0, 100%, 40%);">-                       if (neighbor_ident_key_match(&bts_key, search_for, false))</span><br><span style="color: hsl(0, 100%, 40%);">-                          wildcard_match = bts;</span><br><span style="color: hsl(120, 100%, 40%);">+                 if (local_target_cell)</span><br><span style="color: hsl(120, 100%, 40%);">+                                break;</span><br><span>               }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-           if (!local_target_cell)</span><br><span style="color: hsl(0, 100%, 40%);">-                 local_target_cell = wildcard_match;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>          if (!local_target_cell) {</span><br><span>                    if (log_errors)</span><br><span>                              LOG_HO(conn, LOGL_ERROR, "Cannot Handover, no cell matches %s\n",</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bsc/+/19901">change 19901</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/osmo-bsc/+/19901"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bsc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ib0087b6566ae4d82f8c3ef272c1256bcd1d08bf1 </div>
<div style="display:none"> Gerrit-Change-Number: 19901 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: neels <nhofmeyr@sysmocom.de> </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: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>