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

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">gprs_llc: Correctly refuse any ABM command (SABM, DISC) with DM<br><br>According to Section 6.4.1.4 of 3GPP TS 04.64<br>    The DM unnumbered response shall be used by an LLE to report to<br>       its peer that the LLE is in a state such that ABM operation<br>   cannot be performed. An LLE shall transmit a DM response to any<br>       valid command received that it cannot action.<br><br>Closes: OS#3953<br>Change-Id: Ie8b8e16d5a68f19f21dc4fdb5703c8a794e0173c<br>---<br>M src/gprs/gprs_llc.c<br>1 file changed, 22 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/gprs/gprs_llc.c b/src/gprs/gprs_llc.c</span><br><span>index 654f2c0..2ec7100 100644</span><br><span>--- a/src/gprs/gprs_llc.c</span><br><span>+++ b/src/gprs/gprs_llc.c</span><br><span>@@ -44,6 +44,7 @@</span><br><span> static struct gprs_llc_llme *llme_alloc(uint32_t tlli);</span><br><span> static int gprs_llc_tx_xid(struct gprs_llc_lle *lle, struct msgb *msg,</span><br><span>                           int command);</span><br><span style="color: hsl(120, 100%, 40%);">+static int gprs_llc_tx_dm(struct gprs_llc_lle *lle);</span><br><span> static int gprs_llc_tx_u(struct msgb *msg, uint8_t sapi,</span><br><span>                    int command, enum gprs_llc_u_cmd u_cmd, int pf_bit);</span><br><span> </span><br><span>@@ -676,6 +677,18 @@</span><br><span>     return gprs_llc_tx_u(msg, lle->sapi, command, GPRS_LLC_U_XID, 1);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+static int gprs_llc_tx_dm(struct gprs_llc_lle *lle)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ struct msgb *msg = msgb_alloc_headroom(4096, 1024, "LLC_DM");</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     /* copy identifiers from LLE to ensure lower layers can route */</span><br><span style="color: hsl(120, 100%, 40%);">+      msgb_tlli(msg) = lle->llme->tlli;</span><br><span style="color: hsl(120, 100%, 40%);">+       msgb_bvci(msg) = lle->llme->bvci;</span><br><span style="color: hsl(120, 100%, 40%);">+       msgb_nsei(msg) = lle->llme->nsei;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     return gprs_llc_tx_u(msg, lle->sapi, 0, GPRS_LLC_U_DM_RESP, 1);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /* encrypt information field + FCS, if needed! */</span><br><span> static int apply_gea(struct gprs_llc_lle *lle, uint16_t crypt_len, uint16_t nu,</span><br><span>                   uint32_t oc, uint8_t sapi, uint8_t *fcs, uint8_t *data)</span><br><span>@@ -802,6 +815,8 @@</span><br><span>                      struct gprs_llc_lle *lle)</span><br><span> {</span><br><span>    switch (gph->cmd) {</span><br><span style="color: hsl(120, 100%, 40%);">+#if 0</span><br><span style="color: hsl(120, 100%, 40%);">+ /* we don't fully imoplement ABM, so refuse it properly (OS#3953) */</span><br><span>     case GPRS_LLC_SABM: /* Section 6.4.1.1 */</span><br><span>            lle->v_sent = lle->v_ack = lle->v_recv = 0;</span><br><span>                 if (lle->state == GPRS_LLES_ASSIGNED_ADM) {</span><br><span>@@ -827,6 +842,13 @@</span><br><span>                break;</span><br><span>       case GPRS_LLC_FRMR: /* Section 6.4.1.5 */</span><br><span>            break;</span><br><span style="color: hsl(120, 100%, 40%);">+#else</span><br><span style="color: hsl(120, 100%, 40%);">+ case GPRS_LLC_SABM:</span><br><span style="color: hsl(120, 100%, 40%);">+   case GPRS_LLC_DISC:</span><br><span style="color: hsl(120, 100%, 40%);">+           /* send DM to properly signal we don't do ABM */</span><br><span style="color: hsl(120, 100%, 40%);">+          gprs_llc_tx_dm(lle);</span><br><span style="color: hsl(120, 100%, 40%);">+          break;</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span>       case GPRS_LLC_XID: /* Section 6.4.1.6 */</span><br><span>             rx_llc_xid(lle, gph);</span><br><span>                break;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/13767">change 13767</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/13767"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-sgsn </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ie8b8e16d5a68f19f21dc4fdb5703c8a794e0173c </div>
<div style="display:none"> Gerrit-Change-Number: 13767 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder (1000002) </div>
<div style="display:none"> Gerrit-Reviewer: Vadim Yanitskiy <axilirator@gmail.com> </div>