Skip to content

Commit

Permalink
Commit to close Link-Local Multicast Name Resolution issue when using… (
Browse files Browse the repository at this point in the history
FreeRTOS#300)

* Commit to close Link-Local Multicast Name Resolution issue when using BufferAllocation_1 is used FreeRTOS#292

* Update ci.yml

Co-authored-by: Aniruddha Kanhere <[email protected]>
  • Loading branch information
JeroenWagenaar and AniruddhaKanhere authored Aug 10, 2021
1 parent ed63871 commit c1ce466
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ jobs:
run: sudo apt-get install uncrustify
- name: Complexity
run: |
COMPLEXITY_PARAMS="--scores --threshold=10 --horrid-threshold=250"
COMPLEXITY_PARAMS="--scores --threshold=10 --horrid-threshold=283"
TEMP_DIR=./temp
mkdir -p ${TEMP_DIR}
for SOURCE_FILE in portable/BufferManagement/*.c *.c
Expand Down
41 changes: 24 additions & 17 deletions FreeRTOS_DNS.c
Original file line number Diff line number Diff line change
Expand Up @@ -1467,32 +1467,39 @@
LLMNRAnswer_t * pxAnswer;
uint8_t * pucNewBuffer = NULL;

if( ( xBufferAllocFixedSize == pdFALSE ) && ( pxNetworkBuffer != NULL ) )
if( pxNetworkBuffer != NULL )
{
size_t uxDataLength = uxBufferLength + sizeof( UDPHeader_t ) + sizeof( EthernetHeader_t ) + sizeof( IPHeader_t );
if( xBufferAllocFixedSize == pdFALSE )
{
size_t uxDataLength = uxBufferLength + sizeof( UDPHeader_t ) + sizeof( EthernetHeader_t ) + sizeof( IPHeader_t );

/* Set the size of the outgoing packet. */
pxNetworkBuffer->xDataLength = uxDataLength;
pxNewBuffer = pxDuplicateNetworkBufferWithDescriptor( pxNetworkBuffer, uxDataLength + sizeof( LLMNRAnswer_t ) );
/* Set the size of the outgoing packet. */
pxNetworkBuffer->xDataLength = uxDataLength;
pxNewBuffer = pxDuplicateNetworkBufferWithDescriptor( pxNetworkBuffer, uxDataLength + sizeof( LLMNRAnswer_t ) );

if( pxNewBuffer != NULL )
{
BaseType_t xOffset1, xOffset2;
if( pxNewBuffer != NULL )
{
BaseType_t xOffset1, xOffset2;

xOffset1 = ( BaseType_t ) ( pucByte - pucUDPPayloadBuffer );
xOffset2 = ( BaseType_t ) ( ( ( uint8_t * ) pcRequestedName ) - pucUDPPayloadBuffer );
xOffset1 = ( BaseType_t ) ( pucByte - pucUDPPayloadBuffer );
xOffset2 = ( BaseType_t ) ( ( ( uint8_t * ) pcRequestedName ) - pucUDPPayloadBuffer );

pxNetworkBuffer = pxNewBuffer;
pucNewBuffer = &( pxNetworkBuffer->pucEthernetBuffer[ ipUDP_PAYLOAD_OFFSET_IPv4 ] );
pxNetworkBuffer = pxNewBuffer;
pucNewBuffer = &( pxNetworkBuffer->pucEthernetBuffer[ ipUDP_PAYLOAD_OFFSET_IPv4 ] );

pucByte = &( pucNewBuffer[ xOffset1 ] );
pcRequestedName = ( char * ) &( pucNewBuffer[ xOffset2 ] );
pxDNSMessageHeader = ipCAST_PTR_TO_TYPE_PTR( DNSMessage_t, pucNewBuffer );
pucByte = &( pucNewBuffer[ xOffset1 ] );
pcRequestedName = ( char * ) &( pucNewBuffer[ xOffset2 ] );
pxDNSMessageHeader = ipCAST_PTR_TO_TYPE_PTR( DNSMessage_t, pucNewBuffer );
}
else
{
/* Just to indicate that the message may not be answered. */
pxNetworkBuffer = NULL;
}
}
else
{
/* Just to indicate that the message may not be answered. */
pxNetworkBuffer = NULL;
pucNewBuffer = &( pxNetworkBuffer->pucEthernetBuffer[ ipUDP_PAYLOAD_OFFSET_IPv4 ] );
}
}

Expand Down

0 comments on commit c1ce466

Please sign in to comment.