-
Notifications
You must be signed in to change notification settings - Fork 206
Fix CBMC proof for DHCP #717
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
Fix CBMC proof for DHCP #717
Conversation
Prior to this commit, CBMC would emit logging information in plain text format, which does not contain information required for the CBMC VSCode debugger. This commit makes CBMC use XML instead of plain text. Co-authored-by: Mark Tuttle <[email protected]>
source/FreeRTOS_DHCP.c
Outdated
| lBytes = FreeRTOS_recvfrom( xDHCPv4Socket, &( pucUDPPayload ), 0, FREERTOS_ZERO_COPY, NULL, NULL ); | ||
|
|
||
| if( lBytes > 0 ) | ||
| if( lBytes > 0 && pucUDPPayload != NULL ) |
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.
| if( lBytes > 0 && pucUDPPayload != NULL ) | |
| if( ( lBytes > 0 ) && ( pucUDPPayload != NULL ) ) |
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.
Fixed all formatting issues
source/FreeRTOS_DHCP.c
Outdated
| } | ||
|
|
||
| FreeRTOS_ReleaseUDPPayloadBuffer( pucUDPPayload ); | ||
| if (pucUDPPayload != NULL) |
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.
| if (pucUDPPayload != NULL) | |
| if( pucUDPPayload != NULL ) |
source/FreeRTOS_DHCP.c
Outdated
| pxEndPoint ); | ||
|
|
||
| if( pucUDPPayloadBuffer != NULL ) | ||
| if( xDHCPv4Socket != FREERTOS_INVALID_SOCKET && xDHCPv4Socket != NULL && pucUDPPayloadBuffer != NULL ) |
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.
| if( xDHCPv4Socket != FREERTOS_INVALID_SOCKET && xDHCPv4Socket != NULL && pucUDPPayloadBuffer != NULL ) | |
| if( ( xDHCPv4Socket != FREERTOS_INVALID_SOCKET ) && | |
| ( xDHCPv4Socket != NULL ) && | |
| ( pucUDPPayloadBuffer != NULL ) ) |
source/FreeRTOS_DHCP.c
Outdated
| /* The packet was not successfully queued for sending and must be | ||
| * returned to the stack. */ | ||
| FreeRTOS_ReleaseUDPPayloadBuffer( pucUDPPayloadBuffer ); | ||
| if (pucUDPPayloadBuffer != NULL) |
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.
| if (pucUDPPayloadBuffer != NULL) | |
| if( pucUDPPayloadBuffer != NULL ) |
source/FreeRTOS_DHCP.c
Outdated
| pxEndPoint ); | ||
|
|
||
| if( pucUDPPayloadBuffer != NULL ) | ||
| if( xDHCPv4Socket != FREERTOS_INVALID_SOCKET && xDHCPv4Socket != NULL && pucUDPPayloadBuffer != NULL ) |
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.
| if( xDHCPv4Socket != FREERTOS_INVALID_SOCKET && xDHCPv4Socket != NULL && pucUDPPayloadBuffer != NULL ) | |
| if( ( xDHCPv4Socket != FREERTOS_INVALID_SOCKET ) && | |
| ( xDHCPv4Socket != NULL ) && | |
| ( pucUDPPayloadBuffer != NULL ) ) |
source/FreeRTOS_DHCP.c
Outdated
| /* The packet was not successfully queued for sending and must be | ||
| * returned to the stack. */ | ||
| FreeRTOS_ReleaseUDPPayloadBuffer( pucUDPPayloadBuffer ); | ||
| if (pucUDPPayloadBuffer != NULL) |
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.
| if (pucUDPPayloadBuffer != NULL) | |
| if( pucUDPPayloadBuffer != NULL ) |
| size_t uxAddressLength, | ||
| BaseType_t xInternal ) | ||
| { | ||
| return 0; |
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.
Do we want to verify the pointers being valid?
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.
Fixed
| { | ||
| const char * name; | ||
|
|
||
| name = "hostname"; |
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.
Why not make if non-deterministic too?
uint8_t size_of_hostname;
name = malloc( size_of_hostname );
| BaseType_t xReset; | ||
| eDHCPState_t eExpectedState; | ||
| BaseType_t xDoCheck; | ||
| //eDHCPState_t eExpectedState; |
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.
Unused comment?
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.
Fixed
test/cbmc/patches/FreeRTOSIPConfig.h
Outdated
| #ifndef ipconfigDHCP_REGISTER_HOSTNAME | ||
| #define ipconfigDHCP_REGISTER_HOSTNAME 1 | ||
| #endif |
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.
Why do we need this?
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.
resolved
This PR fixes the build issues and proof failures for the DHCP CBMC proofs post the IPv6 changes.
Test Steps
Related Issue
Failing CBMC proofs
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.