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:
[email protected]