Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Make Flags of proper width #2005

Merged
merged 2 commits into from
May 13, 2020
Merged

Conversation

AniruddhaKanhere
Copy link
Member

@AniruddhaKanhere AniruddhaKanhere commented May 13, 2020

The TCP flags are not of proper width according to the header in the TCP protocol.

Description

The TCP flags are not of proper width according to the header in the TCP protocol. In absence of a cast, this value is downcasted from uin16_t to uint8_t to assign value to the 8 bit width xTCP_HEADER.ucTCPFlags.
These flags are designed to fit in a 6-bit wide value according to RFC 793. The other bits are experimental and are defined in various RFCs. They are not used as of now in the +TCP stack except for the purposes of debugging.

The issue that triggered this PR:
Visual Studio build (v142) yields 2 warnings for FreeRTOS_TCP_IP.c file, both of which are cast truncates constant value.

1>amaon-freertos\amazon-freertos\libraries\freertos_plus\standard\freertos_plus_tcp\source\FreeRTOS_TCP_IP.c(864,60): warning C4310: cast truncates constant value
1>amazon-freertos\libraries\freertos_plus\standard\freertos_plus_tcp\source\FreeRTOS_TCP_IP.c(1885,56): warning C4310: cast truncates constant value

Both places downcast macro constants from uin16_t to uint8_t to assign value to the 8-bit width xTCP_HEADER.ucTCPFlags member here

Checklist:

  • I have tested my changes. No regression in existing tests.
  • My code is Linted.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

The TCP flags are not of proper width according to the header in the TCP protocol.
aggarg
aggarg previously approved these changes May 13, 2020
@AniruddhaKanhere AniruddhaKanhere merged commit b467b68 into master May 13, 2020
@AniruddhaKanhere AniruddhaKanhere deleted the AniruddhaKanhere-patch-2 branch May 13, 2020 23:13
alfred2g pushed a commit to alfred2g/amazon-freertos that referenced this pull request May 21, 2020
* Make Flags of proper width

The TCP flags are not of proper width according to the header in the TCP protocol.

* Update after Archit's comments
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants