@@ -201,8 +201,18 @@ struct cc2520_private {
struct work_struct fifop_irqwork;/* Workqueue for FIFOP */
spinlock_t lock; /* Lock for is_tx*/
struct completion tx_complete; /* Work completion for Tx */
+ bool promisc_mode;
};
+static int promis_on(foobar, bool on) {
+ if (on)
+ /* disable all filter stuff */
+ else
+ /* enable all filter stuff */
+
+ priv->promisc_mode = on;
+}
+
/* Generic Functions */
static int
cc2520_cmd_strobe(struct cc2520_private *priv, u8 cmd)
@@ -518,10 +528,20 @@ static int cc2520_rx(struct cc2520_private *priv)
u8 len = 0, lqi = 0, bytes = 1;
struct sk_buff *skb;
+ /* getting length? */
cc2520_read_rxfifo(priv, &len, bytes, &lqi);
- if (len < 2 || len > IEEE802154_MTU)
- return -EINVAL;
+ if (!ieee802154_is_valid_psdu_len(len)) {
+ /* corrupted frame received, get full frame buffer */
+ len = IEEE802154_MTU;
+ }
+
+ /* len field may invalid, but doesn't matter. just handle it
+ * as it would be correct. The CRC is also no indicator that the
+ * frame is correct received if CRC is correct.
+ */
+ if (!priv->promisc_mode) {
+ /* do validate of crc bit here and drop if invalid */
/* comment, this is better than doing calculation of CRC in mac802154 again */