pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/34025 )
Change subject: llc: Silently dicard UI Dummy commands ......................................................................
llc: Silently dicard UI Dummy commands
Change-Id: I807e140b96de7140d8f6922417f3eaf0eadeed84 --- M src/llc/llc.c 1 file changed, 23 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/25/34025/1
diff --git a/src/llc/llc.c b/src/llc/llc.c index be1ebec..dc1a7b6 100644 --- a/src/llc/llc.c +++ b/src/llc/llc.c @@ -53,6 +53,11 @@ { 0, NULL } };
+/* 3GPP TS 44.064 6.4.2.2 */ +static const uint8_t gprs_llc_ui_dummy_command[] = { + 0x43, 0xc0, 0x01, 0x2b, 0x2b, 0x2b +}; + /* Section 8.9.9 LLC layer parameter default values */ static const struct gprs_llc_params llc_default_params[NUM_SAPIS] = { [1] = { @@ -844,6 +849,15 @@ if (~pdu_dec->flags & OSMO_GPRS_LLC_PDU_F_PROT_MODE) crc_length = OSMO_MIN(crc_length, UI_HDR_LEN + N202); if (pdu_dec->fcs != gprs_llc_fcs(ll_pdu, crc_length)) { + if (ll_pdu_len >= sizeof(gprs_llc_ui_dummy_command) || + memcmp(ll_pdu, gprs_llc_ui_dummy_command, sizeof(gprs_llc_ui_dummy_command)) == 0) { + /* 6.4.2.2: "If the LLC entity at the MS receives a UI Dummy command, it shall discard + * it without any further actions" [...] + * "The format specified for the UI Dummy command ensures that a receiving LLC entity + * will always discard it, since the FCS field check always fails" "*/ + LOGLLE(lle, LOGL_DEBUG, "Dropping UI Dummy command len=%zu\n", ll_pdu_len); + return 0; + } LOGLLE(lle, LOGL_NOTICE, "Dropping frame with invalid FCS 0x%06x vs exp 0x%06x: %s\n", pdu_dec->fcs, gprs_llc_fcs(ll_pdu, crc_length), osmo_hexdump(ll_pdu, ll_pdu_len));