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
Wed Apr 24 13:40:07 UTC 2019


Harald Welte has submitted this change and it was merged. ( 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(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved
  Pau Espin Pedrol: Looks good to me, approved
  Keith Whyte: Looks good to me, but someone else must approve



diff --git a/src/gprs/gprs_llc.c b/src/gprs/gprs_llc.c
index abbb742..c222bc2 100644
--- a/src/gprs/gprs_llc.c
+++ b/src/gprs/gprs_llc.c
@@ -945,9 +945,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);
@@ -958,6 +955,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: merged
Gerrit-Change-Id: I51bbd0f2c618d477a037af343ff41de1c8a5a3ae
Gerrit-Change-Number: 13764
Gerrit-PatchSet: 3
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Keith Whyte <keith at rhizomatica.org>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190424/273c4887/attachment.htm>


More information about the gerrit-log mailing list