[riot-notifications] [RIOT-OS/RIOT] nrf802154: Validate frame length before dst filter (#11191)

Semjon Kerner notifications at github.com
Fri Apr 5 11:42:35 CEST 2019


SemjonKerner requested changes on this pull request.

Just some suggestions.
But I have a more basic question: Could this filtering go into `/drivers/netdev_ieee802154`?

> @@ -131,6 +131,26 @@ static void _enable_tx(void)
     NRF_RADIO->TASKS_START = 1;
  }
 
+/**
+ * @brief basic ieee802.15.4 data frame validation
+ */
+static bool _data_frame_filter(void)
+{
+    size_t psdu_len = rxbuf[0];

does this rly need an own variable?

> @@ -131,6 +131,26 @@ static void _enable_tx(void)
     NRF_RADIO->TASKS_START = 1;
  }
 
+/**
+ * @brief basic ieee802.15.4 data frame validation
+ */
+static bool _data_frame_filter(void)
+{
+    size_t psdu_len = rxbuf[0];
+    if (psdu_len < IEEE802154_FCF_LEN) {
+        return false;
+    }
+    size_t expected_len = ieee802154_get_frame_hdr_len(&rxbuf[1]);
+    if (!expected_len) {

Could go into the last return.
Also, I'd prefer comparison with zero since its not a bool, but its fine to me if you like writing it this way.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11191#pullrequestreview-223180406
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190405/a9fd227a/attachment.html>


More information about the notifications mailing list