FreeRtos+TCP multivlan handling with socket bound to specific ip

Hi Team,

We are using FreeRTOS+TCP 4.0.0 with multiple VLANs and endpoints:

- VLAN10 → IP 100.64.10.5

- VLAN14 → IP 100.64.14.5

- DLT socket bound to 100.64.14.5:3490

During debugging we observed that when a TCP SYN arrives from VLAN10, FreeRTOS+TCP still creates the child/peer socket and proceeds through LISTEN → SYN_RECEIVED → ESTABLISHED, even though the socket is bound to VLAN14 IP.

In prvHandleListen_IPV4 Current code:

if( ( pxEndPoint != NULL ) &&

( pxTCPPacket->xIPHeader.ulDestinationIPAddress == pxEndPoint->ipv4_settings.ulIPAddress ) )

We changed it to:

if( ( pxEndPoint != NULL ) &&

( pxTCPPacket->xIPHeader.ulDestinationIPAddress == pxSocket->xLocalAddress.ulIP_IPv4 ) )

With this change:

- VLAN10 connection attempts are rejected

- Child/peer socket is not created for VLAN10

- Only VLAN14 is able to establish the TCP connection

Could you please confirm whether comparing against “pxSocket->xLocalAddress.ulIP_IPv4” is the correct approach for multi-VLAN systems?

Also, could this have any side effects for multi-endpoint or multi-homed systems?

Thanks.

The comment seems to indicate that the check is for endpoint. @htibosch Do you have any suggestion?