Change in osmo-sgsn[master]: gprs_llc: Correctly refuse any ABM command (SABM, DISC) with DM

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Tue Apr 23 21:22:57 UTC 2019


Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/13767


Change subject: gprs_llc: Correctly refuse any ABM command (SABM, DISC) with DM
......................................................................

gprs_llc: Correctly refuse any ABM command (SABM, DISC) with DM

According to Section 6.4.1.4 of 3GPP TS 04.64
	The DM unnumbered response shall be used by an LLE to report to
	its peer that the LLE is in a state such that ABM operation
	cannot be performed. An LLE shall transmit a DM response to any
	valid command received that it cannot action.

Change-Id: Ie8b8e16d5a68f19f21dc4fdb5703c8a794e0173c
---
M src/gprs/gprs_llc.c
1 file changed, 21 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/67/13767/1

diff --git a/src/gprs/gprs_llc.c b/src/gprs/gprs_llc.c
index 654f2c0..099b258 100644
--- a/src/gprs/gprs_llc.c
+++ b/src/gprs/gprs_llc.c
@@ -44,6 +44,7 @@
 static struct gprs_llc_llme *llme_alloc(uint32_t tlli);
 static int gprs_llc_tx_xid(struct gprs_llc_lle *lle, struct msgb *msg,
 			   int command);
+static int gprs_llc_tx_dm(struct gprs_llc_lle *lle);
 static int gprs_llc_tx_u(struct msgb *msg, uint8_t sapi,
 			 int command, enum gprs_llc_u_cmd u_cmd, int pf_bit);
 
@@ -676,6 +677,18 @@
 	return gprs_llc_tx_u(msg, lle->sapi, command, GPRS_LLC_U_XID, 1);
 }
 
+static int gprs_llc_tx_dm(struct gprs_llc_lle *lle)
+{
+	struct msgb *msg = msgb_alloc_headroom(4096, 1024, "LLC_DM");
+
+	/* copy identifiers from LLE to ensure lower layers can route */
+	msgb_tlli(msg) = lle->llme->tlli;
+	msgb_bvci(msg) = lle->llme->bvci;
+	msgb_nsei(msg) = lle->llme->nsei;
+
+	return gprs_llc_tx_u(msg, lle->sapi, 0, GPRS_LLC_U_DM_RESP, 1);
+}
+
 /* encrypt information field + FCS, if needed! */
 static int apply_gea(struct gprs_llc_lle *lle, uint16_t crypt_len, uint16_t nu,
 		     uint32_t oc, uint8_t sapi, uint8_t *fcs, uint8_t *data)
@@ -802,6 +815,7 @@
 			   struct gprs_llc_lle *lle)
 {
 	switch (gph->cmd) {
+#if 0
 	case GPRS_LLC_SABM: /* Section 6.4.1.1 */
 		lle->v_sent = lle->v_ack = lle->v_recv = 0;
 		if (lle->state == GPRS_LLES_ASSIGNED_ADM) {
@@ -827,6 +841,13 @@
 		break;
 	case GPRS_LLC_FRMR: /* Section 6.4.1.5 */
 		break;
+#else
+	case GPRS_LLC_SABM:
+	case GPRS_LLC_DISC:
+		/* send DM to properly signal we don't do ABM */
+		gprs_llc_tx_dm(lle);
+		break;
+#endif
 	case GPRS_LLC_XID: /* Section 6.4.1.6 */
 		rx_llc_xid(lle, gph);
 		break;

-- 
To view, visit https://gerrit.osmocom.org/13767
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie8b8e16d5a68f19f21dc4fdb5703c8a794e0173c
Gerrit-Change-Number: 13767
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190423/3fedbd1c/attachment.htm>


More information about the gerrit-log mailing list