I am using FreeRTOS-Plus-TCP v4.2.2 with one interface and two endpoints. The first endpoint has dhcp disabled and is configured to have static ip address 192.168.151.2. The other endpoint has dhcp enabled and the ip address assigned to this assigned by dhcp server falls on a different subnet. However, the issue I am seeing is I can only ping one endpoint at a time i.e. when I ping the device over static ip, I cannot ping it over dhcp assigned ip and vice versa. Is this behavior expected with this stack? I was hoping that I will be able to ping on both endpoints simultaneously.
ok, the next question then is what switching/routing infrastructure is between your target and the pinging device(s). Your target has only one MAC address (multiple MAC addresses would be infeasible), but many layer 3 aware routers will not cope well with varying IP addresses going with the same MAC address.
@RAc So, this device (let’s call it A) is connected connected to a network switch along with another device (let’s call it B). The network switch is connected to a wifi bridge. The DHCP server is hosted on the other side of wifi bridge and so A and B can talk to external network using dynamically assigned IP. For sharing private information such as sensor data, A and B talk over static IP.
@RAc@tony-josi-aws
I stepped through the code to understand what’s going on. Before I explain that, let me explain how the current setup looks like.
The board that I am working on has two processors.
Processor A which hosts FreeRTOS-TCP with two endpoints as below.
First endpoint is static on 192.168.151.2 with gateway set 192.168.151.1
Second endpoint is on DHCP say, 172.17.161.168.
The other processor on the board (lets call it B) hosts a linux machine and has two ip addresses configured on it’s ethernet interface. One is statically configured on 192.168.151.1 and the other is dynamic ip say 172.17.161.169.
These two devices are connected to a network switch which in turn is connected to a wifi bridge. The wifi bridge connectes to a network that hosts two dhcp servers that assigned ip addresses as shown below.
172.17.160.2/21
172.17.34.2/23
My laptop is connected to this network and has an ip address assigned by the second dhcp server which is 172.17.34.38.
Now, when I first ping A using on it’s dynamic IP, everything works fine. The ICMP response is sent back to the right destination mac address. However, while this going on, when I ping A from B using static endpoint on 192.168.151.x network, the ping on dynamic IP gets interrupted when the ping on static IP starts.
Upon digging deeper I found that the ICMP response on the dynamic endpoint is infact being sent to processor B (processor B’s mac address is used in destination mac address field of the ICMP response’s Ethernet frame instead of using the mac address of dynamic endpoint’s gateway mac).
I believe this is caused since my laptop and processor A are on different netmasks (due to two dhcp servers) and as a result in eARPGetCacheEntryGateWay, FreeRTOS_FindEndPointOnNetMask returns NULL for my laptop’s ip address which is 172.17.34.38 and it in turn calls FreeRTOS_FindGateWay which returns the first matching gateway which in my case is the static endpoint’s gateway i.e. static ip of Processor B.