FreeRTOS Broadcast IP setting with PolarFire FPGA

Hello Everyone,
I hope you all are doing well.
I’m facing a problem with Broadcast IP.
If i ping from FPGA board (MPF100 Microsemi polarfire module) to any other computer either the plateform is windows or linux with a predefined static IP then it works in both directions (FPGA board to computer and computer to FPGA board) and i will get the ping response.
If i change the static IP to broadcast IP(255.255.255.255) then the ping is successful from FPGA board to Linux Computer. But if i ping with broadcast IP (255.255.255.255) from Linux Computer then i only get reply from my linux computer but not from the FPGA board.

Can anyone have an idea what i’m missing with respect to Broadcast IP, From where i need to enable it for Polarfire FPGA Module. There should be some way because in Linux i have to run following command to Enable Broadcast IP

sysctl -w net.ipv4.icmp_echo_ignore_broadcasts=0

and then update the routing table.

I also would like to tell you that DHCP is working properly and assign IP address with DHCP server.
I could not understand why Broadcast is not working because in DHCP discovery the client send Broadcast message and server acknowledge it and then assign IP.
I tried with Both by enabling (dynamic IP) and Disabling (static IP) DHCP but board is not responding.

#define ipconfigUSE_DHCP 0 or 1

I would also like to tell you i also tried by setting filter packets to 1 in FreeRTOSIPConfigDefaults.h but it’s not working.

#define ipconfigETHERNET_DRIVER_FILTERS_PACKETS 1

If i connect both linux computer and ping with Broadcast IP, there i’m getting acknowledge from both computers.
On FPGA side i’m using Opencores tri-mode ethernet MAC.

If anyone has an idea either it’s a problem with FreeRTOS configuration or with Hardware then please share

Thank you very much.

I think this is just because the ICMP handling code only replies to its own address and doesn’t look for broadcast: FreeRTOS-Plus-TCP/FreeRTOS_IP.c at V2.3.2 · FreeRTOS/FreeRTOS-Plus-TCP · GitHub

Hello Richard,
Thank you for your reply.
Yes i looked with tcpdump and i’m always sending ECHO request but no reply.
I also tried with Multicast group but it’s also not working.
i looked into FreeRTOS_IP.c file for ICMP but it looks fine.
Do you have any idea how i can fix it…?
Thank you very much.

The line I linked to shows you why it is not working because that specific line is looking for an exact match for the IP address. I suggest putting a break point on that line to see if a ping to the broadcast address makes it that far into the stack. If it does then you can edit that line to also accept the broadcast address - if it doesn’t then the broadcast address is rejected before that line is executed so you would have to follow it through the stack from the network interface to see where it gets filtered out.