nuttx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-nuttx] patacongo commented on a change in pull request #1052: drivers: wireless: Apply max payload size to gs2200m.c
Date Fri, 15 May 2020 01:10:38 GMT

patacongo commented on a change in pull request #1052:
URL: https://github.com/apache/incubator-nuttx/pull/1052#discussion_r425511715



##########
File path: drivers/wireless/gs2200m.c
##########
@@ -85,6 +85,7 @@
 #define NRESPMSG     (16 + 2)
 
 #define MAX_PKT_LEN  1500
+#define MAX_PAYLOAD  (MAX_PKT_LEN - 36)

Review comment:
       You should not hardcode the number 36.
   
   What is this numberanyway.  It should:
   
   The size of the Ethernet header (14) +
   The size of IPv4 or IPv6 header (20 or 40) +
   Any other headers.
   
   See:
   ethernet.h:#define ETH_HDRLEN       14     /* Header size: 2*6 + 2 */
   ip.h:#  define IPv4_HDRLEN     20    /* Size of IPv4 header (without options) */
   ip.h:#  define IPv6_HDRLEN     40    /* Size of IPv6 header */
   
   The IP headers can be longer if there are options included in the IP header.  The correct
calculation can be a little complex.
   
   But 36 does not see right?  Is there a 2 byte FCS?  Shouldn't this handle IPv6 too?
   
   Let's not use hard-coded values.
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message