FreeRTOS + TCP based DHCP server Implementation is not working

I have implemented a DHCP server in ARM cortex M0 using FreeRTOs OS , WPA security library and LWIP IP stack. The server is working fine.

After that I replaced the LWIP IP stack with FreeRTOS+TCP IP stack. Now the DHCP Packets from the server are not sending properly. (Broadcast packets are also not sending properly). The wireshark capture of these packets shows that the packets are not decrypted properly( Packet content is not understandable). So the end clients cannot understand the DHCP packets sent from the server. But on disabling the security feature DHCP server is working fine.
I would like to know whether it is due to any settings changes required in freeRTOS IP stack or not ?

Regards
Navas K K

Hello Navas, thaks for reporting this.

It is always interesting to see PCAP files. If you want, you can attach them in a ZIP file.

Are you saying that your server is encrypting the DHCP response? The DHCP client of FreeRTOS+TCP will only understand plain DHCP packets.

Hi Hein
Thanks for your quick reply.

The DHCP server creates the plain Packet ( Let us say the DHCP offer packet). The IP stack will add the required IP headers , then the stack send Packet to a WLAN interface. After that encryption (CCMP )is really happend. Then the packet will be send by WLAN Radio.

The same configuration is working with LWIP stack ( DHCP server + LWIP stack + WPA security).
Also I have noticed the IP packet created by both the LWIP and FreeRTOS IP stack are almost same. Only one difference is the time to leave the packet. In FreeRTOS IP it is 128 and LWIP it is 255.

You wrote:

Only one difference is the time to live the packet.
In FreeRTOS IP it is 128 and LWIP it is 255.

This is configurable in FreeRTOSIPConfig.h :

#define ipconfigUDP_TIME_TO_LIVE     128  // Also used bu DHCP
#define ipconfigTCP_TIME_TO_LIVE     128

Now one important question: when your network interface passes network packets to the IP-stack ( with eNetworkRxEvent ), are the packets already CCMP-decoded?
The FreeRTOS expects plain ( decoded ) network packets only.

Hi Hein,

DHCP request Packet coming from STA is correct ( That is network interface passes the network packets to the IP-stack correctly). DHCP server could identified this packet and parsed the DHCP request message correctly.( DHCP server identified the hardware address of STA from dhcp request message).

But you have developed your own DHCP server? That worked fine when using lwIP, but you don’t get it operational when using FreeRTOS+TCP, correct?

The response, a DHCP offer looks similar, except for its TTL value (which is configurable).

But the offer is not accepted by the STA?

Maybe lwIP did something with CCMP encoding/decoding?

“But you have developed your own DHCP server? That worked fine when using lwIP, but you don’t get it operational when using FreeRTOS+TCP, correct?”
Yes , correct.
"But the offer is not accepted by the STA? "
Offer packet is not a properly decryptable (Normal broadcast packets are not decryptable ). When I disable security the packets are sending properly.

“Maybe lwIP did something with CCMP encoding/decoding?”
When I Implemented STA using ARM cortex M0, FreeRTOS + TCP, WPA security, the STA is working fine.

To reduce the code size , I would like to use FreeRTOS +TCP , instead of LWIP for DHCP server implementation .