<p>laforge has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/15321">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">gsup: Introduce OSMO_GSUP_NUM_VECTORS_REQ_IE<br><br>This is a bit of a hack, as we want to maintain binary compatibility<br>without breaking existing users of libosmocore.  To do so, we use the<br>'num_auth_vectors' field in two ways now:<br><br>* In the existing use case as part of SEND_AUTH_INFO_RESPONSE, it<br>  indicates the number of vectors stored in the 'auth_vectors' field<br><br>* In the new use case as part of SEND_AUTH_INFO_REQUEST, it indicates<br>  the number of vectors actually requested by the MSC/SGSN/MME.<br><br>Change-Id: Iaecc47280f8ce54f3e3a888c1cfc160735483d0f<br>---<br>M include/osmocom/gsm/gsup.h<br>M src/gsm/gsup.c<br>2 files changed, 15 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/21/15321/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmocom/gsm/gsup.h b/include/osmocom/gsm/gsup.h</span><br><span>index fded89b..eff10f4 100644</span><br><span>--- a/include/osmocom/gsm/gsup.h</span><br><span>+++ b/include/osmocom/gsm/gsup.h</span><br><span>@@ -106,6 +106,7 @@</span><br><span> </span><br><span>  OSMO_GSUP_IMEI_IE                       = 0x50,</span><br><span>      OSMO_GSUP_IMEI_RESULT_IE                = 0x51,</span><br><span style="color: hsl(120, 100%, 40%);">+       OSMO_GSUP_NUM_VECTORS_REQ_IE            = 0x52,</span><br><span> </span><br><span>  /* Inter-MSC handover related */</span><br><span>     OSMO_GSUP_SOURCE_NAME_IE                = 0x60,</span><br><span>diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c</span><br><span>index 80ebcb2..f400002 100644</span><br><span>--- a/src/gsm/gsup.c</span><br><span>+++ b/src/gsm/gsup.c</span><br><span>@@ -564,6 +564,11 @@</span><br><span>                  gsup_msg->cause_sm = value[0];</span><br><span>                    break;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+            case OSMO_GSUP_NUM_VECTORS_REQ_IE:</span><br><span style="color: hsl(120, 100%, 40%);">+                    if (gsup_msg->message_type == OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST)</span><br><span style="color: hsl(120, 100%, 40%);">+                               gsup_msg->num_auth_vectors = value[0];</span><br><span style="color: hsl(120, 100%, 40%);">+                     break;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>             default:</span><br><span>                     LOGP(DLGSUP, LOGL_NOTICE,</span><br><span>                         "GSUP IE type %d unknown\n", iei);</span><br><span>@@ -748,12 +753,17 @@</span><br><span>            }</span><br><span>    }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   for (idx = 0; idx < gsup_msg->num_auth_vectors; idx++) {</span><br><span style="color: hsl(0, 100%, 40%);">-          const struct osmo_auth_vector *auth_vector;</span><br><span style="color: hsl(120, 100%, 40%);">+   if (gsup_msg->message_type == OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST) {</span><br><span style="color: hsl(120, 100%, 40%);">+             uint8_t num = gsup_msg->num_auth_vectors;</span><br><span style="color: hsl(120, 100%, 40%);">+          msgb_tlv_put(msg, OSMO_GSUP_NUM_VECTORS_REQ_IE, 1, &num);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+              for (idx = 0; idx < gsup_msg->num_auth_vectors; idx++) {</span><br><span style="color: hsl(120, 100%, 40%);">+                        const struct osmo_auth_vector *auth_vector;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-         auth_vector = &gsup_msg->auth_vectors[idx];</span><br><span style="color: hsl(120, 100%, 40%);">+                    auth_vector = &gsup_msg->auth_vectors[idx];</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-          encode_auth_info(msg, OSMO_GSUP_AUTH_TUPLE_IE, auth_vector);</span><br><span style="color: hsl(120, 100%, 40%);">+                  encode_auth_info(msg, OSMO_GSUP_AUTH_TUPLE_IE, auth_vector);</span><br><span style="color: hsl(120, 100%, 40%);">+          }</span><br><span>    }</span><br><span> </span><br><span>        if (gsup_msg->auts)</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/15321">change 15321</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/+/15321"/><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: Iaecc47280f8ce54f3e3a888c1cfc160735483d0f </div>
<div style="display:none"> Gerrit-Change-Number: 15321 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: laforge <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>