/* 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 (hdr->source.mode == IEEE802154_ADDR_NONE) /* ACK comes with both addresses empty */
skb->pkt_type = PACKET_HOST; elseif (!wpan_dev->parent) /* No dest means PAN coordinator is the recipient */
skb->pkt_type = PACKET_HOST; else /* We are not the PAN coordinator, just relaying */
skb->pkt_type = PACKET_OTHERHOST; break; case IEEE802154_ADDR_LONG: if (mac_cb(skb)->dest.pan_id != span &&
mac_cb(skb)->dest.pan_id != cpu_to_le16(IEEE802154_PANID_BROADCAST))
skb->pkt_type = PACKET_OTHERHOST; elseif (mac_cb(skb)->dest.extended_addr == wpan_dev->extended_addr)
skb->pkt_type = PACKET_HOST; else
skb->pkt_type = PACKET_OTHERHOST; break; case IEEE802154_ADDR_SHORT: if (mac_cb(skb)->dest.pan_id != span &&
mac_cb(skb)->dest.pan_id != cpu_to_le16(IEEE802154_PANID_BROADCAST))
skb->pkt_type = PACKET_OTHERHOST; elseif (mac_cb(skb)->dest.short_addr == sshort)
skb->pkt_type = PACKET_HOST; elseif (mac_cb(skb)->dest.short_addr ==
cpu_to_le16(IEEE802154_ADDR_BROADCAST))
skb->pkt_type = PACKET_BROADCAST; else
skb->pkt_type = PACKET_OTHERHOST; break; default:
pr_debug("invalid dest mode\n"); goto fail;
}
skb->dev = sdata->dev;
/* TODO this should be moved after netif_receive_skb call, otherwise * wireshark will show a mac header with security fields and the * payload is already decrypted.
*/
rc = mac802154_llsec_decrypt(&sdata->sec, skb); if (rc) {
pr_debug("decryption failed: %i\n", rc); goto fail;
}
ret = ieee802154_parse_frame_start(skb, &hdr); if (ret) {
pr_debug("got invalid frame\n"); return;
}
list_for_each_entry_rcu(sdata, &local->interfaces, list) { if (sdata->wpan_dev.iftype == NL802154_IFTYPE_MONITOR) continue;
if (!ieee802154_sdata_running(sdata)) continue;
/* Do not deliver packets received on interfaces expecting * AACK=1 if the address filters where disabled.
*/ if (local->hw.phy->filtering < IEEE802154_FILTERING_4_FRAME_FIELDS &&
sdata->required_filtering == IEEE802154_FILTERING_4_FRAME_FIELDS) continue;
/* TODO: When a transceiver omits the checksum here, we * add an own calculated one. This is currently an ugly * solution because the monitor needs a crc here.
*/ if (local->hw.flags & IEEE802154_HW_RX_OMIT_CKSUM) {
crc = crc_ccitt(0, skb->data, skb->len);
put_unaligned_le16(crc, skb_put(skb, 2));
}
rcu_read_lock();
ieee802154_monitors_rx(local, skb);
/* 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); if (crc) goto drop;
} /* remove crc */
skb_trim(skb, skb->len - 2);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.