falconia has uploaded this change for review.

View Change

HDLC timeslots: fix Rx of maximum-sized frames

E1D protocol sets the maximum permitted size of an HDLC frame to
264 bytes of useful payload, not counting the 2 bytes of FCS.
This limit is fair enough, as it matches GSM TS 08.56, the primary
intended application. However, osmo_isdnhdlc engine used internally
by the daemon requires an Rx buffer 2 bytes larger than the maximum
payload length, for temporary storage of FCS bytes: by the nature
of HDLC, a receiver has no way of identifying FCS bytes as such
until after they have been received and stored in the Rx buffer.

This bug was caught when bringing up OsmoBSC with Nokia Flexi
Multiradio BTS. This BTS emits some long OML messages that get
broken into segments, with each not-last segment traveling over
HDLC as a maximum-sized frame - and these frames then get dropped
by osmo-e1d, causing further breakage downstream.

Change-Id: I479e8fe5118c8eb7d4e6b16b49047a3278bc9808
---
M src/e1d.h
1 file changed, 2 insertions(+), 1 deletion(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/81/42681/1
diff --git a/src/e1d.h b/src/e1d.h
index 5015761..7d2d4c6 100644
--- a/src/e1d.h
+++ b/src/e1d.h
@@ -101,7 +101,8 @@
struct osmo_isdnhdlc_vars tx;
struct osmo_isdnhdlc_vars rx;

- uint8_t rx_buf[E1DP_MAX_SIZE_HDLC];
+ /* extra 2 bytes needed for FCS */
+ uint8_t rx_buf[E1DP_MAX_SIZE_HDLC + 2];
uint8_t tx_buf[E1DP_MAX_SIZE_HDLC];
int tx_ofs;
int tx_len;

To view, visit change 42681. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: I479e8fe5118c8eb7d4e6b16b49047a3278bc9808
Gerrit-Change-Number: 42681
Gerrit-PatchSet: 1
Gerrit-Owner: falconia <falcon@freecalypso.org>