You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/05/15 01:08:16 UTC

[GitHub] [incubator-nuttx] patacongo commented on a change in pull request #1052: drivers: wireless: Apply max payload size to gs2200m.c

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 */
   
   36 does not see right?  Is ther ea 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