Change in osmo-sgsn[master]: LLC: Don't blindly assume all LLC frames have data payload

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 20:49:13 UTC 2019


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


Change subject: LLC: Don't blindly assume all LLC frames have data payload
......................................................................

LLC: Don't blindly assume all LLC frames have data payload

In reality, only UI, I, SABM, UA and XID frames carry payload.  All
other frames will have llhp.data == NULL.

Let's therefore not do any msgb adjustments unless we actually know
there is a user payload field.

Change-Id: I51bbd0f2c618d477a037af343ff41de1c8a5a3ae
Closes: OS#3952
---
M src/gprs/gprs_llc.c
1 file changed, 8 insertions(+), 3 deletions(-)



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

diff --git a/src/gprs/gprs_llc.c b/src/gprs/gprs_llc.c
index 2111e10..685460d 100644
--- a/src/gprs/gprs_llc.c
+++ b/src/gprs/gprs_llc.c
@@ -946,9 +946,6 @@
 		LOGP(DLLC, LOGL_INFO, "Dropping frame with invalid FCS\n");
 		return -EIO;
 	}
-	/* set l3 layer & remove the fcs */
-	msg->l3h = llhp.data;
-	msgb_l3trim(msg, llhp.data_len);
 
 	/* Update LLE's (BVCI, NSEI) tuple */
 	lle->llme->bvci = msgb_bvci(msg);
@@ -959,6 +956,14 @@
 	if (rc < 0)
 		return rc;
 
+	/* there are many frame types that don't carry user information
+	 * and which hence have llhp.data = NULL */
+	if (llhp.data)  {
+		/* set l3 layer & remove the fcs */
+		msg->l3h = llhp.data;
+		msgb_l3trim(msg, llhp.data_len);
+	}
+
 	rate_ctr_inc(&sgsn->rate_ctrs->ctr[CTR_LLC_UL_PACKETS]);
 	rate_ctr_add(&sgsn->rate_ctrs->ctr[CTR_LLC_UL_BYTES], msg->len);
 

-- 
To view, visit https://gerrit.osmocom.org/13764
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: I51bbd0f2c618d477a037af343ff41de1c8a5a3ae
Gerrit-Change-Number: 13764
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/006c599d/attachment.htm>


More information about the gerrit-log mailing list