1
0
mirror of https://github.com/FreeRTOS/FreeRTOS-Plus-TCP synced 2025-10-21 23:30:39 +08:00
Commit Graph

38 Commits

Author SHA1 Message Date
tony-josi-aws
9718ee017d Update version in src files to V4.3.0 2024-12-09 12:51:14 +05:30
Tony Josi
e3412fb92b Fix MISRA 2012 violations (#1208)
* Fix coverity issues

* Fix formatting
2024-12-04 23:41:04 +05:30
Holden
1599660ad3 ARP/ND Build Separation (#1175)
* Separate ARP and ND

* Uncrustify: triggered by comment.

* Fully separate ARP & ND

* Fix tracing and config macros

* Fix Build Issues

* Changed resolution enum name

* Add ND Timer event implementation

* Uncrustify: triggered by comment.

* Fix Tests

* Fix Unit Tests

* Uncrustify: triggered by comment.

* Fix CBMC testing

* Fix ARP utest

* Code review suggestion

* In unit-test, define ipconfigIS_ENABLED to nothing to pass compilation.

* Fix UT coverage.

* Fix buffer access issue in UT.

* Fix spelling

* 100% UT coverage

* Review Fixes

* Fix Unit Tests

* Fix Coverage

* Fix CBMC proof for xCheckRequiresARPResolution

* Fix CBMC proof for xCheckRequiresARPResolution and formatting

* Fix build issue with tools/tcp_utilities/http_client_test.c

---------

Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: tony-josi-aws <tonyjosi@amazon.com>
Co-authored-by: ActoryOu <ousc@amazon.com>
2024-11-11 19:49:38 +05:30
Emil Popov
aa7f9f0ce1 Adds NetIf functions for filtering MAC addresses (#1065)
* Adds ipconfigMAC_FILTERING that when enabled, adds two MAC manipulation functions to NetworkInterface_t
Adds documentation and design notes for the MAC filtering functions of the SAME70 network driver.
Exposes pcLOCAL_ALL_NODES_MULTICAST_MAC[ ipMAC_ADDRESS_LENGTH_BYTES ] so that network drivers can add it to the received multicast addresses during initialization.
Adds functions to the SAME70 network driver that allow modification of what MAC addresses are being received by the hardware. This implementation utilizes the 4 specific match registers and the 64bit hash match register that are present in the SAME70/V71 microcontrollers.
Registes the mDNS address when the SAME70 network driver is initialized.
Moves the registering of the solicited-node multicast address from the network driver to vIPNetworkUpCalls()
Adds 'U'  to some uint8_t[] initializers

* Removes ipconfigMAC_FILTERING
Rewrites the comment describing the MAC filtering functions.

* Adds checks for ipconfigUSE_IPv6
Fixes a copy/paste bug that was allowing pfRemoveAllowedMAC() to be called without being checked for non-NULL

* Updates the unit tests for better coverage. Thanks @htibosch

* Converts the indexing variables to `size_t xIndex` and avoids inline for() declarations in DriverSAM/NetworkInterface.c
Consolidates the solicited-node MAC and MLD management into a single function.
Calls the new solicited-node address management function on network UP/DOWN events.

* Update some comments
Rewrites the generation of the solicited-node multicast IPv6 address. Thanks @htibosch
Sprits the allocation and NULL check when allocating an MLD report. Thanks @AniruddhaKanhere

* Moves vManageSolicitedNodeAddress() from FreeRTOS_IP_Utils.c to FreeRTOS_IPv6_Utils.c
Changes some indexing variables prefix to "ux"

* Adds a macros for easy checking if a MAC address is unicast or multicast.
Improves the readability of the SAME70 hash register code by adding a bunch of macros and defines
Moves all hash register macros anad variables to the top of NetworkInterface.c where they belong.

* Adds xNetworkInterface * parameters to the MAC filtering functions as requested by @HTRamsey

* Updates the DriverSAM network inteface to include the new MAC filter function parameters.

* more renaming

* Adds overflow check when incrementing the specific match register counters. Thanks @HTRamsey

* Adds proper casting when converting byte arrays to uint32_t registers. Thanks @htibosch.

* Exposes pcLOCAL_ALL_NODES_MULTICAST_IP so that it can be re-used by the user

* Fixes an array initializer that was not constant at compile time.
Removes code that was not supposed to be in this PR

* Uncrustify: triggered by comment.

* Fix unit tests

* Fix formatting

---------

Co-authored-by: Emil Popov <epopov@cardinalkinetic.com>
Co-authored-by: Tony Josi <tonyjosi@amazon.com>
Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com>
Co-authored-by: GitHub Action <action@github.com>
2024-04-08 16:46:36 +05:30
Tony Josi
a3beac59e5 Fix incorrect endpoint selection and usage during Neighbor Discovery (#1111)
* Fix improper endpoint selection for NA NS message response

* Fix NS NA response and routing

* Add declarations and comments

* Minor fix with debug logs

* Update UTs

* Uncrustify: triggered by comment.

* Fix build

* Fix CBMC

* Uncrustify: triggered by comment

* UT coverage

* Uncrustify: triggered by comment

* Fix MISRA violations

* Fix formatting

* Updating with review feedback

* Fix formatting

* Update with review comments

* Update with review comments
2024-03-06 16:01:23 +05:30
Tony Josi
b098c07b98 Fixes ARP messages from being sent through wrong endpoints (#1105)
* Fixes the Incoming IPv4 destination IP check when ipconfigETHERNET_DRIVER_FILTERS_PACKETS is disabled

* Add new API FreeRTOS_OutputARPRequest_Multi

* Fix UTs

* Fixes an issue which resulted in the response to a Neighbor Solicitation to be sent out the wrong interface.
Enforces that pxNetworkBuffer, pxNetworkBuffer->pxInterface, and pxNetworkBuffer->pxEndPoint are non-NULL for received packets.

* Adds proper loppback checks. Thanks @tony-josi-aws

* Update assert to checks

* Fix cbmc

* Remove repeated proof

* Fix unit tests

* Fix C90: Wno-declaration-after-statement

* Fix unit tests

* Uncrustify: triggered by comment

* Fix MISRA

* Fix build

* Uncrustify: triggered by comment

* Fix CBMC proofs

* Fix CBMC proof

* Uncrustify: triggered by comment

* Fix CBMC and UTs

* Uncrustify: triggered by comment

* Revert "Fix C90: Wno-declaration-after-statement"

This reverts commit b63cc50e61.

* Add comments as per review suggestions

* Uncrustify: triggered by comment

* Fix UTs

* Update with review suggestions

* Fix UTs and CBMC

* Fix CBMC

* Fix build

* Uncrustify: triggered by comment

* Remove unused comments

---------

Co-authored-by: Emil Popov <epopov@cardinalkinetic.com>
Co-authored-by: GitHub Action <action@github.com>
2024-02-28 09:52:48 +05:30
Tony Josi
ef14a0871f Fix declarations after statements (#1106)
* Fix C90: Wno-declaration-after-statement

* Uncrustify: triggered by comment

---------

Co-authored-by: GitHub Action <action@github.com>
2024-02-23 17:52:12 +05:30
Emil Popov
a87f489935 Neighbor Solicitation Response Fix (#1096)
* Fixes an issue which resulted in the response to a Neighbor Solicitation to be sent out the wrong interface.
Modifies prvHandleEthernetPacket() to ensure prvProcessEthernetPacket() never gets called with a NULL pointer
Modifies prvProcessEthernetPacket() to cleanly handle pxNetworkBuffer->pxInterface and  pxNetworkBuffer->pxEndPoint being NULL.

* Fix unit tests

* Fix unit tests

* Uncrustify: triggered by comment

---------

Co-authored-by: Emil Popov <epopov@cardinalkinetic.com>
Co-authored-by: Tony Josi <tonyjosi@amazon.com>
Co-authored-by: GitHub Action <action@github.com>
2024-02-13 13:32:20 +05:30
Tony Josi
0d74d497e7 Fix MISRA 2012 issues (#1083)
* Fix coverity MISRA issues

* fix misra 12.2

* More MISRA fixes

* More MISRA fixes

* Adding MISRA coverity suppressions

* Add MISRA suppression reasoning

* Uncrustify: triggered by comment

* Fix misra exception comments

* Fix clang warnings

* Revert "Fix clang warnings"

This reverts commit 9d00a1448b.

---------

Co-authored-by: GitHub Action <action@github.com>
2024-02-02 17:46:19 +05:30
Hein Tibosch
163ae3ffa3 Avoid network buffer leak in FreeRTOS_ND.c (#1074)
* Avoid network buffer leak in FreeRTOS_ND.c

* Updat unit tests

---------

Co-authored-by: Tony Josi <tonyjosi@amazon.com>
2024-01-10 16:54:21 -08:00
Emil Popov
9abe2d11c6 Changes the ND cache full behavior when the Neighbor Discovery cache fills up. (#1040)
* Changes the ND cache full behavior: If the Neighbor Discovery cache ever gets full, trying to store a new entry will overwrite the oldest existing entry.

* Adds casting to avoid warnings

---------

Co-authored-by: Emil Popov <epopov@cardinalkinetic.com>
Co-authored-by: Tony Josi <tonyjosi@amazon.com>
2023-11-06 09:22:32 +05:30
Hein Tibosch
16a74c3ae9 Preparing library to use loopback device (#1020)
* Preparing library to use loopback device

* Repaired FreeRTOS_AddEndPoint() as well

* Minor changes for Doxygen

* Uncrustify: triggered by comment.

* Added IPv6.h and removed call to xIsIPv6Loopback

* Conditional compilation of xIPv6_GetIPType()

* Do not call xBadIPv4Loopback() when IPv4 is not enabled

* Repaired unit tests

* In FreeRTOS_AddEndPoint(), set next to NULL

* One more change in FreeRTOS_AddNetworkInterface()

* FreeRTOS_FillEndPoint: save pxNext before clearing entire endpoint struct

* Uncrustify: triggered by comment.

* Changes after review by Shub

* Changes after review by Shub, part 2

* Uncrustify: triggered by comment.

* Replace pxUDPPacket with pxIPacket in function prvAllowIPPacketIPv4()

* utest: replace xIPv6UnspecifiedAddress with FreeRTOS_in6addr_any

* Checked unit-tests and coverage

* ut: Repaired GetIPType loopback test

* Update test/unit-test/FreeRTOS_IPv6_ConfigDriverCheckChecksum/FreeRTOS_IPv6_ConfigDriverCheckChecksum_stubs.c

Co-authored-by: ActoryOu <jay2002824@gmail.com>

* Update test/unit-test/FreeRTOS_IPv6/ut.cmake

Co-authored-by: ActoryOu <jay2002824@gmail.com>

* Remove test for 'ipIPv4_FRAME_TYPE'

* Repairing tu again

---------

Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: Monika Singh <moninom@amazon.com>
Co-authored-by: Tony Josi <tonyjosi@amazon.com>
Co-authored-by: ActoryOu <jay2002824@gmail.com>
2023-10-06 16:27:45 +05:30
Soren Ptak
eed294c0ec CI-CD Updates (#1014)
* Use new version of CI-CD Actions,  checkout@v3 instead of checkout@v2 on all jobs
* Use cSpell spell check, and use ubuntu-20.04 for formatting check
* Add in bot formatting action
2023-09-05 14:31:24 -07:00
Monika Singh
574b646147 Fix Clang warnings (#984)
* CMAKe update

* Fix Wdocumentation errors

* Fix Wconditional-uninitialized

* Fix [-Wformat-pedantic

* Fix Wcompound-token-split-by-space and Wgnu-statement-expression

* Add suppression

* Uncrustify: triggered by comment.

* Fix coverity

---------

Co-authored-by: GitHub Action <action@github.com>
2023-07-28 10:25:24 +05:30
tony-josi-aws
67e5fa31be fix formattting 2023-07-19 15:02:04 +05:30
Tony Josi
e847ee5835 free old buffer once duplicate has been made 2023-07-19 14:59:31 +05:30
ActoryOu
dd9a203249 [IPv6] Fix checksum calculation of IPv6 with extension headers. (#952)
* Fix IPv6 checksum calculation

* Use HW support option to see if we need to calculate TX checksum on NS/NA/RS packets.
2023-07-11 10:52:03 +08:00
ActoryOu
04afe5f5b5 [IPv6] Fix coverity (#933)
* Fix coverity

* Fix UT

* Fix build combination

* Suppress rule 17.2

* Fix 11.3 and 15.7 violations
2023-06-26 11:18:05 +05:30
kar-rahul-aws
a9beafa669 Fix warnings on disable USETCP_WIN macro (#932)
* Fix warnings on disable USETCP_WIN macro

* Uncrustify: triggered by comment.

---------

Co-authored-by: GitHub Action <action@github.com>
2023-06-21 11:27:57 +05:30
Monika Singh
3cec37a264 Add Unit Test for FreeRTOS_ND (#859)
* Initial changes

* First UT

* Run uncrustify

* Coverage

* Add more coverage

* Update

* Uncrustify: triggered by comment.

* Update spell check

---------

Co-authored-by: GitHub Action <action@github.com>
2023-05-21 21:11:24 +05:30
ActoryOu
34e80ef043 Use endpoint's address as source. (#847) 2023-04-26 16:31:50 +08:00
Monika Singh
a492abb0a8 Fix Additional Clang warnings
Corrects several warnings from Clang flags
for Clang 13.
2023-04-18 11:00:00 +00:00
Hein Tibosch
c09528fd57 dev/IPv6: DHCPv6 repaired and tested (#826)
* DHCPv6 repaired and tested

* More changes

* Added entries to lexicon.txt

* Ran uncrustify on tools/tcp_utilities

* Formatting STM32Fxx

* Uncrusitfy tcp_mem_stats.c

* Remove trailing space

* I didn't mean to update the tcp_utilities directory yet

* Changes after Actory's review

* Replaced tabs with spaces

* Fix spelling.

* Changed the application hook for IPv6 and set the correct IPv6 defaults when failed

* Add a macro as maximum send buffer size.
* Fix formatting & build test.

* Replace xApplicationDHCPHook with xApplicationDHCPHook_Multi.

* Fix comments for xDNSServers & uxDNSCount.

* Fix ApplicationDHCPHook_Multi parameters.

---------

Co-authored-by: ActoryOu <jay2002824@gmail.com>
Co-authored-by: ActoryOu <ousc@amazon.com>
2023-04-14 18:24:54 +08:00
ActoryOu
acb8e2eea1 [IPv6] Check unspecified/loopback/multicast reserved/matching addresses in prvAllowIPPacketIPv6. (#805)
* Check IPv6 multicast address and loopback address.

* Check FF02::1 more specific in xCompareIPv6_Address.

* Fix multicast checking for predefined multicast address.

* Check FF02::1 more specific in xCompareIPv6_Address.

* Handle unspecified IPv6 address.

* Fix coverity scan

* Fix doxygen

* Fix comments.

* Fix build.
2023-04-06 16:02:46 +08:00
shubnil
1951dfb6a4 Fix for assert in NDageCache function (#731)
Add a condition so that NDageCache functions just returns
when invoked for IPv4 cases.

Co-authored-by: Monika Singh <108652024+moninom1@users.noreply.github.com>
2023-02-28 13:39:00 +05:30
Monika Singh
9a955f27ac Add changes for Coverity fix (#729)
* Fix Coverity issues

* Fix Misra 4.4 violation:The comment resembles a code snippet

* Misra: Rule 10.4 violations

* Misra: Rule 11.8 violations

* Misra: Rule 12.1 violations

* Misra: Rule 8.2, 8.4, 8.5, and 8.9 violations

* Misra: Rule 5.3, 5.8, 21.1 and 21.2  violations

* Misra: Rule 5.7 violations

* Misra: Rule 8.3 violations

* Misra: Rule Reverse NULL violations

* Misra: Rule 10.3, 10.8 and 8.13 violations

* Fix 11.3 and suppress 11.4

* Misra: Rule 14.3, 15.7, 17.2 and 17.7 violations

* Misra: Rule 2.2 and 2.7 violation

* Misra: Rule 21.6, 8.5 and 8.13 violation

* Fix UT compilation

* Update comments

* Fix Spell checker

* Update snprintf
2023-02-28 12:55:20 +05:30
Tony Josi
36172f9b66 Fix unit tests wrt. latest dev/IPv6_Integration changes (#740)
* fix ip timers unit tests

* fix FreeRTOS_IP_Utils_DiffConfig_utest tests

* fixed FreeRTOS_IP_Utils_utest

* fix dns cache unit test

* wip arp utests

* fixing arp unit tests

* fix dhcp errors

* clearing structs before usage

* fix dns parser seg fault

* fix dns parser seg fault in unit test

* fix arp uunit tests

* fix arp unit tests

* fixing dns unit test and updating the CBMC proofs

* fixing udp unit tests

* fixing TCP IP unit tests

* fixing TCP IP diffconfig unit tests

* adding additional header file for ARP for declaring missing stub headers

* minor fix

* Uncrustify: triggered by comment

* fixing comments

---------

Co-authored-by: GitHub Action <action@github.com>
2023-02-24 14:41:13 +05:30
Tony Josi
0e9628796c Fixing doxygen comments (#728)
* updating doxygen config

* fixing doxygen comments

* adding IPv6 files and fixing comments

* fix doxygen cfg and file names in comments

* wip doxygen v6 docs

* adding doxygen comments

* include RA src file to doxgendocs generation

* fix spell check issues

* Uncrustify: triggered by comment.

* fix minor build issue

* fix spell check issues

* Uncrustify: triggered by comment

* fix trailing white space

* Dev integration hein.v8 (#738)

* Updating tcp utilities

* Some more change in dev_integration_hein.v8

* In FreeRTOS_DNS_Parser.c : use 'ipUDP_PAYLOAD_OFFSET_IPv4' in stead of 'ipIP_PAYLOAD_OFFSET'

* And a few more corrections

* Changes to WinPCap network interface, removed debugging code

* After applying uncrustify

* Oops, I forgot the push changes in include files.

* Now removing it, hopefully

---------

Co-authored-by: Nikhil Kamath <110539926+amazonKamath@users.noreply.github.com>
Co-authored-by: Monika Singh <108652024+moninom1@users.noreply.github.com>

* Fix CBMC proofs for DNS (#718)

* Use CBMC XML output to enable VSCode debugger (#673)

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 <tuttle@acm.org>

* wip

* wip DNSgetHostByName

* wip DNSgetHostByName

* fixed cbmc proof for DNS_ReadNameField

* wip DNSgetHostByName_a_harness

* Fix CBMC prooff for DNSgetHostByName

* wip fix DNSgetHostByName_a CBMC proof

* fixed cbmc target func not called issue in DNSclear

* fixed cbmc target func not called issue in DNSlookup

* fix DNSgetHostByName_a CBMC proof

* update comments

* more asserts

* fixing formatting

* updating as per review comments

* fix dns after review comments

* adding more asserts

* adds more asserts

* minor fix

* fixing comments

* fixing comments

* fixing minor issue

* fixing DNS_ReadReply() signature

* making code more consistant

* adding more  asserts

* making code more consistent

---------

Co-authored-by: Kareem Khazem <karkhaz@amazon.com>
Co-authored-by: Mark Tuttle <tuttle@acm.org>

* Uncrustify: triggered by comment

* fixing formatting

---------

Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: Hein Tibosch <hein_tibosch@yahoo.es>
Co-authored-by: Nikhil Kamath <110539926+amazonKamath@users.noreply.github.com>
Co-authored-by: Monika Singh <108652024+moninom1@users.noreply.github.com>
Co-authored-by: Kareem Khazem <karkhaz@amazon.com>
Co-authored-by: Mark Tuttle <tuttle@acm.org>
2023-02-24 13:58:53 +05:30
Hein Tibosch
ff11a1484a Dev integration hein.v8 (#738)
* Updating tcp utilities

* Some more change in dev_integration_hein.v8

* In FreeRTOS_DNS_Parser.c : use 'ipUDP_PAYLOAD_OFFSET_IPv4' in stead of 'ipIP_PAYLOAD_OFFSET'

* And a few more corrections

* Changes to WinPCap network interface, removed debugging code

* After applying uncrustify

* Oops, I forgot the push changes in include files.

* Now removing it, hopefully

---------

Co-authored-by: Nikhil Kamath <110539926+amazonKamath@users.noreply.github.com>
Co-authored-by: Monika Singh <108652024+moninom1@users.noreply.github.com>
2023-02-23 14:50:27 +05:30
kar-rahul-aws
31a549b73a A new algorithm to select the endpoint for received packets[ PR #713 ] (#726)
* End Point changes #PR 713

* Fix build issues in PR#713 : extra */ in FreeRTOS_Routing.c

* Fix Mathcing EndPoint function in Zynq Interface

* Update FreeRTOS_ARP.c

* Spell check fix

* Fix build check issue : add const in xIPv6_GetIPType declaration

* Uncrustify: triggered by comment.

---------

Co-authored-by: GitHub Action <action@github.com>
2023-02-17 19:22:13 +05:30
Hein Tibosch
d6ddb24a83 Changes after testing all other protocols IPv4 and IPv6 (#689)
* Changes after testing all other protocols IPv4 and IPv6

* Clear interface/endpoint when creating a network buffer

* After running uncristify

* Didn't mean to update 'TCP_Transmission_IPV4'

* Removed changes from Routing.h to make merging easier
2023-01-31 21:20:06 +05:30
Hein Tibosch
f88dea60ca Reparations and recommendations for the dev/IPv6_integration branch (#664)
* Reparations and recommendations for the dev/IPv6_integration branch
* Applied uncrustify
* More changes after testing ARP, ICMP4, ICMP6, UDPv4 and UDPv6, DNSv6
* A few changes to DNS after testing it
2023-01-25 18:33:44 +05:30
Monika Singh
7315e4b3ba Fix FreeRTOS_IP test cases (#666)
* Fix FreeRTOS_IP and FreeRTOS_IP_DiffConfig test cases
* Remove test_prvProcessIPEventsAndTimers_eNetworkDownEvent test Case
 - eNetworkDownEvent no longer support xNetworkUp variable, the network status
is kept in pxEndPoint->bits.bEndPointUp.
* Run Uncrustify.

Co-authored-by: GitHub Action <action@github.com>
2023-01-16 21:07:57 +05:30
kar-rahul-aws
bf32bf336e Demo changes for IPv4 Endpoint changes (#660)
* Update FreeRTOS_ARP.c
* Update FreeRTOS_UDP_IPv4.c
* Update FreeRTOS_TCP_Transmission_IPV4.c
* Update FreeRTOS_IP.c
* Update FreeRTOS_DHCP.c
* Update FreeRTOS_DNS.c
* Update NetworkInterface.c

Add Functions  To avoid scheduler suspension: xPacketBouncedBack and prvStreamBufferAdd
2023-01-10 19:27:49 +05:30
Monika Singh
66ca9c2011 Update DNS file to add end point changes (#607)
* Add endpoint changes to DNS files.
* SocketAddress changes
* Update DNS_Parser
* Provide stub for NetworkInterface functions
* Run uncrustify
2022-12-16 16:18:47 +05:30
Monika Singh
96643cedf1 Add IPv6 data path and endpoint changes to FreeRTOS_IP.c (#591)
* Add IPv6 data path and endpoint changes to FreeRTOS_IP.c
* Add FreeRTOS_IPv4.h and FreeRTOS_IPv6.h files.
* Fix compilation issues and run Uncrustify
2022-12-06 11:59:32 +05:30
xuelix
4a453b5495 Fix compilation errors and misra violations (#594)
* Fix compilation errors and misra violations

* Fix compilation error
2022-12-02 17:20:46 +05:30
xuelix
f42329b89d Merge FreeRTOS_ND.c FreeRTOS_RA.c to ipv6_integration (#586)
* Merge FreeRTOS_ND.c and FreeRTOS_RA.c to ipv6_integration

* Misra violation fixes.
2022-11-23 21:15:17 -08:00