summaryrefslogtreecommitdiffstats
path: root/net/mac802154
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2015-09-18 11:30:44 +0200
committerMarcel Holtmann <marcel@holtmann.org>2015-09-22 11:51:20 +0200
commit02c7b6922899621aa8e8babe27fca7b6b2e497b0 (patch)
tree6b9ab5b1dac2512b6341af6dd0f7e9b2003ff6fc /net/mac802154
parent87a93e4eceb495f93e3f37b100334d2641765b6c (diff)
downloadlinux-02c7b6922899621aa8e8babe27fca7b6b2e497b0.tar.gz
linux-02c7b6922899621aa8e8babe27fca7b6b2e497b0.tar.bz2
linux-02c7b6922899621aa8e8babe27fca7b6b2e497b0.zip
mac802154: tx: add warning if MTU exceeds
Sending over AF_PACKET RAW sockets we can sending frames which exceeds MTU size. To handling it correct we need to change things in AF_PACKET which knows on RAW sockets an additional FCS is set by hardware or mac802154 transmit functionality. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/mac802154')
-rw-r--r--net/mac802154/tx.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c
index 66d7ecb7c56b..5ee596e00a6d 100644
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -71,6 +71,17 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb)
struct net_device *dev = skb->dev;
int ret;
+ /* This check is for AF_PACKET RAW socket only, which doesn't
+ * know about the FCS which is set here or by hardware. otherwise
+ * it should not occur in any case!
+ *
+ * TODO: This should be handled in AF_PACKET and return -EMSGSIZE.
+ */
+ if (skb->len > IEEE802154_MTU - IEEE802154_FCS_LEN) {
+ netdev_warn(dev, "Frame len above MTU limit. Dropped.\n");
+ goto err_tx;
+ }
+
if (!(local->hw.flags & IEEE802154_HW_TX_OMIT_CKSUM)) {
u16 crc = crc_ccitt(0, skb->data, skb->len);