-
Notifications
You must be signed in to change notification settings - Fork 206
IP-Version byte offset cleanup #946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4693a12
971d1b0
0a18c29
4ede1bf
c7d5627
594f88d
5224492
f64c580
9a63342
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -996,6 +996,10 @@ void vPreCheckConfigs( void ) | |
| } | ||
| #endif | ||
| /* LCOV_EXCL_BR_STOP */ | ||
|
|
||
| /* ipIP_TYPE_OFFSET = ( sizeof( UDPHeader_t ) + sizeof( IPHeader_IPv6_t ) - ( sizeof( UDPPacket_t ) ) | ||
| * and it MUST be > 0, otherwise storing the IPv4 version byte will overwrite the Ethernet header. */ | ||
| configASSERT( ipIP_TYPE_OFFSET > 0 ); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As |
||
| } | ||
| #endif /* if ( configASSERT_DEFINED == 1 ) */ | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,22 +55,16 @@ | |
| #undef TCP_PACKET_SIZE | ||
| #define TCP_PACKET_SIZE ( sizeof( TCPPacket_IPv6_t ) ) | ||
|
|
||
| /* The offset from the UDP payload where the IP type will be stored. | ||
| * For IPv4 packets, this it located 6 bytes before pucEthernetBuffer. | ||
| * For IPv6 packets, this it located in the usual 'ucVersionTrafficClass'. */ | ||
| #define ipIP_TYPE_OFFSET ( 6U ) | ||
| /* The offset into an IP packet into which the IP data (payload) starts. */ | ||
| #define ipIPv6_PAYLOAD_OFFSET ( sizeof( IPPacket_IPv6_t ) ) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see any reference to |
||
| /* MISRA Ref 20.5.1 [Use of undef] */ | ||
| /* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-2051 */ | ||
| /* coverity[misra_c_2012_rule_20_5_violation] */ | ||
| /* The maximum UDP payload length. */ | ||
| #undef ipMAX_UDP_PAYLOAD_LENGTH | ||
| #define ipMAX_UDP_PAYLOAD_LENGTH ( ( ipconfigNETWORK_MTU - ipSIZE_OF_IPv6_HEADER ) - ipSIZE_OF_UDP_HEADER ) | ||
| #define ipMAX_UDP_PAYLOAD_LENGTH ( ( ipconfigNETWORK_MTU - ipSIZE_OF_IPv6_HEADER ) - ipSIZE_OF_UDP_HEADER ) | ||
| /* The offset into a UDP packet at which the UDP data (payload) starts. */ | ||
| #define ipUDP_PAYLOAD_OFFSET_IPv6 ( sizeof( UDPPacket_IPv6_t ) ) | ||
| /* The value of 'ipUDP_PAYLOAD_IP_TYPE_OFFSET' is 42 + 6 = 48 bytes. */ | ||
| #define ipUDP_PAYLOAD_IPv6_TYPE_OFFSET ( sizeof( UDPPacket_IPv6_t ) + ipIP_TYPE_OFFSET ) | ||
| #define ipUDP_PAYLOAD_OFFSET_IPv6 ( sizeof( UDPPacket_IPv6_t ) ) | ||
|
|
||
| #if ( ipconfigBYTE_ORDER == pdFREERTOS_LITTLE_ENDIAN ) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still like to have it set for both IPv4 and IPv6 packets. It can be useful when debugging UDP and zero-copy. When we don't set it, it might have an old value of
0x4?Maybe adapt the comment, saying that the value is only set for debugging purposes.