提交 02c7b692 编写于 作者: A Alexander Aring 提交者: Marcel Holtmann

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: NAlexander Aring <alex.aring@gmail.com>
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
上级 87a93e4e
...@@ -71,6 +71,17 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb) ...@@ -71,6 +71,17 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb)
struct net_device *dev = skb->dev; struct net_device *dev = skb->dev;
int ret; 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)) { if (!(local->hw.flags & IEEE802154_HW_TX_OMIT_CKSUM)) {
u16 crc = crc_ccitt(0, skb->data, skb->len); u16 crc = crc_ccitt(0, skb->data, skb->len);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册