summaryrefslogtreecommitdiff
path: root/net/mac802154
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2022-10-19 16:44:23 +0300
committerStefan Schmidt <stefan@datenfreihafen.org>2022-10-24 10:34:15 +0300
commit4161634bce9537ed173b3c8fd0bf9f0218bcf41c (patch)
tree2f591e9ece691713c40115a6b301b38b16d21c9f /net/mac802154
parent19177eedcf4412a90ec1ebaffac3514d0a3b4ff2 (diff)
downloadlinux-4161634bce9537ed173b3c8fd0bf9f0218bcf41c.tar.xz
mac802154: Ensure proper scan-level filtering
We now have a fine grained filtering information so let's ensure proper filtering in scan mode, which means that only beacons are processed. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Alexander Aring <aahringo@redhat.com> Link: https://lore.kernel.org/r/20221019134423.877169-4-miquel.raynal@bootlin.com Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Diffstat (limited to 'net/mac802154')
-rw-r--r--net/mac802154/rx.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c
index d1f7b8df41fe..dc9ca2c0ea84 100644
--- a/net/mac802154/rx.c
+++ b/net/mac802154/rx.c
@@ -34,6 +34,7 @@ ieee802154_subif_frame(struct ieee802154_sub_if_data *sdata,
struct sk_buff *skb, const struct ieee802154_hdr *hdr)
{
struct wpan_dev *wpan_dev = &sdata->wpan_dev;
+ struct wpan_phy *wpan_phy = sdata->local->hw.phy;
__le16 span, sshort;
int rc;
@@ -42,6 +43,17 @@ ieee802154_subif_frame(struct ieee802154_sub_if_data *sdata,
span = wpan_dev->pan_id;
sshort = wpan_dev->short_addr;
+ /* Level 3 filtering: Only beacons are accepted during scans */
+ if (sdata->required_filtering == IEEE802154_FILTERING_3_SCAN &&
+ sdata->required_filtering > wpan_phy->filtering) {
+ if (mac_cb(skb)->type != IEEE802154_FC_TYPE_BEACON) {
+ dev_dbg(&sdata->dev->dev,
+ "drop non-beacon frame (0x%x) during scan\n",
+ mac_cb(skb)->type);
+ goto fail;
+ }
+ }
+
switch (mac_cb(skb)->dest.mode) {
case IEEE802154_ADDR_NONE:
if (mac_cb(skb)->dest.mode != IEEE802154_ADDR_NONE)
@@ -277,10 +289,6 @@ void ieee802154_rx(struct ieee802154_local *local, struct sk_buff *skb)
ieee802154_monitors_rx(local, skb);
- /* TODO: Handle upcomming receive path where the PHY is at the
- * IEEE802154_FILTERING_NONE level during a scan.
- */
-
/* Level 1 filtering: Check the FCS by software when relevant */
if (local->hw.phy->filtering == IEEE802154_FILTERING_NONE) {
crc = crc_ccitt(0, skb->data, skb->len);