Skip to content

Commit c19bfa7

Browse files
authored
Merge branch 'dev/IPv6_integration' into dev-defines
2 parents e55b2ab + 8caca5f commit c19bfa7

File tree

5 files changed

+175
-10
lines changed

5 files changed

+175
-10
lines changed

.github/lexicon.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1738,6 +1738,7 @@ xcolon
17381738
xconnected
17391739
xcount
17401740
xcurlength
1741+
xcurrentorder
17411742
xcurstart
17421743
xdatalength
17431744
xdatalengthbytes
@@ -1781,6 +1782,7 @@ xeventgroupwaitbits
17811782
xexpected
17821783
xexpectedmessagetype
17831784
xexpiredstate
1785+
xextheadercount
17841786
xfamily
17851787
xfield
17861788
xflags

.github/workflows/ci.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,12 @@ jobs:
7171
formatting:
7272
# Use only 18.04 since we want the uncrustify version to
7373
# be 0.66.1_f to ensure proper formatting.
74-
runs-on: ubuntu-18.04
74+
runs-on: ubuntu-20.04
75+
container: ubuntu:18.04
7576
steps:
76-
- uses: actions/checkout@v2
77+
- uses: actions/checkout@v3
7778
- name: Install Uncrustify
78-
run: sudo apt-get install uncrustify
79+
run: apt-get update && apt-get install uncrustify
7980
- name: Run Uncrustify
8081
run: |
8182
uncrustify --version

.github/workflows/uncrustify.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ jobs:
88
Uncrustify:
99
name: Run_Uncrustify
1010
if: ${{ github.event.issue.pull_request && github.event.comment.body == '/bot run uncrustify' }}
11-
runs-on: ubuntu-18.04
11+
runs-on: ubuntu-20.04
12+
container: ubuntu:18.04
1213
steps:
1314
- name: Dump GitHub context
1415
env:
@@ -29,17 +30,16 @@ jobs:
2930
run: |
3031
echo ${{ steps.upstreamrepo.outputs.RemoteRepo }}:${{ steps.upstreambranch.outputs.branchname }}
3132
- name: Checkout upstream repo
32-
uses: actions/checkout@v2
33+
uses: actions/checkout@v3
3334
with:
3435
repository: ${{ steps.upstreamrepo.outputs.RemoteRepo }}
3536
ref: ${{ steps.upstreambranch.outputs.branchname }}
36-
- name: Install Uncrustify
37-
run: sudo apt-get install uncrustify
37+
- name: Install Uncrustify and Git
38+
run: apt-get update && apt-get install uncrustify git-all
3839
- name: Run Uncrustify
3940
run: |
4041
uncrustify --version
4142
find . -iname "*.[hc]" -exec uncrustify -c tools/uncrustify.cfg --no-backup --replace {} +
42-
find . -iname "*.[hc]" -exec uncrustify -c tools/uncrustify.cfg --no-backup --replace {} +
4343
- name: Push changes to upstream repository
4444
run: |
4545
git config --global user.name 'GitHub Action'

source/FreeRTOS_IP.c

100644100755
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2231,6 +2231,158 @@ uint32_t FreeRTOS_GetIPAddress( void )
22312231
}
22322232
/*-----------------------------------------------------------*/
22332233

2234+
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 )
2235+
2236+
/*
2237+
* The helper functions here below assume that there is a single
2238+
* interface and a single end-point (ipconfigIPv4_BACKWARD_COMPATIBLE)
2239+
*/
2240+
2241+
/**
2242+
* @brief Sets the IP address of the NIC.
2243+
*
2244+
* @param[in] ulIPAddress: IP address of the NIC to be set.
2245+
*/
2246+
void FreeRTOS_SetIPAddress( uint32_t ulIPAddress )
2247+
{
2248+
/* Sets the IP address of the NIC. */
2249+
NetworkEndPoint_t * pxEndPoint = FreeRTOS_FirstEndPoint( NULL );
2250+
2251+
if( pxEndPoint != NULL )
2252+
{
2253+
pxEndPoint->ipv4_settings.ulIPAddress = ulIPAddress;
2254+
}
2255+
}
2256+
/*-----------------------------------------------------------*/
2257+
2258+
/**
2259+
* @brief Get the gateway address of the subnet.
2260+
*
2261+
* @return The IP-address of the gateway, zero if a gateway is
2262+
* not used/defined.
2263+
*/
2264+
uint32_t FreeRTOS_GetGatewayAddress( void )
2265+
{
2266+
uint32_t ulIPAddress = 0U;
2267+
NetworkEndPoint_t * pxEndPoint = FreeRTOS_FirstEndPoint( NULL );
2268+
2269+
if( pxEndPoint != NULL )
2270+
{
2271+
ulIPAddress = pxEndPoint->ipv4_settings.ulGatewayAddress;
2272+
}
2273+
2274+
return ulIPAddress;
2275+
}
2276+
/*-----------------------------------------------------------*/
2277+
2278+
/**
2279+
* @brief Get the DNS server address.
2280+
*
2281+
* @return The IP address of the DNS server.
2282+
*/
2283+
uint32_t FreeRTOS_GetDNSServerAddress( void )
2284+
{
2285+
uint32_t ulIPAddress = 0U;
2286+
NetworkEndPoint_t * pxEndPoint = FreeRTOS_FirstEndPoint( NULL );
2287+
2288+
if( pxEndPoint != NULL )
2289+
{
2290+
ulIPAddress = pxEndPoint->ipv4_settings.ulDNSServerAddresses[ 0 ];
2291+
}
2292+
2293+
return ulIPAddress;
2294+
}
2295+
/*-----------------------------------------------------------*/
2296+
2297+
/**
2298+
* @brief Get the netmask for the subnet.
2299+
*
2300+
* @return The 32 bit netmask for the subnet.
2301+
*/
2302+
uint32_t FreeRTOS_GetNetmask( void )
2303+
{
2304+
uint32_t ulIPAddress = 0U;
2305+
NetworkEndPoint_t * pxEndPoint = FreeRTOS_FirstEndPoint( NULL );
2306+
2307+
if( pxEndPoint != NULL )
2308+
{
2309+
ulIPAddress = pxEndPoint->ipv4_settings.ulNetMask;
2310+
}
2311+
2312+
return ulIPAddress;
2313+
}
2314+
/*-----------------------------------------------------------*/
2315+
2316+
/**
2317+
* @brief Update the MAC address.
2318+
*
2319+
* @param[in] ucMACAddress: the MAC address to be set.
2320+
*/
2321+
void FreeRTOS_UpdateMACAddress( const uint8_t ucMACAddress[ ipMAC_ADDRESS_LENGTH_BYTES ] )
2322+
{
2323+
NetworkEndPoint_t * pxEndPoint = FreeRTOS_FirstEndPoint( NULL );
2324+
2325+
if( pxEndPoint != NULL )
2326+
{
2327+
/* Copy the MAC address at the start of the default packet header fragment. */
2328+
( void ) memcpy( pxEndPoint->xMACAddress.ucBytes, ( const void * ) ucMACAddress, ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );
2329+
}
2330+
}
2331+
/*-----------------------------------------------------------*/
2332+
2333+
/**
2334+
* @brief Get the MAC address.
2335+
*
2336+
* @return The pointer to MAC address.
2337+
*/
2338+
const uint8_t * FreeRTOS_GetMACAddress( void )
2339+
{
2340+
const uint8_t * pucReturn = NULL;
2341+
NetworkEndPoint_t * pxEndPoint = FreeRTOS_FirstEndPoint( NULL );
2342+
2343+
if( pxEndPoint != NULL )
2344+
{
2345+
/* Copy the MAC address at the start of the default packet header fragment. */
2346+
pucReturn = pxEndPoint->xMACAddress.ucBytes;
2347+
}
2348+
2349+
return pucReturn;
2350+
}
2351+
/*-----------------------------------------------------------*/
2352+
2353+
/**
2354+
* @brief Set the netmask for the subnet.
2355+
*
2356+
* @param[in] ulNetmask: The 32 bit netmask of the subnet.
2357+
*/
2358+
void FreeRTOS_SetNetmask( uint32_t ulNetmask )
2359+
{
2360+
NetworkEndPoint_t * pxEndPoint = FreeRTOS_FirstEndPoint( NULL );
2361+
2362+
if( pxEndPoint != NULL )
2363+
{
2364+
pxEndPoint->ipv4_settings.ulNetMask = ulNetmask;
2365+
}
2366+
}
2367+
/*-----------------------------------------------------------*/
2368+
2369+
/**
2370+
* @brief Set the gateway address.
2371+
*
2372+
* @param[in] ulGatewayAddress: The gateway address.
2373+
*/
2374+
void FreeRTOS_SetGatewayAddress( uint32_t ulGatewayAddress )
2375+
{
2376+
NetworkEndPoint_t * pxEndPoint = FreeRTOS_FirstEndPoint( NULL );
2377+
2378+
if( pxEndPoint != NULL )
2379+
{
2380+
pxEndPoint->ipv4_settings.ulGatewayAddress = ulGatewayAddress;
2381+
}
2382+
}
2383+
/*-----------------------------------------------------------*/
2384+
#endif /* ( ipconfigIPv4_BACKWARD_COMPATIBLE != 0 ) */
2385+
22342386
/**
22352387
* @brief Returns whether the IP task is ready.
22362388
*

source/FreeRTOS_IPv6.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ eFrameProcessingResult_t eHandleIPv6ExtensionHeaders( NetworkBufferDescriptor_t
342342
uint8_t ucCurrentHeader = pxIPPacket_IPv6->xIPHeader.ucNextHeader;
343343
uint8_t ucNextHeader = 0U;
344344
BaseType_t xNextOrder = 0;
345+
BaseType_t xExtHeaderCount = 0;
345346

346347
while( ( uxIndex + 8U ) < uxMaxLength )
347348
{
@@ -379,9 +380,18 @@ eFrameProcessingResult_t eHandleIPv6ExtensionHeaders( NetworkBufferDescriptor_t
379380
ucNextHeader,
380381
( int ) xNextOrder ) );
381382

382-
if( xNextOrder <= xCurrentOrder )
383+
xExtHeaderCount += 1;
384+
385+
/*
386+
* IPv6 nodes must accept and attempt to process extension headers in
387+
* any order and occurring any number of times in the same packet,
388+
* except for the Hop-by-Hop Options header which is restricted to
389+
* appear immediately after an IPv6 header only. Outlined
390+
* by RFC 2460 section 4.1 Extension Header Order.
391+
*/
392+
if( ( xExtHeaderCount > 1 ) && ( xCurrentOrder == 1 ) ) /* ipIPv6_EXT_HEADER_HOP_BY_HOP */
383393
{
384-
FreeRTOS_printf( ( "Wrong order\n" ) );
394+
FreeRTOS_printf( ( "Wrong order. Hop-by-Hop Options header restricted to appear immediately after an IPv6 header\n" ) );
385395
uxIndex = uxMaxLength;
386396
break;
387397
}

0 commit comments

Comments
 (0)