This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 2efb9a762b4ee215b4a10e81eac7ddd451bd3e67
Author: raiden00pl <[email protected]>
AuthorDate: Thu Oct 22 13:23:24 2026 +0200

    wireless/ieee802154: leave room for the FCS in a MAC data frame
    
    The radio appends the 2 byte FCS, but MCPS-DATA accepted 127 byte
    frames, so a full frame from a PF_IEEE802154 socket or the MAC character
    device exceeded aMaxPHYPacketSize. Limit the MAC frame to 125 bytes.
    
    Assisted-by: Claude Code
    Signed-off-by: raiden00pl <[email protected]>
---
 include/nuttx/wireless/ieee802154/ieee802154_mac.h | 5 +++++
 wireless/ieee802154/mac802154_data.c               | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/nuttx/wireless/ieee802154/ieee802154_mac.h 
b/include/nuttx/wireless/ieee802154/ieee802154_mac.h
index 58641d58a3f..ee5ab20fd44 100644
--- a/include/nuttx/wireless/ieee802154/ieee802154_mac.h
+++ b/include/nuttx/wireless/ieee802154/ieee802154_mac.h
@@ -242,6 +242,11 @@
 #define IEEE802154_MAX_UNSEC_MHR_OVERHEAD     23
 #define IEEE802154_MFR_LENGTH                 2
 
+/* Longest MAC frame, the FCS completes the PSDU */
+
+#define IEEE802154_MAX_FRAME_SIZE \
+        (IEEE802154_MAX_PHY_PACKET_SIZE - IEEE802154_MFR_LENGTH)
+
 #define IEEE802154_MAX_MPDU_UNSEC_OVERHEAD  \
         (IEEE802154_MAX_UNSEC_MHR_OVERHEAD + IEEE802154_MFR_LENGTH)
 
diff --git a/wireless/ieee802154/mac802154_data.c 
b/wireless/ieee802154/mac802154_data.c
index bf49b6ac131..8b429ce634c 100644
--- a/wireless/ieee802154/mac802154_data.c
+++ b/wireless/ieee802154/mac802154_data.c
@@ -71,7 +71,7 @@ int mac802154_req_data(MACHANDLE mac,
 
   /* Check the required frame size */
 
-  if (frame->io_len > IEEE802154_MAX_PHY_PACKET_SIZE)
+  if (frame->io_len > IEEE802154_MAX_FRAME_SIZE)
     {
       return -E2BIG;
     }

Reply via email to